Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: SBUS.cpp
- Revision:
- 10:ac27dfde496e
- Parent:
- 9:0c412933b84f
- Child:
- 11:afe8c7d2cdf0
diff -r 0c412933b84f -r ac27dfde496e SBUS.cpp --- a/SBUS.cpp Fri Jul 05 11:13:47 2019 +0000 +++ b/SBUS.cpp Sat Jul 13 02:10:29 2019 +0000 @@ -76,8 +76,9 @@ void SBUS::convertReceivedData() { for(int i = 0; i < 4; i++) { float buf; - if(channel[i] > stickNeutralValue) buf = ((channel[i] - stickNeutralValue) / (float)(stickMaximumValue - stickNeutralValue)); - else buf = -((channel[i] - stickNeutralValue) / (float)(stickMinimumValue - stickNeutralValue)); + if(channel[i] > (stickNeutralValue + 11)) buf = ((channel[i] - stickNeutralValue) / (float)(stickMaximumValue - stickNeutralValue)); + else if(channel[i] < (stickNeutralValue - 11)) buf = -((channel[i] - stickNeutralValue) / (float)(stickMinimumValue - stickNeutralValue)); + else buf = 0.0f; buf = (int)(buf*100)/100.0f; buf = (buf > 1.0f) ? 1.0f : buf; switch(i) {