Set up scheduled program cycles #24

Merged
W1CDN merged 41 commits from program-cycle into main 2023-09-15 16:51:45 -05:00
Showing only changes of commit 458232f08f - Show all commits

View File

@ -73,9 +73,15 @@ const char index_html[] PROGMEM = R"rawliteral(
document.getElementById("hidden-form").onload = function() { document.getElementById("hidden-form").onload = function() {
top.location.reload(); 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> </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>): Sending program (cycle doesn't work yet) (current value: <b>%inputSend%</b>):
<select name="inputSend" id="send-program"> <select name="inputSend" id="send-program">
@ -94,7 +100,7 @@ const char index_html[] PROGMEM = R"rawliteral(
<option value="5">5 - MO5</option> <option value="5">5 - MO5</option>
</select><br> </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" /> <input type="hidden" name="inputStartTimeUnix" id="js_start_time_unix" />
Current time (UTC): %inputTimeUnix% Current time (UTC): %inputTimeUnix%
@ -426,7 +432,7 @@ void setup() {
yourInputWPM = readFile(SPIFFS, "/inputWPM.txt").toInt(); yourInputWPM = readFile(SPIFFS, "/inputWPM.txt").toInt();
yourInputMsg = readFile(SPIFFS, "/inputMsg.txt").toInt(); yourInputMsg = readFile(SPIFFS, "/inputMsg.txt").toInt();
yourInputFloat = readFile(SPIFFS, "/inputFloat.txt").toFloat(); 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 // On restart, keep doing what you were doing before
yourInputMsg_old = yourInputMsg; yourInputMsg_old = yourInputMsg;
@ -530,7 +536,6 @@ void setup() {
// GET inputStartTimeUnix value on <ESP_IP>/get?inputStartTimeUnix=<inputMessage> // GET inputStartTimeUnix value on <ESP_IP>/get?inputStartTimeUnix=<inputMessage>
if (request->hasParam(PARAM_START)) { if (request->hasParam(PARAM_START)) {
inputMessage = request->getParam(PARAM_START)->value(); inputMessage = request->getParam(PARAM_START)->value();
Serial.println(inputMessage);
writeFile(SPIFFS, "/inputStartTimeUnix.txt", inputMessage.c_str()); writeFile(SPIFFS, "/inputStartTimeUnix.txt", inputMessage.c_str());
yourInputStartTimeUnix = atol(inputMessage.c_str()); yourInputStartTimeUnix = atol(inputMessage.c_str());
Serial.println(yourInputStartTimeUnix); Serial.println(yourInputStartTimeUnix);