diff --git a/Arduino/BTCDieselHeater/src/OLED/ExperimentalSettingsScreen.cpp b/Arduino/BTCDieselHeater/src/OLED/ExperimentalSettingsScreen.cpp index ad377b1..500de3e 100644 --- a/Arduino/BTCDieselHeater/src/OLED/ExperimentalSettingsScreen.cpp +++ b/Arduino/BTCDieselHeater/src/OLED/ExperimentalSettingsScreen.cpp @@ -37,7 +37,7 @@ static const int Line3 = 14; static const int Line2 = 27; static const int Line1 = 40; -static const int Column = 75; +static const int Column = 70; static const int plugPowers[] = { 35, 40, 45, 80, 85, 90}; @@ -79,8 +79,8 @@ CExperimentalSettingsScreen::show() } else { _printInverted(_display.xCentre(), 0, " Experimental ", true, eCentreJustify); - _printMenuText(67, Line2, "Thermostat:", false, eRightJustify); - _printMenuText(67, Line1, "Window:", false, eRightJustify); + _printMenuText(65, Line2, "Thermostat:", false, eRightJustify); + _printMenuText(65, Line1, "Window:", false, eRightJustify); sprintf(msg, "%.1f", _window); _printMenuText(Column, Line1, msg, _rowSel == 1); switch(_thermoMode) { diff --git a/Arduino/BTCDieselHeater/src/Utility/BTC_JSON.cpp b/Arduino/BTCDieselHeater/src/Utility/BTC_JSON.cpp index 23ecd91..0ecaff5 100644 --- a/Arduino/BTCDieselHeater/src/Utility/BTC_JSON.cpp +++ b/Arduino/BTCDieselHeater/src/Utility/BTC_JSON.cpp @@ -86,6 +86,12 @@ void interpretJsonCommand(char* pLine) else if(strcmp("FanMax", it->key) == 0) { setFanMax(it->value.as()); } + else if(strcmp("ThermostatMethod", it->key) == 0) { + NVstore.setThermostatMethodMode(it->value.as()); + } + else if(strcmp("ThermostatWindow", it->key) == 0) { + NVstore.setThermostatMethodWindow(it->value.as()); + } else if(strcmp("Thermostat", it->key) == 0) { if(!setThermostatMode(it->value.as())) { // this request is blocked if OEM controller active JSONmoderator.reset("ThermoStat"); @@ -199,6 +205,23 @@ bool makeJSONString(CModerator& moderator, char* opStr, int len) return bSend; } +bool makeJSONStringEx(CModerator& moderator, char* opStr, int len) +{ + StaticJsonBuffer<800> jsonBuffer; // create a JSON buffer on the stack + JsonObject& root = jsonBuffer.createObject(); // create object to add JSON commands to + + bool bSend = false; // reset should send flag + + bSend |= moderator.addJson("ThermostatMethod", NVstore.getThermostatMethodMode(), root); + bSend |= moderator.addJson("ThermostatWindow", NVstore.getThermostatMethodWindow(), root); + + if(bSend) { + root.printTo(opStr, len); + } + + return bSend; +} + // the way the JSON timer strings are crafted, we have to iterate over each timer's parameters // individually, the JSON name is always the same for each timer, the payload IDs the specific // timer @@ -237,6 +260,16 @@ void updateJSONclients(bool report) sendWebServerString( jsonStr ); } } + // update extended params + { + if(makeJSONStringEx(JSONmoderator, jsonStr, sizeof(jsonStr))) { + if (report) { + DebugPort.print("JSON send: "); DebugPort.println(jsonStr); + } + getBluetoothClient().send( jsonStr ); + sendWebServerString( jsonStr ); + } + } // update timer parameters bool bNewTimerInfo = false; for(int tmr=0; tmr<14; tmr++) diff --git a/Arduino/BTCDieselHeater/src/Utility/BTC_JSON.h b/Arduino/BTCDieselHeater/src/Utility/BTC_JSON.h index c76a0a4..da65ecc 100644 --- a/Arduino/BTCDieselHeater/src/Utility/BTC_JSON.h +++ b/Arduino/BTCDieselHeater/src/Utility/BTC_JSON.h @@ -28,6 +28,7 @@ extern char defaultJSONstr[64]; bool makeJSONString(CModerator& moderator, char* opStr, int len); +bool makeJSONStringEx(CModerator& moderator, char* opStr, int len); bool makeJSONTimerString(int channel, char* opStr, int len); void updateJSONclients(bool report);