Skip to content

Commit

Permalink
HAL_ChibiOS: fixed array length in ADC debug code
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Jun 1, 2018
1 parent b6e3616 commit 4d1ac3c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libraries/AP_HAL_ChibiOS/AnalogIn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,11 @@ void AnalogIn::_timer_tick(void)
if (AP_HAL::millis() > 5000 && count++ == 10) {
count = 0;
uint16_t adc[6] {};
for (uint8_t i=0; i < ADC_GRP1_NUM_CHANNELS; i++) {
uint8_t n = ADC_GRP1_NUM_CHANNELS;
if (n > 6) {
n = 6;
}
for (uint8_t i=0; i < n; i++) {
adc[i] = buf_adc[i];
}
mavlink_msg_ap_adc_send(MAVLINK_COMM_0, adc[0], adc[1], adc[2], adc[3], adc[4], adc[5]);
Expand Down

0 comments on commit 4d1ac3c

Please sign in to comment.