Humidistat
Arduino firmware for a humidistat (humidity controller)
Loading...
Searching...
No Matches
GraphicalDisplayUI< Humidistat_t > Class Template Reference

TUI for 128*64 px graphical display using U8g2. Holds references to a U8g2lib instance for writing to display, an EEPROMConfig instance to edit the config, and to a Humidistat instance to show/edit its state. More...

#include <GraphicalDisplayUI.h>

Inheritance diagram for GraphicalDisplayUI< Humidistat_t >:
[legend]
Collaboration diagram for GraphicalDisplayUI< Humidistat_t >:
[legend]

Public Member Functions

void begin () override
 Initialize the display.
 
 GraphicalDisplayUI (U8G2 *u8g2, const ButtonReader *buttonReader, SingleHumidistat *humidistat, etl::span< const ThermistorReader, 4 > trs, EEPROMConfig *eepromConfig, SetpointProfileRunner *spr)
 Constructor.
 
 GraphicalDisplayUI (U8G2 *u8g2, const ButtonReader *buttonReader, CascadeHumidistat *humidistat, etl::span< const ThermistorReader, 4 > trs, EEPROMConfig *eepromConfig, SetpointProfileRunner *spr)
 
- Public Member Functions inherited from ControllerUI
void update ()
 Update the display and handle input: set Humidistat's setpoint.
 

Private Types

enum class  Tab { main , info , config , _last = config }
 Tab definitions. More...
 
enum class  Selection { par , number , actions }
 Config tab selection definitions. More...
 
enum class  Action { save , reset , _last = reset }
 Config tab action definitions. More...
 

Private Member Functions

void drawMain ()
 Draw the Main tab.
 
void drawTabInfo ()
 
void drawConfig ()
 Draw the Config tab.
 
void DrawMainCommon ()
 Draw common elements in Main tab.
 
void drawTabBar ()
 Draw the tab bar.
 
bool handleInput (Buttons state, uint16_t pressedFor) override
 Handle input.
 
bool handleInputMain (Buttons state, uint16_t pressedFor)
 Handle input on the Main tab.
 
bool handleInputInfo (Buttons state, uint16_t pressedFor)
 Handle input on the Info tab.
 
bool handleInputConfig (Buttons state, uint8_t pressedFor)
 Handle input on the Config tab.
 
void draw () override
 Draw main interface (main loop).
 
void drawSplash () override
 Draw splash screen.
 
void drawInfo () override
 Draw info screen.
 
void clear () override
 Clear screen.
 
void setCursor (uint8_t col, uint8_t row) override
 Set cursor to coordinates.
 
void drawMain ()
 
void drawMain ()
 

Private Attributes

U8G2 & u8g2
 
EEPROMConfigeepromConfig
 
Humidistat_t & humidistat
 
SetpointProfileRunnerspr
 
Tab currentTab = Tab::main
 Currently active tab.
 
uint8_t currentPar = 0
 Currently active config parameter.
 
Selection currentSelection = Selection::par
 
Action currentAction = Action::save
 
uint8_t currentDigit = NUM_DIGITS - 1
 
uint8_t currentSPProfile = 0
 
uint8_t frame = 0
 Frame counter (overflows, but that's OK)
 
uint8_t configSaveTimer = 0
 Timer containing the current value of the cooldown on saving config to EEPROM.
 
const uint16_t longPressDuration = config::longPressDuration
 
const uint8_t configSaveCooldown = config::configSaveCooldown
 
const uint8_t nConfigPars
 Total number of config parameters.
 
const ConfigPar configPars [13]
 Array of config parameters.
 

Additional Inherited Members

- Protected Member Functions inherited from ControllerUI
 ControllerUI (Print *display, const ButtonReader *buttonReader, etl::span< const ThermistorReader, 4 > trs)
 Constructor.
 
void blink (uint8_t col, uint8_t row, const char *buf)
 Print blinking text.
 
void printNTC (uint8_t col, uint8_t row, uint8_t i)
 Print temperature read from thermistors. Handles NaN values as 0.
 
template<typename... T>
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 internally.
 
- Static Protected Member Functions inherited from ControllerUI
static void adjustValue (double delta, double &value, uint8_t min, uint8_t max)
 In-/de-crement a variable, while clipping it to [min, max].
 
- Protected Attributes inherited from ControllerUI
etl::span< const ThermistorReader, 4 > trs
 
unsigned long lastRefreshed = 0
 Last time display was updated (in millis)
 
const uint16_t refreshInterval = config::refreshInterval
 
const uint8_t adjustStep = config::adjustStep
 
const double tolerance = config::tolerance
 

Detailed Description

template<class Humidistat_t>
class GraphicalDisplayUI< Humidistat_t >

TUI for 128*64 px graphical display using U8g2. Holds references to a U8g2lib instance for writing to display, an EEPROMConfig instance to edit the config, and to a Humidistat instance to show/edit its state.

Template Parameters
Humidistat_tEither SingleHumidistat or CascadeHumidistat

Definition at line 24 of file GraphicalDisplayUI.h.

Member Enumeration Documentation

◆ Action

template<class Humidistat_t >
enum class GraphicalDisplayUI::Action
strongprivate

Config tab action definitions.

Enumerator
save 
reset 
_last 

Definition at line 42 of file GraphicalDisplayUI.h.

◆ Selection

template<class Humidistat_t >
enum class GraphicalDisplayUI::Selection
strongprivate

Config tab selection definitions.

Enumerator
par 
number 
actions 

Definition at line 35 of file GraphicalDisplayUI.h.

◆ Tab

template<class Humidistat_t >
enum class GraphicalDisplayUI::Tab
strongprivate

Tab definitions.

Enumerator
main 
info 
config 
_last 

Definition at line 27 of file GraphicalDisplayUI.h.

Constructor & Destructor Documentation

◆ GraphicalDisplayUI() [1/2]

template<class Humidistat_t >
GraphicalDisplayUI< Humidistat_t >::GraphicalDisplayUI ( U8G2 * u8g2,
const ButtonReader * buttonReader,
SingleHumidistat * humidistat,
etl::span< const ThermistorReader, 4 > trs,
EEPROMConfig * eepromConfig,
SetpointProfileRunner * spr )
inlineexplicit

Constructor.

Parameters
u8g2Pointer to a U8G2 instance
buttonReaderPointer to a ButtonReader instance
humidistatPointer to a Humidistat instance
trsSpan over 4 ThermistorReader instances
eepromConfigPointer to a EEPROMConfig instance
sprPointer to a SetpointProfileRunner instance

Definition at line 521 of file GraphicalDisplayUI.h.

◆ GraphicalDisplayUI() [2/2]

template<class Humidistat_t >
GraphicalDisplayUI< Humidistat_t >::GraphicalDisplayUI ( U8G2 * u8g2,
const ButtonReader * buttonReader,
CascadeHumidistat * humidistat,
etl::span< const ThermistorReader, 4 > trs,
EEPROMConfig * eepromConfig,
SetpointProfileRunner * spr )
inlineexplicit

Definition at line 534 of file GraphicalDisplayUI.h.

Member Function Documentation

◆ begin()

template<class Humidistat_t >
void GraphicalDisplayUI< Humidistat_t >::begin ( )
inlineoverridevirtual

Initialize the display.

Implements ControllerUI.

Definition at line 555 of file GraphicalDisplayUI.h.

◆ clear()

template<class Humidistat_t >
void GraphicalDisplayUI< Humidistat_t >::clear ( )
inlineoverrideprivatevirtual

Clear screen.

Implements ControllerUI.

Definition at line 504 of file GraphicalDisplayUI.h.

◆ draw()

template<class Humidistat_t >
void GraphicalDisplayUI< Humidistat_t >::draw ( )
inlineoverrideprivatevirtual

Draw main interface (main loop).

Implements ControllerUI.

Definition at line 462 of file GraphicalDisplayUI.h.

Here is the call graph for this function:

◆ drawConfig()

template<class Humidistat_t >
void GraphicalDisplayUI< Humidistat_t >::drawConfig ( )
inlineprivate

Draw the Config tab.

Definition at line 121 of file GraphicalDisplayUI.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawInfo()

template<class Humidistat_t >
void GraphicalDisplayUI< Humidistat_t >::drawInfo ( )
inlineoverrideprivatevirtual

Draw info screen.

Implements ControllerUI.

Definition at line 502 of file GraphicalDisplayUI.h.

◆ drawMain() [1/3]

template<class Humidistat_t >
void GraphicalDisplayUI< Humidistat_t >::drawMain ( )
private

Draw the Main tab.

Here is the caller graph for this function:

◆ drawMain() [2/3]

void GraphicalDisplayUI< SingleHumidistat >::drawMain ( )
private

Definition at line 562 of file GraphicalDisplayUI.h.

◆ drawMain() [3/3]

void GraphicalDisplayUI< CascadeHumidistat >::drawMain ( )
private

Definition at line 585 of file GraphicalDisplayUI.h.

◆ DrawMainCommon()

template<class Humidistat_t >
void GraphicalDisplayUI< Humidistat_t >::DrawMainCommon ( )
inlineprivate

Draw common elements in Main tab.

Definition at line 231 of file GraphicalDisplayUI.h.

Here is the call graph for this function:

◆ drawSplash()

template<class Humidistat_t >
void GraphicalDisplayUI< Humidistat_t >::drawSplash ( )
inlineoverrideprivatevirtual

Draw splash screen.

Implements ControllerUI.

Definition at line 488 of file GraphicalDisplayUI.h.

◆ drawTabBar()

template<class Humidistat_t >
void GraphicalDisplayUI< Humidistat_t >::drawTabBar ( )
inlineprivate

Draw the tab bar.

Definition at line 308 of file GraphicalDisplayUI.h.

Here is the caller graph for this function:

◆ drawTabInfo()

template<class Humidistat_t >
void GraphicalDisplayUI< Humidistat_t >::drawTabInfo ( )
inlineprivate

Definition at line 74 of file GraphicalDisplayUI.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleInput()

template<class Humidistat_t >
bool GraphicalDisplayUI< Humidistat_t >::handleInput ( Buttons state,
uint16_t pressedFor )
inlineoverrideprivatevirtual

Handle input.

Parameters
stateKeypad state
pressedForDuration the key has been pressed (in millis)
Returns
1 if button was pressed, 0 if not

Implements ControllerUI.

Definition at line 318 of file GraphicalDisplayUI.h.

Here is the call graph for this function:

◆ handleInputConfig()

template<class Humidistat_t >
bool GraphicalDisplayUI< Humidistat_t >::handleInputConfig ( Buttons state,
uint8_t pressedFor )
inlineprivate

Handle input on the Config tab.

Definition at line 384 of file GraphicalDisplayUI.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleInputInfo()

template<class Humidistat_t >
bool GraphicalDisplayUI< Humidistat_t >::handleInputInfo ( Buttons state,
uint16_t pressedFor )
inlineprivate

Handle input on the Info tab.

Definition at line 369 of file GraphicalDisplayUI.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleInputMain()

template<class Humidistat_t >
bool GraphicalDisplayUI< Humidistat_t >::handleInputMain ( Buttons state,
uint16_t pressedFor )
inlineprivate

Handle input on the Main tab.

Definition at line 336 of file GraphicalDisplayUI.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCursor()

template<class Humidistat_t >
void GraphicalDisplayUI< Humidistat_t >::setCursor ( uint8_t col,
uint8_t row )
inlineoverrideprivatevirtual

Set cursor to coordinates.

Parameters
colLCD column
rowLCD row

Implements ControllerUI.

Definition at line 508 of file GraphicalDisplayUI.h.

Member Data Documentation

◆ configPars

template<class Humidistat_t >
const ConfigPar GraphicalDisplayUI< Humidistat_t >::configPars[13]
private

Array of config parameters.

Definition at line 68 of file GraphicalDisplayUI.h.

◆ configSaveCooldown

template<class Humidistat_t >
const uint8_t GraphicalDisplayUI< Humidistat_t >::configSaveCooldown = config::configSaveCooldown
private

Definition at line 65 of file GraphicalDisplayUI.h.

◆ configSaveTimer

template<class Humidistat_t >
uint8_t GraphicalDisplayUI< Humidistat_t >::configSaveTimer = 0
private

Timer containing the current value of the cooldown on saving config to EEPROM.

Definition at line 62 of file GraphicalDisplayUI.h.

◆ currentAction

template<class Humidistat_t >
Action GraphicalDisplayUI< Humidistat_t >::currentAction = Action::save
private

Definition at line 57 of file GraphicalDisplayUI.h.

◆ currentDigit

template<class Humidistat_t >
uint8_t GraphicalDisplayUI< Humidistat_t >::currentDigit = NUM_DIGITS - 1
private

Definition at line 58 of file GraphicalDisplayUI.h.

◆ currentPar

template<class Humidistat_t >
uint8_t GraphicalDisplayUI< Humidistat_t >::currentPar = 0
private

Currently active config parameter.

Definition at line 55 of file GraphicalDisplayUI.h.

◆ currentSelection

template<class Humidistat_t >
Selection GraphicalDisplayUI< Humidistat_t >::currentSelection = Selection::par
private

Definition at line 56 of file GraphicalDisplayUI.h.

◆ currentSPProfile

template<class Humidistat_t >
uint8_t GraphicalDisplayUI< Humidistat_t >::currentSPProfile = 0
private

Definition at line 59 of file GraphicalDisplayUI.h.

◆ currentTab

template<class Humidistat_t >
Tab GraphicalDisplayUI< Humidistat_t >::currentTab = Tab::main
private

Currently active tab.

Definition at line 54 of file GraphicalDisplayUI.h.

◆ eepromConfig

template<class Humidistat_t >
EEPROMConfig& GraphicalDisplayUI< Humidistat_t >::eepromConfig
private

Definition at line 49 of file GraphicalDisplayUI.h.

◆ frame

template<class Humidistat_t >
uint8_t GraphicalDisplayUI< Humidistat_t >::frame = 0
private

Frame counter (overflows, but that's OK)

Definition at line 61 of file GraphicalDisplayUI.h.

◆ humidistat

template<class Humidistat_t >
Humidistat_t& GraphicalDisplayUI< Humidistat_t >::humidistat
private

Definition at line 50 of file GraphicalDisplayUI.h.

◆ longPressDuration

template<class Humidistat_t >
const uint16_t GraphicalDisplayUI< Humidistat_t >::longPressDuration = config::longPressDuration
private

Definition at line 64 of file GraphicalDisplayUI.h.

◆ nConfigPars

template<class Humidistat_t >
const uint8_t GraphicalDisplayUI< Humidistat_t >::nConfigPars
private

Total number of config parameters.

Definition at line 67 of file GraphicalDisplayUI.h.

◆ spr

template<class Humidistat_t >
SetpointProfileRunner& GraphicalDisplayUI< Humidistat_t >::spr
private

Definition at line 51 of file GraphicalDisplayUI.h.

◆ u8g2

template<class Humidistat_t >
U8G2& GraphicalDisplayUI< Humidistat_t >::u8g2
private

Definition at line 48 of file GraphicalDisplayUI.h.


The documentation for this class was generated from the following file: