diff options
author | Daniel Shiels <diyd5@tofubar.com> | 2014-11-10 15:54:28 +1100 |
---|---|---|
committer | Daniel Shiels <diyd5@tofubar.com> | 2014-11-10 15:54:28 +1100 |
commit | 34e9d9efce10ce487b4c5af0cf93a442ab3b8594 (patch) | |
tree | c819960f986f919527e07a65dc69e5911b4a61e6 | |
parent | 60ecd8868db3539e552bad5f51473d1baf5d6ecd (diff) | |
download | px4-firmware-34e9d9efce10ce487b4c5af0cf93a442ab3b8594.tar.gz px4-firmware-34e9d9efce10ce487b4c5af0cf93a442ab3b8594.tar.bz2 px4-firmware-34e9d9efce10ce487b4c5af0cf93a442ab3b8594.zip |
Code style cleanup.
-rw-r--r-- | src/modules/px4iofirmware/sbus.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/modules/px4iofirmware/sbus.c b/src/modules/px4iofirmware/sbus.c index 2f234234e..90c0e0503 100644 --- a/src/modules/px4iofirmware/sbus.c +++ b/src/modules/px4iofirmware/sbus.c @@ -125,8 +125,7 @@ sbus_init(const char *device) void sbus1_output(uint16_t *values, uint16_t num_values) { - //int. first byte of data is offset 1 in sbus - uint8_t byteindex = 1; + uint8_t byteindex = 1; /*Data starts one byte into the sbus frame. */ uint8_t offset = 0; uint16_t value; hrt_abstime now; @@ -141,11 +140,13 @@ sbus1_output(uint16_t *values, uint16_t num_values) oframe[i] = 0; } - // 16 is sbus number of servos/channels minus 2 single bit channels. - // currently ignoring single bit channels. - for (uint16_t i = 0; (i < num_values) && (i < 16); ++i) { + /* 16 is sbus number of servos/channels minus 2 single bit channels. + * currently ignoring single bit channels. */ + + for (unsigned i = 0; (i < num_values) && (i < 16); ++i) { value = (uint16_t)(((values[i] - SBUS_SCALE_OFFSET) / SBUS_SCALE_FACTOR) + .5f); - //protect from out of bounds values and limit to 11 bits; + + /*protect from out of bounds values and limit to 11 bits*/ if (value > 0x07ff ) { value = 0x07ff; } |