-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to auto-select Koch lesson after symbol is keyed correctly multiple times in a row #46
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ using namespace MorseMenu; | |
//////// variables and constants for the modus menu | ||
|
||
|
||
const uint8_t menuN = 42; // no of menu items +1 | ||
const uint8_t menuN = 43; // no of menu items +1 | ||
|
||
const String menuText [menuN] = { | ||
"", | ||
|
@@ -73,7 +73,8 @@ const String menuText [menuN] = { | |
"Wifi Select", //40 | ||
|
||
|
||
"Go To Sleep" } ; // 41 | ||
"Go To Sleep", // 41 | ||
"Auto Selection" } ; // 42 Koch | ||
|
||
enum navi {naviLevel, naviLeft, naviRight, naviUp, naviDown }; | ||
|
||
|
@@ -95,15 +96,15 @@ const uint8_t menuNav [menuN] [5] = { // { level, left, right, | |
{1,_echoWords,_echoMixed,_echo,0}, // 13 echo calls | ||
{1,_echoCalls,_echoPlayer,_echo,0}, // 14 echo mixed | ||
{1,_echoMixed,_echoRand,_echo,0}, // 15 echo player | ||
{0,_echo,_trx,_dummy,_kochSel}, // 16 koch | ||
{1,_kochEcho,_kochLearn,_koch,0}, // 17 koch select | ||
{0,_echo,_trx,_dummy,_kochSel}, // 16 koch | ||
{1,_kochAutoSel,_kochLearn,_koch,0}, // 17 koch select | ||
{1,_kochSel,_kochGen,_koch,0}, // 18 koch learn new | ||
{1,_kochLearn,_kochEcho,_koch,_kochGenRand}, // 19 koch gen | ||
{2,_kochGenMixed,_kochGenAbb,_kochGen,0}, // 20 koch gen random | ||
{2,_kochGenRand,_kochGenWords,_kochGen,0}, // 21 koch gen abb | ||
{2,_kochGenAbb,_kochGenMixed,_kochGen,0}, // 22 koch gen words | ||
{2,_kochGenWords,_kochGenRand,_kochGen,0}, // 23 koch gen mixed | ||
{1,_kochGen,_kochSel,_koch,_kochEchoRand}, // 24 koch echo | ||
{1,_kochGen,_kochAutoSel,_koch,_kochEchoRand}, // 24 koch echo | ||
{2,_kochEchoMixed,_kochEchoAbb,_kochEcho,0}, // 25 koch echo random | ||
{2,_kochEchoRand,_kochEchoWords,_kochEcho,0}, // 26 koch echo abb | ||
{2,_kochEchoAbb,_kochEchoMixed,_kochEcho,0}, // 27 koch echo words | ||
|
@@ -120,7 +121,8 @@ const uint8_t menuNav [menuN] [5] = { // { level, left, right, | |
{1,_wifi_check,_wifi_update,_wifi,0}, // 38 Upload File | ||
{1,_wifi_upload,_wifi_select,_wifi,0}, // 39 Update Firmware | ||
{1,_wifi_update,_wifi_mac,_wifi,0}, // 40 Select network | ||
{0,_wifi,_keyer,_dummy,0} // 41 goto sleep | ||
{0,_wifi,_keyer,_dummy,0}, // 41 goto sleep | ||
{1,_kochEcho,_kochSel,_koch,0}, // 42 koch Auto select check 16 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New menu between Echo and Select Lesson |
||
}; | ||
|
||
//boolean quickStart; // should we execute menu item immediately? | ||
|
@@ -321,6 +323,12 @@ boolean MorseMenu::menuExec() { // retu | |
MorsePreferences::writePreferences("morserino"); | ||
return false; | ||
break; | ||
case _kochAutoSel: // Koch Auto Select | ||
MorsePreferences::displayKeyerPreferencesMenu(MorsePreferences::posKochAutoSel); | ||
MorsePreferences::adjustKeyerPreference(MorsePreferences::posKochAutoSel); | ||
MorsePreferences::writePreferences("morserino"); | ||
return false; | ||
break; | ||
case _kochLearn: // Koch Learn New . /// just a new generatormode.... | ||
generatorMode = KOCH_LEARN; | ||
MorsePreferences::setCurrentOptions(MorsePreferences::kochEchoOptions, MorsePreferences::kochEchoOptionsSize); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,7 +105,8 @@ Preferences pref; // use the Preferences library for storing and r | |
uint8_t MorsePreferences::snapShots = 0; // keep track which snapshots are being used ( 0 .. 7, called 1 to 8) | ||
|
||
uint8_t MorsePreferences::boardVersion = 0; // which Morserino board version? v3 uses heltec Wifi Lora V2, V4 uses V2.1 | ||
|
||
|
||
uint8_t MorsePreferences::okKeyingMaxCount = 0; // Max number of correct keying before moving to next lesson | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default to disable. |
||
//////// end of variables stored in preferences | ||
|
||
//// temporary buffer for conversions, local to this file | ||
|
@@ -131,7 +132,7 @@ const String MorsePreferences::prefOption[] = { "Encoder Click", "Tone Pitch Hz" | |
"Koch Sequence", "Koch ", "Latency ", "Randomize File", | ||
"Time Out ", "Quick Start ", "Stop/Next/Rep", "Max # of Words","LoRa Channel ", "Serial Output", | ||
"LoRa Band ", "LoRa Frequ ", "RECALLSnapshot", "STORE Snapshot", | ||
"Calibrate Batt", "Hardware Conf"}; | ||
"Calibrate Batt", "Hardware Conf", "Koch Auto Sel"}; | ||
prefPos MorsePreferences::keyerOptions[] = {posClicks, posPitch, posExtPaddles, posPolarity, posLatency, posCurtisMode, posCurtisBDahTiming, posCurtisBDotTiming, posACS, | ||
posKeyTrainerMode, posTimeOut, posQuickStart, posSerialOut }; | ||
prefPos MorsePreferences::generatorOptions[] = {posClicks, posPitch, posExtPaddles, posInterWordSpace, posInterCharSpace, posRandomOption, | ||
|
@@ -278,7 +279,7 @@ boolean MorsePreferences::setupPreferences(uint8_t atMenu) { | |
|
||
void MorsePreferences::displayKeyerPreferencesMenu(int pos) { | ||
MorseOutput::clearDisplay(); | ||
if (pos < posLoraBand) | ||
if (pos < posLoraBand || (pos == posKochAutoSel)) | ||
MorseOutput::printOnStatusLine( true, 0, "Set Preferences: "); | ||
else if (pos < posSnapRecall) | ||
MorseOutput::printOnStatusLine( true, 0, "Config LoRa: "); | ||
|
@@ -372,7 +373,9 @@ void MorsePreferences::displayKeyerPreferencesMenu(int pos) { | |
case posVAdjust: internal::displayVAdjust(); | ||
break; | ||
case posHwConf: internal::displayHwConf(); | ||
break; | ||
break; | ||
case posKochAutoSel:internal::displayKochAutoSel(); | ||
break; | ||
} /// switch (pos) | ||
Heltec.display -> display(); | ||
} // displayKeyerPreferences() | ||
|
@@ -618,7 +621,6 @@ void internal::displayKochFilter() { // const String ko | |
MorseOutput::printOnScroll(2, REGULAR, 1, numBuffer); | ||
} | ||
|
||
|
||
void internal::displayWordDoubler() { | ||
MorseOutput::printOnScroll(2, REGULAR, 1, MorsePreferences::wordDoubler ? "On " : | ||
"Off " ); | ||
|
@@ -800,6 +802,7 @@ boolean MorsePreferences::adjustKeyerPreference(prefPos pos) { /// rotati | |
return true; | ||
} | ||
} | ||
|
||
if ((t=checkEncoder())) { | ||
MorseOutput::pwmClick(MorsePreferences::sidetoneVolume); /// click | ||
switch (pos) { | ||
|
@@ -855,6 +858,10 @@ boolean MorsePreferences::adjustKeyerPreference(prefPos pos) { /// rotati | |
internal::displayKochFilter(); | ||
break; | ||
|
||
case posKochAutoSel: MorsePreferences::okKeyingMaxCount = constrain(MorsePreferences::okKeyingMaxCount + t, 0, 100); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Range form 0 to 100. |
||
internal::displayKochAutoSel(); | ||
break; | ||
|
||
case posRandomOption : MorsePreferences::randomOption = (MorsePreferences::randomOption + t + 10) % 10; // which char set for random chars? | ||
internal::displayRandomOption(); | ||
break; | ||
|
@@ -1343,6 +1350,10 @@ void MorsePreferences::writePreferences(String repository) { | |
koch.setup(); | ||
} | ||
} | ||
|
||
if (MorsePreferences::okKeyingMaxCount != pref.getUChar("okKeyingMaxCount")) { | ||
pref.putUChar("okKeyingMaxCount", MorsePreferences::okKeyingMaxCount); | ||
} | ||
|
||
if (MorsePreferences::lcwoKochSeq != pref.getBool("lcwoKochSeq")) { | ||
pref.putBool("lcwoKochSeq", MorsePreferences::lcwoKochSeq); | ||
|
@@ -1768,3 +1779,29 @@ String Koch::getRandomAbbrev() { | |
uint16_t index = abbrIndices[random(numberOfAbbr)]; | ||
return Abbrev::abbreviations[index]; | ||
} | ||
|
||
void Koch::moveToNextKochLesson() { | ||
MorsePreferences::kochFilter = constrain(MorsePreferences::kochFilter + 1, 1, kochCharsLength); | ||
} | ||
|
||
uint8_t Koch::getOkKeyingCount(void) | ||
{ | ||
return this->okKeyingCount; | ||
} | ||
|
||
void Koch::setOkKeyingCount(uint8_t count) | ||
{ | ||
this->okKeyingCount = count; | ||
} | ||
|
||
void internal::displayKochAutoSel() { | ||
if(MorsePreferences::okKeyingMaxCount) | ||
{ | ||
sprintf(numBuffer, " %2i ", MorsePreferences::okKeyingMaxCount); | ||
} | ||
else | ||
{ | ||
sprintf(numBuffer, "%s", " None "); | ||
} | ||
MorseOutput::printOnScroll(2, REGULAR, 1, numBuffer); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New menu string to select max number of times a symbol should be keyed correctly before moving to next lesson.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put new menu and strings at the end to avoid shifting everything