Snapshot.

This commit is contained in:
mattbk 2023-09-11 21:09:27 -05:00
parent 958e71513c
commit 1bde39e148
2 changed files with 34 additions and 34 deletions

View File

@ -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

View File

@ -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).
@ -282,12 +282,12 @@ 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.
// Extra space at the end to get around https://github.com/jandelgado/jled/issues/122 on cycle mode // Extra space at the end to get around https://github.com/jandelgado/jled/issues/122 on cycle mode
MorseEffect morseEffectTEST("TEST TEST TEST 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);
// CW for keyer // CW for keyer
auto morseTEST = auto morseTEST =
@ -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)
@ -622,17 +621,18 @@ 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);