|
|
|
@ -4,11 +4,13 @@ |
|
|
|
|
|
|
|
|
|
#include <stdbool.h> |
|
|
|
|
#include <string.h> |
|
|
|
|
#include <hardware/gpio.h> |
|
|
|
|
#include "app_gui.h" |
|
|
|
|
#include "lcd/lcdbuf.h" |
|
|
|
|
#include "lcd.h" |
|
|
|
|
#include "app_config.h" |
|
|
|
|
#include "app_io.h" |
|
|
|
|
#include "pinout.h" |
|
|
|
|
|
|
|
|
|
struct State s_app = {}; |
|
|
|
|
|
|
|
|
@ -45,6 +47,8 @@ void gui_init() |
|
|
|
|
LcdBuffer_Init(&lcd, CGROM_A00, CGRAM_CZ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool blink_state = 0; |
|
|
|
|
|
|
|
|
|
void gui_loop_iter(GuiEvent message) |
|
|
|
|
{ |
|
|
|
|
uint32_t tickNow = timestamp_ms(); |
|
|
|
@ -95,6 +99,25 @@ void gui_loop_iter(GuiEvent message) |
|
|
|
|
s_app.screen(GUI_EVENT_SCREEN_TICK_1S); |
|
|
|
|
read_time_and_moisture(); |
|
|
|
|
s_app.last_1s_time = tickNow; |
|
|
|
|
|
|
|
|
|
// blinking
|
|
|
|
|
blink_state = !blink_state; |
|
|
|
|
gpio_put(PIN_LED, blink_state); |
|
|
|
|
|
|
|
|
|
// also blink with the relay pin, so we can route that to a indicator light in the lid
|
|
|
|
|
// ->
|
|
|
|
|
// check if we have schedule enabled & set
|
|
|
|
|
bool any_sch = false; |
|
|
|
|
if (app_config.scheduler_enable) { |
|
|
|
|
for (int i = 0; i < SCHEDULE_COUNT; i++) { |
|
|
|
|
if (!app_config.schedules[i].enable) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
any_sch = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
gpio_put(PIN_RE5, any_sch && blink_state); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 100ms tick event
|
|
|
|
|