Get dates lined up, readable, and values refreshed.

This commit is contained in:
mattbk 2023-09-05 16:55:42 -05:00
parent a47451b541
commit 458232f08f

View File

@ -73,9 +73,15 @@ const char index_html[] PROGMEM = R"rawliteral(
document.getElementById("hidden-form").onload = function() {
top.location.reload();
}
// Current start date to string
s = %inputStartTimeUnix%;
current_start = new Date(s * 1000);
current_start_utc = current_start.toUTCString();
document.getElementById('current-start').innerHTML = current_start_utc;
}
</script></head><body>
<form action="/get" target="hidden-form" onsubmit="putDate(this);">
<form action="/get" target="hidden-form" onsubmit="putDate(this);" accept-charset=utf-8>
Sending program (cycle doesn't work yet) (current value: <b>%inputSend%</b>):
<select name="inputSend" id="send-program">
@ -94,7 +100,7 @@ const char index_html[] PROGMEM = R"rawliteral(
<option value="5">5 - MO5</option>
</select><br>
Program start time (current value <b>%inputStartTimeUnix%</b>): <input type="datetime-local" id="js_start_time_unix_entry" /><br>
Program start time (current value <b><span id = current-start></span></b>): <input type="datetime-local" id="js_start_time_unix_entry" /><br>
<input type="hidden" name="inputStartTimeUnix" id="js_start_time_unix" />
Current time (UTC): %inputTimeUnix%
@ -426,7 +432,7 @@ void setup() {
yourInputWPM = readFile(SPIFFS, "/inputWPM.txt").toInt();
yourInputMsg = readFile(SPIFFS, "/inputMsg.txt").toInt();
yourInputFloat = readFile(SPIFFS, "/inputFloat.txt").toFloat();
yourInputStartTimeUnix = readFile(SPIFFS, "inputStartTimeUnix.txt").toInt();
yourInputStartTimeUnix = readFile(SPIFFS, "/inputStartTimeUnix.txt").toInt();
// On restart, keep doing what you were doing before
yourInputMsg_old = yourInputMsg;
@ -530,7 +536,6 @@ void setup() {
// GET inputStartTimeUnix value on <ESP_IP>/get?inputStartTimeUnix=<inputMessage>
if (request->hasParam(PARAM_START)) {
inputMessage = request->getParam(PARAM_START)->value();
Serial.println(inputMessage);
writeFile(SPIFFS, "/inputStartTimeUnix.txt", inputMessage.c_str());
yourInputStartTimeUnix = atol(inputMessage.c_str());
Serial.println(yourInputStartTimeUnix);