formatted
This commit is contained in:
parent
c5343f9cdd
commit
ba05bb5ff4
|
@ -82,52 +82,52 @@ static void set_led_color(LedId id, LedColor color) {
|
|||
|
||||
void status_led_state(TSState state, TSErrorKind error) {
|
||||
switch (state) {
|
||||
case TS_INACTIVE:
|
||||
set_led_color(LED_1, (LedColor) {.red = 0, .green = 0, .blue = 0});
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 0, .blue = 0});
|
||||
break;
|
||||
case TS_ACTIVE:
|
||||
set_led_color(LED_1, (LedColor) {.red = 0, .green = 0, .blue = 1});
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 0, .blue = 0});
|
||||
break;
|
||||
case TS_PRECHARGE:
|
||||
set_led_color(LED_1, (LedColor) {.red = 0, .green = 0, .blue = 1});
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 1, .blue = 1});
|
||||
break;
|
||||
case TS_DISCHARGE:
|
||||
set_led_color(LED_1, (LedColor) {.red = 0, .green = 0, .blue = 1});
|
||||
set_led_color(LED_2, (LedColor) {.red = 1, .green = 0, .blue = 1});
|
||||
break;
|
||||
case TS_ERROR:
|
||||
set_led_color(LED_1, (LedColor) {.red = 1, .green = 0, .blue = 0});
|
||||
switch (error) {
|
||||
case TS_ERRORKIND_NONE:
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 0, .blue = 0});
|
||||
break;
|
||||
case TS_ERRORKIND_SLAVE_TIMEOUT:
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 0, .blue = 1});
|
||||
break;
|
||||
case TS_ERRORKIND_SLAVE_PANIC:
|
||||
set_led_color(LED_2, (LedColor) {.red = 1, .green = 0, .blue = 1});
|
||||
break;
|
||||
case TS_ERRORKIND_SHUNT_TIMEOUT:
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 1, .blue = 0});
|
||||
break;
|
||||
case TS_ERRORKIND_SHUNT_OVERCURRENT:
|
||||
set_led_color(LED_2, (LedColor) {.red = 1, .green = 1, .blue = 0});
|
||||
break;
|
||||
case TS_ERRORKIND_SHUNT_OVERTEMP:
|
||||
set_led_color(LED_2, (LedColor) {.red = 1, .green = 0, .blue = 0});
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TS_CHARGING_CHECK:
|
||||
set_led_color(LED_1, (LedColor) {.red = 0, .green = 1, .blue = 0});
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 1, .blue = 1});
|
||||
break;
|
||||
case TS_CHARGING:
|
||||
set_led_color(LED_1, (LedColor) {.red = 0, .green = 1, .blue = 0});
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 0, .blue = 0});
|
||||
break;
|
||||
case TS_INACTIVE:
|
||||
set_led_color(LED_1, (LedColor) {.red = 0, .green = 0, .blue = 0});
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 0, .blue = 0});
|
||||
break;
|
||||
case TS_ACTIVE:
|
||||
set_led_color(LED_1, (LedColor) {.red = 0, .green = 0, .blue = 1});
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 0, .blue = 0});
|
||||
break;
|
||||
case TS_PRECHARGE:
|
||||
set_led_color(LED_1, (LedColor) {.red = 0, .green = 0, .blue = 1});
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 1, .blue = 1});
|
||||
break;
|
||||
case TS_DISCHARGE:
|
||||
set_led_color(LED_1, (LedColor) {.red = 0, .green = 0, .blue = 1});
|
||||
set_led_color(LED_2, (LedColor) {.red = 1, .green = 0, .blue = 1});
|
||||
break;
|
||||
case TS_ERROR:
|
||||
set_led_color(LED_1, (LedColor) {.red = 1, .green = 0, .blue = 0});
|
||||
switch (error) {
|
||||
case TS_ERRORKIND_NONE:
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 0, .blue = 0});
|
||||
break;
|
||||
case TS_ERRORKIND_SLAVE_TIMEOUT:
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 0, .blue = 1});
|
||||
break;
|
||||
case TS_ERRORKIND_SLAVE_PANIC:
|
||||
set_led_color(LED_2, (LedColor) {.red = 1, .green = 0, .blue = 1});
|
||||
break;
|
||||
case TS_ERRORKIND_SHUNT_TIMEOUT:
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 1, .blue = 0});
|
||||
break;
|
||||
case TS_ERRORKIND_SHUNT_OVERCURRENT:
|
||||
set_led_color(LED_2, (LedColor) {.red = 1, .green = 1, .blue = 0});
|
||||
break;
|
||||
case TS_ERRORKIND_SHUNT_OVERTEMP:
|
||||
set_led_color(LED_2, (LedColor) {.red = 1, .green = 0, .blue = 0});
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TS_CHARGING_CHECK:
|
||||
set_led_color(LED_1, (LedColor) {.red = 0, .green = 1, .blue = 0});
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 1, .blue = 1});
|
||||
break;
|
||||
case TS_CHARGING:
|
||||
set_led_color(LED_1, (LedColor) {.red = 0, .green = 1, .blue = 0});
|
||||
set_led_color(LED_2, (LedColor) {.red = 0, .green = 0, .blue = 0});
|
||||
break;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue