diff --git a/src/html.h b/src/html.h
index d664827..15b6fff 100644
--- a/src/html.h
+++ b/src/html.h
@@ -59,8 +59,8 @@ const char html_begin[] PROGMEM = R"(
var context = c.getContext("2d");
var maxX = 400, maxY = 200;
var biasX = 20, biasY = 20;
- var curVoltage = 20;
- var freq = 16;
+ var maxVoltage = 20;
+ var freq = 4/4;
function iY(y) {
return maxY + biasY - y;
}
@@ -71,7 +71,7 @@ const char html_begin[] PROGMEM = R"(
context.lineTo(20, iY(i));
context.lineTo(15, iY(i));
context.moveTo(20, iY(i));
- textY = i/200*curVoltage;
+ textY = i/200*maxVoltage;
context.fillText(textY.toFixed(1), 0, iY(i-2.5));
}
context.moveTo(20, iY(0));
@@ -100,8 +100,6 @@ const char html_begin[] PROGMEM = R"(
for (i = 1; i < 200; i++) {
context.lineTo(i*2 + biasX, data.data[i] + biasY);
}
- voltage = data.data[199]*(-0.1)+20;
- context.fillText(voltage + " V", 200,20);
context.stroke();
};
function calibrateDevice() {
diff --git a/src/main.cpp b/src/main.cpp
index db6cfe7..fec68b8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -131,6 +131,19 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length
}
}
+void selfTest(){
+ if (millis() - lastTest > 19) {
+ if (!testState) {
+ digitalWrite(D0, HIGH);
+ testState = true;
+ } else {
+ digitalWrite(D0, LOW);
+ testState = false;
+ }
+ lastTest = millis();
+ }
+}
+
void setup(void)
@@ -157,6 +170,7 @@ void setup(void)
webSocket.onEvent(webSocketEvent);
pinMode(A0, INPUT);
+ pinMode(D0, OUTPUT); //selftest pin
}
void loop(void)
@@ -168,6 +182,8 @@ void loop(void)
updateSensors();
sendDataToSocket();
+ selfTest();
+
updateCpuTime(1);
printCpuLoad();
}
\ No newline at end of file