From c0e01080f8fa9f14b0ebc0bd95d4870dff8021d6 Mon Sep 17 00:00:00 2001 From: OE1WKL Date: Sat, 7 Dec 2024 10:11:48 +0100 Subject: [PATCH] =?UTF-8?q?Included=20option=20to=20rotate=20screen=20180?= =?UTF-8?q?=C2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For left-handed use of M32 Pocket --- .../Version 6.x/m32_user-Manual_v6.adoc | 8 +++-- .../Version 6.x/m32_user-Manual_v6_de.adoc | 6 +++- Software/src/.gitignore | 5 ++++ Software/src/.vscode/extensions.json | 10 +++++++ Software/src/Version 6/MorseOutput.cpp | 3 +- Software/src/Version 6/MorsePreferences.cpp | 29 +++++++++++++------ Software/src/Version 6/MorsePreferences.h | 2 ++ Software/src/Version 6/m32_v6.ino | 9 +++--- Software/src/Version 6/morsedefs.h | 6 ++-- Software/src/platformio.ini | 2 +- 10 files changed, 59 insertions(+), 21 deletions(-) create mode 100644 Software/src/.gitignore create mode 100644 Software/src/.vscode/extensions.json diff --git a/Documentation/User Manual/Version 6.x/m32_user-Manual_v6.adoc b/Documentation/User Manual/Version 6.x/m32_user-Manual_v6.adoc index 976c943..e1f6be1 100644 --- a/Documentation/User Manual/Version 6.x/m32_user-Manual_v6.adoc +++ b/Documentation/User Manual/Version 6.x/m32_user-Manual_v6.adoc @@ -1045,11 +1045,11 @@ Be aware that you must have an antenna connected when you transmit via LoRa, oth == Appendices -=== Appendix 1: Hardware Configuration (LoRa and Calibration of Battery Measurement) +=== Appendix 1: Hardware Configuration (Screen, LoRa and Calibration of Battery Measurement) There is a hardware configuration menu that can be reached by pressing a paddle (or external paddle or straight key) while switching the M32 on. You can then select the configuration you want to perform by rotating the encoder knob, and pressing it once the right option shows up. -The selectable options are "Calibr. Batt." (calibration of battery measurement), "LoRa Config." and "Cancel" (which just leaves this menu and continues with regular start-up of the M32). +The selectable options are "Calibr. Batt." (calibration of battery measurement), "Flip Screen", "LoRa Config." and "Cancel" (which just leaves this menu and continues with regular start-up of the M32). ==== Appendix 1.1: Configuring LoRa Bands, Frequencies and Output Power [[appendix1_1]] @@ -1088,6 +1088,10 @@ In order to calibrate the voltage measurement, you have to measure the actual ba * You will see a voltage value (in Millivolts) on the display. Now rotate the encoder until the displayed value is as close as possible to the measured battery voltage. * Press the BLACK encoder knob to store the calibration value, and to continue with the boot-up of the M32. +==== Appendix 1.3: Flipping the display screen for left-hand use [[appendix1_3]] + +This is probably only relevant for the M32 Pocket! +With the M32 Pocket, if you want to key with your left hand, the normal display would be upsode down; with this configuration option the display is rotated by 180° to allow lef-thand use. === Appendix 2: Adjusting Audio Input Level [[app2]] diff --git a/Documentation/User Manual/Version 6.x/m32_user-Manual_v6_de.adoc b/Documentation/User Manual/Version 6.x/m32_user-Manual_v6_de.adoc index 0b7d46f..cfe093d 100644 --- a/Documentation/User Manual/Version 6.x/m32_user-Manual_v6_de.adoc +++ b/Documentation/User Manual/Version 6.x/m32_user-Manual_v6_de.adoc @@ -1046,7 +1046,7 @@ Beachte, dass beim Senden über LoRa eine Antenne angeschlossen sein muss, da so == Anhänge -=== Anhang 1: Hardware Konfiguration (LoRa und Kalibrierung der Batterie-Messung) +=== Anhang 1: Hardware Konfiguration (Anzeige, LoRa und Kalibrierung der Batterie-Messung) Es gibt ein Hardware-Konfigurationsmenü, welches man erreicht, indem man das Paddle (oder ein externes Paddle bzw. eine Handtaste) beim Einschalten des Morserino-32 gedrückt hält. Man kann dann die gewünschte Konfiguration durch Drehen des Drehreglers auswählen, und mit einem Druck auf den schwarzen Knopf aktivieren. @@ -1090,6 +1090,10 @@ Um die Messung der Batteriespannung zu kalibrieren, musst du zuerst einmal die S * Man sieht nun eine Spannungsanzeige am Display (in Millivolt). Dreh nun den Drehregler in die eine oder andere Richtung, bis der angezeigte Wert möglichst nahe am gemessenen Wert der Batteriespannung liegt. * Drück den Schwarzen Knopf um den Kalibrierungswert zu speichern, und um mit dem Hochfahren des M32 fortzufahren. +==== Anhang 1.3: Flip Screen (Drehung des Displays für linkshändige Benutzung) + +Dies ist vermutlich nur für das M32 Pocket relevant! +Würde man beim M32 Pocket mit der linken Hand die Paddles betätigen, würde die Anzeige auf dem Kopf stehen; mit dieser Konfigurationsoption wird die Anzeige um 180° gedreht, um eine linkshändige Bedienung zu ermöglichen. === Anhang 2: Einstellen des Audioeingangspegels [[appendix2]] diff --git a/Software/src/.gitignore b/Software/src/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/Software/src/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/Software/src/.vscode/extensions.json b/Software/src/.vscode/extensions.json new file mode 100644 index 0000000..080e70d --- /dev/null +++ b/Software/src/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +} diff --git a/Software/src/Version 6/MorseOutput.cpp b/Software/src/Version 6/MorseOutput.cpp index 635ba23..b1c3365 100644 --- a/Software/src/Version 6/MorseOutput.cpp +++ b/Software/src/Version 6/MorseOutput.cpp @@ -95,7 +95,8 @@ void MorseOutput::initDisplay() digitalWrite(OLED_RST, HIGH); #endif display.init(); - display.flipScreenVertically(); + if (! MorsePreferences::leftHanded) + display.flipScreenVertically(); display.clear(); } diff --git a/Software/src/Version 6/MorsePreferences.cpp b/Software/src/Version 6/MorsePreferences.cpp index 04c21ea..a6b78f8 100644 --- a/Software/src/Version 6/MorsePreferences.cpp +++ b/Software/src/Version 6/MorsePreferences.cpp @@ -47,7 +47,7 @@ Preferences pref; // use the Preferences library for storing and r posQuickStart, posAutoStop, posMaxSequence, posLoraChannel, posSerialOut, // 31 // to be treated differently: posKochFilter, // 36 - posLoraBand, posLoraQRG, posSnapRecall, posSnapStore, posVAdjust, posHwConf // 37 + posLoraBand, posLoraQRG, posSnapRecall, posSnapStore, posVAdjust, posHwConf, posScreen // 37 }; */ @@ -331,7 +331,7 @@ String extraItems[] = {"Koch Lesson", "LoRa Band", "LoRa Frequ", "LoRa Power", uint8_t MorsePreferences::loraBand = 0; // 0 = 433, 1 = 868, 2 = 920 uint32_t MorsePreferences::loraQRG = QRG433; // for 70 cm band uint8_t MorsePreferences::loraPower = 14; // default 14 dBm = 25 mW - +boolean MorsePreferences::leftHanded = false; // to flip screen for left-handed use in Pocket ///// stored in preferences, but not adjustable through preferences menu: @@ -353,7 +353,6 @@ uint8_t MorsePreferences::loraPower = 14; // default 14 dBm = uint8_t MorsePreferences::kochMaximum = 52; String MorsePreferences::customCharSet = ""; // a place to store the custom character set boolean MorsePreferences::useCustomChars = false; // flag if we should use custom characters - //uint8_t MorsePreferences::responsePause = 5; // in echoTrainer mode, how long do we wait for response? in interWordSpaces; 2-12, default 5 uint8_t MorsePreferences::menuPtr = 1; // current position of menu uint8_t MorsePreferences::newMenuPtr = 1; // current position of menu when changed @@ -371,7 +370,6 @@ uint8_t MorsePreferences::loraPower = 14; // default 14 dBm = String MorsePreferences::wlanTRXPeer3 = ""; // peer Morserino for WiFI TRX uint32_t MorsePreferences::fileWordPointer = 0; // remember how far we have read the file in player mode / reset when loading new file - //uint8_t MorsePreferences::promptPause = 2; // in echoTrainer mode, length of pause before we send next word; multiplied by interWordSpace touch_value_t MorsePreferences::tLeft = 20; // threshold for left paddle touch_value_t MorsePreferences::tRight = 20; // threshold for right paddle @@ -621,7 +619,7 @@ void MorsePreferences::displayKeyerPreferencesMenu(prefPos pos) { displayValueLine(pos, itemLine, false); } -/// posKochFilter, posLoraBand, posLoraQRG, posSnapRecall, posSnapStore, posVAdjust, posHwConf +/// posKochFilter, posLoraBand, posLoraQRG, posSnapRecall, posSnapStore, posVAdjust, posScreen, posHwConf @@ -753,11 +751,14 @@ String MorsePreferences::getValueLine(prefPos pos) { sprintf(numBuffer, "%4d mV", volt); str = String(numBuffer); break; + case posHwConf: switch (hwConf) { case 1: str = "Calibr. Batt."; break; - case 2: str = "LoRa Config."; + case 2: str = "Flip Screen"; + break; + case 3: str = "LoRa Config."; break; default: str = "Cancel"; break; @@ -883,8 +884,8 @@ boolean MorsePreferences::adjustKeyerPreference(prefPos pos) { /// rotati MorsePreferences::vAdjust = constrain(MorsePreferences::vAdjust, 155, 254); break; case posHwConf: - hwConf += (t+3); - hwConf = hwConf % 3; + hwConf += (t+4); + hwConf = hwConf % 4; break; case posLoraPower: MorsePreferences::loraPower += t; // set the LoRa band @@ -1010,6 +1011,11 @@ void MorsePreferences::readPreferences(String repository) { MorsePreferences::loraPower = temp; else MorsePreferences::loraPower = 14; + + if (temp = pref.getBool("leftHanded")) + MorsePreferences::leftHanded = temp; + else + MorsePreferences::leftHanded = false; MorsePreferences::snapShots = pref.getUChar("snapShots",0); updateMemory(MorsePreferences::snapShots); @@ -1073,7 +1079,6 @@ void MorsePreferences::writePreferences(String repository) { if (morserino) { // the following things are not stored in snapshots anymore, //only in the ""Morserino" permanent memory pref.putUChar("brightness", MorsePreferences::oledBrightness); // if not snapshots, store current screen brightness - if (MorsePreferences::pliste[posSerialOut].value != pref.getUChar("serialOut")) { pref.remove("serialOut"); pref.putUChar("serialOut", MorsePreferences::pliste[posSerialOut].value); @@ -1363,6 +1368,12 @@ void MorsePreferences::calibrateVoltageMeasurement() { pref.end(); } +void MorsePreferences::flipScreen() { + MorsePreferences::leftHanded = ! MorsePreferences::leftHanded; + pref.begin("morserino", false); + pref.putBool("leftHanded", MorsePreferences::leftHanded); + pref.end(); +} void MorsePreferences::fireCharSeen(boolean wpmOnly) { diff --git a/Software/src/Version 6/MorsePreferences.h b/Software/src/Version 6/MorsePreferences.h index e1955cc..656a795 100644 --- a/Software/src/Version 6/MorsePreferences.h +++ b/Software/src/Version 6/MorsePreferences.h @@ -101,6 +101,7 @@ namespace MorsePreferences #define QRG920 920.55E6 extern uint32_t loraQRG; extern uint8_t loraPower; + extern boolean leftHanded; extern uint8_t snapShots; extern uint8_t boardVersion; extern uint8_t oledBrightness; @@ -182,6 +183,7 @@ namespace MorsePreferences void setCustomChars(String); //void kochSetup(); void loraSystemSetup(); + void flipScreen(); void determineBoardVersion(); void calibrateVoltageMeasurement(); void writeWordPointer(); diff --git a/Software/src/Version 6/m32_v6.ino b/Software/src/Version 6/m32_v6.ino index f91185b..839b897 100644 --- a/Software/src/Version 6/m32_v6.ino +++ b/Software/src/Version 6/m32_v6.ino @@ -90,8 +90,6 @@ ESP32Encoder rotaryEncoder; // <== left, count down -int8_t woken = 0; // what for? - ///// the states the morserino can be in - selected in top level menu morserinoMode morseState = morseKeyer; @@ -155,7 +153,7 @@ GEN_TYPE generatorMode = RANDOMS; // trainer: what symbol (groups) are File file; /// variable for selecting a hardware configuration menu option -int8_t hwConf = 1; // 0 = cancel hw config, 1 = battery measurement calibration, 2 = lora config +int8_t hwConf = 1; // 0 = cancel hw config, 1 = battery measurement calibration, 2 = flip screen, 3 = lora config boolean kochActive = false; // set to true when in Koch trainer mode @@ -532,7 +530,10 @@ void setup() case 1: MorsePreferences::calibrateVoltageMeasurement(); break; - case 2: MorsePreferences::loraSystemSetup(); + case 2: MorsePreferences::flipScreen(); + ESP.restart(); + break; + case 3: MorsePreferences::loraSystemSetup(); break; default: break; } diff --git a/Software/src/Version 6/morsedefs.h b/Software/src/Version 6/morsedefs.h index f94b961..1bcd585 100644 --- a/Software/src/Version 6/morsedefs.h +++ b/Software/src/Version 6/morsedefs.h @@ -35,12 +35,12 @@ const String PROJECTNAME = "Morserino-32"; #define VERSION_MAJOR 6 #define VERSION_MINOR 0 -#define VERSION_PATCH 0 +#define VERSION_PATCH 1 -#define BETA false +#define BETA true -#define IGNORE_SERIALOUT false +#define IGNORE_SERIALOUT true // if IGNORE_SERIALOUT is true, alle DEBUG messages are on serial out, even when Serial Out is active outputting characters from Keyer, Decoder etc diff --git a/Software/src/platformio.ini b/Software/src/platformio.ini index 307f21d..a15295c 100644 --- a/Software/src/platformio.ini +++ b/Software/src/platformio.ini @@ -10,7 +10,7 @@ [platformio] src_dir=Version 6 -default_envs=heltec_wifi_lora_32_V2 +default_envs=heltec_wifi_kit_32_V3 [common] lib_deps_external =