You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zavlaha-kzk/src/screens/screen_home.c

64 lines
1.5 KiB

/**
* TODO file description
*/
//
// Created by MightyPork on 2023/04/09.
//
#include <stdio.h>
#include <string.h>
#include "app_gui.h"
#include "gui_event.h"
#include "ds_rtc.h"
#include "app_io.h"
#include "app_config.h"
static uint32_t last_time = 0;
static struct rtc_time rtc_time = {};
static uint16_t moisture_pt = 0;
static uint8_t showbuf_wp = 0;
void screen_home(GuiEvent event)
{
uint32_t now = timestamp();
uint32_t elapsed = now - last_time;
switch (event) {
case GUI_EVENT_SCREEN_INIT:
// pass
case GUI_EVENT_SCREEN_TICK_10MS:
if (elapsed >= 100) {
last_time = now;
rtc_get_time(&rtc_time);
moisture_pt = moisture_convert(moisture_read());
request_paint();
}
break;
2 years ago
case GUI_EVENT_PAINT:;
// TODO
2 years ago
sprintf(sbuf, " %2d:%02d:%02d %3d%% 🌢 ", rtc_time.hour, rtc_time.minute, rtc_time.second, moisture_pt);
LcdBuffer_Write(&lcd, 0, 0, sbuf);
LcdBuffer_Write(&lcd, 1, 0, "Plán. závlaha 7:15");
LcdBuffer_Write(&lcd, 2, 0, "❶Spustit ❷Přeskočit");
LcdBuffer_Write(&lcd, 3, 0, "🅰Nastavení");
break;
case GUI_EVENT_KEY_1:
2 years ago
// TODO
switch_screen(screen_cyklus, true); // fake cycle
break;
case GUI_EVENT_KEY_2:
// TODO
break;
case GUI_EVENT_KEY_A:
2 years ago
switch_screen(screen_settings, true);
break;
}
}