SpaIot Library
|
Control Panel. More...
#include <controlpanel.h>
Public Member Functions | |
void | begin (unsigned long waitingTimeMs=BeginWaitingTimeMs) |
Configures each of the buttons and initializes and connect with the spa. More... | |
void | begin (const HardwareSettings &hwsettings, unsigned long waitingTimeMs=BeginWaitingTimeMs) |
Configures each of the buttons and initializes and connect with the spa. More... | |
void | begin (const String &hwSettingsName, unsigned long waitingTimeMs=BeginWaitingTimeMs) |
Configures each of the buttons and initializes and connect with the spa. More... | |
bool | isOpened () const |
Indicates whether the connection with the spa is established. More... | |
bool | hasButton (int key) const |
Check if the hardware configuration has the button. More... | |
Button & | button (int key) |
Button. More... | |
bool | pushButton (int key) |
Press and release a button. More... | |
uint8_t | setPower (bool v=true) |
Start or stop the spa. More... | |
uint8_t | setFilter (bool v=true) |
Start or stop the water filtration. More... | |
uint8_t | setHeater (bool v=true) |
Start or stop water heating. More... | |
uint8_t | setBubble (bool v=true) |
Start or stop the the bubble generator. More... | |
uint8_t | setJet (bool v=true) |
Start or stop the water jets. More... | |
bool | setDesiredTemp (uint16_t temp) |
Setting the desired water temperature. More... | |
bool | setSanitizerTime (uint16_t time) |
Set the water sanitation time. More... | |
uint16_t | waitForDesiredTemp (unsigned long MaxWaitingTimeMs=5000) |
Press the TempUp button to read the desired temperature. More... | |
void | end () |
Close the FrameDecoder. | |
~ControlPanel () | |
Destructor. More... | |
const std::map< int, ButtonSettings > | buttonSettings () const |
Button settings provides. More... | |
void | begin (const BusSettings &settings, const std::map< int, LedSettings > &leds, unsigned long waitingTimeMs=BeginWaitingTimeMs) |
bool | hasLed (int key) const |
Check if the hardware configuration has the LED. More... | |
const BusSettings & | busSettings () const |
Bus settings provides at the instantiation. More... | |
const std::map< int, LedSettings > | ledSettings () const |
Leds settings provides at the instantiation. More... | |
uint16_t | rawStatus () const |
Last state of the LEDs received. More... | |
uint8_t | isLedOn (int key) const |
Last state received from an LED. More... | |
uint8_t | isPowerOn () const |
Last state of the Power LED. More... | |
uint8_t | isFilterOn () const |
Last state of the Filter LED. More... | |
uint8_t | isBubbleOn () const |
Last state of the Bubble LED. More... | |
uint8_t | isHeatReached () const |
Last state of the HeatReached LED. More... | |
uint8_t | isJetOn () const |
Last state of the Jet LED. More... | |
uint8_t | isSanitizerOn () const |
Last state of the Sanitizer LED. More... | |
uint8_t | isHeaterOn () const |
State of water heating. More... | |
uint16_t | waterTemp () const |
Water temperature in °C. More... | |
uint16_t | desiredTemp () const |
Water temperature desired in °C. More... | |
uint16_t | sanitizerTime () const |
Remaining sanitation time. More... | |
uint32_t | frameCounter () const |
Number of frames received from startup. More... | |
uint32_t | frameDropped () const |
Number of dropped frames. More... | |
uint16_t | error () |
Error code displayed by the control panel. More... | |
bool | isSetupModeTriggered () const |
Reset request triggered. More... | |
uint8_t | isDisplayBlink () const |
Check if the display blink. More... | |
uint8_t | waitUntilDisplayBlink (unsigned long MaxWaitingTimeMs=5000) const |
Wait until the display blink. More... | |
uint16_t | waitForWaterTemp (unsigned long MaxWaitingTimeMs=25000) const |
Wait until the water temperature could be read. More... | |
Static Public Member Functions | |
static ControlPanel & | singleton (const HardwareSettings &hwsettings) |
Create the control panel singleton with the provided settings. More... | |
static ControlPanel & | singleton (const String &hwSettingsName) |
static ControlPanel & | singleton () |
static ControlPanel * | getInstance (const HardwareSettings &hwsettings) |
Create the control panel instance with the provided settings. More... | |
static ControlPanel * | getInstance (const String &hwSettingsName) |
static ControlPanel * | getInstance () |
Control Panel.
This class is the programming interface of the application (API). It allows to monitor and control the spa.
It is a singleton class that can only be instantiated through getInstance()
SpaIot::ControlPanel::~ControlPanel | ( | ) |
Destructor.
Call end() and delete m_instance
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
settings | describes the bus pins settings |
leds | describes the leds settings |
void SpaIot::ControlPanel::begin | ( | const HardwareSettings & | hwsettings, |
unsigned long | waitingTimeMs = BeginWaitingTimeMs |
||
) |
Configures each of the buttons and initializes and connect with the spa.
isOpened()
lets you know if the connection has been successfully completed
hwsettings | Description of hardware settings |
void SpaIot::ControlPanel::begin | ( | const String & | hwSettingsName, |
unsigned long | waitingTimeMs = BeginWaitingTimeMs |
||
) |
Configures each of the buttons and initializes and connect with the spa.
isOpened()
lets you know if the connection has been successfully completed
hwSettingsName | configuration name in the register of hardware settings |
void SpaIot::ControlPanel::begin | ( | unsigned long | waitingTimeMs = BeginWaitingTimeMs | ) |
Configures each of the buttons and initializes and connect with the spa.
isOpened()
lets you know if the connection has been successfully completed
|
inherited |
Bus settings provides at the instantiation.
Button & SpaIot::ControlPanel::button | ( | int | key | ) |
Button.
key | button identification key in the possible values of SpaIot::Key |
const std::map< int, ButtonSettings > SpaIot::ControlPanel::buttonSettings | ( | ) | const |
Button settings provides.
|
inherited |
Water temperature desired in °C.
The desired temperature can only be known if the user has made a setting. Indeed, this temperature is only displayed when the user presses the SpaIot::TempUp or SpaIot::TempDown buttons (blinking the display).
We can use ControlPanel::waitForDesiredTemp() to perform this operation and can read a correct value.
|
inherited |
Error code displayed by the control panel.
For example, the E90 value can be displayed to indicate a water circulation problem. The user manual must be consulted for the meaning of this code.
This value is reset when calling this function if no error code has been displayed for more than 4 seconds (SpaIot::ResetErrorTimeMs).
|
inherited |
Number of frames received from startup.
|
inherited |
Number of dropped frames.
If a new frame is received before decoding the previous frame is complete, this frame is lost. If the value of this counter increases rapidly is that the number of operations running under interruption by the CPU is important (the real time constraint is too high).
It is important to adjust the frequency of the CPU to its maximum value (160MHz for ESP8266).
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
static |
Create the control panel instance with the provided settings.
hwsettings | Description of hardware settings |
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
hwSettingsName | configuration name in the register of hardware settings |
bool SpaIot::ControlPanel::hasButton | ( | int | key | ) | const |
Check if the hardware configuration has the button.
key | button identification key in the possible values of SpaIot::Key |
|
inherited |
Check if the hardware configuration has the LED.
key | LED identification key in the possible values of SpaIot::Key |
|
inlineinherited |
Last state of the Bubble LED.
Lets you know if the bubble generator is started.
References SpaIot::Bubble, and SpaIot::FrameDecoder::isLedOn().
|
inherited |
Check if the display blink.
|
inlineinherited |
Last state of the Filter LED.
Lets you know if the water filtration pump is started.
References SpaIot::Filter, and SpaIot::FrameDecoder::isLedOn().
|
inherited |
State of water heating.
Indicates that the heating is started, that the temperature of the water is reached or not
|
inlineinherited |
Last state of the HeatReached LED.
Lets you know if the water temperature is greater than or equal to the desired temperature.
References SpaIot::HeatReached, and SpaIot::FrameDecoder::isLedOn().
|
inlineinherited |
Last state of the Jet LED.
Lets you know if the water jets are activated.
References SpaIot::FrameDecoder::isLedOn(), and SpaIot::Jet.
|
inherited |
Last state received from an LED.
key | LED identification key in the possible values of SpaIot::Key |
Referenced by SpaIot::FrameDecoder::isBubbleOn(), SpaIot::FrameDecoder::isFilterOn(), SpaIot::FrameDecoder::isHeatReached(), SpaIot::FrameDecoder::isJetOn(), SpaIot::FrameDecoder::isPowerOn(), and SpaIot::FrameDecoder::isSanitizerOn().
bool SpaIot::ControlPanel::isOpened | ( | ) | const |
Indicates whether the connection with the spa is established.
begin()
succeeded and everything works returns true. Returns false if the connection to the spa is not established and no frame is received.
|
inlineinherited |
Last state of the Power LED.
References SpaIot::FrameDecoder::isLedOn(), and SpaIot::Power.
|
inlineinherited |
Last state of the Sanitizer LED.
Lets you know if the sanitation of the water is in progress.
References SpaIot::FrameDecoder::isLedOn(), and SpaIot::Sanitizer.
|
inherited |
Reset request triggered.
The user can trigger a reset of settings by quickly changing SpaIot::SetupTrigUnitChangeMin times the temperature unit.
|
inherited |
Leds settings provides at the instantiation.
bool SpaIot::ControlPanel::pushButton | ( | int | key | ) |
Press and release a button.
key | button identification key in the possible values of SpaIot::Key |
|
inherited |
Last state of the LEDs received.
Pour la mise au point uniquement.
|
inherited |
Remaining sanitation time.
uint8_t SpaIot::ControlPanel::setBubble | ( | bool | v = true | ) |
Start or stop the the bubble generator.
v | true for ON, false for OFF |
bool SpaIot::ControlPanel::setDesiredTemp | ( | uint16_t | temp | ) |
Setting the desired water temperature.
temp | temperature in °C |
uint8_t SpaIot::ControlPanel::setFilter | ( | bool | v = true | ) |
Start or stop the water filtration.
v | true for ON, false for OFF |
uint8_t SpaIot::ControlPanel::setHeater | ( | bool | v = true | ) |
Start or stop water heating.
v | true for ON, false for OFF |
uint8_t SpaIot::ControlPanel::setJet | ( | bool | v = true | ) |
Start or stop the water jets.
v | true for ON, false for OFF |
uint8_t SpaIot::ControlPanel::setPower | ( | bool | v = true | ) |
Start or stop the spa.
v | true for ON, false for OFF |
bool SpaIot::ControlPanel::setSanitizerTime | ( | uint16_t | time | ) |
Set the water sanitation time.
time | Sanitation time in hours, the possible values are {0, 3, 5, 8}. 0 Disables sanitation. |
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
static |
Create the control panel singleton with the provided settings.
hwsettings | Description of hardware settings |
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
hwSettingsName | configuration name in the register of hardware settings |
uint16_t SpaIot::ControlPanel::waitForDesiredTemp | ( | unsigned long | MaxWaitingTimeMs = 5000 | ) |
Press the TempUp button to read the desired temperature.
MaxWaitingTimeMs | Maximum waiting time in milliseconds |
|
inherited |
Wait until the water temperature could be read.
Framedecoder must wait to be sure that the display does not blink and the value is stable before determining the temperature of the water.
It can take 20 seconds. waitForWaterTemp() can be used to wait for FrameDecoder to determine the temperature.
MaxWaitingTimeMs | Maximum waiting time in milliseconds |
|
inherited |
Wait until the display blink.
MaxWaitingTimeMs | Maximum waiting time in milliseconds |
|
inherited |
Water temperature in °C.
Framedecoder must wait to be sure that the display does not blink and the value is stable before determining the temperature of the water.
It can take 20 seconds. waitForWaterTemp() can be used to wait for FrameDecoder to determine the temperature.