Send previous message on startup.

This commit is contained in:
mattbk 2023-09-01 10:01:49 -05:00
parent 6af5dfcd0e
commit 20e075d29d

View File

@ -43,8 +43,8 @@ const char* PARAM_FLOAT = "inputFloat";
String yourInputString; String yourInputString;
int yourInputSend; int yourInputSend;
int yourInputWPM; int yourInputWPM;
int yourInputMsg = 0; int yourInputMsg;
int yourInputMsg_old = 0; // to save previous state and check changes int yourInputMsg_old; // to save previous state and check changes
float yourInputFloat; float yourInputFloat;
// HTML web page to handle 3 input fields (inputString, inputSend, inputFloat) // HTML web page to handle 3 input fields (inputString, inputSend, inputFloat)
@ -285,7 +285,7 @@ auto morseMOH =
JLed(output26).UserFunc(&morseEffectMOH).DelayAfter(word_space_ms).Forever(); JLed(output26).UserFunc(&morseEffectMOH).DelayAfter(word_space_ms).Forever();
auto morseMO5 = auto morseMO5 =
JLed(output26).UserFunc(&morseEffectMO5).DelayAfter(word_space_ms).Forever(); JLed(output26).UserFunc(&morseEffectMO5).DelayAfter(word_space_ms).Forever();
auto morseToSend = JLed(output26); // set this up to overwrite later in loop() auto morseToSend = morseCQ; // set this up to overwrite later
//================================================================================ //================================================================================
// setup(): stuff that only gets done once, after power up (KB1OIQ's description) // setup(): stuff that only gets done once, after power up (KB1OIQ's description)
@ -346,6 +346,23 @@ void setup() {
yourInputMsg = readFile(SPIFFS, "/inputMsg.txt").toInt(); yourInputMsg = readFile(SPIFFS, "/inputMsg.txt").toInt();
yourInputFloat = readFile(SPIFFS, "/inputFloat.txt").toFloat(); yourInputFloat = readFile(SPIFFS, "/inputFloat.txt").toFloat();
// On restart, keep doing what you were doing before
yourInputMsg_old = yourInputMsg;
if(yourInputMsg == 0){
morseToSend = morseCQ;
} else if(yourInputMsg == 1){
morseToSend = morseMOE;
} else if(yourInputMsg == 2){
morseToSend = morseMOI;
} else if(yourInputMsg == 3){
morseToSend = morseMOS;
} else if(yourInputMsg == 4){
morseToSend = morseMOH;
} else if(yourInputMsg == 5){
morseToSend = morseMO5;
}
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password); WiFi.begin(ssid, password);
if (WiFi.waitForConnectResult() != WL_CONNECTED) { if (WiFi.waitForConnectResult() != WL_CONNECTED) {