Browse Source

HAL_ChibiOS: fixed integer promotion bug in SoftSigReaderInt

this caused corrupted PPM values. Many thanks to Andrea Belloni for reporting
master
Andrew Tridgell 7 years ago
parent
commit
f75dea34e1
  1. 4
      libraries/AP_HAL_ChibiOS/SoftSigReaderInt.cpp

4
libraries/AP_HAL_ChibiOS/SoftSigReaderInt.cpp

@ -62,8 +62,8 @@ bool SoftSigReaderInt::read(uint32_t &widths0, uint32_t &widths1) @@ -62,8 +62,8 @@ bool SoftSigReaderInt::read(uint32_t &widths0, uint32_t &widths1)
uint16_t p0, p1;
if (sigbuf.available() >= 2) {
if (sigbuf.pop(p0)&&sigbuf.pop(p1)) {
widths0 = p0 - last_value;
widths1 = p1 - p0;
widths0 = uint16_t(p0 - last_value);
widths1 = uint16_t(p1 - p0);
last_value = p1;
return true;
}

Loading…
Cancel
Save