From 93ea803a5bd7ccfa074e06e51f2c3dc20d2f97a0 Mon Sep 17 00:00:00 2001 From: Silver Kuusik Date: Tue, 14 Nov 2017 14:55:15 +0100 Subject: [PATCH 1/5] Update sumorobot.js --- sumorobot.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sumorobot.js b/sumorobot.js index 303c3df..152e17d 100755 --- a/sumorobot.js +++ b/sumorobot.js @@ -55,9 +55,9 @@ Sumorobot.prototype.connect = function() { var data = evt.data.replace(/'/g, '"').toLowerCase(); console.log(data); var battery = JSON.parse(data)["battery_voltage"]; - battery = Math.round((((battery - 3.6) * 100) / (4.2 - 3.6))); - //$("#battery").html(battery + ""); - $("#bar").html("Connected"); + battery = Math.round((((battery - 3.0) * 100) / (4.2 - 3.6))); + $("#battery").html(battery + ""); + //$("#bar").html("Connected"); $("#bar").addClass("connected"); }; /* when there is an WebSocket error */ From e34572a8f2ab3b13a6f282d89d466d07debd02ff Mon Sep 17 00:00:00 2001 From: Silver Kuusik Date: Tue, 14 Nov 2017 14:57:47 +0100 Subject: [PATCH 2/5] Update sumorobot.js --- sumorobot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sumorobot.js b/sumorobot.js index 152e17d..bc4642a 100755 --- a/sumorobot.js +++ b/sumorobot.js @@ -56,8 +56,8 @@ Sumorobot.prototype.connect = function() { console.log(data); var battery = JSON.parse(data)["battery_voltage"]; battery = Math.round((((battery - 3.0) * 100) / (4.2 - 3.6))); - $("#battery").html(battery + ""); - //$("#bar").html("Connected"); + $("#battery").html(battery + "%"); + $("#bar").html("Battery"); $("#bar").addClass("connected"); }; /* when there is an WebSocket error */ From bef66dfbdab9077ebd78302458180eb0dbec5b4d Mon Sep 17 00:00:00 2001 From: Silver Kuusik Date: Tue, 14 Nov 2017 14:59:19 +0100 Subject: [PATCH 3/5] Update sumorobot.js --- sumorobot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sumorobot.js b/sumorobot.js index bc4642a..15932b5 100755 --- a/sumorobot.js +++ b/sumorobot.js @@ -55,7 +55,7 @@ Sumorobot.prototype.connect = function() { var data = evt.data.replace(/'/g, '"').toLowerCase(); console.log(data); var battery = JSON.parse(data)["battery_voltage"]; - battery = Math.round((((battery - 3.0) * 100) / (4.2 - 3.6))); + battery = Math.round((((battery - 3.0) * 100) / (4.2 - 3.0))); $("#battery").html(battery + "%"); $("#bar").html("Battery"); $("#bar").addClass("connected"); From 30b382b3387a8f2ebb6723ffd7840b8de8f2815d Mon Sep 17 00:00:00 2001 From: Silver Kuusik Date: Tue, 14 Nov 2017 15:00:57 +0100 Subject: [PATCH 4/5] Update sumorobot.js --- sumorobot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sumorobot.js b/sumorobot.js index 15932b5..1aded82 100755 --- a/sumorobot.js +++ b/sumorobot.js @@ -57,7 +57,7 @@ Sumorobot.prototype.connect = function() { var battery = JSON.parse(data)["battery_voltage"]; battery = Math.round((((battery - 3.0) * 100) / (4.2 - 3.0))); $("#battery").html(battery + "%"); - $("#bar").html("Battery"); + //$("#bar").html("Battery"); $("#bar").addClass("connected"); }; /* when there is an WebSocket error */ From ab469d10e02f9e63d6718cdd675c05b13fd213c9 Mon Sep 17 00:00:00 2001 From: Silver Kuusik Date: Tue, 14 Nov 2017 15:02:04 +0100 Subject: [PATCH 5/5] Update index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 4f1c066..c04436e 100755 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@ -
Disconnected
+
Battery: