From 6b9decc01307535d66a54d8e2b0657a3caec0b57 Mon Sep 17 00:00:00 2001 From: k3ng Date: Fri, 15 Mar 2024 09:56:12 -0400 Subject: [PATCH] 2024.03.15.1354 FEATURE_WINKEY_EMULATION: Changed potentiometer behavior to work correctly with N1MM+ pot settings --- k3ng_keyer/k3ng_keyer.ino | 21 +++++++++++++++++--- k3ng_keyer/keyer_features_and_options_test.h | 8 ++++---- k3ng_keyer/keyer_pin_settings_test.h | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/k3ng_keyer/k3ng_keyer.ino b/k3ng_keyer/k3ng_keyer.ino index 09f1ad1..cf37d96 100644 --- a/k3ng_keyer/k3ng_keyer.ino +++ b/k3ng_keyer/k3ng_keyer.ino @@ -1411,6 +1411,9 @@ Recent Update History 2024.02.28.0239 FEATURE_MORTTY_SPEEDPOT_BOOT_FUNCTION + 2024.03.15.1354 + FEATURE_WINKEY_EMULATION: Changed potentiometer behavior to work correctly with N1MM+ pot settings + qwerty Documentation: https://github.com/k3ng/k3ng_cw_keyer/wiki @@ -5660,15 +5663,26 @@ void check_potentiometer() debug_serial_port->print(F(" analog read: ")); debug_serial_port->println(analogRead(potentiometer)); #endif - if (keyer_machine_mode == KEYER_COMMAND_MODE) command_speed_set(pot_value_wpm_read); - else speed_set(pot_value_wpm_read); - last_pot_wpm_read = pot_value_wpm_read; #ifdef FEATURE_WINKEY_EMULATION + if (keyer_machine_mode == KEYER_COMMAND_MODE) { + command_speed_set(pot_value_wpm_read); + } else { + if (!winkey_host_open){ + speed_set(pot_value_wpm_read); + } + } if ((primary_serial_port_mode == SERIAL_WINKEY_EMULATION) && (winkey_host_open)) { winkey_port_write(((pot_value_wpm_read-pot_wpm_low_value)|128),0); winkey_last_unbuffered_speed_wpm = configuration.wpm; + } + #else + if (keyer_machine_mode == KEYER_COMMAND_MODE) { + command_speed_set(pot_value_wpm_read); + } else { + speed_set(pot_value_wpm_read); } #endif + last_pot_wpm_read = pot_value_wpm_read; #ifdef FEATURE_SLEEP last_activity_time = millis(); #endif //FEATURE_SLEEP @@ -10744,6 +10758,7 @@ void winkey_ptt_times_parm2_command(byte incoming_serial_byte) { #ifdef FEATURE_WINKEY_EMULATION void winkey_set_pot_parm1_command(byte incoming_serial_byte) { + pot_wpm_low_value = incoming_serial_byte; } diff --git a/k3ng_keyer/keyer_features_and_options_test.h b/k3ng_keyer/keyer_features_and_options_test.h index 4b0400c..2cca21e 100644 --- a/k3ng_keyer/keyer_features_and_options_test.h +++ b/k3ng_keyer/keyer_features_and_options_test.h @@ -13,16 +13,16 @@ #if defined(TEST_CONFIG_1) -#define FEATURE_BUTTONS -#define FEATURE_COMMAND_MODE -// #define FEATURE_COMMAND_LINE_INTERFACE // Command Line Interface functionality +// #define FEATURE_BUTTONS +// #define FEATURE_COMMAND_MODE +#define FEATURE_COMMAND_LINE_INTERFACE // Command Line Interface functionality // #define FEATURE_MEMORIES // on the Arduino Due, you must have FEATURE_EEPROM_E24C1024 and E24C1024 EEPROM hardware in order to compile this // #define FEATURE_MEMORY_MACROS #define FEATURE_WINKEY_EMULATION // disabling Automatic Software Reset is highly recommended (see documentation) // #define FEATURE_BEACON // Go into beacon mode if paddle_left pin is LOW at boot up // #define FEATURE_BEACON_SETTING // Go into beacon mode at boot up if EEPROM setting is enabled (\_ CLI Command) // #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE -// #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes +#define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). // #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home // #define FEATURE_SERIAL_HELP diff --git a/k3ng_keyer/keyer_pin_settings_test.h b/k3ng_keyer/keyer_pin_settings_test.h index e5dee84..91a3232 100644 --- a/k3ng_keyer/keyer_pin_settings_test.h +++ b/k3ng_keyer/keyer_pin_settings_test.h @@ -17,7 +17,7 @@ #define paddle_left 2 #define paddle_right 5 #define sidetone_line 4 -#define potentiometer A0 +#define potentiometer 28 //A0 // Pico test jig: 28 (GP28) #define ptt_tx_1 13 // PTT ("push to talk") lines //Raspberry Pi Pico Test Jig