From 3d963fe02b41290a854608f3a6cc82fa7a64d9b6 Mon Sep 17 00:00:00 2001 From: satoryboy Date: Sat, 27 Apr 2019 13:17:45 +0500 Subject: [PATCH] Finalize smootch dynamic tune --- mchf-eclipse/drivers/ui/menu/ui_menu.c | 3 ++- mchf-eclipse/drivers/ui/ui_configuration.c | 1 + mchf-eclipse/drivers/ui/ui_configuration.h | 3 ++- mchf-eclipse/drivers/ui/ui_driver.c | 4 ++-- mchf-eclipse/hardware/uhsdr_board.h | 20 +++++++++++++++++++- mchf-eclipse/src/uhsdr_main.c | 2 +- 6 files changed, 27 insertions(+), 6 deletions(-) diff --git a/mchf-eclipse/drivers/ui/menu/ui_menu.c b/mchf-eclipse/drivers/ui/menu/ui_menu.c index 5c0e99aaa..c77b16360 100644 --- a/mchf-eclipse/drivers/ui/menu/ui_menu.c +++ b/mchf-eclipse/drivers/ui/menu/ui_menu.c @@ -4320,7 +4320,8 @@ void UiMenu_UpdateItem(uint16_t select, MenuProcessingMode_t mode, int pos, int break; #endif case MENU_DEBUG_SMOOTH_DYN_TUNE: - var_change = UiDriverMenuItemChangeEnableOnOffBool(var, mode, &ts.smooth_dyn_tune,0,options,&clr); + var_change = UiDriverMenuItemChangeEnableOnOffFlag(var, mode, &ts.expflags1,0,options,&clr, EXPFLAGS1_SMOOTH_DYNAMIC_TUNE); + clr = White; break; default: // Move to this location if we get to the bottom of the table! diff --git a/mchf-eclipse/drivers/ui/ui_configuration.c b/mchf-eclipse/drivers/ui/ui_configuration.c index 4711596fb..83e81726b 100644 --- a/mchf-eclipse/drivers/ui/ui_configuration.c +++ b/mchf-eclipse/drivers/ui/ui_configuration.c @@ -272,6 +272,7 @@ const ConfigEntryDescriptor ConfigEntryInfo[] = { ConfigEntry_Int32_16, EEPROM_CW_DECODER_BLOCKSIZE,&cw_decoder_config.blocksize,CW_DECODER_BLOCKSIZE_DEFAULT,CW_DECODER_BLOCKSIZE_MIN,CW_DECODER_BLOCKSIZE_MAX}, // NO INT DEFAULT PROBLEM { ConfigEntry_UInt8x2, EEPROM_SMETER_ALPHAS,&sm.config.alphaCombined,CONFIG_UINT8x2_COMBINE(SMETER_ALPHA_ATTACK_DEFAULT, SMETER_ALPHA_DECAY_DEFAULT), CONFIG_UINT8x2_COMBINE(SMETER_ALPHA_MIN, SMETER_ALPHA_MIN), CONFIG_UINT8x2_COMBINE(SMETER_ALPHA_MAX,SMETER_ALPHA_MAX) }, { ConfigEntry_UInt8, EEPROM_VSWR_PROTECTION_THRESHOLD,&ts.debug_vswr_protection_threshold,1,1,10}, + { ConfigEntry_UInt16, EEPROM_EXPFLAGS1,&ts.expflags1,EXPFLAGS1_CONFIG_DEFAULT,0,0xffff}, // the entry below MUST be the last entry, and only at the last position Stop is allowed { diff --git a/mchf-eclipse/drivers/ui/ui_configuration.h b/mchf-eclipse/drivers/ui/ui_configuration.h index 916e24ff2..38daf95aa 100644 --- a/mchf-eclipse/drivers/ui/ui_configuration.h +++ b/mchf-eclipse/drivers/ui/ui_configuration.h @@ -607,7 +607,8 @@ void UiConfiguration_UpdateMacroCap(void); #define EEPROM_TX_IQ_10M_UP_GAIN_BALANCE_TRANS_OFF 424 #define EEPROM_TX_IQ_10M_UP_PHASE_BALANCE_TRANS_OFF 425 #define EEPROM_VSWR_PROTECTION_THRESHOLD 426 -#define EEPROM_FIRST_UNUSED 427 // change this if new value ids are introduced, must be correct at any time +#define EEPROM_EXPFLAGS1 427 // Flags for options in Debag/Expert menu - see variable "expflags1" +#define EEPROM_FIRST_UNUSED 428 // change this if new value ids are introduced, must be correct at any time #define MAX_VAR_ADDR (EEPROM_FIRST_UNUSED - 1) diff --git a/mchf-eclipse/drivers/ui/ui_driver.c b/mchf-eclipse/drivers/ui/ui_driver.c index 492fca705..b01f2d10a 100644 --- a/mchf-eclipse/drivers/ui/ui_driver.c +++ b/mchf-eclipse/drivers/ui/ui_driver.c @@ -3346,7 +3346,7 @@ static bool UiDriver_CheckFrequencyEncoder() if (ts.flags1 & FLAGS1_DYN_TUNE_ENABLE) // check if dynamic tuning has been activated by touchscreen { - if (!ts.smooth_dyn_tune) // Smooth dynamic tune is OFF + if (!(ts.expflags1 & EXPFLAGS1_SMOOTH_DYNAMIC_TUNE)) // Smooth dynamic tune is OFF { if ((enc_speed_avg > 80) || (enc_speed_avg < (-80))) { @@ -3536,7 +3536,7 @@ static void UiDriver_CheckEncoderTwo() enc_multiplier = 1; //set standard speed - if (!ts.smooth_dyn_tune) // Smooth dynamic tune is OFF + if (!(ts.expflags1 & EXPFLAGS1_SMOOTH_DYNAMIC_TUNE)) // Smooth dynamic tune is OFF { if ((enc_speed_avg > 80) || (enc_speed_avg < (-80))) { diff --git a/mchf-eclipse/hardware/uhsdr_board.h b/mchf-eclipse/hardware/uhsdr_board.h index 13afd08d9..4b0772e13 100644 --- a/mchf-eclipse/hardware/uhsdr_board.h +++ b/mchf-eclipse/hardware/uhsdr_board.h @@ -486,6 +486,25 @@ typedef struct TransceiverState #define FLAGS1_REVERSE_X_TOUCHSCREEN 0x4000 // 1 = X direcction of touchscreen is mirrored #define FLAGS1_REVERSE_Y_TOUCHSCREEN 0x8000 // 1 = Y direcction of touchscreen is mirrored + uint16_t expflags1; // Used to hold flags for options in Debag/Expert menu, stored in EEPROM location "EEPROM_EXPFLAGS1" +#define EXPFLAGS1_SMOOTH_DYNAMIC_TUNE 0x01 // 1 = Smooth dynamic tune is ON +// #define EXPFLAGS1_RESERVE_1 0x02 // Reserve flag for options in Debag/Expert menu +// #define EXPFLAGS1_RESERVE_2 0x04 // Reserve flag for options in Debag/Expert menu +// #define EXPFLAGS1_RESERVE_3 0x08 // Reserve flag for options in Debag/Expert menu +// #define EXPFLAGS1_RESERVE_4 0x10 // Reserve flag for options in Debag/Expert menu +// #define EXPFLAGS1_RESERVE_5 0x20 // Reserve flag for options in Debag/Expert menu +// #define EXPFLAGS1_RESERVE_6 0x40 // Reserve flag for options in Debag/Expert menu +// #define EXPFLAGS1_RESERVE_7 0x80 // Reserve flag for options in Debag/Expert menu +// #define EXPFLAGS1_RESERVE_8 0x100 // Reserve flag for options in Debag/Expert menu +// #define EXPFLAGS1_RESERVE_9 0x200 // Reserve flag for options in Debag/Expert menu +// #define EXPFLAGS1_RESERVE_10 0x400 // Reserve flag for options in Debag/Expert menu +// #define EXPFLAGS1_RESERVE_11 0x800 // Reserve flag for options in Debag/Expert menu +// #define EXPFLAGS1_RESERVE_12 0x1000 // Reserve flag for options in Debag/Expert menu +// #define EXPFLAGS1_RESERVE_13 0x2000 // Reserve flag for options in Debag/Expert menu +// #define EXPFLAGS1_RESERVE_14 0x4000 // Reserve flag for options in Debag/Expert menu +// #define EXPFLAGS1_RESERVE_15 0x8000 // Reserve flag for options in Debag/Expert menu +#define EXPFLAGS1_CONFIG_DEFAULT 0x0000 // Default flags state + #ifdef UI_BRD_MCHF // the default screen needs no reversed touch #define FLAGS1_CONFIG_DEFAULT (FLAGS1_WFALL_ENABLED|FLAGS1_SCOPE_ENABLED) @@ -674,7 +693,6 @@ typedef struct TransceiverState // noise reduction gain display in spectrum int16_t nr_gain_display; // 0 = do not display gains, 1 = display bin gain in spectrum display, 2 = display long_tone_gain // 3 = display bin gain multiplied with long_tone_gain - bool smooth_dyn_tune; // Smooth dynamic tune is active? } TransceiverState; diff --git a/mchf-eclipse/src/uhsdr_main.c b/mchf-eclipse/src/uhsdr_main.c index a7d56443e..e39643a2e 100644 --- a/mchf-eclipse/src/uhsdr_main.c +++ b/mchf-eclipse/src/uhsdr_main.c @@ -315,7 +315,7 @@ void TransceiverStateInit(void) ts.debug_vswr_protection_threshold = 1; // OFF - ts.smooth_dyn_tune = false; // Smooth dynamic tune is OFF + //CONFIG LOADED:ts.expflags1 = 0; // Used to hold flags for options in Debag/Expert menu, stored in EEPROM location "EEPROM_EXPFLAGS1" ts.band_effective = 255; // this is an invalid band number, which will trigger a redisplay of the band name and the effective power }