Webform switch between continuous and cycle sending #12
|
@ -43,7 +43,8 @@ const char* PARAM_FLOAT = "inputFloat";
|
|||
String yourInputString;
|
||||
int yourInputSend;
|
||||
int yourInputWPM;
|
||||
int yourInputMsg;
|
||||
int yourInputMsg = 0;
|
||||
int yourInputMsg_old = 0; // to save previous state and check changes
|
||||
float yourInputFloat;
|
||||
|
||||
// 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();
|
||||
auto morseMO5 =
|
||||
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)
|
||||
|
@ -384,6 +386,8 @@ void setup() {
|
|||
if (request->hasParam(PARAM_MSG)) {
|
||||
inputMessage = request->getParam(PARAM_MSG)->value();
|
||||
writeFile(SPIFFS, "/inputMsg.txt", inputMessage.c_str());
|
||||
// save previous state
|
||||
yourInputMsg_old = yourInputMsg;
|
||||
yourInputMsg = inputMessage.toInt();
|
||||
}
|
||||
// GET inputFloat value on <ESP_IP>/get?inputFloat=<inputMessage>
|
||||
|
@ -423,46 +427,50 @@ void loop() {
|
|||
//sender.continueSending();
|
||||
|
||||
// See which message we are sending
|
||||
// if(yourInputMsg == 0){
|
||||
// morseToSend = JLed(output26).UserFunc(&morseEffectCQ).DelayAfter(word_space_ms).Forever();
|
||||
// } 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;
|
||||
// }
|
||||
// Only do this when the message has been updated.
|
||||
if(yourInputMsg != yourInputMsg_old){
|
||||
morseToSend.Stop(JLed::eStopMode::FULL_OFF).Update();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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
|
||||
morseCQ.Reset().Update();
|
||||
morseToSend.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) & (morseCQ.IsRunning() == true)){
|
||||
morseCQ.Update();
|
||||
} else if((yourInputSend == 1) & (morseToSend.IsRunning() == true)){
|
||||
morseToSend.Update();
|
||||
|
||||
// if you want to send cycle code and it is sending, keep sending
|
||||
} else if((yourInputSend == 2) & (morseCQ.IsRunning() == true)){
|
||||
morseCQ.Update();
|
||||
} else if((yourInputSend == 2) & (morseToSend.IsRunning() == true)){
|
||||
morseToSend.Update();
|
||||
|
||||
// if you want to send cycle code and it's not sending, then start it up
|
||||
} else if((yourInputSend == 2) & (morseCQ.IsRunning() == true)){
|
||||
morseCQ.Reset().Update();
|
||||
} else if((yourInputSend == 2) & (morseToSend.IsRunning() == true)){
|
||||
morseToSend.Reset().Update();
|
||||
|
||||
// if you don't want to send code
|
||||
} else {
|
||||
// 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