Change WPM on webform #45
|
@ -67,6 +67,8 @@ int yourInputNtransmitters;
|
||||||
long start_millis = 0;
|
long start_millis = 0;
|
||||||
long stop_millis = 0;
|
long stop_millis = 0;
|
||||||
long pause_until_millis = 0;
|
long pause_until_millis = 0;
|
||||||
|
float wpm = 10;
|
||||||
|
float ms_per_dit = 1000 * (60 / (50 * wpm));
|
||||||
|
|
||||||
// HTML web page to handle 3 input fields (inputString, inputSend, inputFloat)
|
// HTML web page to handle 3 input fields (inputString, inputSend, inputFloat)
|
||||||
const char index_html[] PROGMEM = R"rawliteral(
|
const char index_html[] PROGMEM = R"rawliteral(
|
||||||
|
@ -136,7 +138,10 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||||
<option value="3">3 - MOS</option>
|
<option value="3">3 - MOS</option>
|
||||||
<option value="4">4 - MOH</option>
|
<option value="4">4 - MOH</option>
|
||||||
<option value="5">5 - MO5</option>
|
<option value="5">5 - MO5</option>
|
||||||
</select></p>
|
</select><br>
|
||||||
|
|
||||||
|
Speed: <input type="number" name="inputWPM" value = %inputWPM%> WPM
|
||||||
|
</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>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>
|
||||||
|
@ -157,7 +162,6 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||||
<input type="hidden" name="inputTimeUnix" id="js_time_unix">
|
<input type="hidden" name="inputTimeUnix" id="js_time_unix">
|
||||||
|
|
||||||
<!-- Extra fields just in case I need them -->
|
<!-- Extra fields just in case I need them -->
|
||||||
<input type="hidden" name="inputWPM" value = %inputWPM%>
|
|
||||||
<input type="hidden" name="inputString" value = %inputString%>
|
<input type="hidden" name="inputString" value = %inputString%>
|
||||||
<input type="hidden" name="inputFloat" value = %inputFloat%>
|
<input type="hidden" name="inputFloat" value = %inputFloat%>
|
||||||
|
|
||||||
|
@ -245,15 +249,8 @@ String processor(const String& var){
|
||||||
|
|
||||||
|
|
||||||
// Set up arduinomorse pin and default WPM
|
// Set up arduinomorse pin and default WPM
|
||||||
LEDMorseSender sender_blink(blinker, 10.0f) ; // the 'f' makes sure this is a float
|
LEDMorseSender sender_blink(blinker, wpm);
|
||||||
LEDMorseSender sender_key(keyer, 10.0f) ; // the 'f' makes sure this is a float
|
LEDMorseSender sender_key(keyer, wpm);
|
||||||
|
|
||||||
// Speed is milliseconds per dit, which is 1000 * (60 / (50 * WPM))
|
|
||||||
// 60 is 20 wpm, 120 is 10 wpm, 90 is 15 wpm, etc.
|
|
||||||
// https://morsecode.world/international/timing.html
|
|
||||||
float wpm = 10;
|
|
||||||
float ms_per_dit = 1000 * (60 / (50 * wpm));
|
|
||||||
int word_space_ms = ms_per_dit * 7;
|
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
// 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)
|
||||||
|
@ -322,6 +319,9 @@ void setup() {
|
||||||
yourInputStepLength = readFile(SPIFFS, "/inputStepLength.txt").toInt();
|
yourInputStepLength = readFile(SPIFFS, "/inputStepLength.txt").toInt();
|
||||||
yourInputCycleID = readFile(SPIFFS, "/inputCycleID.txt").toInt();
|
yourInputCycleID = readFile(SPIFFS, "/inputCycleID.txt").toInt();
|
||||||
yourInputNtransmitters = readFile(SPIFFS, "/inputNtransmitters.txt").toInt();
|
yourInputNtransmitters = readFile(SPIFFS, "/inputNtransmitters.txt").toInt();
|
||||||
|
// Set WPM from saved value
|
||||||
|
sender_blink.setWPM(yourInputWPM);
|
||||||
|
sender_key.setWPM(yourInputWPM);
|
||||||
|
|
||||||
// On restart, keep doing what you were doing before
|
// On restart, keep doing what you were doing before
|
||||||
yourInputMsg_old = yourInputMsg;
|
yourInputMsg_old = yourInputMsg;
|
||||||
|
@ -385,7 +385,9 @@ void setup() {
|
||||||
if (request->hasParam(PARAM_WPM)) {
|
if (request->hasParam(PARAM_WPM)) {
|
||||||
inputMessage = request->getParam(PARAM_WPM)->value();
|
inputMessage = request->getParam(PARAM_WPM)->value();
|
||||||
writeFile(SPIFFS, "/inputWPM.txt", inputMessage.c_str());
|
writeFile(SPIFFS, "/inputWPM.txt", inputMessage.c_str());
|
||||||
yourInputWPM = inputMessage.toInt();
|
yourInputWPM = inputMessage.toFloat();
|
||||||
|
sender_blink.setWPM(yourInputWPM);
|
||||||
|
sender_key.setWPM(yourInputWPM);
|
||||||
}
|
}
|
||||||
// GET inputMsg value on <ESP_IP>/get?inputMsg=<inputMessage>
|
// GET inputMsg value on <ESP_IP>/get?inputMsg=<inputMessage>
|
||||||
if (request->hasParam(PARAM_MSG)) {
|
if (request->hasParam(PARAM_MSG)) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user