Set old msg to new msg (fix lockup) and change CQ to TEST.

This commit is contained in:
mattbk 2023-09-04 17:26:03 -05:00
parent 48db6bc4c9
commit a3ec425c88

View File

@ -76,7 +76,7 @@ const char index_html[] PROGMEM = R"rawliteral(
Message (current value <b>%inputMsg%</b>): Message (current value <b>%inputMsg%</b>):
<select name="inputMsg" id="message"> <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="1">1 - MOE</option>
<option value="2">2 - MOI</option> <option value="2">2 - MOI</option>
<option value="3">3 - MOS</option> <option value="3">3 - MOS</option>
@ -100,7 +100,7 @@ String output26State = "off";
String output27State = "off"; String output27State = "off";
// Assign output variables to GPIO pins // 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; const int output27 = 27;
// Timers // Timers
@ -277,15 +277,15 @@ float wpm = 10;
float ms_per_dit = 1000 * (60 / (50 * wpm)); float ms_per_dit = 1000 * (60 / (50 * wpm));
int word_space_ms = ms_per_dit * 7; int word_space_ms = ms_per_dit * 7;
// Hardcoding messages and WPM for now, will come back and make it more flexible. // 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 morseEffectMOE("MOE", ms_per_dit);
MorseEffect morseEffectMOI("MOI", ms_per_dit); MorseEffect morseEffectMOI("MOI", ms_per_dit);
MorseEffect morseEffectMOS("MOS", ms_per_dit); MorseEffect morseEffectMOS("MOS", ms_per_dit);
MorseEffect morseEffectMOH("MOH", ms_per_dit); MorseEffect morseEffectMOH("MOH", ms_per_dit);
MorseEffect morseEffectMO5("MO5", ms_per_dit); MorseEffect morseEffectMO5("MO5", ms_per_dit);
auto morseCQ = auto morseTEST =
JLed(output26).UserFunc(&morseEffectCQ).DelayAfter(word_space_ms).Forever(); JLed(output26).UserFunc(&morseEffectTEST).DelayAfter(word_space_ms).Forever();
auto morseMOE = auto morseMOE =
JLed(output26).UserFunc(&morseEffectMOE).DelayAfter(word_space_ms).Forever(); JLed(output26).UserFunc(&morseEffectMOE).DelayAfter(word_space_ms).Forever();
auto morseMOI = auto morseMOI =
@ -296,7 +296,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 = morseCQ; // set this up to overwrite later auto morseToSend = morseTEST; // set this up to overwrite later
// format and print a time_t value // format and print a time_t value
@ -397,7 +397,7 @@ void setup() {
// On restart, keep doing what you were doing before // On restart, keep doing what you were doing before
yourInputMsg_old = yourInputMsg; yourInputMsg_old = yourInputMsg;
if(yourInputMsg == 0){ if(yourInputMsg == 0){
morseToSend = morseCQ; morseToSend = morseTEST;
} else if(yourInputMsg == 1){ } else if(yourInputMsg == 1){
morseToSend = morseMOE; morseToSend = morseMOE;
} else if(yourInputMsg == 2){ } else if(yourInputMsg == 2){
@ -539,7 +539,7 @@ void loop() {
if(yourInputMsg != yourInputMsg_old){ if(yourInputMsg != yourInputMsg_old){
//morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update(); //morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update();
if(yourInputMsg == 0){ if(yourInputMsg == 0){
morseToSend = morseCQ; morseToSend = morseTEST;
} else if(yourInputMsg == 1){ } else if(yourInputMsg == 1){
morseToSend = morseMOE; morseToSend = morseMOE;
} else if(yourInputMsg == 2){ } else if(yourInputMsg == 2){
@ -551,6 +551,8 @@ void loop() {
} else if(yourInputMsg == 5){ } else if(yourInputMsg == 5){
morseToSend = morseMO5; 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 // stop sending and make sure the pin is off
morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update(); morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update();
} }
morseToSend.Update(); //morseToSend.Update();