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/app_gui.h

92 lines
2.0 KiB

/**
* TODO file description
*/
#ifndef ZAVLAHA_APP_GUI_H
#define ZAVLAHA_APP_GUI_H
#include <stdbool.h>
#include <stdint.h>
#include <pico/time.h>
#include "gui_event.h"
#include "lcd/lcdbuf.h"
#include "ds_rtc.h"
// 🌢🅰🅱🅲🅳❶❷❸❹⊛¤▌↑↓✔
/// Temporary scratch buffer
extern char sbuf[100];
#define sbuf_len 100
extern struct LcdBuffer lcd;
/**
* Screen callback type. The event is either INIT, PAINT, or one of the input events.
*/
typedef void (*screen_t)(GuiEvent event);
static inline uint32_t timestamp_ms() {
return to_ms_since_boot(get_absolute_time());
}
/** Input beep (push or knob turn) */
void input_sound_effect();
void gui_loop_iter(GuiEvent message);
void gui_init();
/** Switch to a different screen. Handles initial push state handling (so release
* does not cause a "click" event).
*
* @param pScreen - screen to switch to
* @param init - call the INIT event immediately after
*/
void switch_screen(screen_t pScreen, bool init);
void request_paint();
// prototypes for screen handlers
void screen_home(GuiEvent event);
void screen_cyklus(GuiEvent event);
extern struct AppConfig settings_scratch;
void screen_settings(GuiEvent event);
void screen_set_time(GuiEvent event);
void screen_set_moisture_threshold(GuiEvent event);
void screen_moisture_calib(GuiEvent event);
void screen_delka_zalivky(GuiEvent event);
void screen_kompenzace_tlaku(GuiEvent event);
void screen_program_prehled(GuiEvent event);
extern int pgm_edit_slot;
void screen_program_edit(GuiEvent event);
// XXX other prototypes
void gui_read_moisture();
struct State {
struct rtc_time rtc_time;
uint16_t moisture_raw;
uint16_t moisture_pt;
struct rtc_time last_cycle_time;
bool cycle_time_checking;
/// Repaint was requested from the screen code
bool paint_needed;
/// Pointer to the currently active screen func
screen_t screen;
uint32_t last_10ms_time;
uint32_t last_100ms_time;
uint32_t last_1s_time;
uint32_t screen_open_time;
};
extern struct State s_app;
#endif //ZAVLAHA_APP_GUI_H