From ba5bd51b146bdab73b26f33172b70c1ffa779412 Mon Sep 17 00:00:00 2001 From: James Date: Sun, 9 Dec 2018 17:15:27 +1100 Subject: [PATCH] Fixed small issue of not terminating init() function correctly --- Arduino/BTCDieselHeater/mainpage.cpp | 31 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Arduino/BTCDieselHeater/mainpage.cpp b/Arduino/BTCDieselHeater/mainpage.cpp index 151f1f4..bd5559e 100644 --- a/Arduino/BTCDieselHeater/mainpage.cpp +++ b/Arduino/BTCDieselHeater/mainpage.cpp @@ -9,22 +9,23 @@ const char* MAIN_PAGE PROGMEM = R"=====( function init() { Socket = new WebSocket('ws://' + window.location.hostname + ':81/'); Socket.onmessage = function(event){ - console.log("msg rec", evt.data); - var msgArray = evt.data.split(","); // split message by delimiter into a string array - console.log("msgArray", msgArray[0]); - console.log("msgArray", msgArray[1]); - console.log("msgArray", msgArray[2]); - console.log("msgArray", msgArray[3]); - var indicator = msgArray[1]; // the first element in the message array is the ID of the object to update - console.log("indiactor", indicator); - if (SensorRead) // if an object by the name of the message exists, update its value or its attributes - { - switch (msgArray[1]) - { - case "CurrentTemp": - document.getElementById("TempCurrent").innerHTML = event.data; + console.log("msg rec", evt.data); + var msgArray = evt.data.split(","); // split message by delimiter into a string array + console.log("msgArray", msgArray[0]); + console.log("msgArray", msgArray[1]); + console.log("msgArray", msgArray[2]); + console.log("msgArray", msgArray[3]); + var indicator = msgArray[1]; // the first element in the message array is the ID of the object to update + console.log("indiactor", indicator); + if (SensorRead) // if an object by the name of the message exists, update its value or its attributes + { + switch (msgArray[1]) + { + case "CurrentTemp": + document.getElementById("TempCurrent").innerHTML = event.data; + } + } } - }