From 9a8200c4103088b5af5a5a6ada4846dd45ddb768 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Sun, 17 Jul 2022 10:26:04 +0200 Subject: [PATCH] Many small updates --- nanovna.h | 2 +- plot.c | 2 +- sa_core.c | 7 +++++-- si4468.c | 5 +++-- ui_sa.c | 20 +++++++++++++++----- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/nanovna.h b/nanovna.h index fe14635..33fc5c3 100644 --- a/nanovna.h +++ b/nanovna.h @@ -90,7 +90,7 @@ #define __USE_SD_CARD__ // Enable SD card support #define __SD_CARD_LOAD__ // Allow run commands from SD card (config.ini in root) #define __LCD_BRIGHTNESS__ // LCD or hardware allow change brightness, add menu item for this -//#define __HARMONIC__ +#define __HARMONIC__ #define __NOISE_FIGURE__ #define __VBW__ #define __SWEEP_RESTART__ diff --git a/plot.c b/plot.c index 1b3da9c..da34b49 100644 --- a/plot.c +++ b/plot.c @@ -1767,7 +1767,7 @@ static void cell_draw_marker_info(int x0, int y0) uint16_t color; int level = temppeakLevel - get_attenuation() + setting.external_gain; if ((!setting.normalized[t] && !setting.subtract[t]) && // Disabled when normalized or subtract - ((setting.mode == M_LOW && (setting.extra_lna ? level > -32 : level > -10)) + ((setting.mode == M_LOW && (setting.extra_lna ? level > -33 : level > -10)) || (setting.mode == M_HIGH && level > -29) || (setting.mode == M_LOW && (markers[i].mtype & M_NOISE) && vbwSteps > 1)) //MAXPEAK increases noise marker, should reduce span. ) diff --git a/sa_core.c b/sa_core.c index f66c0d0..330da5c 100644 --- a/sa_core.c +++ b/sa_core.c @@ -397,7 +397,7 @@ void set_input_path(freq_t f) enable_direct(false); enable_high(false); common: - enable_ADF_output(true, setting.tracking); + enable_ADF_output(true, setting.tracking_output); common2: if (SI4463_is_in_tx_mode()) SI4463_init_rx(); @@ -454,7 +454,10 @@ void update_min_max_freq(void) #ifdef __ULTRA__ if (ultra) #ifdef TINYSA4 - maxFreq = 12000000000; // ULTRA_MAX_FREQ; // make use of harmonic mode above ULTRA_MAX_FREQ + if (setting.harmonic) + maxFreq = setting.harmonic * MAX_LO_FREQ - DEFAULT_IF; // ULTRA_MAX_FREQ; // make use of harmonic mode above ULTRA_MAX_FREQ + else + maxFreq = ULTRA_MAX_FREQ; #else maxFreq = 3000000000; // ULTRA_MAX_FREQ; // make use of harmonic mode above ULTRA_MAX_FREQ #endif diff --git a/si4468.c b/si4468.c index 5e49d53..b09f443 100644 --- a/si4468.c +++ b/si4468.c @@ -642,9 +642,10 @@ void ADF4351_enable_aux_out(int s) { if (bitRead(registers[4],8) == (s & 0x01)) return; - if (s) + if (s) { bitSet(registers[4], 8); - else + maskedWrite(registers[4],6, 0x3, 3); // Max drive aux out + } else bitClear(registers[4], 8); ADF4351_Set(0); osalThreadSleepMilliseconds(10); diff --git a/ui_sa.c b/ui_sa.c index 9844dea..2bc6773 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -1400,6 +1400,9 @@ static UI_FUNCTION_ADV_CALLBACK(menu_measure_acb) // reset_settings(setting.mode); if (0) { no_measurement: + drawMessageBox("Error", "Incorrect input", 2000); + redraw_request|= REDRAW_AREA; + data = M_OFF; } if (setting.measurement == M_LINEARITY) { @@ -1511,7 +1514,11 @@ static UI_FUNCTION_ADV_CALLBACK(menu_measure_acb) #ifdef TINYSA3 center = uistat.value; #endif +#ifdef TINYSA4 + kp_help_text = "Modulation frequency: 500hz .. 10kHz"; +#else kp_help_text = "Modulation frequency: 3 .. 10kHz"; +#endif ui_mode_keypad(KM_SPAN); // if (uistat.value < 3000) // break; @@ -1539,9 +1546,9 @@ static UI_FUNCTION_ADV_CALLBACK(menu_measure_acb) ui_mode_keypad(KM_CENTER); set_marker_frequency(0, uistat.value); #ifdef TINYSA4 - kp_help_text = "Modulation frequency: 1 .. 10kHz"; + kp_help_text = "Modulation frequency: 500Hz .. 10kHz"; ui_mode_keypad(KM_SPAN); - if (uistat.value < 1000 || uistat.value > 10000) + if (uistat.value < 500 || uistat.value > 10000) goto no_measurement; set_RBW(uistat.value/300); #else @@ -2178,6 +2185,9 @@ static void choose_active_marker(void) } active_marker = MARKER_INVALID; } +#ifdef TINYSA4 +#define __HARMONIC__ +#endif #ifdef __HARMONIC__ static UI_FUNCTION_ADV_CALLBACK(menu_harmonic_acb) @@ -2797,6 +2807,9 @@ static const menuitem_t menu_settings3[] = #ifdef __WAIT_CTS_WHILE_SLEEPING__ { MT_ADV_CALLBACK, 0, "SLEEP\nWAIT", menu_sleep_acb}, #endif +#ifdef __HARMONIC__ + { MT_SUBMENU ,0, "HARMONIC", menu_harmonic}, +#endif // { MT_ADV_CALLBACK | MT_LOW, 0, "ULTRA\nMODE", menu_settings_ultra_acb}, #ifdef __HAM_BAND__ { MT_ADV_CALLBACK, 0, "HAM\nBANDS", menu_settings_ham_bands}, @@ -2845,9 +2858,6 @@ static const menuitem_t menu_settings4[] = // { MT_CALLBACK, 1 , "LOAD\nSETTING.INI", menu_load_config_cb}, #endif { MT_CALLBACK, 0 , "CLEAR\nCONFIG", menu_clearconfig_cb}, -#ifdef __HARMONIC__ - { MT_SUBMENU,0, "HARMONIC", menu_harmonic}, -#endif { MT_ADV_CALLBACK, 0, "LINEAR\nAVERAGING", menu_linear_averaging_acb}, // { MT_SUBMENU, 0, S_RARROW" MORE", menu_settings3}, { MT_KEYPAD, KM_DIRECT_START, "DSTART\n\b%s", ""},