Skip to content

Commit

Permalink
Merge pull request #283 from doudar/ERG-Respin
Browse files Browse the repository at this point in the history
Status.html using rtConfig
  • Loading branch information
doudar authored Dec 25, 2021
2 parents 3fafee2 + 5fd432c commit 0865f95
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 12 deletions.
53 changes: 41 additions & 12 deletions data/status.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<style type="text/css">
html {
background-color: #03245c;
}
</style>
}
</style>
<title>SmartSpin2K Web Server</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
Expand All @@ -17,7 +17,7 @@
<p style="text-align: left;"><strong><a href="index.html">Main Index</a></strong></p>
<h1 style="text-align: left;"><strong>Status</strong></h1>
<h2>
<form action="requestConfigValues()">
<form>
<table>
<tbody>
<tr>
Expand All @@ -26,9 +26,13 @@ <h2>
</td>
<td><input type="text" id="ssid" name="ssid" value="loading" /></td>
<td>
<p><label for="simulatedWatts">Watts</label></p>
<p><label for="simulatedWatts">Current Watts</label></p>
</td>
<td><input type="text" id="simulatedWatts" name="simulatedWatts" value="loading" /></td>
<td>
<p><label for="targetWatts">Target Watts</label></p>
</td>
<td><input type="text" id="targetWatts" name="targetWatts" value="loading" /></td>
</tr>
<tr>
<td>
Expand Down Expand Up @@ -59,9 +63,13 @@ <h2>
<td><input type="text" id="shiftStep" name="shiftStep" value="loading" />
</td>
<td>
<p><label for="ssid">Incline</label></p>
<p><label for="ssid">Current Incline</label></p>
</td>
<td><input type="text" id="incline" name="incline" value="loading" /></td>
<td><input type="text" id="currentIncline" name="currentIncline" value="loading" /></td>
<td>
<p><label for="ssid">Target Incline</label></p>
</td>
<td><input type="text" id="targetIncline" name="targetIncline" value="loading" /></td>
</tr>
<tr>
<td>
Expand Down Expand Up @@ -92,7 +100,8 @@ <h2>
</tr>
<tr>
<td colspan="2">
<pre id="debug" name="debug" style="margin: 0;padding: 5;background-color:black;background-image:radial-gradient(rgba(0,150,0,0.75), black 120%);text-align: left;height:30vh;width:100%;resize:both;border:1px solid #ccc;color:white;font:1.3rem Inconsolata, monospace;overflow:auto;text-shadow: 0 0 4px #C8C8C8;">Loading</pre>
<pre id="debug" name="debug"
style="margin: 0;padding: 5;background-color:black;background-image:radial-gradient(rgba(0,150,0,0.75), black 120%);text-align: left;height:30vh;width:100%;resize:both;border:1px solid #ccc;color:white;font:1.3rem Inconsolata, monospace;overflow:auto;text-shadow: 0 0 4px #C8C8C8;">Loading</pre>
</td>
</tr>
</tbody>
Expand All @@ -107,7 +116,7 @@ <h2>
var followElement = document.getElementById("follow");
var updatePending = false;
var updateTimer = undefined;

function onVisibilityChanged() {
if (document.hidden || document.mozHidden || document.webkitHidden || document.msHidden) {
stopUpdate();
Expand All @@ -125,7 +134,7 @@ <h2>
//Update values on specified interval loading late because this tiny webserver hates frequent requests
if (updateTimer === undefined) {
updateTimer = setInterval(function () {
requestConfigValues();
requestRuntimeValues();
}, 1500);
}
}
Expand Down Expand Up @@ -154,11 +163,29 @@ <h2>
document.getElementById("deviceName").value = obj.deviceName;
document.getElementById("shiftStep").value = obj.shiftStep;
document.getElementById("inclineMultiplier").value = obj.inclineMultiplier;
document.getElementById("incline").value = obj.incline;
//--- document.getElementById("ERGSensitivity").value = obj.ERGSensitivity; ---//
document.getElementById("connectedPowerMeter").value = obj.connectedPowerMeter;
}
};
xhttp.open("GET", "/configJSON?includeDebugLog=true", true);
xhttp.send();
}
}

function requestRuntimeValues() {
if (!updatePending) {
updatePending = true
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
updatePending = false;
if (this.readyState == 4 && this.status == 200) {
var obj = JSON.parse(this.responseText);
document.getElementById("currentIncline").value = obj.currentIncline;
document.getElementById("targetIncline").value = obj.targetIncline;
document.getElementById("simulatedHr").value = obj.simulatedHr;
document.getElementById("simulatedWatts").value = obj.simulatedWatts;
document.getElementById("targetWatts").value = obj.targetWatts;
document.getElementById("simulatedCad").value = obj.simulatedCad;
document.getElementById("connectedPowerMeter").value = obj.connectedPowerMeter;
if (debugElement.innerHTML == "Loading") {
document.getElementById("debug").innerHTML = obj.debug;
} else {
Expand All @@ -167,7 +194,7 @@ <h2>
updateDebugView(obj.debug);
}
};
xhttp.open("GET", "/configJSON?includeDebugLog=true", true);
xhttp.open("GET", "/runtimeConfigJSON?includeDebugLog=true", true);
xhttp.send();
}
}
Expand All @@ -184,6 +211,8 @@ <h2>
//Delay loading css to not swamp webserver
window.addEventListener('load', function () {
setTimeout(loadCss, 100);
requestConfigValues();
requestRuntimeValues();
startUpdate();
}, false);
</script>
Expand Down
3 changes: 3 additions & 0 deletions lib/ArduinoCompat/include/task.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

typedef void* TaskHandle_t;
1 change: 1 addition & 0 deletions test/native/test_PowerBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

#include <unity.h>
#include <task.h>
#include "test.h"
#include "ERG_Mode.h"

Expand Down

0 comments on commit 0865f95

Please sign in to comment.