Choose message to send.
This only works after you submit the webform again. More work needed so it works on start.
This commit is contained in:
parent
cc4d798a03
commit
6af5dfcd0e
|
@ -43,7 +43,8 @@ const char* PARAM_FLOAT = "inputFloat";
|
||||||
String yourInputString;
|
String yourInputString;
|
||||||
int yourInputSend;
|
int yourInputSend;
|
||||||
int yourInputWPM;
|
int yourInputWPM;
|
||||||
int yourInputMsg;
|
int yourInputMsg = 0;
|
||||||
|
int yourInputMsg_old = 0; // 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)
|
||||||
|
@ -284,6 +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()
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
// 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)
|
||||||
|
@ -384,6 +386,8 @@ void setup() {
|
||||||
if (request->hasParam(PARAM_MSG)) {
|
if (request->hasParam(PARAM_MSG)) {
|
||||||
inputMessage = request->getParam(PARAM_MSG)->value();
|
inputMessage = request->getParam(PARAM_MSG)->value();
|
||||||
writeFile(SPIFFS, "/inputMsg.txt", inputMessage.c_str());
|
writeFile(SPIFFS, "/inputMsg.txt", inputMessage.c_str());
|
||||||
|
// save previous state
|
||||||
|
yourInputMsg_old = yourInputMsg;
|
||||||
yourInputMsg = inputMessage.toInt();
|
yourInputMsg = inputMessage.toInt();
|
||||||
}
|
}
|
||||||
// GET inputFloat value on <ESP_IP>/get?inputFloat=<inputMessage>
|
// GET inputFloat value on <ESP_IP>/get?inputFloat=<inputMessage>
|
||||||
|
@ -423,46 +427,50 @@ void loop() {
|
||||||
//sender.continueSending();
|
//sender.continueSending();
|
||||||
|
|
||||||
// See which message we are sending
|
// See which message we are sending
|
||||||
// if(yourInputMsg == 0){
|
// Only do this when the message has been updated.
|
||||||
// morseToSend = JLed(output26).UserFunc(&morseEffectCQ).DelayAfter(word_space_ms).Forever();
|
if(yourInputMsg != yourInputMsg_old){
|
||||||
// } else if(yourInputMsg == 1){
|
morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update();
|
||||||
// morseToSend = morseMOE;
|
if(yourInputMsg == 0){
|
||||||
// } else if(yourInputMsg == 2){
|
morseToSend = morseCQ;
|
||||||
// morseToSend = morseMOI;
|
} else if(yourInputMsg == 1){
|
||||||
// } else if(yourInputMsg == 3){
|
morseToSend = morseMOE;
|
||||||
// morseToSend = morseMOS;
|
} else if(yourInputMsg == 2){
|
||||||
// } else if(yourInputMsg == 4){
|
morseToSend = morseMOI;
|
||||||
// morseToSend = morseMOH;
|
} else if(yourInputMsg == 3){
|
||||||
// } else if(yourInputMsg == 5){
|
morseToSend = morseMOS;
|
||||||
// morseToSend = morseMO5;
|
} else if(yourInputMsg == 4){
|
||||||
// }
|
morseToSend = morseMOH;
|
||||||
|
} else if(yourInputMsg == 5){
|
||||||
|
morseToSend = morseMO5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// if you want to send continuous code, and it's not sending, then start it up
|
// if you want to send continuous code, and it's not sending, then start it up
|
||||||
if((yourInputSend == 1) & (morseCQ.IsRunning() == false)){
|
if((yourInputSend == 1) & (morseToSend.IsRunning() == false)){
|
||||||
//jled
|
//jled
|
||||||
morseCQ.Reset().Update();
|
morseToSend.Reset().Update();
|
||||||
//morse.send("CQ CQ CQ DE W1CDN K"); //etherkit morse
|
//morse.send("CQ CQ CQ DE W1CDN K"); //etherkit morse
|
||||||
//telegraph26.send("CQ CQ CQ DE W1CDN K"); //telegraph
|
//telegraph26.send("CQ CQ CQ DE W1CDN K"); //telegraph
|
||||||
|
|
||||||
// if you want to send continuous code, and it is sending, keep sending
|
// if you want to send continuous code, and it is sending, keep sending
|
||||||
} else if((yourInputSend == 1) & (morseCQ.IsRunning() == true)){
|
} else if((yourInputSend == 1) & (morseToSend.IsRunning() == true)){
|
||||||
morseCQ.Update();
|
morseToSend.Update();
|
||||||
|
|
||||||
// if you want to send cycle code and it is sending, keep sending
|
// if you want to send cycle code and it is sending, keep sending
|
||||||
} else if((yourInputSend == 2) & (morseCQ.IsRunning() == true)){
|
} else if((yourInputSend == 2) & (morseToSend.IsRunning() == true)){
|
||||||
morseCQ.Update();
|
morseToSend.Update();
|
||||||
|
|
||||||
// if you want to send cycle code and it's not sending, then start it up
|
// if you want to send cycle code and it's not sending, then start it up
|
||||||
} else if((yourInputSend == 2) & (morseCQ.IsRunning() == true)){
|
} else if((yourInputSend == 2) & (morseToSend.IsRunning() == true)){
|
||||||
morseCQ.Reset().Update();
|
morseToSend.Reset().Update();
|
||||||
|
|
||||||
// if you don't want to send code
|
// if you don't want to send code
|
||||||
} else {
|
} else {
|
||||||
// stop sending and make sure the pin is off
|
// stop sending and make sure the pin is off
|
||||||
morseCQ.Stop(JLed::eStopMode::FULL_OFF).Update();
|
morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update();
|
||||||
}
|
}
|
||||||
morseCQ.Update();
|
morseToSend.Update();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user