diff --git a/Code/6-wire-version/data/WebSocket.js b/Code/6-wire-version/data/WebSocket.js index bde59fc6..79efbe91 100644 --- a/Code/6-wire-version/data/WebSocket.js +++ b/Code/6-wire-version/data/WebSocket.js @@ -82,8 +82,16 @@ function handlemsg(e) { ] document.getElementById('mqtt').innerHTML = "MQTT:" + mqtt_states[msgobj.MQTT + 4]; //console.log(msgobj.PressedButton); - if(msgobj.HASJETS) document.getElementById('jets').style.visibility = 'visible' - else document.getElementById('jets').style.visibility = 'hidden'; + if(msgobj.HASJETS) { + document.getElementById('jets').style.visibility = 'visible'; + document.getElementById('jettime').style.visibility = 'visible'; + document.getElementById('jettitle').style.visibility = 'visible'; + } + else { + document.getElementById('jets').style.visibility = 'hidden'; + document.getElementById('jettime').style.visibility = 'hidden'; + document.getElementById('jettitle').style.visibility = 'hidden'; + } //} } @@ -155,6 +163,7 @@ function handlemsg(e) { document.getElementById('uptime').innerHTML = s2dhms(msgobj.UPTIME); document.getElementById('airtime').innerHTML = s2dhms(msgobj.AIRTIME); document.getElementById('filtertime').innerHTML = s2dhms(msgobj.PUMPTIME); + document.getElementById('jettime').innerHTML = s2dhms(msgobj.JETTIME); document.getElementById('cost').innerHTML = (msgobj.COST).toFixed(2); } diff --git a/Code/6-wire-version/data/index.html b/Code/6-wire-version/data/index.html index d929bb2b..f0a560c9 100644 --- a/Code/6-wire-version/data/index.html +++ b/Code/6-wire-version/data/index.html @@ -134,6 +134,10 @@

Target temp:

Air: 2456:- + + Hydrojets: + 2456:- + Estimated cost: 00:00:00 diff --git a/Code/6-wire-version/lib/BWC/BWC_8266.cpp b/Code/6-wire-version/lib/BWC/BWC_8266.cpp index 69148e6d..a38bb929 100644 --- a/Code/6-wire-version/lib/BWC/BWC_8266.cpp +++ b/Code/6-wire-version/lib/BWC/BWC_8266.cpp @@ -67,7 +67,8 @@ void CIO::loop(void) { states[CHAR1] = (uint8_t)_getChar(payload[DGT1_IDX]); states[CHAR2] = (uint8_t)_getChar(payload[DGT2_IDX]); states[CHAR3] = (uint8_t)_getChar(payload[DGT3_IDX]); - states[JETSSTATE] = (payload[HJT_IDX] & (1 << HJT_BIT)) > 0; + if(HASJETS) states[JETSSTATE] = (payload[HJT_IDX] & (1 << HJT_BIT)) > 0; + else states[JETSSTATE] = 0; //Determine if display is showing target temp or actual temp or anything else. //capture TARGET after UP/DOWN has been pressed... if( ((button == ButtonCodes[UP]) || (button == ButtonCodes[DOWN])) && (prevButton != ButtonCodes[UP]) && (prevButton != ButtonCodes[DOWN]) ) capturePhase = 1; @@ -400,6 +401,20 @@ void BWC::begin( } void BWC::begin2(){ + //Initialize variables + _cltime = 0; + _ftime = 0; + _uptime = 0; + _pumptime = 0; + _heatingtime = 0; + _airtime = 0; + _jettime = 0; + _timezone = 0; + _price = 1; + _finterval = 30; + _clinterval = 14; + _audio = true; + _restoreStatesOnStart = false; _dsp.textOut(F(" hello ")); _startNTP(); LittleFS.begin(); @@ -412,8 +427,6 @@ void BWC::begin2(){ saveSettingsTimer.attach(3600.0, std::bind(&BWC::saveSettingsFlag, this)); } - - void BWC::loop(){ //feed the dog ESP.wdtFeed(); @@ -970,6 +983,11 @@ void BWC::reloadCommandQueue(){ return; } +void BWC::reloadSettings(){ + _loadSettings(); + return; +} + void BWC::_saveStates() { if(maxeffort) { _saveStatesNeeded = true; @@ -1094,7 +1112,7 @@ void BWC::_saveRebootInfo(){ void BWC::_updateTimes(){ uint32_t now = millis(); - static uint32_t prevtime; + static uint32_t prevtime = now; int elapsedtime = now-prevtime; prevtime = now; if (elapsedtime < 0) return; //millis() rollover every 49 days diff --git a/Code/6-wire-version/lib/BWC/BWC_8266.h b/Code/6-wire-version/lib/BWC/BWC_8266.h index 891bf430..7d209f19 100644 --- a/Code/6-wire-version/lib/BWC/BWC_8266.h +++ b/Code/6-wire-version/lib/BWC/BWC_8266.h @@ -115,6 +115,7 @@ class BWC { bool maxeffort = false; String getPressedButton(); void reloadCommandQueue(); + void reloadSettings(); String getButtonName(); private: diff --git a/Code/6-wire-version/lib/BWC/BWC_8266_globals.h b/Code/6-wire-version/lib/BWC/BWC_8266_globals.h index 64c88ae5..5618aca1 100644 --- a/Code/6-wire-version/lib/BWC/BWC_8266_globals.h +++ b/Code/6-wire-version/lib/BWC/BWC_8266_globals.h @@ -44,8 +44,8 @@ const byte F_IDX = 9; const byte F_BIT = 3; const byte PWR_IDX = 9; const byte PWR_BIT = 4; -const byte HJT_IDX = 9; //still to be verified. This is an educated guess -const byte HJT_BIT = 5; //if correct the web page should show correct states on everything +const byte HJT_IDX = 9; +const byte HJT_BIT = 5; //7-segment codes. MSB always 1 const uint8_t CHARCODES[] = { diff --git a/Code/6-wire-version/src/main.cpp b/Code/6-wire-version/src/main.cpp index e3d20027..12b38d6f 100644 --- a/Code/6-wire-version/src/main.cpp +++ b/Code/6-wire-version/src/main.cpp @@ -221,6 +221,9 @@ void handleFileUpload() { // upload a new file to the LittleFS server.send(303); if(upload.filename == "cmdq.txt"){ bwc.reloadCommandQueue(); + } + if(upload.filename == "settings.txt"){ + bwc.reloadSettings(); } } else { server.send(500, "text/plain", "500: couldn't create file");