Shelve.
This commit is contained in:
parent
f5aa43ef76
commit
4380a56055
@ -63,12 +63,12 @@ bool programRunning;
|
||||
int yourInputStepLength;
|
||||
int yourInputCycleID;
|
||||
int yourInputNtransmitters;
|
||||
int step_length = 10000; // 10 secs
|
||||
int cycle_id = 1; // number of this transmitter in cycle
|
||||
int n_transmitters = 2; //number of transmitters total
|
||||
//int step_length = 10000; // 10 secs
|
||||
//int cycle_id = 1; // number of this transmitter in cycle
|
||||
//int n_transmitters = 2; //number of transmitters total
|
||||
long start_millis = 0;
|
||||
long stop_millis = 0;
|
||||
long pause_millis = 0;
|
||||
long pause_until_millis = 0;
|
||||
|
||||
// HTML web page to handle 3 input fields (inputString, inputSend, inputFloat)
|
||||
const char index_html[] PROGMEM = R"rawliteral(
|
||||
@ -247,7 +247,7 @@ String processor(const String& var){
|
||||
|
||||
|
||||
// Set up arduinomorse pin and default WPM
|
||||
LEDMorseSender sender(blinker, 10.0f); // the 'f' makes sure this is a float
|
||||
LEDMorseSender sender(blinker, 10.0f) ; // the 'f' makes sure this is a float
|
||||
// TODO also for keyer once blinker works
|
||||
|
||||
// Speed is milliseconds per dit, which is 1000 * (60 / (50 * WPM))
|
||||
@ -370,10 +370,11 @@ void setup() {
|
||||
writeFile(SPIFFS, "/inputSend.txt", inputMessage.c_str());
|
||||
yourInputSend = inputMessage.toInt();
|
||||
// if not running a program, set the program running off
|
||||
if(yourInputSend != 2){
|
||||
//if(yourInputSend != 2){
|
||||
// Cease all programs on new input
|
||||
startProgram = false;
|
||||
programRunning = false;
|
||||
}
|
||||
//}
|
||||
}
|
||||
// GET inputWPM value on <ESP_IP>/get?inputWPM=<inputMessage>
|
||||
if (request->hasParam(PARAM_WPM)) {
|
||||
@ -388,6 +389,21 @@ void setup() {
|
||||
// save previous state
|
||||
yourInputMsg_old = yourInputMsg;
|
||||
yourInputMsg = inputMessage.toInt();
|
||||
|
||||
// Check the message every time the form is submitted.
|
||||
if(yourInputMsg == 0){
|
||||
sender.setMessage(String("test test test de w1cdn "));
|
||||
} else if(yourInputMsg == 1){
|
||||
sender.setMessage(String("moe "));
|
||||
} else if(yourInputMsg == 2){
|
||||
sender.setMessage(String("moi "));
|
||||
} else if(yourInputMsg == 3){
|
||||
sender.setMessage(String("mos "));
|
||||
} else if(yourInputMsg == 4){
|
||||
sender.setMessage(String("moh "));
|
||||
} else if(yourInputMsg == 5){
|
||||
sender.setMessage(String("mo5 "));
|
||||
}
|
||||
}
|
||||
// GET inputStepLength value on <ESP_IP>/get?inputStepLength=<inputMessage>
|
||||
if (request->hasParam(PARAM_STEPLENGTH)) {
|
||||
@ -483,23 +499,23 @@ void loop() {
|
||||
|
||||
// See which message we are sending
|
||||
// Only do this when the message has been updated.
|
||||
if(yourInputMsg != yourInputMsg_old){
|
||||
if(yourInputMsg == 0){
|
||||
sender.setMessage(String("test test test de w1cdn "));
|
||||
} else if(yourInputMsg == 1){
|
||||
sender.setMessage(String("moe "));
|
||||
} else if(yourInputMsg == 2){
|
||||
sender.setMessage(String("moi "));
|
||||
} else if(yourInputMsg == 3){
|
||||
sender.setMessage(String("mos "));
|
||||
} else if(yourInputMsg == 4){
|
||||
sender.setMessage(String("moh "));
|
||||
} else if(yourInputMsg == 5){
|
||||
sender.setMessage(String("mo5 "));
|
||||
}
|
||||
// Keeps the key/led from locking up
|
||||
yourInputMsg_old = yourInputMsg;
|
||||
}
|
||||
// if(yourInputMsg != yourInputMsg_old){
|
||||
// if(yourInputMsg == 0){
|
||||
// sender.setMessage(String("test test test de w1cdn "));
|
||||
// } else if(yourInputMsg == 1){
|
||||
// sender.setMessage(String("moe "));
|
||||
// } else if(yourInputMsg == 2){
|
||||
// sender.setMessage(String("moi "));
|
||||
// } else if(yourInputMsg == 3){
|
||||
// sender.setMessage(String("mos "));
|
||||
// } else if(yourInputMsg == 4){
|
||||
// sender.setMessage(String("moh "));
|
||||
// } else if(yourInputMsg == 5){
|
||||
// sender.setMessage(String("mo5 "));
|
||||
// }
|
||||
// // Keeps the key/led from locking up
|
||||
// yourInputMsg_old = yourInputMsg;
|
||||
// }
|
||||
|
||||
// This statement from https://github.com/garrysblog/DS3231-Alarm-With-Adafruit-RTClib-Library/blob/master/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired.ino
|
||||
// Check if alarm by polling SQW alarm pin
|
||||
@ -516,35 +532,40 @@ void loop() {
|
||||
}
|
||||
|
||||
// Once alarm has started the program, set things up to run
|
||||
if(startProgram == true){
|
||||
if (startProgram == true){
|
||||
//Serial.println("Start sending");
|
||||
|
||||
start_millis = millis();
|
||||
stop_millis = start_millis + step_length;
|
||||
pause_millis = stop_millis + step_length;
|
||||
sender.startSending(); //arduinomorse
|
||||
start_millis = millis() + ((yourInputCycleID - 1) * yourInputStepLength);
|
||||
stop_millis = start_millis + yourInputStepLength;
|
||||
// Subtract 2 rather than 1 here to account for start_millis duration at beginning of repeat.
|
||||
pause_until_millis = stop_millis + (yourInputStepLength * (yourInputNtransmitters - 2));
|
||||
//sender.startSending();
|
||||
programRunning = true;
|
||||
startProgram = false;
|
||||
}
|
||||
|
||||
// if you want to send continuous code, and it's not sending, then start it up
|
||||
if((yourInputSend == 1)){;// & (morseToSend.IsRunning() == false)){
|
||||
if((yourInputSend == 1)){
|
||||
if (!sender.continueSending()){
|
||||
// Set the internal counters to the message's beginning.
|
||||
// Here, this results in repeating the message indefinitely.
|
||||
sender.startSending();
|
||||
}
|
||||
// if you want to send cycle code and it's not sending, then start it up
|
||||
} else if((yourInputSend == 2) & (programRunning == true)){//& (morses_sequence_blink.Update() == false)
|
||||
if((millis() > start_millis) & (millis() < stop_millis)){
|
||||
} else if((yourInputSend == 2) & (programRunning == true)){
|
||||
if((millis() < start_millis)){
|
||||
// Shut the pin off manually
|
||||
digitalWrite(blinker, LOW);
|
||||
} else if((millis() >= start_millis) & (millis() <= stop_millis)){
|
||||
if (!sender.continueSending()){
|
||||
// Set the internal counters to the message's beginning.
|
||||
// Here, this results in repeating the message indefinitely.
|
||||
sender.startSending();
|
||||
}
|
||||
} else if((millis() > stop_millis) & (millis() < pause_millis)){
|
||||
} else if((millis() >= stop_millis) & (millis() <= pause_until_millis)){
|
||||
// do nothing in this case -- in between cycles
|
||||
} else if((millis() > pause_millis)){
|
||||
// Shut the pin off manually
|
||||
digitalWrite(blinker, LOW);
|
||||
} else if((millis() >= pause_until_millis)){
|
||||
startProgram = true;
|
||||
}
|
||||
// if the cycle program is not running
|
||||
@ -552,7 +573,9 @@ void loop() {
|
||||
// do we need something here?
|
||||
// if you don't want to send code
|
||||
} else if(yourInputSend == 0){
|
||||
sender.setMessage(String("")); // Not sure this is the right way to stop things.
|
||||
//sender.setMessage(String("")) ; // Not sure this is the right way to stop things.
|
||||
// Shut the pin off manually
|
||||
digitalWrite(blinker, LOW);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user