SpaIot Library
|
This class decodes information from the technical block of the spa. More...
#include <framedecoder.h>
Public Member Functions | |
void | begin () |
Initializes and connect with the spa. More... | |
bool | isOpened () const |
Indicates whether the connection with the spa is established. More... | |
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... | |
This class decodes information from the technical block of the spa.
This class decodes the frames so as to retrieve the condition of the LEDs and the value present on the 7-segment display.It can not detect if the user presses a button.
FrameDecoder stores the bits of the frame on each interrupt triggered by the clock rising edges, once the 16 bits of the raw status received, it decodes this status on the rising edge of the nWR (HOLD) signal.
Base class that can not be instantiated !
void begin | ( | ) |
Initializes and connect with the spa.
This function must be called before you can use the instance. This function configures the different hardware features, then loop waiting for a frame for a time of BeginWaitingTimeMs
milliseconds. isOpened()
lets you know if the connection has been successfully completed
const BusSettings & busSettings | ( | ) | const |
Bus settings provides at the instantiation.
uint16_t desiredTemp | ( | ) | const |
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.
uint16_t error | ( | ) |
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).
uint32_t frameCounter | ( | ) | const |
Number of frames received from startup.
uint32_t frameDropped | ( | ) | const |
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).
bool hasLed | ( | int | key | ) | const |
Check if the hardware configuration has the LED.
key | LED identification key in the possible values of SpaIot::Key |
|
inline |
Last state of the Bubble LED.
Lets you know if the bubble generator is started.
References SpaIot::Bubble, and FrameDecoder::isLedOn().
uint8_t isDisplayBlink | ( | ) | const |
Check if the display blink.
|
inline |
Last state of the Filter LED.
Lets you know if the water filtration pump is started.
References SpaIot::Filter, and FrameDecoder::isLedOn().
uint8_t isHeaterOn | ( | ) | const |
State of water heating.
Indicates that the heating is started, that the temperature of the water is reached or not
|
inline |
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 FrameDecoder::isLedOn().
|
inline |
Last state of the Jet LED.
Lets you know if the water jets are activated.
References FrameDecoder::isLedOn(), and SpaIot::Jet.
uint8_t isLedOn | ( | int | key | ) | const |
Last state received from an LED.
key | LED identification key in the possible values of SpaIot::Key |
Referenced by FrameDecoder::isBubbleOn(), FrameDecoder::isFilterOn(), FrameDecoder::isHeatReached(), FrameDecoder::isJetOn(), FrameDecoder::isPowerOn(), and FrameDecoder::isSanitizerOn().
bool 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.
|
inline |
Last state of the Power LED.
References FrameDecoder::isLedOn(), and SpaIot::Power.
|
inline |
Last state of the Sanitizer LED.
Lets you know if the sanitation of the water is in progress.
References FrameDecoder::isLedOn(), and SpaIot::Sanitizer.
bool isSetupModeTriggered | ( | ) | const |
Reset request triggered.
The user can trigger a reset of settings by quickly changing SpaIot::SetupTrigUnitChangeMin times the temperature unit.
const std::map< int, LedSettings > ledSettings | ( | ) | const |
Leds settings provides at the instantiation.
uint16_t rawStatus | ( | ) | const |
Last state of the LEDs received.
Pour la mise au point uniquement.
uint16_t sanitizerTime | ( | ) | const |
Remaining sanitation time.
uint16_t waitForWaterTemp | ( | unsigned long | MaxWaitingTimeMs = 25000 | ) | const |
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 |
uint8_t waitUntilDisplayBlink | ( | unsigned long | MaxWaitingTimeMs = 5000 | ) | const |
Wait until the display blink.
MaxWaitingTimeMs | Maximum waiting time in milliseconds |
uint16_t waterTemp | ( | ) | const |
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.