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:
- 2:493d10424466
- Parent:
- 1:a1307d47b1b8
- Child:
- 4:da8728f3d289
--- a/SBUS.cpp Fri Jun 28 07:59:32 2019 +0000 +++ b/SBUS.cpp Fri Jun 28 08:31:04 2019 +0000 @@ -13,7 +13,7 @@ com.format(8, Serial::Even, 2); switchPositionValue[0] = 0x076F; switchPositionValue[1] = 0x03FF; - switchPositionValue[2] = 0x080F; + switchPositionValue[2] = 0x008F; switchFPositionValue[0] = 0x076F; switchFPositionValue[1] = 0x0074; } @@ -87,5 +87,21 @@ break; } } - for(int i = 0; i < 12; i++) switchValue[i] = ((channel[i + 3] == switchPositionValue[High]) ? 1 : 0); + for(int i = 0; i < 12; i++) { + switch(channel[i + 4]) { + case 0x008F: + case 0x0074: + switchValue[i] = High; + break; + case 0x03FF: + switchValue[i] = Neutral; + break; + case 0x076F: + switchValue[i] = Low; + break; + default: + switchValue[i] = channel[i + 3] / 1903.0f; + break; + } + } }