forked from marva/sumorobot-web
merge commits
This commit is contained in:
commit
1db25f2260
@ -59,9 +59,9 @@ Sumorobot.prototype.connect = function() {
|
|||||||
var data = evt.data.replace(/'/g, '"').toLowerCase();
|
var data = evt.data.replace(/'/g, '"').toLowerCase();
|
||||||
console.log(data);
|
console.log(data);
|
||||||
var battery = JSON.parse(data)["battery_voltage"];
|
var battery = JSON.parse(data)["battery_voltage"];
|
||||||
battery = Math.round((((battery - 3.6) * 100) / (4.2 - 3.6)));
|
battery = Math.round((((battery - 3.0) * 100) / (4.2 - 3.0)));
|
||||||
//$("#battery").html(battery + "");
|
$("#battery").html(battery + "%");
|
||||||
$("#bar").html("Connected");
|
//$("#bar").html("Battery");
|
||||||
$("#bar").addClass("connected");
|
$("#bar").addClass("connected");
|
||||||
};
|
};
|
||||||
/* when there is an WebSocket error */
|
/* when there is an WebSocket error */
|
||||||
|
Loading…
Reference in New Issue
Block a user