PX4IO: Initialize all channels to zero

This sets all channels to zero, including unused channels. Any consumer of the data using the channel count will not see a difference, but this is helpful to avoid confusion in log analysis.
This commit is contained in:
Lorenz Meier
2018-06-15 23:48:44 +02:00
parent af07d4b37b
commit d14d31df14
+5
View File
@@ -1814,6 +1814,11 @@ PX4IO::io_get_raw_rc_input(rc_input_values &input_rc)
input_rc.values[i] = regs[prolog + i];
}
/* zero the remaining fields */
for (unsigned i = channel_count; i < (sizeof(input_rc.values) / sizeof(input_rc.values[0])); i++) {
input_rc.values[i] = 0;
}
/* get RSSI from input channel */
if (_rssi_pwm_chan > 0 && _rssi_pwm_chan <= input_rc_s::RC_INPUT_MAX_CHANNELS && _rssi_pwm_max - _rssi_pwm_min != 0) {
int rssi = ((input_rc.values[_rssi_pwm_chan - 1] - _rssi_pwm_min) * 100) /