Fix lockup and message change #21

Merged
W1CDN merged 3 commits from debug-new-message into main 2023-09-04 20:48:14 -05:00
Showing only changes of commit a3ec425c88 - Show all commits

View File

@ -76,7 +76,7 @@ const char index_html[] PROGMEM = R"rawliteral(
Message (current value <b>%inputMsg%</b>):
<select name="inputMsg" id="message">
<option value="0">0 - CQ CQ CQ DE W1CDN</option>
<option value="0">0 - TEST TEST TEST DE W1CDN</option>
<option value="1">1 - MOE</option>
<option value="2">2 - MOI</option>
<option value="3">3 - MOS</option>
@ -100,7 +100,7 @@ String output26State = "off";
String output27State = "off";
// Assign output variables to GPIO pins
const int output26 = 32;//26 for LED; //32 for transmitter keyer
const int output26 = 32; //LED_BUILTIN for on-board (dev);//26 for LED; //32 for transmitter keyer
const int output27 = 27;
// Timers
@ -277,15 +277,15 @@ 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 morseEffectCQ("CQ CQ CQ DE W1CDN", ms_per_dit);
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);
auto morseCQ =
JLed(output26).UserFunc(&morseEffectCQ).DelayAfter(word_space_ms).Forever();
auto morseTEST =
JLed(output26).UserFunc(&morseEffectTEST).DelayAfter(word_space_ms).Forever();
auto morseMOE =
JLed(output26).UserFunc(&morseEffectMOE).DelayAfter(word_space_ms).Forever();
auto morseMOI =
@ -296,7 +296,7 @@ auto morseMOH =
JLed(output26).UserFunc(&morseEffectMOH).DelayAfter(word_space_ms).Forever();
auto morseMO5 =
JLed(output26).UserFunc(&morseEffectMO5).DelayAfter(word_space_ms).Forever();
auto morseToSend = morseCQ; // set this up to overwrite later
auto morseToSend = morseTEST; // set this up to overwrite later
// format and print a time_t value
@ -397,7 +397,7 @@ void setup() {
// On restart, keep doing what you were doing before
yourInputMsg_old = yourInputMsg;
if(yourInputMsg == 0){
morseToSend = morseCQ;
morseToSend = morseTEST;
} else if(yourInputMsg == 1){
morseToSend = morseMOE;
} else if(yourInputMsg == 2){
@ -539,7 +539,7 @@ void loop() {
if(yourInputMsg != yourInputMsg_old){
//morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update();
if(yourInputMsg == 0){
morseToSend = morseCQ;
morseToSend = morseTEST;
} else if(yourInputMsg == 1){
morseToSend = morseMOE;
} else if(yourInputMsg == 2){
@ -551,6 +551,8 @@ void loop() {
} else if(yourInputMsg == 5){
morseToSend = morseMO5;
}
// Keeps the key from locking up
yourInputMsg_old = yourInputMsg;
}
@ -578,7 +580,7 @@ void loop() {
// stop sending and make sure the pin is off
morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update();
}
morseToSend.Update();
//morseToSend.Update();