Set up scheduled program cycles #24
|
@ -22,7 +22,7 @@ lib_deps =
|
||||||
me-no-dev/ESP Async WebServer@^1.2.3
|
me-no-dev/ESP Async WebServer@^1.2.3
|
||||||
contrem/arduino-timer@^3.0.1
|
contrem/arduino-timer@^3.0.1
|
||||||
;kj7rrv/Telegraph@^1.0.0
|
;kj7rrv/Telegraph@^1.0.0
|
||||||
jandelgado/JLed@^4.13.0
|
jandelgado/JLed@^4.13.1
|
||||||
;adafruit/RTClib@^2.1.1
|
;adafruit/RTClib@^2.1.1
|
||||||
https://github.com/adafruit/RTClib.git ; >=2.1.2
|
https://github.com/adafruit/RTClib.git ; >=2.1.2
|
||||||
adafruit/Adafruit BusIO@^1.14.3
|
adafruit/Adafruit BusIO@^1.14.3
|
||||||
|
|
|
@ -136,17 +136,17 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||||
</select></p>
|
</select></p>
|
||||||
|
|
||||||
<h2>Cycle Settings</h2>
|
<h2>Cycle Settings</h2>
|
||||||
|
<p>Only applies when <em>Sending Program</em> is set to "2 - Cycle". You cannot set a cycle start date more than a month in advance.</p>
|
||||||
<p>Cycle start time <input type="datetime-local" id="js_start_time_unix_entry" /><br>
|
<p>Cycle start time <input type="datetime-local" id="js_start_time_unix_entry" /><br>
|
||||||
Current value: <b><span id=current-start></span></b>, but only day-of-month HH:MM:SS are used.
|
Current value: <b><span id=current-start></span></b>
|
||||||
Only applies when <em>Sending Program</em> is set to "2 - Cycle".
|
|
||||||
You cannot set a cycle start date more than a month in advance.
|
|
||||||
<!-- JS converts the entered start time to a unix timestamp, and copies that value
|
<!-- JS converts the entered start time to a unix timestamp, and copies that value
|
||||||
to this hidden field so the user doesn't have to see it. -->
|
to this hidden field so the user doesn't have to see it. -->
|
||||||
<input type="hidden" name="inputStartTimeUnix" id="js_start_time_unix" /></p>
|
<input type="hidden" name="inputStartTimeUnix" id="js_start_time_unix" /></p>
|
||||||
<p>
|
<p>
|
||||||
Step length: <input type="number" name="inputStepLength" value = %inputStepLength%><br>
|
Step length: <input type="number" name="inputStepLength" min=1000 step=1000 value = %inputStepLength%> milliseconds <br>
|
||||||
Cycle ID: <input type="number" name="inputCycleID" value = %inputCycleID%><br>
|
Cycle ID: <input type="number" name="inputCycleID" min=1 value = %inputCycleID%><br>
|
||||||
Number of transmitters: <input type="number" name="inputNtransmitters" value = %inputNtransmitters%><br>
|
Number of transmitters: <input type="number" name="inputNtransmitters" min=1 value = %inputNtransmitters%><br>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<!-- This field is hidden so people don't change the submit time (it will be wrong).
|
<!-- This field is hidden so people don't change the submit time (it will be wrong).
|
||||||
|
@ -321,27 +321,26 @@ auto morseToSend_blink = morseTEST_blink; // set this up to overwrite later
|
||||||
|
|
||||||
// Cycle stuff
|
// Cycle stuff
|
||||||
auto morse_cycle = morseEffectMOS;
|
auto morse_cycle = morseEffectMOS;
|
||||||
int period = morse_cycle.Period();
|
int period = morse_cycle.Period() + word_space_ms;
|
||||||
int repeats = step_length / period;
|
int repeats = step_length / period;
|
||||||
int remainder_wait = step_length - (period * repeats);
|
int remainder_wait = step_length - (period * repeats);
|
||||||
int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait));
|
int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait));
|
||||||
|
auto blinker_continuous = JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats).DelayAfter(word_space_ms);
|
||||||
|
auto blinker_continuous_wait = JLed(blinker).Off(total_wait);
|
||||||
JLed morses_blink[] = {
|
JLed morses_blink[] = {
|
||||||
// WOW it looks like you can't do Repeat() and DelayAfter() at the same time?
|
blinker_continuous,
|
||||||
// Opened https://github.com/jandelgado/jled/issues/122
|
blinker_continuous_wait
|
||||||
JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats),
|
|
||||||
//JLed(blinker).FadeOn(1000).Repeat(3)
|
|
||||||
JLed(blinker).Off(total_wait)
|
|
||||||
};
|
};
|
||||||
auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
// start_program(): a function to start the planned program at the planned time
|
// start_program(): a function to start the planned program at the planned time
|
||||||
//================================================================================
|
//================================================================================
|
||||||
bool start_program(){
|
// bool start_program(){
|
||||||
Serial.println("The scheduled program has started.");
|
// Serial.println("The scheduled program has started.");
|
||||||
startProgram = true;
|
// startProgram = true;
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
// 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)
|
||||||
|
@ -623,16 +622,17 @@ void loop() {
|
||||||
// Once alarm has started the program, set things up to run
|
// Once alarm has started the program, set things up to run
|
||||||
if(startProgram == true){
|
if(startProgram == true){
|
||||||
//auto morse_cycle = morseEffectMOS;
|
//auto morse_cycle = morseEffectMOS;
|
||||||
int period = morse_cycle.Period();
|
//int period = morse_cycle.Period() + word_space_ms;
|
||||||
int repeats = step_length / period;
|
//int repeats = step_length / period;
|
||||||
int remainder_wait = step_length - (period * repeats);
|
//int remainder_wait = step_length - (period * repeats);
|
||||||
int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait));
|
//int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait));
|
||||||
|
|
||||||
|
// Nothing makes it out of this scope...
|
||||||
|
blinker_continuous = JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats).DelayAfter(word_space_ms);
|
||||||
|
blinker_continuous_wait = JLed(blinker).Off(total_wait);
|
||||||
JLed morses_blink[] = {
|
JLed morses_blink[] = {
|
||||||
// WOW it looks like you can't do Repeat() and DelayAfter() at the same time?
|
blinker_continuous,
|
||||||
// Opened https://github.com/jandelgado/jled/issues/122
|
blinker_continuous_wait
|
||||||
JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats),
|
|
||||||
//JLed(blinker).FadeOn(1000).Repeat(3)
|
|
||||||
JLed(blinker).Off(total_wait)
|
|
||||||
};
|
};
|
||||||
auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user