1#ifndef HUMIDISTAT_CONTROLLERUI_H
2#define HUMIDISTAT_CONTROLLERUI_H
44 virtual void setCursor(uint8_t col, uint8_t row) = 0;
53 etl::span<const ThermistorReader, 4>
trs;
71 void blink(uint8_t col, uint8_t row,
const char *buf);
77 void printNTC(uint8_t col, uint8_t row, uint8_t i);
84 static void adjustValue(
double delta,
double &value, uint8_t min, uint8_t max);
91 template <
typename... T>
92 void printf(uint8_t col, uint8_t row,
const char *fmt, T... args) {
char * asprintf(const char *fmt, T... args)
Print formatted data to string. Automatically allocates string on the heap. Make sure to delete it im...
User interface (display and input) for humidistat. Hold references to ButtonReader for keypad input,...
const uint16_t refreshInterval
static void adjustValue(double delta, double &value, uint8_t min, uint8_t max)
In-/de-crement a variable, while clipping it to [min, max].
etl::span< const ThermistorReader, 4 > trs
unsigned long lastRefreshed
Last time display was updated (in millis)
const uint16_t splashDuration
void update()
Update the display and handle input: set Humidistat's setpoint.
const uint16_t inputInterval
virtual void drawSplash()=0
Draw splash screen.
virtual void setCursor(uint8_t col, uint8_t row)=0
Set cursor to coordinates.
const uint16_t infoDuration
virtual void begin()=0
Initialize the display.
void printf(uint8_t col, uint8_t row, const char *fmt, T... args)
Print formatted data to display, at (col, row). Calculates lengths and creates appropriate buffer int...
const uint16_t blinkInterval
virtual bool handleInput(Buttons state, uint16_t pressedFor)=0
Handle input.
const uint16_t buttonDebounceInterval
ControllerUI(Print *display, const ButtonReader *buttonReader, etl::span< const ThermistorReader, 4 > trs)
Constructor.
const ButtonReader & buttonReader
void printNTC(uint8_t col, uint8_t row, uint8_t i)
Print temperature read from thermistors. Handles NaN values as 0.
virtual void drawInfo()=0
Draw info screen.
virtual void draw()=0
Draw main interface (main loop).
unsigned long lastPressed
Last time a keypress event occurred (in millis)
virtual void clear()=0
Clear screen.
void blink(uint8_t col, uint8_t row, const char *buf)
Print blinking text.
const uint16_t refreshInterval
Interval for updating the display (in millis)
const uint16_t blinkInterval
Interval for blinking display elements (in millis)
const double tolerance
Tolerance in difference between process variable and setpoint outside which the setpoint blinks (in p...
const uint16_t buttonDebounceInterval
For debouncing: interval the keypad state must be stable for (in micros)
const uint16_t infoDuration
Duration for which to show the info screen (in millis)
const uint16_t splashDuration
Duration for which to show the splash screen (in millis)
const uint8_t adjustStep
Step size by which to in-/de-crement for coarse adjustment.
const uint16_t inputInterval
Repeat interval for keypress events (in millis)