bolderflight / sbus

Arduino and CMake library for communicating with SBUS receivers and servos.
MIT License
373 stars 132 forks source link

Fix compiler warnings. #62

Closed ScottDuckworth closed 1 year ago

ScottDuckworth commented 1 year ago

Fixes compiler warnings from -Wparentheses and -Wreorder. Examples below.

src/sbus.cpp:112:68: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]        
         data_.ch[0]  = static_cast<int16_t>(buf_[1] | buf_[2] << 8 & 0x07FF);
                                                       ~~~~~~~~~~~~~^~~~~~~~
src/sbus.h: In constructor 'bfs::SbusRx::SbusRx(HardwareSerial*, int8_t, int8_t, bool, bool)':
src/sbus.h:74:18: warning: 'bfs::SbusRx::txpin_' will be initialized after [-Wreorder]
   int8_t rxpin_, txpin_;
                  ^~~~~~
src/sbus.h:72:16: warning:   'bool bfs::SbusRx::fast_' [-Wreorder]
   bool fast_ = false;
                ^~~~~
src/sbus.h:53:3: warning:   when initialized here [-Wreorder]
   SbusRx(HardwareSerial *bus, const int8_t rxpin, const int8_t txpin,
   ^~~~~~
flybrianfly commented 1 year ago

Looks good, thanks!