diff --git a/Arduino/BTCDieselHeater/BTC_JSON.cpp b/Arduino/BTCDieselHeater/BTC_JSON.cpp index 61cf372..09f3fd5 100644 --- a/Arduino/BTCDieselHeater/BTC_JSON.cpp +++ b/Arduino/BTCDieselHeater/BTC_JSON.cpp @@ -51,7 +51,7 @@ void interpretJsonCommand(char* pLine) JsonObject::iterator it; for(it = obj.begin(); it != obj.end(); ++it) { - if(strcmp("DesiredTemp", it->key) == 0) { + if(strcmp("TempDesired", it->key) == 0) { reqTemp(it->value.as()); } else if(strcmp("RunState", it->key) == 0) { diff --git a/Arduino/BTCDieselHeater/mainpage.cpp b/Arduino/BTCDieselHeater/mainpage.cpp index 4bbe259..7c6d0fd 100644 --- a/Arduino/BTCDieselHeater/mainpage.cpp +++ b/Arduino/BTCDieselHeater/mainpage.cpp @@ -169,6 +169,21 @@ window.onload = function() { case "ErrorState": console.log("JSON Rx: ErrorState:", heater.ErrorState); break; + case "Thermostat": + console.log("JSON Rx: Thermostat:", heater.Thermostat); + if(heater.Thermostat) { + document.getElementById("FixedDiv").hidden = true; + document.getElementById("ThermoDiv").hidden = false; + } + else { + document.getElementById("FixedDiv").hidden = false; + document.getElementById("ThermoDiv").hidden = true; + } + break; + case "PumpFixed": + console.log("JSON Rx: Thermostat:", heater.PumpFixed); + document.getElementById("PumpFixed").innerHTML = heater.PumpFixed; + break; } } } @@ -268,10 +283,8 @@ function onSlide(newVal, JSONKey) { document.getElementById(JSONKey).innerHTML = newVal; - const cmd = { JSONKey: 0 }; - cmd.JSONKey = newVal; - var str = JSON.stringify(cmd); - + // hand carve JSON string - cannot get JSON.stringify to co-operate with a variable as the key + var str = '{\"' + JSONKey + '\":' + newVal + '}'; console.log("JSON Tx:", str); Socket.send(str); } @@ -469,11 +482,15 @@ MainPage {

Temperature Control

-
+
Desired Temp: -
+
+Fixed Hz: + +
+
Current Temp: