This commit is contained in:
mattbk 2023-09-06 18:02:07 -05:00
parent c174d7f594
commit b648900c7b
2 changed files with 10 additions and 9 deletions

View File

@ -11,7 +11,7 @@
[env:esp32doit-devkit-v1]
platform = espressif32
build_flags =
-std=c++11
; -std=c++11
; -std=gnu++11
board = esp32doit-devkit-v1
framework = arduino

View File

@ -63,24 +63,29 @@ const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE HTML><html><head>
<title>ESP Input Form</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
<script type="text/javascript">
console.log("JS");
// Submit timestamps as unix seconds
var putDate = function(form) {
console.log("putDate");
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);
};
}
// Refresh page after submit so values are right https://stackoverflow.com/a/1860732/2152245
window.onload = function() {
document.getElementById("hidden-form").onload = function() {
top.location.reload();
console.log("Reloading");
}
// Current start date to string
s = %inputStartTimeUnix%;
//s = %inputStartTimeUnix%;
s = "1694019170";
console.log(s);
current_start = new Date(s * 1000);
//current_start_utc = current_start.toUTCString();
document.getElementById('current-start').innerHTML = current_start.toString();
// 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();
}
@ -212,10 +217,6 @@ String processor(const String& var){
}
else if(var == "inputFloat"){
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"){
return readFile(SPIFFS, "/inputStartTimeUnix.txt");
}