Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/SpaInterface/SpaInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ bool SpaInterface::setVARIValue(int mode){

bool SpaInterface::setMode(int mode){
debugD("setMode - %i", mode);
if (mode == getMode().toInt()) { //TODO - change getMode to return int??? why is it string???
debugD("No Mode change detected - current %i, new %i", getMode(), mode);
if (mode == getModeIndex(getMode())) {
debugD("No Mode change detected - current %i, new %i", getModeIndex(getMode()), mode);
return true;
}

Expand Down Expand Up @@ -712,7 +712,7 @@ void SpaInterface::loop(){
}

if (_resultRegistersDirty) {
_nextUpdateDue = millis() + 200; // if we need to read the registers, pause a bit to see if there are more commands coming.
_nextUpdateDue = millis() + 500; // if we need to read the registers, pause a bit to see if there are more commands coming.
_resultRegistersDirty = false;
}

Expand Down
8 changes: 8 additions & 0 deletions lib/SpaInterface/SpaProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,14 @@ Property<bool> HV_2;
void setHCONCallback(void (*callback)(int)) { HCON.setCallback(callback); }

String getMode() { return Mode.getValue(); }
int getModeIndex(String mode) {
for (size_t i = 0; i < spaModeStrings.size(); i++)
{
if (spaModeStrings[i] == mode)
return i;
}
return -1;
}
void setModeCallback(void (*callback)(String)) { Mode.setCallback(callback); }
const std::array <String, 4> spaModeStrings = {"NORM","ECON", "AWAY","WEEK"};

Expand Down