Commit 09b0eda4 by Corey Koval

Added auto-refresh

parent c1cf0ef6
...@@ -16,6 +16,7 @@ Click the power button to enable/disable. ...@@ -16,6 +16,7 @@ Click the power button to enable/disable.
- Black is enabled, red is disabled. - Black is enabled, red is disabled.
- If you lose connectivity to a receiver, that particular receiver will be disabled. - If you lose connectivity to a receiver, that particular receiver will be disabled.
Click the power button to try to reconnect. Click the power button to try to reconnect.
- Map refreshes every 5 seconds. Change `refreshrate` at the top of `static/receiver_configurator.js` to change the refresh rate.
## Dependencies: ## Dependencies:
- Python >= 3.6 - Python >= 3.6
......
// Update Map ever 5 seconds
var refreshrate = 5000;
var autoRefresh = setInterval(function () { updateParams(); }, refreshrate);
// ************************************************* // *************************************************
// * Gets Rx data from backend // * Gets Rx data from backend
// ************************************************* // *************************************************
...@@ -56,6 +60,7 @@ function editReceivers(rx_json, id) { ...@@ -56,6 +60,7 @@ function editReceivers(rx_json, id) {
var editButton = document.getElementById(id + "-edit"); var editButton = document.getElementById(id + "-edit");
var isMobileCheck = document.getElementById("mobilerx_toggle_" + id); var isMobileCheck = document.getElementById("mobilerx_toggle_" + id);
if (editButton.checked) { if (editButton.checked) {
clearInterval(autoRefresh);
let isMobile = ""; let isMobile = "";
if (receivers[id].mobile) isMobile = "checked"; if (receivers[id].mobile) isMobile = "checked";
document.getElementById(id + "-editicon").innerHTML = "save"; document.getElementById(id + "-editicon").innerHTML = "save";
...@@ -77,6 +82,7 @@ function editReceivers(rx_json, id) { ...@@ -77,6 +82,7 @@ function editReceivers(rx_json, id) {
// } // }
// } // }
} else { } else {
autoRefresh = setInterval(function () { updateParams(); }, refreshrate);
isMobileCheck = document.getElementById("mobilerx_toggle_" + id); isMobileCheck = document.getElementById("mobilerx_toggle_" + id);
if (isMobileCheck.checked) { if (isMobileCheck.checked) {
receivers[id].mobile = true; receivers[id].mobile = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment