parent
88c215393b
commit
b128efecd3
@ -0,0 +1,68 @@ |
||||
#include <stdio.h> |
||||
#include "app_gui.h" |
||||
#include "gui_event.h" |
||||
#include "app_io.h" |
||||
#include "lcd.h" |
||||
|
||||
static bool valve1, valve2, valve3, valve4; |
||||
|
||||
void screen_manual_control(GuiEvent event) |
||||
{ |
||||
switch (event) { |
||||
case GUI_EVENT_SCREEN_INIT: |
||||
open_valve(0); // make sure all are closed
|
||||
valve1 = valve2 = valve3 = valve4 = false; |
||||
break; |
||||
|
||||
case GUI_EVENT_PAINT: |
||||
LcdBuffer_Write(&lcd, 0, 0, "== MANUÁLNÍ REŽIM =="); |
||||
LcdBuffer_Write(&lcd, 1, 0, "1-4 ventil,0 vyp.vše"); |
||||
|
||||
LcdBuffer_SetCursor(&lcd, 2, 0, CURSOR_BOTH); |
||||
|
||||
snprintf(sbuf, sbuf_len, " %s %s %s %s ", |
||||
valve1 ? "█1█" : " 1 ", |
||||
valve2 ? "█2█" : " 2 ", |
||||
valve3 ? "█3█" : " 3 ", |
||||
valve4 ? "█4█" : " 4 "); |
||||
LcdBuffer_Write(&lcd, 2, 0, sbuf); |
||||
|
||||
LcdBuffer_Write(&lcd, 3, 0, "🅳Konec"); |
||||
break; |
||||
|
||||
case GUI_EVENT_KEY_D: // CANCEL
|
||||
open_valve(0); |
||||
switch_screen(screen_home, true); |
||||
break; |
||||
|
||||
case GUI_EVENT_KEY_0: |
||||
valve1 = valve2 = valve3 = valve4 = false; |
||||
open_valve(0); |
||||
request_paint(); |
||||
break; |
||||
|
||||
case GUI_EVENT_KEY_1: |
||||
valve1 = !valve1; |
||||
set_one_relay(1, valve1); |
||||
break; |
||||
|
||||
case GUI_EVENT_KEY_2: |
||||
valve2 = !valve2; |
||||
set_one_relay(2, valve2); |
||||
break; |
||||
|
||||
case GUI_EVENT_KEY_3: |
||||
valve3 = !valve3; |
||||
set_one_relay(3, valve3); |
||||
break; |
||||
|
||||
case GUI_EVENT_KEY_4: |
||||
valve4 = !valve4; |
||||
set_one_relay(4, valve4); |
||||
break; |
||||
|
||||
case GUI_EVENT_SCREEN_DEINIT: |
||||
open_valve(0); // close all
|
||||
break; |
||||
} |
||||
} |
@ -0,0 +1,44 @@ |
||||
#include <stdio.h> |
||||
#include "app_gui.h" |
||||
#include "gui_event.h" |
||||
#include "app_io.h" |
||||
#include "lcd.h" |
||||
#include "app_config.h" |
||||
|
||||
static int value; |
||||
|
||||
void screen_suche_dny(GuiEvent event) |
||||
{ |
||||
switch (event) { |
||||
case GUI_EVENT_SCREEN_INIT: |
||||
value = app_config.scheduler_dry_days; |
||||
break; |
||||
|
||||
case GUI_EVENT_PAINT: |
||||
LcdBuffer_Write(&lcd, 0, 0, "Vynechat dny mezi"); |
||||
LcdBuffer_Write(&lcd, 1, 0, "auto. zálivkou (0-5)"); |
||||
|
||||
LcdBuffer_SetCursor(&lcd, 2, 0, CURSOR_BOTH); |
||||
|
||||
snprintf(sbuf, sbuf_len, "%d d", value); |
||||
LcdBuffer_Write(&lcd, 2, 0, sbuf); |
||||
|
||||
LcdBuffer_Write(&lcd, 3, 0, "🅳Zrušit 🅰OK"); |
||||
break; |
||||
|
||||
case GUI_EVENT_KEY_A: // Confirm
|
||||
settings_scratch.scheduler_dry_days = value; |
||||
switch_to_parent_screen(screen_settings); |
||||
break; |
||||
|
||||
case GUI_EVENT_KEY_D: // CANCEL
|
||||
switch_to_parent_screen(screen_settings); |
||||
break; |
||||
|
||||
default: |
||||
if (event >= '0' && event <= '5') { |
||||
value = (uint8_t) (event - '0'); |
||||
request_paint(); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue