Fix host_led_pin_list out of bound issue
This commit is contained in:
parent
5c61a8b0bc
commit
485e45ea67
1 changed files with 10 additions and 4 deletions
|
|
@ -237,10 +237,16 @@ static void indicator_timer_cb(void *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HOST_LED_PIN_LIST
|
#ifdef HOST_LED_PIN_LIST
|
||||||
if (indicator_config.value && (indicator_config.value & 0x80)) {
|
if (indicator_config.value)
|
||||||
writePin(host_led_pin_list[indicator_config.value & 0x0F], HOST_LED_PIN_ON_STATE);
|
{
|
||||||
} else {
|
uint8_t idx = (indicator_config.value & 0x0F) - 1;
|
||||||
writePin(host_led_pin_list[indicator_config.value & 0x0F], !HOST_LED_PIN_ON_STATE);
|
chDbgAssert(idx < HOST_DEVICES_COUNT, "array out of bounds");
|
||||||
|
|
||||||
|
if (indicator_config.value & 0x80) {
|
||||||
|
writePin(host_led_pin_list[idx], HOST_LED_PIN_ON_STATE);
|
||||||
|
} else {
|
||||||
|
writePin(host_led_pin_list[idx], !HOST_LED_PIN_ON_STATE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue