FrSky icon indicating copy to clipboard operation
FrSky copied to clipboard

Add explanation to readme about how to use the hardward serial.

Open RobinLeblond opened this issue 3 years ago • 3 comments

Hello, I didn't know how to ask this elsaway, but can you explain how to use it with the hardware serial instead of the sofware one ? All your example look like using the software serial, thanks.

RobinLeblond avatar Nov 29 '21 13:11 RobinLeblond

Better documentation is a good idea 😊

You can use hardware serial like this:

SPortHub hub(0x12, Serial);

RealTadango avatar Nov 29 '21 15:11 RealTadango

Wow, easy like that! Thanks

RobinLeblond avatar Nov 29 '21 15:11 RobinLeblond

Unfortunately, this solution does not work due to several reasons:

  1. The constructor of SPortHub with a Serial parameter is hidden in a strange conditional compilation statement:
 #ifdef Serial_
            SPortHub(int physicalId, Serial_& serial);
    #elif HardwareSerial
            SPortHub(int physicalId, HardwareSerial& serial);
    #endif

I think, the different constructors shall be all visible and overloaded.

  1. Because of the conversion operator Serial_::operator bool() in the class Serial_ the constructor used for SPortHub(0x12, Serial); is again; SPortHub(int physicalId, int softwarePin); which makes no sense at all, but we get no error message here.

icebreaker-ch avatar Dec 28 '23 08:12 icebreaker-ch