commit
b76ab770da
@ -0,0 +1,3 @@ |
||||
|
||||
kompilovano s SDK ver 3352ccf5de3a704e74355f72aa61143fb36cfec9 |
||||
|
@ -0,0 +1,64 @@ |
||||
#include <stdio.h> |
||||
#include "app_gui.h" |
||||
#include "gui_event.h" |
||||
#include "app_io.h" |
||||
#include "lcd.h" |
||||
|
||||
static int cur_valve = 0; |
||||
|
||||
void screen_manual_control(GuiEvent event) |
||||
{ |
||||
int num = 0; |
||||
switch (event) { |
||||
case GUI_EVENT_SCREEN_INIT: |
||||
open_valve(0); // make sure all are closed
|
||||
cur_valve = 0; |
||||
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 ", |
||||
(cur_valve == 1) ? "█1█" : " 1 ", |
||||
(cur_valve == 2) ? "█2█" : " 2 ", |
||||
(cur_valve == 3) ? "█3█" : " 3 ", |
||||
(cur_valve == 4) ? "█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: |
||||
cur_valve = 0; |
||||
open_valve(0); |
||||
request_paint(); |
||||
break; |
||||
|
||||
case GUI_EVENT_KEY_1: |
||||
case GUI_EVENT_KEY_2: |
||||
case GUI_EVENT_KEY_3: |
||||
case GUI_EVENT_KEY_4: |
||||
num = (int) (event - '0'); |
||||
if (cur_valve == num) { |
||||
cur_valve = 0; |
||||
open_valve(0); |
||||
} else { |
||||
cur_valve = num; |
||||
open_valve(num); |
||||
} |
||||
request_paint(); |
||||
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 = settings_scratch.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