Humidistat
Arduino firmware for a humidistat (humidity controller)
Loading...
Searching...
No Matches
CharDisplayUI Class Reference

TUI for 16x2 character LCD. Holds a reference to a LiquidCrystal instance for writing to display. Displays current mode, PV, SP, and CV the first line of the display, and temperatures on the second line. Use keypad to adjust setpoint (UP/DOWN for fine, LEFT/RIGHT for coarse). More...

#include <CharDisplayUI.h>

Inheritance diagram for CharDisplayUI:
[legend]
Collaboration diagram for CharDisplayUI:
[legend]

Public Member Functions

 CharDisplayUI (LiquidCrystal *liquidCrystal, const ButtonReader *buttonReader, SingleHumidistat *humidistat, etl::span< const ThermistorReader, 4 > trs)
 Constructor.
 
void begin () override
 Initialize the display.
 
- Public Member Functions inherited from ControllerUI
void update ()
 Update the display and handle input: set Humidistat's setpoint.
 

Private Member Functions

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.
 
bool handleInput (Buttons state, uint16_t pressedFor) override
 Handle input.
 

Private Attributes

LiquidCrystal & liquidCrystal
 
SingleHumidistathumidistat
 

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

TUI for 16x2 character LCD. Holds a reference to a LiquidCrystal instance for writing to display. Displays current mode, PV, SP, and CV the first line of the display, and temperatures on the second line. Use keypad to adjust setpoint (UP/DOWN for fine, LEFT/RIGHT for coarse).

Definition at line 14 of file CharDisplayUI.h.

Constructor & Destructor Documentation

◆ CharDisplayUI()

CharDisplayUI::CharDisplayUI ( LiquidCrystal * liquidCrystal,
const ButtonReader * buttonReader,
SingleHumidistat * humidistat,
etl::span< const ThermistorReader, 4 > trs )
explicit

Constructor.

Parameters
liquidCrystalPointer to a LiquidCrystal instance
buttonReaderPointer to a ButtonReader instance
humidistatPointer to a SingleHumidistat instance
trsSpan over 4 ThermistorReader instances

Definition at line 3 of file CharDisplayUI.cpp.

Member Function Documentation

◆ begin()

void CharDisplayUI::begin ( )
overridevirtual

Initialize the display.

Implements ControllerUI.

Definition at line 67 of file CharDisplayUI.cpp.

◆ clear()

void CharDisplayUI::clear ( )
overrideprivatevirtual

Clear screen.

Implements ControllerUI.

Definition at line 38 of file CharDisplayUI.cpp.

◆ draw()

void CharDisplayUI::draw ( )
overrideprivatevirtual

Draw main interface (main loop).

Implements ControllerUI.

Definition at line 7 of file CharDisplayUI.cpp.

Here is the call graph for this function:

◆ drawInfo()

void CharDisplayUI::drawInfo ( )
overrideprivatevirtual

Draw info screen.

Implements ControllerUI.

Definition at line 54 of file CharDisplayUI.cpp.

Here is the call graph for this function:

◆ drawSplash()

void CharDisplayUI::drawSplash ( )
overrideprivatevirtual

Draw splash screen.

Implements ControllerUI.

Definition at line 46 of file CharDisplayUI.cpp.

◆ handleInput()

bool CharDisplayUI::handleInput ( Buttons state,
uint16_t pressedFor )
overrideprivatevirtual

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 71 of file CharDisplayUI.cpp.

Here is the call graph for this function:

◆ setCursor()

void CharDisplayUI::setCursor ( uint8_t col,
uint8_t row )
overrideprivatevirtual

Set cursor to coordinates.

Parameters
colLCD column
rowLCD row

Implements ControllerUI.

Definition at line 42 of file CharDisplayUI.cpp.

Member Data Documentation

◆ humidistat

SingleHumidistat& CharDisplayUI::humidistat
private

Definition at line 17 of file CharDisplayUI.h.

◆ liquidCrystal

LiquidCrystal& CharDisplayUI::liquidCrystal
private

Definition at line 16 of file CharDisplayUI.h.


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