diff --git a/components/wifi-manager/battery-0.svg b/components/wifi-manager/battery-0.svg new file mode 100644 index 00000000..2b98108f --- /dev/null +++ b/components/wifi-manager/battery-0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/wifi-manager/battery-1.svg b/components/wifi-manager/battery-1.svg new file mode 100644 index 00000000..5bc3b0a7 --- /dev/null +++ b/components/wifi-manager/battery-1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/wifi-manager/battery-2.svg b/components/wifi-manager/battery-2.svg new file mode 100644 index 00000000..57084430 --- /dev/null +++ b/components/wifi-manager/battery-2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/wifi-manager/battery-3.svg b/components/wifi-manager/battery-3.svg new file mode 100644 index 00000000..bea94bf5 --- /dev/null +++ b/components/wifi-manager/battery-3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/wifi-manager/battery-4.svg b/components/wifi-manager/battery-4.svg new file mode 100644 index 00000000..42373ea2 --- /dev/null +++ b/components/wifi-manager/battery-4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/wifi-manager/code.js b/components/wifi-manager/code.js index d14c2914..b2617607 100644 --- a/components/wifi-manager/code.js +++ b/components/wifi-manager/code.js @@ -706,6 +706,24 @@ function checkStatus(){ lastMsg = msg; } } + if (data.hasOwnProperty('Voltage')) { + var voltage = data['Voltage']; + var i; + if (voltage > 0) { + if (inRange(voltage, 5.8, 6.2) || inRange(voltage, 8.8, 9.2)) { + i = 0; + } else if (inRange(voltage, 6.2, 6.8) || inRange(voltage, 9.2, 10.0)) { + i = 1; + } else if (inRange(voltage, 6.8, 7.1) || inRange(voltage, 10.0, 10.5)) { + i = 2; + } else if (inRange(voltage, 7.1, 7.5) || inRange(voltage, 10.5, 11.0)) { + i = 3; + } else { + i = 4; + } + $("#battery").html(''); + } + } blockAjax = false; }) .fail(function(xhr, ajaxOptions, thrownError) { @@ -778,3 +796,7 @@ function showMessage(message, severity) { }); }); } + +function inRange(x, min, max) { + return ((x-min)*(x-max) <= 0); +} diff --git a/components/wifi-manager/index.html b/components/wifi-manager/index.html index 6bfe8c6d..8bfe1411 100644 --- a/components/wifi-manager/index.html +++ b/components/wifi-manager/index.html @@ -24,6 +24,7 @@ +