Set up scheduled program cycles #24
|
@ -11,7 +11,7 @@
|
||||||
[env:esp32doit-devkit-v1]
|
[env:esp32doit-devkit-v1]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
build_flags =
|
build_flags =
|
||||||
-std=c++11
|
; -std=c++11
|
||||||
; -std=gnu++11
|
; -std=gnu++11
|
||||||
board = esp32doit-devkit-v1
|
board = esp32doit-devkit-v1
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
|
@ -63,24 +63,29 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||||
<!DOCTYPE HTML><html><head>
|
<!DOCTYPE HTML><html><head>
|
||||||
<title>ESP Input Form</title>
|
<title>ESP Input Form</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
|
console.log("JS");
|
||||||
// Submit timestamps as unix seconds
|
// Submit timestamps as unix seconds
|
||||||
var putDate = function(form) {
|
var putDate = function(form) {
|
||||||
|
console.log("putDate");
|
||||||
form.inputTimeUnix.value = Math.floor(Date.now() / 1000) - new Date().getTimezoneOffset()*60;
|
form.inputTimeUnix.value = Math.floor(Date.now() / 1000) - new Date().getTimezoneOffset()*60;
|
||||||
document.getElementById("js_start_time_unix").value = ((Date.parse(js_start_time_unix_entry.value))/1000);
|
document.getElementById("js_start_time_unix").value = ((Date.parse(js_start_time_unix_entry.value))/1000);
|
||||||
};
|
}
|
||||||
// Refresh page after submit so values are right https://stackoverflow.com/a/1860732/2152245
|
// Refresh page after submit so values are right https://stackoverflow.com/a/1860732/2152245
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
document.getElementById("hidden-form").onload = function() {
|
document.getElementById("hidden-form").onload = function() {
|
||||||
top.location.reload();
|
top.location.reload();
|
||||||
|
console.log("Reloading");
|
||||||
}
|
}
|
||||||
// Current start date to string
|
// Current start date to string
|
||||||
s = %inputStartTimeUnix%;
|
//s = %inputStartTimeUnix%;
|
||||||
|
s = "1694019170";
|
||||||
|
console.log(s);
|
||||||
current_start = new Date(s * 1000);
|
current_start = new Date(s * 1000);
|
||||||
//current_start_utc = current_start.toUTCString();
|
//current_start_utc = current_start.toUTCString();
|
||||||
document.getElementById('current-start').innerHTML = current_start.toString();
|
document.getElementById('current-start').innerHTML = current_start.toString();
|
||||||
// Show the local time
|
// Show the local time
|
||||||
local_time_unix = new Date().toString(); //Math.floor(Date.now() / 1000) - new Date().getTimezoneOffset()*60;
|
local_time_unix = new Date().toString();
|
||||||
document.getElementById('local-time-unix').innerHTML = local_time_unix.toString();
|
document.getElementById('local-time-unix').innerHTML = local_time_unix.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,10 +217,6 @@ String processor(const String& var){
|
||||||
}
|
}
|
||||||
else if(var == "inputFloat"){
|
else if(var == "inputFloat"){
|
||||||
return readFile(SPIFFS, "/inputFloat.txt");
|
return readFile(SPIFFS, "/inputFloat.txt");
|
||||||
// } else if(var == "inputTimeUnix"){
|
|
||||||
// //return rtc.now().timestamp();
|
|
||||||
// Serial.print("RTC time: ");
|
|
||||||
// Serial.println(rtc.now().unixtime());
|
|
||||||
} else if(var == "inputStartTimeUnix"){
|
} else if(var == "inputStartTimeUnix"){
|
||||||
return readFile(SPIFFS, "/inputStartTimeUnix.txt");
|
return readFile(SPIFFS, "/inputStartTimeUnix.txt");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user