From 4fb62abd2ff61d03ada52fd3f522755b6a659025 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 25 Oct 2020 15:14:39 +0100 Subject: Add EOL SK message when wind gen breaker is open --- src/simulator/src/Gui/gui.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/simulator') diff --git a/src/simulator/src/Gui/gui.c b/src/simulator/src/Gui/gui.c index 3dab969..dea5007 100644 --- a/src/simulator/src/Gui/gui.c +++ b/src/simulator/src/Gui/gui.c @@ -183,6 +183,11 @@ float gui_measured_voltage = 14.0f; int gui_measured_capacity = 1630; // Ah int gui_measured_capacity_last = 1630; // Ah +static const char *breaker_status[] = {"Closed", "Open"}; +static const char *breaker_message[] = {"On", "Off"}; +int gui_breaker_status = 0; +int gui_breaker_status_last = 0; + /** * SWR @@ -802,6 +807,19 @@ void main_gui() { nk_label_colored(ctx, "Voltage", NK_TEXT_LEFT, c); nk_property_float(ctx, "V", 0.0f, &gui_measured_voltage, 24.0f, 0.5f, 0.5f); + nk_layout_row_dynamic(ctx, 25, 2); + nk_label_colored(ctx, "Eolienne breaker", NK_TEXT_LEFT, c); + gui_breaker_status = nk_combo(ctx, breaker_status, LEN(breaker_status), gui_breaker_status, 30); + + if (gui_breaker_status != gui_breaker_status_last) { + uart_send_txt_len = snprintf(uart_send_txt, sizeof(uart_send_txt), "DISJEOL,%ld,%s", timestamp_now()/1000, breaker_message[gui_breaker_status]); + + uart_send_txt[uart_send_txt_len] = '\0'; + gui_usart_send(uart_send_txt); + + gui_breaker_status_last = gui_breaker_status; + } + nk_layout_row_dynamic(ctx, 25, 2); nk_label_colored(ctx, "Capacity", NK_TEXT_LEFT, c); nk_property_int(ctx, "Ah", 0, &gui_measured_capacity, 1650, 10, 0.1f); -- cgit v1.2.3