dprintf(5, 0, "Command: %d%%", command_val);
dprintf(6, 0, "Mode: %c", heat_mode);
dprintf(7, 0, MODULE_VERSION_STR " - " SOFT_VERSION_STR "." COMPILE_VERSION);
-
- /* Update RGB leds */
- /* FIXME : use for error signal */
- ws2812_set_pixel(&ws2812_leds, 0, (home_conso_value / 2000), (solar_prod_value / 2000), 0);
- ws2812_set_pixel(&ws2812_leds, 1, 0, 0, command_val);
- ws2812_send_frame(&ws2812_leds, 0);
} else {
/* Config mode. Mode entered by button action, which implies that interface board is present. */
interface_mode = config_interface_handle();
}
/* Update Oled display */
ssd130x_display_full_screen(&display);
+
+ if (1) {
+ static uint8_t blink = 0; /* For blinking leds */
+ uint8_t red = 0, green = 0, blue = 0;
+ /* Update RGB leds */
+ /* FIXME : use for error signal */
+ if (blink != 0) {
+ ws2812_set_pixel(&ws2812_leds, 0, 0, 0, 0);
+ ws2812_set_pixel(&ws2812_leds, 1, 0, 0, 0);
+ blink = 0;
+ } else {
+ switch (heat_mode) {
+ case mode_water_critical: /* Both Leds to Full RED */
+ if (blink == 0) {
+ ws2812_set_pixel(&ws2812_leds, 0, 255, 0, 0);
+ ws2812_set_pixel(&ws2812_leds, 1, 255, 0, 0);
+ blink = 1;
+ }
+ break;
+ case mode_overvoltage: /* First Led Red blinking */
+ if (blink == 0) {
+ ws2812_set_pixel(&ws2812_leds, 0, 255, 0, 0);
+ blink = 1;
+ }
+ break;
+ case mode_overtemp: /* Second Led Red blinking */
+ if (blink == 0) {
+ ws2812_set_pixel(&ws2812_leds, 1, 255, 0, 0);
+ blink = 1;
+ }
+ break;
+ default:
+ if (heat_mode == mode_manual) { /* -> Green */
+ green = command_val;
+ } else if (heat_mode == mode_forced) { /* -> Yellow */
+ green = command_val;
+ blue = command_val;
+ } else { /* -> Blue */
+ blue = command_val;
+ }
+ ws2812_set_pixel(&ws2812_leds, 0, (home_conso_value / 2000), (solar_prod_value / 2000), 0);
+ ws2812_set_pixel(&ws2812_leds, 1, red, green, blue);
+ break;
+ }
+ }
+ ws2812_send_frame(&ws2812_leds, 0);
+ }
}