diff --git a/index.html b/index.html
index 2a66301..8890465 100755
--- a/index.html
+++ b/index.html
@@ -14,8 +14,8 @@
+
-
diff --git a/styles.css b/styles.css
index bbd1e7c..1a0a90b 100755
--- a/styles.css
+++ b/styles.css
@@ -71,6 +71,16 @@ input.has-error {
.goog-menuitem-content {
font-size: 2em !important;
}
+#bar {
+ right: 0px;
+ z-index: 35;
+ font-size: 2vw;
+ color: #ee4d4d;
+ position: absolute;
+}
+#bar.connected {
+ color: #44CC00;
+}
#panel {
z-index: 35;
width: 100%;
diff --git a/sumorobot.js b/sumorobot.js
index 7b87e5e..36d7933 100755
--- a/sumorobot.js
+++ b/sumorobot.js
@@ -56,7 +56,12 @@ Sumorobot.prototype.connect = function() {
workspace.highlightBlock(evt.data);
highlighted = evt.data;
} else {
- console.log(evt.data);
+ 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").addClass("connected");
}
};
/* when there is an WebSocket error */
@@ -434,6 +439,8 @@ window.onload = function() {
$("#panel").hide();
});
+ $("#stream").prepend('
');
+
/* try to close if block bubble canvas */
/*$(document).click(function(e) {
var target = e.target;