From c65bc22028f5edaf36046c7c92256cbcb2fbb0fb Mon Sep 17 00:00:00 2001 From: mattbk Date: Mon, 4 Sep 2023 21:53:09 -0500 Subject: [PATCH 01/40] Shelve. Collect unix time from webform, but need to make sure it is UTC. --- vulpes/src/main.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index 09210a8..9c2b0f4 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -44,6 +44,7 @@ const char* PARAM_WPM = "inputWPM"; const char* PARAM_MSG = "inputMsg"; const char* PARAM_FLOAT = "inputFloat"; const char* PARAM_TIME = "inputTimeUnix"; +const char* PARAM_START = "inputStartTimeUnix"; // Global variables String yourInputString; @@ -53,6 +54,7 @@ int yourInputMsg; int yourInputMsg_old; // to save previous state and check changes float yourInputFloat; uint32_t yourInputTime; //to keep time +uint32_t yourInputStartTimeUnix; // HTML web page to handle 3 input fields (inputString, inputSend, inputFloat) const char index_html[] PROGMEM = R"rawliteral( @@ -65,8 +67,7 @@ const char index_html[] PROGMEM = R"rawliteral( };
- inputString (current value %inputString%):
- + Sending program (cycle doesn't work yet) (current value: %inputSend%):
- - WPM (current value %inputWPM%): (doesn't work yet)
+ Program start time (current value %inputStartTimeUnix%):
+ + Current time (UTC): %inputTimeUnix% +
- inputFloat (current value %inputFloat%):
+ +
+
+
+
+ )rawliteral"; // Auxiliary variables to store the current output state @@ -181,6 +191,8 @@ String processor(const String& var){ return readFile(SPIFFS, "/inputFloat.txt"); } else if(var == "inputTimeUnix"){ return rtc.now().timestamp(); + } else if(var == "inputStartTimeUnix"){ + return readFile(SPIFFS, "/inputStartTimeUnix.txt"); } return String(); } @@ -508,6 +520,14 @@ void setup() { writeFile(SPIFFS, "/inputFloat.txt", inputMessage.c_str()); yourInputFloat = inputMessage.toFloat(); } + // GET inputStartTimeUnix value on /get?inputStartTimeUnix= + 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); + } // else { // inputMessage = "No message sent"; // } -- 2.30.2 From 2060df96917d853942ba03af9b23ef3795bea2f9 Mon Sep 17 00:00:00 2001 From: mattbk Date: Tue, 5 Sep 2023 11:08:01 -0500 Subject: [PATCH 02/40] Refresh webform automatically after submit so values are right. --- vulpes/src/main.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index 9c2b0f4..dd5170d 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -61,10 +61,18 @@ const char index_html[] PROGMEM = R"rawliteral( ESP Input Form -
@@ -99,10 +107,7 @@ const char index_html[] PROGMEM = R"rawliteral(
- - + )rawliteral"; // Auxiliary variables to store the current output state -- 2.30.2 From a47451b5418bcce9c7e55caa8e4ce14ff503bab1 Mon Sep 17 00:00:00 2001 From: mattbk Date: Tue, 5 Sep 2023 15:41:56 -0500 Subject: [PATCH 03/40] Get time and start time aligned. --- vulpes/src/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index dd5170d..d40a17a 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -61,11 +61,12 @@ const char index_html[] PROGMEM = R"rawliteral( ESP Input Form - -
+ Sending program (cycle doesn't work yet) (current value: %inputSend%):
- Program start time (current value %inputStartTimeUnix%):
+ Program start time (current value ):
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 /get?inputStartTimeUnix= 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); -- 2.30.2 From 8a95413224f22c1622553cffab37048d4084a275 Mon Sep 17 00:00:00 2001 From: mattbk Date: Tue, 5 Sep 2023 20:41:55 -0500 Subject: [PATCH 05/40] Snapshot. --- vulpes/src/main.cpp | 55 ++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index 46c2ae7..f4c06c1 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -25,7 +25,7 @@ #include // for DS3231 #include // for DS3231 //#include //for DS3231 -//#include +#include // download zip from https://github.com/me-no-dev/ESPAsyncWebServer and install. #include @@ -45,6 +45,7 @@ const char* PARAM_MSG = "inputMsg"; const char* PARAM_FLOAT = "inputFloat"; const char* PARAM_TIME = "inputTimeUnix"; const char* PARAM_START = "inputStartTimeUnix"; +const char* PARAM_RUNNING = "programRunning"; // Global variables String yourInputString; @@ -55,6 +56,7 @@ int yourInputMsg_old; // to save previous state and check changes float yourInputFloat; uint32_t yourInputTime; //to keep time uint32_t yourInputStartTimeUnix; +int yourProgramRunning; // HTML web page to handle 3 input fields (inputString, inputSend, inputFloat) const char index_html[] PROGMEM = R"rawliteral( @@ -83,11 +85,11 @@ const char index_html[] PROGMEM = R"rawliteral( - Sending program (cycle doesn't work yet) (current value: %inputSend%): +

Sending program (cycle doesn't work yet) (current value: %inputSend%):
Message (current value %inputMsg%): @@ -98,19 +100,24 @@ const char index_html[] PROGMEM = R"rawliteral( -
+

- Program start time (current value ):
- +

Current time (UTC): %inputTimeUnix%
+ + Program start time (current value ): + +

- Current time (UTC): %inputTimeUnix% - -
+ + + -
-
-
+ + + @@ -205,7 +212,7 @@ String processor(const String& var){ return rtc.now().timestamp(); } else if(var == "inputStartTimeUnix"){ return readFile(SPIFFS, "/inputStartTimeUnix.txt"); - } + } return String(); } @@ -350,6 +357,15 @@ auto morseToSend_blink = morseTEST_blink; // set this up to overwrite later // Serial.println(buf); // } +//================================================================================ +// start_program(): a function to start the planned program at the planned time +//================================================================================ +bool start_program(){ + Serial.println("The scheduled program has started."); + yourProgramRunning = 1; + return false; +} + //================================================================================ // setup(): stuff that only gets done once, after power up (KB1OIQ's description) //================================================================================ @@ -485,6 +501,10 @@ void setup() { inputMessage = request->getParam(PARAM_SEND)->value(); writeFile(SPIFFS, "/inputSend.txt", inputMessage.c_str()); yourInputSend = inputMessage.toInt(); + // if not running a program, set the program running off + if(yourInputSend != 2){ + yourProgramRunning = 0; + } } // GET inputWPM value on /get?inputWPM= if (request->hasParam(PARAM_WPM)) { @@ -503,7 +523,6 @@ void setup() { // GET inputTimeUnix value on /get?inputTimeUnix= if (request->hasParam(PARAM_TIME)) { inputMessage = request->getParam(PARAM_TIME)->value(); - Serial.println(inputMessage); //https://stackoverflow.com/a/22733127/2152245 yourInputTime = atol(inputMessage.c_str()); Serial.println(yourInputTime); @@ -536,8 +555,12 @@ void setup() { // GET inputStartTimeUnix value on /get?inputStartTimeUnix= if (request->hasParam(PARAM_START)) { inputMessage = request->getParam(PARAM_START)->value(); - writeFile(SPIFFS, "/inputStartTimeUnix.txt", inputMessage.c_str()); - yourInputStartTimeUnix = atol(inputMessage.c_str()); + Serial.println(inputMessage); + // if a start time isn't entered, don't overwrite the old one + //if(!(inputMessage != NULL && inputMessage[0] == '\0')){ + writeFile(SPIFFS, "/inputStartTimeUnix.txt", inputMessage.c_str()); + yourInputStartTimeUnix = atol(inputMessage.c_str()); + //} Serial.println(yourInputStartTimeUnix); } // else { -- 2.30.2 From fd61efebba8c1cbcca475ba52614608c6df1241b Mon Sep 17 00:00:00 2001 From: mattbk Date: Tue, 5 Sep 2023 21:11:31 -0500 Subject: [PATCH 06/40] Get on local time, baby. --- vulpes/src/main.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index f4c06c1..b73d8cb 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -66,9 +66,8 @@ const char index_html[] PROGMEM = R"rawliteral( + +

Local time: %inputTimeUnix%

+

Sending program (cycle doesn't work yet) (current value: %inputSend%): @@ -102,9 +104,8 @@ const char index_html[] PROGMEM = R"rawliteral(

-

Current time (UTC): %inputTimeUnix%
- - Program start time (current value ): +

Program start time
+ Current value: )

-- 2.30.2 From c174d7f594c8c7d971ffd3452726aa198647dfcb Mon Sep 17 00:00:00 2001 From: mattbk Date: Wed, 6 Sep 2023 16:57:57 -0500 Subject: [PATCH 07/40] Make date formats match and stop passing an extra variable. --- vulpes/platformio.ini | 4 ++-- vulpes/src/main.cpp | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/vulpes/platformio.ini b/vulpes/platformio.ini index 1a2242f..30e769d 100644 --- a/vulpes/platformio.ini +++ b/vulpes/platformio.ini @@ -10,8 +10,8 @@ [env:esp32doit-devkit-v1] platform = espressif32 -;build_flags = -; -std=c++11 +build_flags = + -std=c++11 ; -std=gnu++11 board = esp32doit-devkit-v1 framework = arduino diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index b73d8cb..e1511d8 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -79,11 +79,14 @@ const char index_html[] PROGMEM = R"rawliteral( 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; + document.getElementById('local-time-unix').innerHTML = local_time_unix.toString(); } -

Local time: %inputTimeUnix%

+

Local time:

@@ -105,7 +108,7 @@ const char index_html[] PROGMEM = R"rawliteral(

Program start time
- Current value: ) + Current value:

@@ -209,8 +212,10 @@ String processor(const String& var){ } else if(var == "inputFloat"){ return readFile(SPIFFS, "/inputFloat.txt"); - } else if(var == "inputTimeUnix"){ - return rtc.now().timestamp(); + // } 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"); } -- 2.30.2 From b648900c7b8391279a1b421f70813fee756222c8 Mon Sep 17 00:00:00 2001 From: mattbk Date: Wed, 6 Sep 2023 18:02:07 -0500 Subject: [PATCH 08/40] Shelve. --- vulpes/platformio.ini | 2 +- vulpes/src/main.cpp | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/vulpes/platformio.ini b/vulpes/platformio.ini index 30e769d..e8e473f 100644 --- a/vulpes/platformio.ini +++ b/vulpes/platformio.ini @@ -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 diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index e1511d8..9d05535 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -63,24 +63,29 @@ const char index_html[] PROGMEM = R"rawliteral( ESP Input Form - @@ -117,7 +116,6 @@ const char index_html[] PROGMEM = R"rawliteral(

- @@ -125,12 +123,15 @@ const char index_html[] PROGMEM = R"rawliteral( - + + )rawliteral"; // Auxiliary variables to store the current output state @@ -218,6 +219,7 @@ String processor(const String& var){ else if(var == "inputFloat"){ return readFile(SPIFFS, "/inputFloat.txt"); } else if(var == "inputStartTimeUnix"){ + // Webform breaks if this value is empty. String temp = readFile(SPIFFS, "/inputStartTimeUnix.txt"); if(temp == ""){ temp = "0"; -- 2.30.2 From dab159060821041764d04acf610b9341ddb0abe7 Mon Sep 17 00:00:00 2001 From: mattbk Date: Wed, 6 Sep 2023 21:21:05 -0500 Subject: [PATCH 12/40] Use unix timestamps and convert to/from local in js. --- vulpes/src/main.cpp | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index d126918..5c6c8b7 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -65,9 +65,27 @@ const char index_html[] PROGMEM = R"rawliteral( ESP Input Form -- 2.30.2 From a996c13e63bbefb4272f4a6ce20dffde51b9a215 Mon Sep 17 00:00:00 2001 From: mattbk Date: Wed, 6 Sep 2023 21:36:10 -0500 Subject: [PATCH 13/40] Snapshot to capture working refresh... --- vulpes/src/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index 5c6c8b7..022e4c4 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -91,9 +91,9 @@ const char index_html[] PROGMEM = R"rawliteral( } // 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(); - } + //document.getElementById("hidden-form").onload = function() { + //top.location.reload(); + //} // Current start date to string s = %inputStartTimeUnix%; current_start = new Date(s * 1000); @@ -110,7 +110,7 @@ const char index_html[] PROGMEM = R"rawliteral(

Local time:

-
+

Sending program (cycle doesn't work yet) (current value: %inputSend%): - +
-- 2.30.2 From f496a10ef272d6b8ea3e2a58e7512d16e562cee2 Mon Sep 17 00:00:00 2001 From: mattbk Date: Wed, 6 Sep 2023 22:07:48 -0500 Subject: [PATCH 15/40] Try to account for infrequent weird RTC times. --- vulpes/src/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index 403a7f0..3679732 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -555,9 +555,16 @@ void setup() { inputMessage = request->getParam(PARAM_TIME)->value(); //https://stackoverflow.com/a/22733127/2152245 yourInputTime = atol(inputMessage.c_str()); + Serial.print("yourInputTime: "); Serial.println(yourInputTime); // update the RTC time rtc.adjust(DateTime(yourInputTime)); + // Might work to fix random errors? If date is far in the future, + // try to update again. + while(rtc.now().year() > 2100){ + Serial.println("RTC can't set time. Trying again."); + rtc.adjust(DateTime(yourInputTime)); + } ; DateTime now = rtc.now(); Serial.print("UTC time from browser: "); @@ -575,6 +582,9 @@ void setup() { Serial.print(':'); Serial.print(now.second(), DEC); Serial.println(); + + Serial.print("rtc.now().unixtime(): "); + Serial.println(rtc.now().unixtime()); } // GET inputFloat value on /get?inputFloat= if (request->hasParam(PARAM_FLOAT)) { -- 2.30.2 From a69128397a7c840b889e4eaec2d9cf1127abaadc Mon Sep 17 00:00:00 2001 From: mattbk Date: Thu, 7 Sep 2023 20:20:53 -0500 Subject: [PATCH 16/40] Snapshot. --- vulpes/platformio.ini | 2 +- vulpes/src/main.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/vulpes/platformio.ini b/vulpes/platformio.ini index e8e473f..1a2242f 100644 --- a/vulpes/platformio.ini +++ b/vulpes/platformio.ini @@ -10,7 +10,7 @@ [env:esp32doit-devkit-v1] platform = espressif32 -build_flags = +;build_flags = ; -std=c++11 ; -std=gnu++11 board = esp32doit-devkit-v1 diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index 3679732..657250d 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -162,10 +162,11 @@ const int blinker = LED_BUILTIN; // Timers //auto timer = timer_create_default(); Timer<1> timer; -auto time_until_start = timer_create_default(); // Example from https://github.com/contrem/arduino-timer#examples bool toggle_led(void *) { + Serial.print("Timer time: "); + Serial.println(rtc.now().timestamp()); digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); // toggle the LED return true; // keep timer active? true } @@ -602,11 +603,17 @@ void setup() { yourInputStartTimeUnix = atol(inputMessage.c_str()); //} Serial.println(yourInputStartTimeUnix); + + timer.at(millis() + 10000, toggle_led); + Serial.println(millis()); + auto active_tasks = timer.size(); + Serial.println(active_tasks); } // else { // inputMessage = "No message sent"; // } //request->send(200, "text/plain", inputMessage); + // https://techtutorialsx.com/2018/01/14/esp32-arduino-http-server-external-and-internal-redirects/ request->redirect("/"); }); server.onNotFound(notFound); @@ -621,13 +628,10 @@ void setup() { // sender.setMessage(String("73 de kb3jcy ")); // sender.startSending(); - - } void loop() { // Timers - time_until_start.tick(); timer.tick(); // DateTime now = rtc.now(); -- 2.30.2 From af4920d634905b0cd412765367ee9ddb65ab4694 Mon Sep 17 00:00:00 2001 From: mattbk Date: Fri, 8 Sep 2023 08:39:14 -0500 Subject: [PATCH 17/40] Snapshot. --- vulpes/src/main.cpp | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index 657250d..0bec9dc 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -165,8 +165,8 @@ Timer<1> timer; // Example from https://github.com/contrem/arduino-timer#examples bool toggle_led(void *) { - Serial.print("Timer time: "); - Serial.println(rtc.now().timestamp()); + //Serial.print("Timer time: "); + //Serial.println(rtc.now().timestamp()); digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); // toggle the LED return true; // keep timer active? true } @@ -562,7 +562,7 @@ void setup() { rtc.adjust(DateTime(yourInputTime)); // Might work to fix random errors? If date is far in the future, // try to update again. - while(rtc.now().year() > 2100){ + while(rtc.now().year() > 2040){ Serial.println("RTC can't set time. Trying again."); rtc.adjust(DateTime(yourInputTime)); } @@ -604,10 +604,16 @@ void setup() { //} Serial.println(yourInputStartTimeUnix); - timer.at(millis() + 10000, toggle_led); - Serial.println(millis()); - auto active_tasks = timer.size(); - Serial.println(active_tasks); + // We can't use arduino-timer for starting a program because + // it relies on millis(), which reset on power cycle. + // timer.at(millis() + 10000, toggle_led); + // Serial.println(millis()); + // auto active_tasks = timer.size(); + // Serial.println(active_tasks); + + // Use alarm built into RTC + rtc.setAlarm2(DateTime(yourInputStartTimeUnix), DS3231_A2_Date); + //rtc.setAlarm1(DateTime(2020, 6, 25, 15, 34, 0), DS3231_A2_Date); } // else { // inputMessage = "No message sent"; @@ -634,6 +640,21 @@ void loop() { // Timers timer.tick(); + // This function from https://github.com/garrysblog/DS3231-Alarm-With-Adafruit-RTClib-Library/blob/master/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired.ino + // Check if alarm by polling by using alarmFired + // We don't want old alarms, though. + //& (rtc.getAlarm2() >= rtc.now()) + // if ((rtc.alarmFired(2) == 1) ){ + + // // Print current time and date + // DateTime now = rtc.now(); // Get the current time + // char buff[] = "Alarm triggered at hh:mm:ss DDD, DD MMM YYYY"; + // Serial.println(now.toString(buff)); + + // // Disable and clear alarm + // rtc.clearAlarm(2); + // } + // DateTime now = rtc.now(); // Serial.print(now.year(), DEC); // Serial.print('/'); -- 2.30.2 From 57a1c1af80450c85149d8c7a0211585cf15fbc6b Mon Sep 17 00:00:00 2001 From: mattbk Date: Fri, 8 Sep 2023 10:39:24 -0500 Subject: [PATCH 18/40] Snapshot. --- vulpes/src/main.cpp | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index 0bec9dc..eddc6cd 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -33,6 +33,7 @@ AsyncWebServer server(80); RTC_DS3231 rtc; // set up RTC +const int alarmPin = 4; // pin to monitor for RTC alarms // Read from config.h const char* ssid = WIFI_SSID; @@ -403,6 +404,14 @@ bool start_program(){ void setup() { Serial.begin(115200); + pinMode(alarmPin, INPUT_PULLUP); // Set alarm pin as pullup + // Disable and clear both alarms + // rtc.disableAlarm(1); + // rtc.disableAlarm(2); + // rtc.clearAlarm(1); + // rtc.clearAlarm(2); + // rtc.writeSqwPinMode(DS3231_OFF); // Place SQW pin into alarm interrupt mode + // https://github.com/JChristensen/DS3232RTC/blob/master/examples/TimeRTC/TimeRTC.ino // rtc.begin(); // setSyncProvider(rtc.get); // the function to get the time from the RTC @@ -427,6 +436,11 @@ void setup() { //rtc.adjust(DateTime(2023, 9, 2, 17, 32, 0)); } + // Are there any RTC alarms set? + DateTime alarm_two = rtc.getAlarm2(); // Get the current time + char buff[] = "Alarm 2 set for at hh:mm:ss DDD, DD MMM YYYY"; + Serial.println(alarm_two.toString(buff)); + // Timer example, blink main LED pinMode(LED_BUILTIN, OUTPUT); // set LED pin to OUTPUT // call the toggle_led function every 10000 millis (10 second) @@ -645,15 +659,16 @@ void loop() { // We don't want old alarms, though. //& (rtc.getAlarm2() >= rtc.now()) // if ((rtc.alarmFired(2) == 1) ){ + if (digitalRead(alarmPin) == LOW) { - // // Print current time and date - // DateTime now = rtc.now(); // Get the current time - // char buff[] = "Alarm triggered at hh:mm:ss DDD, DD MMM YYYY"; - // Serial.println(now.toString(buff)); + // Print current time and date + DateTime now = rtc.now(); // Get the current time + char buff[] = "Alarm triggered at hh:mm:ss DDD, DD MMM YYYY"; + Serial.println(now.toString(buff)); - // // Disable and clear alarm - // rtc.clearAlarm(2); - // } + // Disable and clear alarm + rtc.clearAlarm(2); + } // DateTime now = rtc.now(); // Serial.print(now.year(), DEC); -- 2.30.2 From 38c1417351a90820039bfe26a3180b82c5f33459 Mon Sep 17 00:00:00 2001 From: mattbk Date: Fri, 8 Sep 2023 11:12:44 -0500 Subject: [PATCH 19/40] Report time alarm is set (serial). --- vulpes/src/main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index eddc6cd..5e54d7e 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -439,7 +439,8 @@ void setup() { // Are there any RTC alarms set? DateTime alarm_two = rtc.getAlarm2(); // Get the current time char buff[] = "Alarm 2 set for at hh:mm:ss DDD, DD MMM YYYY"; - Serial.println(alarm_two.toString(buff)); + Serial.print(alarm_two.toString(buff)); + Serial.println(" (only accurate to day of month)"); // Timer example, blink main LED pinMode(LED_BUILTIN, OUTPUT); // set LED pin to OUTPUT @@ -628,6 +629,10 @@ void setup() { // Use alarm built into RTC rtc.setAlarm2(DateTime(yourInputStartTimeUnix), DS3231_A2_Date); //rtc.setAlarm1(DateTime(2020, 6, 25, 15, 34, 0), DS3231_A2_Date); + DateTime alarm_two = rtc.getAlarm2(); // Get the current time + char buff[] = "Alarm 2 set for at hh:mm:ss DDD, DD MMM YYYY"; + Serial.print(alarm_two.toString(buff)); + Serial.println(" (only accurate to day of month)"); } // else { // inputMessage = "No message sent"; -- 2.30.2 From cbdc7ec939da54c4e00ee7a2b29fa33a778651f0 Mon Sep 17 00:00:00 2001 From: mattbk Date: Fri, 8 Sep 2023 15:00:48 -0500 Subject: [PATCH 20/40] Use Alarm2 instead of Alarm2 to avoid late alarms. --- vulpes/src/main.cpp | 50 +++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index 5e54d7e..ab78e07 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -116,7 +116,7 @@ const char index_html[] PROGMEM = R"rawliteral(
Message (current value %inputMsg%): @@ -129,8 +129,10 @@ const char index_html[] PROGMEM = R"rawliteral(

-

Program start time
- Current value: +

Cycle start time
+ Current value: , but only day-of-month HH:MM:SS are used. + Only applies when Sending Program is set to "2 - Cycle". + You cannot set a cycle start date more than a month in advance.

@@ -437,10 +439,10 @@ void setup() { } // Are there any RTC alarms set? - DateTime alarm_two = rtc.getAlarm2(); // Get the current time - char buff[] = "Alarm 2 set for at hh:mm:ss DDD, DD MMM YYYY"; - Serial.print(alarm_two.toString(buff)); - Serial.println(" (only accurate to day of month)"); + DateTime alarm_one = rtc.getAlarm1(); // Get the current time + char buff[] = "Alarm 1 set for at hh:mm:ss DDD, DD MMM YYYY"; + Serial.print(alarm_one.toString(buff)); + Serial.println(" (only HH:MM:SS day-of-month are accurate)"); // Timer example, blink main LED pinMode(LED_BUILTIN, OUTPUT); // set LED pin to OUTPUT @@ -575,14 +577,17 @@ void setup() { Serial.println(yourInputTime); // update the RTC time rtc.adjust(DateTime(yourInputTime)); + DateTime now = rtc.now(); // Might work to fix random errors? If date is far in the future, // try to update again. - while(rtc.now().year() > 2040){ + // replace if with while if you want it to try a bunch... + if(now.year() > 2040){ + Serial.print("Year is "); + Serial.println(now.year()); Serial.println("RTC can't set time. Trying again."); rtc.adjust(DateTime(yourInputTime)); } -; - DateTime now = rtc.now(); + Serial.print("UTC time from browser: "); Serial.print(now.year(), DEC); Serial.print('/'); @@ -627,12 +632,12 @@ void setup() { // Serial.println(active_tasks); // Use alarm built into RTC - rtc.setAlarm2(DateTime(yourInputStartTimeUnix), DS3231_A2_Date); + rtc.setAlarm1(DateTime(yourInputStartTimeUnix), DS3231_A1_Date); //rtc.setAlarm1(DateTime(2020, 6, 25, 15, 34, 0), DS3231_A2_Date); - DateTime alarm_two = rtc.getAlarm2(); // Get the current time - char buff[] = "Alarm 2 set for at hh:mm:ss DDD, DD MMM YYYY"; - Serial.print(alarm_two.toString(buff)); - Serial.println(" (only accurate to day of month)"); + DateTime alarm_one = rtc.getAlarm1(); // Get the current alarm time + char buff[] = "Alarm 1 set for at hh:mm:ss DDD, DD MMM YYYY"; + Serial.print(alarm_one.toString(buff)); + Serial.println(" (only HH:MM:SS day-of-month are accurate)"); } // else { // inputMessage = "No message sent"; @@ -659,20 +664,17 @@ void loop() { // Timers timer.tick(); - // This function from https://github.com/garrysblog/DS3231-Alarm-With-Adafruit-RTClib-Library/blob/master/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired.ino - // Check if alarm by polling by using alarmFired - // We don't want old alarms, though. - //& (rtc.getAlarm2() >= rtc.now()) - // if ((rtc.alarmFired(2) == 1) ){ - if (digitalRead(alarmPin) == LOW) { - + // This statement from https://github.com/garrysblog/DS3231-Alarm-With-Adafruit-RTClib-Library/blob/master/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired.ino + // Check if alarm by polling SQW alarm pin + if (yourInputSend == 2 & digitalRead(alarmPin) == LOW) { // Print current time and date DateTime now = rtc.now(); // Get the current time char buff[] = "Alarm triggered at hh:mm:ss DDD, DD MMM YYYY"; Serial.println(now.toString(buff)); // Disable and clear alarm - rtc.clearAlarm(2); + rtc.clearAlarm(1); + rtc.clearAlarm(2); // clear the other one just in case } // DateTime now = rtc.now(); @@ -742,7 +744,7 @@ void loop() { morseToSend_blink.Update(); // if you want to send cycle code and it's not sending, then start it up - } else if((yourInputSend == 2) & (morseToSend.IsRunning() == true)){ + } else if((yourInputSend == 2) & (morseToSend.IsRunning() == false)){ morseToSend.Reset().Update(); morseToSend_blink.Reset().Update(); -- 2.30.2 From 26a1ee97c0b092545e0ff6adbef958b2faeaccec Mon Sep 17 00:00:00 2001 From: mattbk Date: Fri, 8 Sep 2023 15:07:57 -0500 Subject: [PATCH 21/40] Delete a bunch of old stuff. --- vulpes/src/main.cpp | 188 -------------------------------------------- 1 file changed, 188 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index ab78e07..caf81d6 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -17,14 +17,10 @@ #include #include #include -// #include -//#include //arduino morse -//#include //etherkit morse #include // jled #include "jled/morse.h" //jled #include // for DS3231 #include // for DS3231 -//#include //for DS3231 #include // download zip from https://github.com/me-no-dev/ESPAsyncWebServer and install. @@ -154,10 +150,6 @@ const char index_html[] PROGMEM = R"rawliteral( )rawliteral"; -// Auxiliary variables to store the current output state -//String output26State = "off"; -//String output27State = "off"; - // Assign output variables to GPIO pins const int keyer = 32; //LED_BUILTIN for on-board (dev);//26 for LED; //32 for transmitter keyer const int blinker = LED_BUILTIN; @@ -174,18 +166,6 @@ bool toggle_led(void *) { return true; // keep timer active? true } -// Toggle GPIO pin (LED or relay) -// bool toggle_gpio_26(void *) { -// if(output26State == "off"){ -// output26State = "on"; -// digitalWrite(output26, HIGH); -// } else { -// output26State = "off"; -// digitalWrite(output26, LOW); -// } -// return true; // keep timer active? true -// } - void notFound(AsyncWebServerRequest *request) { request->send(404, "text/plain", "Not found"); } @@ -250,72 +230,6 @@ String processor(const String& var){ return String(); } -// // vvvvv Modify some functions from KB1OIQ's controller. -// // This section hasn't been tested on the hardware. - -// //int dit_len = 60 ; //milliseconds; https://morsecode.world/international/timing.html - -// //================================================================================ -// // stop_26(): set GPIO 26 to LOW. Used for dot(), dash(). -// //================================================================================ -// bool stop_26(void *){ -// output26State = "off"; -// digitalWrite(output26, LOW); -// return false; // keep timer active? true -// } - -// //================================================================================ -// // dit(): transmit a single dit -// //================================================================================ -// void dit(int dit_len = 1000) { -// output26State = "on"; -// digitalWrite(output26, HIGH); -// timer.in(dit_len, stop_26); -// } - -// //================================================================================ -// // dah(): transmit a single dah -// //================================================================================ -// void dah(int dit_len = 1000) { -// output26State = "on"; -// digitalWrite(output26, HIGH); -// timer.in(dit_len * 3, stop_26); -// } - -// //================================================================================ -// // char_space()): transmit a character space -// //================================================================================ -// // A function that does nothing except (hopefully) block the timer. -// bool empty(void *) { -// return false; -// } - -// void char_space(int dit_len = 1000) { - -// timer.in(dit_len, empty); -// } - -// void k(){ -// Serial.println("K"); -// dah(); -// char_space(); -// dit(); -// char_space(); -// dah(); -// } - -// // ^^^^ - -// //telegraph -// //Telegraph telegraph(LED_BUILTIN, 10, HIGH); -// Telegraph telegraph26(output26, 10, HIGH); - -//arduinomorse -//LEDMorseSender sender(LED_BUILTIN); - -//Etherkit Morse -//Morse morse(LED_BUILTIN, 15); - //jled from https://github.com/jandelgado/jled/blob/master/examples/morse/morse_effect.h class MorseEffect : public jled::BrightnessEvaluator { Morse morse_; @@ -379,18 +293,6 @@ auto morseMO5_blink = JLed(blinker).UserFunc(&morseEffectMO5).DelayAfter(word_space_ms).Forever(); auto morseToSend_blink = morseTEST_blink; // set this up to overwrite later - -// format and print a time_t value -// void printTime(time_t t) -// { -// char buf[25]; -// char m[4]; // temporary storage for month string (DateStrings.cpp uses shared buffer) -// strcpy(m, monthShortStr(month(t))); -// sprintf(buf, "%.2d:%.2d:%.2d %s %.2d %s %d", -// hour(t), minute(t), second(t), dayShortStr(weekday(t)), day(t), m, year(t)); -// Serial.println(buf); -// } - //================================================================================ // start_program(): a function to start the planned program at the planned time //================================================================================ @@ -407,20 +309,6 @@ void setup() { Serial.begin(115200); pinMode(alarmPin, INPUT_PULLUP); // Set alarm pin as pullup - // Disable and clear both alarms - // rtc.disableAlarm(1); - // rtc.disableAlarm(2); - // rtc.clearAlarm(1); - // rtc.clearAlarm(2); - // rtc.writeSqwPinMode(DS3231_OFF); // Place SQW pin into alarm interrupt mode - - // https://github.com/JChristensen/DS3232RTC/blob/master/examples/TimeRTC/TimeRTC.ino - // rtc.begin(); - // setSyncProvider(rtc.get); // the function to get the time from the RTC - // if(timeStatus() != timeSet) - // Serial.println("Unable to sync with the RTC"); - // else - // Serial.println("RTC has set the system time"); if (! rtc.begin()) { Serial.println("Couldn't find RTC"); @@ -444,13 +332,6 @@ void setup() { Serial.print(alarm_one.toString(buff)); Serial.println(" (only HH:MM:SS day-of-month are accurate)"); - // Timer example, blink main LED - pinMode(LED_BUILTIN, OUTPUT); // set LED pin to OUTPUT - // call the toggle_led function every 10000 millis (10 second) - //timer.every(10000, toggle_led); - // call the toggle_gpio_26 function - //timer.every(1000, toggle_gpio_26); - // Initialize the output variables as outputs pinMode(keyer, OUTPUT); pinMode(blinker, OUTPUT); @@ -460,34 +341,15 @@ void setup() { // Initialize SPIFFS SPIFFS.begin(true); - //#ifdef ESP32 if(!SPIFFS.begin(true)){ Serial.println("An Error has occurred while mounting SPIFFS"); return; } - //#else if(!SPIFFS.begin()){ Serial.println("An Error has occurred while mounting SPIFFS"); return; } - //#endif - // Make sure files exist, maybe with defaults here - // if(SPIFFS.exists("/inputString.txt") == 0){ - // writeFile(SPIFFS, "/inputString.txt", "CQ"); - // } - // if(SPIFFS.exists("/inputSend.txt") == 0){ - // writeFile(SPIFFS, "/inputSend.txt", "0"); - // } - // if(SPIFFS.exists("/inputWPM.txt") == 0){ - // writeFile(SPIFFS, "/inputWPM.txt", "10"); - // } - // if(SPIFFS.exists("/inputMsg.txt") == 0){ - // writeFile(SPIFFS, "/inputMsg.txt", "0"); - // } - // if(SPIFFS.exists("/inputFloat.txt") == 0){ - // writeFile(SPIFFS, "/inputFloat.txt", "1.1"); - // } // Read in existing data @@ -639,25 +501,12 @@ void setup() { Serial.print(alarm_one.toString(buff)); Serial.println(" (only HH:MM:SS day-of-month are accurate)"); } - // else { - // inputMessage = "No message sent"; - // } - //request->send(200, "text/plain", inputMessage); // https://techtutorialsx.com/2018/01/14/esp32-arduino-http-server-external-and-internal-redirects/ request->redirect("/"); }); server.onNotFound(notFound); server.begin(); - //telegraph - //telegraph.send("CQ CQ CQ"); - //telegraph26.send("CQ CQ CQ DE W1CDN K"); - - // arduinomorse - // sender.setup(); - // sender.setMessage(String("73 de kb3jcy ")); - // sender.startSending(); - } void loop() { @@ -677,26 +526,6 @@ void loop() { rtc.clearAlarm(2); // clear the other one just in case } - // DateTime now = rtc.now(); - // Serial.print(now.year(), DEC); - // Serial.print('/'); - // Serial.print(now.month(), DEC); - // Serial.print('/'); - // Serial.print(now.day(), DEC); - // Serial.print(" ("); - // Serial.print(now.dayOfTheWeek()); - // Serial.print(") "); - // Serial.print(now.hour(), DEC); - // Serial.print(':'); - // Serial.print(now.minute(), DEC); - // Serial.print(':'); - // Serial.print(now.second(), DEC); - // Serial.println(); - - - //arduinomorse - //sender.continueSending(); - // See which message we are sending // Only do this when the message has been updated. if(yourInputMsg != yourInputMsg_old){ @@ -756,21 +585,4 @@ void loop() { } //morseToSend.Update(); - - - // Blink LED according to seconds entered - // if (yourInputInt > 0) { - // Serial.println("GPIO 26 on"); - // output26State = "on"; - // digitalWrite(output26, HIGH); - // delay(yourInputInt * 1000); - // Serial.println(yourInputInt); - // Serial.println("GPIO 26 off"); - // output26State = "off"; - // digitalWrite(output26, LOW); - // delay(yourInputInt * 1000); - // } else { - // output26State = "off"; - // } - } \ No newline at end of file -- 2.30.2 From fbe5a4a6e0e795911a2c2bc1fe9a9330e14d5703 Mon Sep 17 00:00:00 2001 From: mattbk Date: Fri, 8 Sep 2023 21:21:19 -0500 Subject: [PATCH 22/40] Snapshot. --- vulpes/src/main.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index caf81d6..b363a88 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -308,6 +308,9 @@ bool start_program(){ void setup() { Serial.begin(115200); + Serial.print("morseEffectTEST.Period(): "); + Serial.println(morseEffectTEST.Period()); + pinMode(alarmPin, INPUT_PULLUP); // Set alarm pin as pullup if (! rtc.begin()) { @@ -533,6 +536,11 @@ void loop() { if(yourInputMsg == 0){ morseToSend = morseTEST; morseToSend_blink = morseTEST_blink; + // Experiment with timing + int step_length = 30000; // 30 secs + int repeats = step_length / morseEffectTEST.Period(); + morseToSend_blink.UserFunc(&morseEffectTEST).DelayAfter(word_space_ms).Repeat(repeats); + } else if(yourInputMsg == 1){ morseToSend = morseMOE; morseToSend_blink = morseMOE_blink; @@ -559,8 +567,6 @@ void loop() { //jled morseToSend.Reset().Update(); morseToSend_blink.Reset().Update(); - //morse.send("CQ CQ CQ DE W1CDN K"); //etherkit morse - //telegraph26.send("CQ CQ CQ DE W1CDN K"); //telegraph // if you want to send continuous code, and it is sending, keep sending } else if((yourInputSend == 1) & (morseToSend.IsRunning() == true)){ -- 2.30.2 From e706327623365f428d01312d754ce4ca381a9745 Mon Sep 17 00:00:00 2001 From: mattbk Date: Fri, 8 Sep 2023 22:55:31 -0500 Subject: [PATCH 23/40] Shelve. --- vulpes/src/main.cpp | 91 ++++++++++++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 31 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index b363a88..8e9e253 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -53,7 +53,11 @@ int yourInputMsg_old; // to save previous state and check changes float yourInputFloat; uint32_t yourInputTime; //to keep time uint32_t yourInputStartTimeUnix; -int yourProgramRunning; +bool yourProgramRunning; +bool yourProgramRunning_old; +int step_length = 30000; // 30 secs +int cycle_id = 1; // number of this transmitter in cycle +int n_transmitters = 5; //number of transmitters total // HTML web page to handle 3 input fields (inputString, inputSend, inputFloat) const char index_html[] PROGMEM = R"rawliteral( @@ -276,6 +280,7 @@ auto morseMOH = JLed(keyer).UserFunc(&morseEffectMOH).DelayAfter(word_space_ms).Forever(); auto morseMO5 = JLed(keyer).UserFunc(&morseEffectMO5).DelayAfter(word_space_ms).Forever(); +auto morseWait = JLed(keyer).Off().Forever(); // set this up to overwrite later auto morseToSend = morseTEST; // set this up to overwrite later // CW for blinker @@ -291,14 +296,19 @@ auto morseMOH_blink = JLed(blinker).UserFunc(&morseEffectMOH).DelayAfter(word_space_ms).Forever(); auto morseMO5_blink = JLed(blinker).UserFunc(&morseEffectMO5).DelayAfter(word_space_ms).Forever(); +auto morseWait_blink = JLed(blinker).Off().Forever(); // set this up to overwrite later auto morseToSend_blink = morseTEST_blink; // set this up to overwrite later +// Cycle sequence placeholder +JLed morseToSend_sequence_blink[] = {morseToSend_blink, morseWait_blink}; +auto seq = JLedSequence(JLedSequence::eMode::SEQUENCE, morseToSend_sequence_blink).Forever(); + //================================================================================ // start_program(): a function to start the planned program at the planned time //================================================================================ bool start_program(){ Serial.println("The scheduled program has started."); - yourProgramRunning = 1; + yourProgramRunning = true; return false; } @@ -416,7 +426,7 @@ void setup() { yourInputSend = inputMessage.toInt(); // if not running a program, set the program running off if(yourInputSend != 2){ - yourProgramRunning = 0; + yourProgramRunning = false; } } // GET inputWPM value on /get?inputWPM= @@ -523,40 +533,57 @@ void loop() { DateTime now = rtc.now(); // Get the current time char buff[] = "Alarm triggered at hh:mm:ss DDD, DD MMM YYYY"; Serial.println(now.toString(buff)); + yourProgramRunning = true; // Disable and clear alarm rtc.clearAlarm(1); rtc.clearAlarm(2); // clear the other one just in case } + // Once alarm has started the program, set things up to run + if(yourProgramRunning == true){ + Serial.println("Running program"); + // cycle instructions go here + // Experiment with timing + int repeats = step_length / morseEffectTEST.Period(); + // add morseToSend once blink works + // add morseWait once blink works + // Send the message the right number of times + // put in the right message once this works + morseToSend_blink.UserFunc(&morseEffectTEST).DelayAfter(word_space_ms).Repeat(repeats); + // Wait the right amount of time + int remainder_wait = step_length - (morseEffectTEST.Period() * repeats); + int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait)); + morseWait_blink.Off().DelayAfter(total_wait); + // Set up sequence + JLed morseToSend_sequence_blink[] = {morseToSend_blink, morseWait_blink}; + // fix the variable names through here, yikes + auto seq = JLedSequence(JLedSequence::eMode::SEQUENCE, morseToSend_sequence_blink).Forever().Update(); + yourProgramRunning = false; + } else // See which message we are sending // Only do this when the message has been updated. if(yourInputMsg != yourInputMsg_old){ //morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update(); - if(yourInputMsg == 0){ - morseToSend = morseTEST; - morseToSend_blink = morseTEST_blink; - // Experiment with timing - int step_length = 30000; // 30 secs - int repeats = step_length / morseEffectTEST.Period(); - morseToSend_blink.UserFunc(&morseEffectTEST).DelayAfter(word_space_ms).Repeat(repeats); - - } else if(yourInputMsg == 1){ - morseToSend = morseMOE; - morseToSend_blink = morseMOE_blink; - } else if(yourInputMsg == 2){ - morseToSend = morseMOI; - morseToSend_blink = morseMOI_blink; - } else if(yourInputMsg == 3){ - morseToSend = morseMOS; - morseToSend_blink = morseMOS_blink; - } else if(yourInputMsg == 4){ - morseToSend = morseMOH; - morseToSend_blink = morseMOH_blink; - } else if(yourInputMsg == 5){ - morseToSend = morseMO5; - morseToSend_blink = morseMO5_blink; - } + if(yourInputMsg == 0){ + morseToSend = morseTEST; + morseToSend_blink = morseTEST_blink; + } else if(yourInputMsg == 1){ + morseToSend = morseMOE; + morseToSend_blink = morseMOE_blink; + } else if(yourInputMsg == 2){ + morseToSend = morseMOI; + morseToSend_blink = morseMOI_blink; + } else if(yourInputMsg == 3){ + morseToSend = morseMOS; + morseToSend_blink = morseMOS_blink; + } else if(yourInputMsg == 4){ + morseToSend = morseMOH; + morseToSend_blink = morseMOH_blink; + } else if(yourInputMsg == 5){ + morseToSend = morseMO5; + morseToSend_blink = morseMO5_blink; + } // Keeps the key from locking up yourInputMsg_old = yourInputMsg; } @@ -574,14 +601,16 @@ void loop() { morseToSend_blink.Update(); // if you want to send cycle code and it is sending, keep sending - } else if((yourInputSend == 2) & (morseToSend.IsRunning() == true)){ + } else if((yourInputSend == 2) & (seq.Update() == true)){ morseToSend.Update(); - morseToSend_blink.Update(); + //morseToSend_blink.Update(); + seq.Update(); // if you want to send cycle code and it's not sending, then start it up - } else if((yourInputSend == 2) & (morseToSend.IsRunning() == false)){ + } else if((yourInputSend == 2) & (seq.Update() == false)){ morseToSend.Reset().Update(); - morseToSend_blink.Reset().Update(); + //morseToSend_blink.Reset().Update(); + seq.Update(); // if you don't want to send code } else { -- 2.30.2 From 40baa679e1f473aa95282f4f5960b39e90d69d74 Mon Sep 17 00:00:00 2001 From: mattbk Date: Sat, 9 Sep 2023 12:53:34 -0500 Subject: [PATCH 24/40] Working cycle example with hardcoded variables. --- vulpes/platformio.ini | 2 +- vulpes/src/main.cpp | 51 +++++++++++++++++++------------------------ 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/vulpes/platformio.ini b/vulpes/platformio.ini index 1a2242f..070e79a 100644 --- a/vulpes/platformio.ini +++ b/vulpes/platformio.ini @@ -21,7 +21,7 @@ lib_deps = me-no-dev/AsyncTCP@^1.1.1 me-no-dev/ESP Async WebServer@^1.2.3 contrem/arduino-timer@^3.0.1 - kj7rrv/Telegraph@^1.0.0 + ;kj7rrv/Telegraph@^1.0.0 jandelgado/JLed@^4.13.0 ;adafruit/RTClib@^2.1.1 https://github.com/adafruit/RTClib.git ; >=2.1.2 diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index 8e9e253..a3e948b 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -57,7 +57,7 @@ bool yourProgramRunning; bool yourProgramRunning_old; int step_length = 30000; // 30 secs int cycle_id = 1; // number of this transmitter in cycle -int n_transmitters = 5; //number of transmitters total +int n_transmitters = 2; //number of transmitters total // HTML web page to handle 3 input fields (inputString, inputSend, inputFloat) const char index_html[] PROGMEM = R"rawliteral( @@ -280,7 +280,6 @@ auto morseMOH = JLed(keyer).UserFunc(&morseEffectMOH).DelayAfter(word_space_ms).Forever(); auto morseMO5 = JLed(keyer).UserFunc(&morseEffectMO5).DelayAfter(word_space_ms).Forever(); -auto morseWait = JLed(keyer).Off().Forever(); // set this up to overwrite later auto morseToSend = morseTEST; // set this up to overwrite later // CW for blinker @@ -296,12 +295,22 @@ auto morseMOH_blink = JLed(blinker).UserFunc(&morseEffectMOH).DelayAfter(word_space_ms).Forever(); auto morseMO5_blink = JLed(blinker).UserFunc(&morseEffectMO5).DelayAfter(word_space_ms).Forever(); -auto morseWait_blink = JLed(blinker).Off().Forever(); // set this up to overwrite later auto morseToSend_blink = morseTEST_blink; // set this up to overwrite later -// Cycle sequence placeholder -JLed morseToSend_sequence_blink[] = {morseToSend_blink, morseWait_blink}; -auto seq = JLedSequence(JLedSequence::eMode::SEQUENCE, morseToSend_sequence_blink).Forever(); +// Cycle stuff +auto morse_cycle = morseEffectMOS; +int period = morse_cycle.Period(); +int repeats = step_length / period; +int remainder_wait = step_length - (period * repeats); +int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait)); +JLed morses[] = { + // WOW it looks like you can't do Repeat() and DelayAfter() at the same time? + // Opened https://github.com/jandelgado/jled/issues/122 + JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats), + //JLed(blinker).FadeOn(1000).Repeat(3) + JLed(blinker).Off(total_wait) +}; +auto morses_sequence = JLedSequence(JLedSequence::eMode::SEQUENCE, morses); //================================================================================ // start_program(): a function to start the planned program at the planned time @@ -528,7 +537,7 @@ void loop() { // This statement from https://github.com/garrysblog/DS3231-Alarm-With-Adafruit-RTClib-Library/blob/master/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired.ino // Check if alarm by polling SQW alarm pin - if (yourInputSend == 2 & digitalRead(alarmPin) == LOW) { + if ((yourInputSend == 2) & (digitalRead(alarmPin) == LOW)) { // Print current time and date DateTime now = rtc.now(); // Get the current time char buff[] = "Alarm triggered at hh:mm:ss DDD, DD MMM YYYY"; @@ -542,24 +551,8 @@ void loop() { // Once alarm has started the program, set things up to run if(yourProgramRunning == true){ - Serial.println("Running program"); - // cycle instructions go here - // Experiment with timing - int repeats = step_length / morseEffectTEST.Period(); - // add morseToSend once blink works - // add morseWait once blink works - // Send the message the right number of times - // put in the right message once this works - morseToSend_blink.UserFunc(&morseEffectTEST).DelayAfter(word_space_ms).Repeat(repeats); - // Wait the right amount of time - int remainder_wait = step_length - (morseEffectTEST.Period() * repeats); - int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait)); - morseWait_blink.Off().DelayAfter(total_wait); - // Set up sequence - JLed morseToSend_sequence_blink[] = {morseToSend_blink, morseWait_blink}; - // fix the variable names through here, yikes - auto seq = JLedSequence(JLedSequence::eMode::SEQUENCE, morseToSend_sequence_blink).Forever().Update(); - yourProgramRunning = false; + morses_sequence.Forever().Update(); + yourProgramRunning = false; } else // See which message we are sending // Only do this when the message has been updated. @@ -601,16 +594,16 @@ void loop() { morseToSend_blink.Update(); // if you want to send cycle code and it is sending, keep sending - } else if((yourInputSend == 2) & (seq.Update() == true)){ + } else if((yourInputSend == 2) & (morses_sequence.Update() == true)){ morseToSend.Update(); //morseToSend_blink.Update(); - seq.Update(); + morses_sequence.Update(); // if you want to send cycle code and it's not sending, then start it up - } else if((yourInputSend == 2) & (seq.Update() == false)){ + } else if((yourInputSend == 2) & (morses_sequence.Update() == false)){ morseToSend.Reset().Update(); //morseToSend_blink.Reset().Update(); - seq.Update(); + morses_sequence.Reset(); // if you don't want to send code } else { -- 2.30.2 From 2127d4a75a1c661578fc1bb417043be9c27c6822 Mon Sep 17 00:00:00 2001 From: mattbk Date: Sat, 9 Sep 2023 13:14:28 -0500 Subject: [PATCH 25/40] Add extra space at end of message to workaround Jled bug. --- vulpes/src/main.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index a3e948b..66a5c09 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -260,12 +260,13 @@ float wpm = 10; float ms_per_dit = 1000 * (60 / (50 * wpm)); int word_space_ms = ms_per_dit * 7; // Hardcoding messages and WPM for now, will come back and make it more flexible. -MorseEffect morseEffectTEST("TEST TEST TEST DE W1CDN", ms_per_dit); -MorseEffect morseEffectMOE("MOE", ms_per_dit); -MorseEffect morseEffectMOI("MOI", ms_per_dit); -MorseEffect morseEffectMOS("MOS", ms_per_dit); -MorseEffect morseEffectMOH("MOH", ms_per_dit); -MorseEffect morseEffectMO5("MO5", ms_per_dit); +// Extra space at the end to get around https://github.com/jandelgado/jled/issues/122 on cycle mode +MorseEffect morseEffectTEST("TEST TEST TEST DE W1CDN ", ms_per_dit); +MorseEffect morseEffectMOE("MOE ", ms_per_dit); +MorseEffect morseEffectMOI("MOI ", ms_per_dit); +MorseEffect morseEffectMOS("MOS ", ms_per_dit); +MorseEffect morseEffectMOH("MOH ", ms_per_dit); +MorseEffect morseEffectMO5("MO5 ", ms_per_dit); // CW for keyer auto morseTEST = -- 2.30.2 From 70decbbcca420194fc144ea19fc4d1319038b8a9 Mon Sep 17 00:00:00 2001 From: mattbk Date: Sat, 9 Sep 2023 16:01:41 -0500 Subject: [PATCH 26/40] Only send cycles when program is running. --- vulpes/src/main.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index 66a5c09..732085f 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -53,8 +53,8 @@ int yourInputMsg_old; // to save previous state and check changes float yourInputFloat; uint32_t yourInputTime; //to keep time uint32_t yourInputStartTimeUnix; -bool yourProgramRunning; -bool yourProgramRunning_old; +bool startProgram; +bool programRunning; int step_length = 30000; // 30 secs int cycle_id = 1; // number of this transmitter in cycle int n_transmitters = 2; //number of transmitters total @@ -318,7 +318,7 @@ auto morses_sequence = JLedSequence(JLedSequence::eMode::SEQUENCE, morses); //================================================================================ bool start_program(){ Serial.println("The scheduled program has started."); - yourProgramRunning = true; + startProgram = true; return false; } @@ -436,7 +436,8 @@ void setup() { yourInputSend = inputMessage.toInt(); // if not running a program, set the program running off if(yourInputSend != 2){ - yourProgramRunning = false; + startProgram = false; + programRunning = false; } } // GET inputWPM value on /get?inputWPM= @@ -538,12 +539,12 @@ void loop() { // This statement from https://github.com/garrysblog/DS3231-Alarm-With-Adafruit-RTClib-Library/blob/master/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired.ino // Check if alarm by polling SQW alarm pin - if ((yourInputSend == 2) & (digitalRead(alarmPin) == LOW)) { + if((yourInputSend == 2) & (digitalRead(alarmPin) == LOW)) { // Print current time and date DateTime now = rtc.now(); // Get the current time char buff[] = "Alarm triggered at hh:mm:ss DDD, DD MMM YYYY"; Serial.println(now.toString(buff)); - yourProgramRunning = true; + startProgram = true; // Disable and clear alarm rtc.clearAlarm(1); @@ -551,9 +552,10 @@ void loop() { } // Once alarm has started the program, set things up to run - if(yourProgramRunning == true){ + if(startProgram == true){ morses_sequence.Forever().Update(); - yourProgramRunning = false; + programRunning = true; + startProgram = false; } else // See which message we are sending // Only do this when the message has been updated. @@ -578,7 +580,7 @@ void loop() { morseToSend = morseMO5; morseToSend_blink = morseMO5_blink; } - // Keeps the key from locking up + // Keeps the key/led from locking up yourInputMsg_old = yourInputMsg; } @@ -595,22 +597,25 @@ void loop() { morseToSend_blink.Update(); // if you want to send cycle code and it is sending, keep sending - } else if((yourInputSend == 2) & (morses_sequence.Update() == true)){ + } else if((yourInputSend == 2) & (programRunning == true) &(morses_sequence.Update() == true)){ morseToSend.Update(); //morseToSend_blink.Update(); morses_sequence.Update(); // if you want to send cycle code and it's not sending, then start it up - } else if((yourInputSend == 2) & (morses_sequence.Update() == false)){ + } else if((yourInputSend == 2) & (programRunning == true) & (morses_sequence.Update() == false)){ morseToSend.Reset().Update(); //morseToSend_blink.Reset().Update(); morses_sequence.Reset(); - + // if the cycle program is not running + } else if((yourInputSend == 2 & (programRunning == false))){ + morses_sequence.Stop(); // if you don't want to send code } else { // stop sending and make sure the pin is off morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update(); morseToSend_blink.Stop(JLed::eStopMode::FULL_OFF).Update(); + morses_sequence.Stop(); } //morseToSend.Update(); -- 2.30.2 From 958e71513cfe3647fcaa0448e782f77be51fd33d Mon Sep 17 00:00:00 2001 From: mattbk Date: Sun, 10 Sep 2023 12:35:02 -0500 Subject: [PATCH 27/40] Snapshot. --- vulpes/src/main.cpp | 136 +++++++++++++++++++++++++++++++------------- 1 file changed, 96 insertions(+), 40 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index 732085f..a1491e6 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -43,6 +43,9 @@ const char* PARAM_FLOAT = "inputFloat"; const char* PARAM_TIME = "inputTimeUnix"; const char* PARAM_START = "inputStartTimeUnix"; const char* PARAM_RUNNING = "programRunning"; +const char* PARAM_STEPLENGTH = "inputStepLength"; +const char* PARAM_CYCLEID = "inputCycleID"; +const char* PARAM_NTRANS = "inputNtransmitters"; // Global variables String yourInputString; @@ -55,7 +58,10 @@ uint32_t yourInputTime; //to keep time uint32_t yourInputStartTimeUnix; bool startProgram; bool programRunning; -int step_length = 30000; // 30 secs +int yourInputStepLength; +int yourInputCycleID; +int yourInputNtransmitters; +int step_length = 10000; // 10 secs int cycle_id = 1; // number of this transmitter in cycle int n_transmitters = 2; //number of transmitters total @@ -107,19 +113,19 @@ const char index_html[] PROGMEM = R"rawliteral( } - +

Vulpes Radio Orienteering Controller

Local time:

- -

Sending program (cycle doesn't work yet) (current value: %inputSend%): +

General Settings

+

Sending program:
- Message (current value %inputMsg%): + Message:

+

Cycle Settings

Cycle start time
Current value: , but only day-of-month HH:MM:SS are used. Only applies when Sending Program is set to "2 - Cycle". @@ -136,6 +143,11 @@ const char index_html[] PROGMEM = R"rawliteral(

+

+ Step length:
+ Cycle ID:
+ Number of transmitters:
+

@@ -221,6 +233,15 @@ String processor(const String& var){ else if(var == "inputMsg"){ return readFile(SPIFFS, "/inputMsg.txt"); } + else if(var == "inputStepLength"){ + return readFile(SPIFFS, "/inputStepLength.txt"); + } + else if(var == "inputCycleID"){ + return readFile(SPIFFS, "/inputCycleID.txt"); + } + else if(var == "inputNtransmitters"){ + return readFile(SPIFFS, "/inputNtransmitters.txt"); + } else if(var == "inputFloat"){ return readFile(SPIFFS, "/inputFloat.txt"); } else if(var == "inputStartTimeUnix"){ @@ -304,14 +325,14 @@ int period = morse_cycle.Period(); int repeats = step_length / period; int remainder_wait = step_length - (period * repeats); int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait)); -JLed morses[] = { +JLed morses_blink[] = { // WOW it looks like you can't do Repeat() and DelayAfter() at the same time? // Opened https://github.com/jandelgado/jled/issues/122 JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats), //JLed(blinker).FadeOn(1000).Repeat(3) JLed(blinker).Off(total_wait) }; -auto morses_sequence = JLedSequence(JLedSequence::eMode::SEQUENCE, morses); +auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink); //================================================================================ // start_program(): a function to start the planned program at the planned time @@ -328,9 +349,6 @@ bool start_program(){ void setup() { Serial.begin(115200); - Serial.print("morseEffectTEST.Period(): "); - Serial.println(morseEffectTEST.Period()); - pinMode(alarmPin, INPUT_PULLUP); // Set alarm pin as pullup if (! rtc.begin()) { @@ -349,6 +367,11 @@ void setup() { //rtc.adjust(DateTime(2023, 9, 2, 17, 32, 0)); } + // Report the RTC time + Serial.print("RTC time on startup: "); + Serial.println(rtc.now().unixtime()); + Serial.println(rtc.now().timestamp()); + // Are there any RTC alarms set? DateTime alarm_one = rtc.getAlarm1(); // Get the current time char buff[] = "Alarm 1 set for at hh:mm:ss DDD, DD MMM YYYY"; @@ -373,8 +396,6 @@ void setup() { return; } - - // Read in existing data yourInputString = readFile(SPIFFS, "/inputString.txt"); yourInputSend = readFile(SPIFFS, "/inputSend.txt").toInt(); @@ -382,6 +403,9 @@ void setup() { yourInputMsg = readFile(SPIFFS, "/inputMsg.txt").toInt(); yourInputFloat = readFile(SPIFFS, "/inputFloat.txt").toFloat(); yourInputStartTimeUnix = readFile(SPIFFS, "/inputStartTimeUnix.txt").toInt(); + yourInputStepLength = readFile(SPIFFS, "/inputStepLength.txt").toInt(); + yourInputCycleID = readFile(SPIFFS, "/inputCycleID.txt").toInt(); + yourInputNtransmitters = readFile(SPIFFS, "/inputNtransmitters.txt").toInt(); // On restart, keep doing what you were doing before yourInputMsg_old = yourInputMsg; @@ -454,6 +478,24 @@ void setup() { yourInputMsg_old = yourInputMsg; yourInputMsg = inputMessage.toInt(); } + // GET inputStepLength value on /get?inputStepLength= + if (request->hasParam(PARAM_STEPLENGTH)) { + inputMessage = request->getParam(PARAM_STEPLENGTH)->value(); + writeFile(SPIFFS, "/inputStepLength.txt", inputMessage.c_str()); + yourInputStepLength = inputMessage.toInt(); + } + // GET inputCycleID value on /get?inputCycleID= + if (request->hasParam(PARAM_CYCLEID)) { + inputMessage = request->getParam(PARAM_CYCLEID)->value(); + writeFile(SPIFFS, "/inputCycleID.txt", inputMessage.c_str()); + yourInputCycleID = inputMessage.toInt(); + } + // GET inputNtransmitters value on /get?inputNtransmitters= + if (request->hasParam(PARAM_NTRANS)) { + inputMessage = request->getParam(PARAM_NTRANS)->value(); + writeFile(SPIFFS, "/inputNtransmitters.txt", inputMessage.c_str()); + yourInputNtransmitters = inputMessage.toInt(); + } // GET inputTimeUnix value on /get?inputTimeUnix= if (request->hasParam(PARAM_TIME)) { inputMessage = request->getParam(PARAM_TIME)->value(); @@ -537,27 +579,7 @@ void loop() { // Timers timer.tick(); - // This statement from https://github.com/garrysblog/DS3231-Alarm-With-Adafruit-RTClib-Library/blob/master/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired.ino - // Check if alarm by polling SQW alarm pin - if((yourInputSend == 2) & (digitalRead(alarmPin) == LOW)) { - // Print current time and date - DateTime now = rtc.now(); // Get the current time - char buff[] = "Alarm triggered at hh:mm:ss DDD, DD MMM YYYY"; - Serial.println(now.toString(buff)); - startProgram = true; - - // Disable and clear alarm - rtc.clearAlarm(1); - rtc.clearAlarm(2); // clear the other one just in case - } - - // Once alarm has started the program, set things up to run - if(startProgram == true){ - morses_sequence.Forever().Update(); - programRunning = true; - startProgram = false; - } else - // See which message we are sending +// See which message we are sending // Only do this when the message has been updated. if(yourInputMsg != yourInputMsg_old){ //morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update(); @@ -584,6 +606,40 @@ void loop() { yourInputMsg_old = yourInputMsg; } + // This statement from https://github.com/garrysblog/DS3231-Alarm-With-Adafruit-RTClib-Library/blob/master/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired.ino + // Check if alarm by polling SQW alarm pin + if((yourInputSend == 2) & (digitalRead(alarmPin) == LOW)) { + // Print current time and date + DateTime now = rtc.now(); // Get the current time + char buff[] = "Alarm triggered at hh:mm:ss DDD, DD MMM YYYY"; + Serial.println(now.toString(buff)); + startProgram = true; + + // Disable and clear alarm + rtc.clearAlarm(1); + rtc.clearAlarm(2); // clear the other one just in case + } + + // Once alarm has started the program, set things up to run + if(startProgram == true){ + //auto morse_cycle = morseEffectMOS; + int period = morse_cycle.Period(); + int repeats = step_length / period; + int remainder_wait = step_length - (period * repeats); + int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait)); + JLed morses_blink[] = { + // WOW it looks like you can't do Repeat() and DelayAfter() at the same time? + // Opened https://github.com/jandelgado/jled/issues/122 + JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats), + //JLed(blinker).FadeOn(1000).Repeat(3) + JLed(blinker).Off(total_wait) + }; + auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink); + + morses_sequence_blink.Forever().Update(); + programRunning = true; + startProgram = false; + } // if you want to send continuous code, and it's not sending, then start it up if((yourInputSend == 1) & (morseToSend.IsRunning() == false)){ @@ -597,25 +653,25 @@ void loop() { morseToSend_blink.Update(); // if you want to send cycle code and it is sending, keep sending - } else if((yourInputSend == 2) & (programRunning == true) &(morses_sequence.Update() == true)){ + } else if((yourInputSend == 2) & (programRunning == true) &(morses_sequence_blink.Update() == true)){ morseToSend.Update(); //morseToSend_blink.Update(); - morses_sequence.Update(); + morses_sequence_blink.Update(); // if you want to send cycle code and it's not sending, then start it up - } else if((yourInputSend == 2) & (programRunning == true) & (morses_sequence.Update() == false)){ + } else if((yourInputSend == 2) & (programRunning == true) & (morses_sequence_blink.Update() == false)){ morseToSend.Reset().Update(); //morseToSend_blink.Reset().Update(); - morses_sequence.Reset(); + morses_sequence_blink.Reset(); // if the cycle program is not running - } else if((yourInputSend == 2 & (programRunning == false))){ - morses_sequence.Stop(); + } else if((yourInputSend == 2) & (programRunning == false)){ + morses_sequence_blink.Stop(); // if you don't want to send code } else { // stop sending and make sure the pin is off morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update(); morseToSend_blink.Stop(JLed::eStopMode::FULL_OFF).Update(); - morses_sequence.Stop(); + morses_sequence_blink.Stop(); } //morseToSend.Update(); -- 2.30.2 From 1bde39e148706d3a8659d17a90dd4472629d08d8 Mon Sep 17 00:00:00 2001 From: mattbk Date: Mon, 11 Sep 2023 21:09:27 -0500 Subject: [PATCH 28/40] Snapshot. --- vulpes/platformio.ini | 2 +- vulpes/src/main.cpp | 66 +++++++++++++++++++++---------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/vulpes/platformio.ini b/vulpes/platformio.ini index 070e79a..9502974 100644 --- a/vulpes/platformio.ini +++ b/vulpes/platformio.ini @@ -22,7 +22,7 @@ lib_deps = me-no-dev/ESP Async WebServer@^1.2.3 contrem/arduino-timer@^3.0.1 ;kj7rrv/Telegraph@^1.0.0 - jandelgado/JLed@^4.13.0 + jandelgado/JLed@^4.13.1 ;adafruit/RTClib@^2.1.1 https://github.com/adafruit/RTClib.git ; >=2.1.2 adafruit/Adafruit BusIO@^1.14.3 diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index a1491e6..2e46b53 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -136,17 +136,17 @@ const char index_html[] PROGMEM = R"rawliteral(

Cycle Settings

+

Only applies when Sending Program is set to "2 - Cycle". You cannot set a cycle start date more than a month in advance.

Cycle start time
- Current value: , but only day-of-month HH:MM:SS are used. - Only applies when Sending Program is set to "2 - Cycle". - You cannot set a cycle start date more than a month in advance. + Current value: +

- Step length:
- Cycle ID:
- Number of transmitters:
+ Step length: milliseconds
+ Cycle ID:
+ Number of transmitters: