formatted

This commit is contained in:
Kilian Bracher 2024-04-01 19:58:33 +02:00
parent c5343f9cdd
commit ba05bb5ff4
Signed by: k.bracher
SSH Key Fingerprint: SHA256:mXpyZkK7RDiJ7qeHCKJX108woM0cl5TrCvNBJASu6lM
1 changed files with 47 additions and 47 deletions

View File

@ -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;
}
}