From 5901b61126f3a9f4eae70587d889ad8e94e2686b Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Tue, 15 Dec 2020 15:11:07 +0100 Subject: [PATCH] Reduce differences --- nanovna.h | 2 +- plot.c | 4 ++-- sa_core.c | 14 ++++++-------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/nanovna.h b/nanovna.h index 58eca55..f8a3e53 100644 --- a/nanovna.h +++ b/nanovna.h @@ -364,7 +364,7 @@ extern uint16_t graph_bottom; // Maximum menu buttons count #define MENU_BUTTON_MAX 8 #define MENU_BUTTON_WIDTH 80 -#define MENU_BUTTON_HEIGHT (LCD_HEIGHT/8-2) +#define MENU_BUTTON_HEIGHT (LCD_HEIGHT/8-1) #define MENU_BUTTON_BORDER 1 #define KEYBOARD_BUTTON_BORDER 2 #define FORM_BUTTON_BORDER 2 diff --git a/plot.c b/plot.c index 49a4840..da169a1 100644 --- a/plot.c +++ b/plot.c @@ -2394,7 +2394,7 @@ redraw_frame(void) static void update_waterfall(void){ int i; - int w_width = area_width < POINTS_COUNT ? area_width : POINTS_COUNT; + int w_width = area_width < WIDTH ? area_width : WIDTH; // Waterfall only in 290 or 145 points // if (!(sweep_points == 290 || sweep_points == 145)) // return; @@ -2447,7 +2447,7 @@ static void update_waterfall(void){ else color = RGB565( 0, 124-((y-160)*4), 252-((y-160)*4)); #endif - while (j * sweep_points < (i+1) * 290) { // Scale waterfall to 290 points + while (j * sweep_points < (i+1) * WIDTH) { // Scale waterfall to WIDTH points spi_buffer[j++] = color; } } diff --git a/sa_core.c b/sa_core.c index 96f65fb..b3f4736 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1009,9 +1009,7 @@ void apply_settings(void) // Ensure all settings in the setting structure if (setting.mode == M_LOW) { } -#ifdef __SI4432__ set_calibration_freq(setting.refer); -#endif update_rbw(); calculate_step_delay(); } @@ -1767,10 +1765,10 @@ modulation_again: if (MODE_HIGH(setting.mode)) { local_IF = 0; } else if (MODE_LOW(setting.mode)){ // All low mode - if (!setting.auto_IF) { + if (!setting.auto_IF) local_IF = setting.frequency_IF; - } - local_IF = DEFAULT_IF; + else + local_IF = DEFAULT_IF; if (setting.mode == M_LOW) { if (tracking) { // VERY SPECIAL CASE!!!!! Measure BPF local_IF += lf - reffer_freq[setting.refer]; // Offset so fundamental of reffer is visible @@ -1884,8 +1882,8 @@ modulation_again: // jump here if in zero span mode and all HW frequency setup is done. -#ifdef __SI4432__ #ifdef __FAST_SWEEP__ +#ifdef __SI4432__ if (i == 0 && setting.frequency_step == 0 && setting.trigger == T_AUTO && S_STATE(setting.spur_removal) == 0 && SI4432_step_delay == 0 && setting.repeat == 1 && setting.sweep_time_us < 100*ONE_MS_TIME) { // if ultra fast scanning is needed prefill the SI4432 RSSI read buffer SI4432_Fill(MODE_SELECT(setting.mode), 0); @@ -1957,7 +1955,7 @@ modulation_again: } #ifdef __SPUR__ static pureRSSI_t spur_RSSI = -1; // Initialization only to avoid warning. - if (S_STATE(setting.spur_removal)) { + if (setting.mode == M_LOW && S_STATE(setting.spur_removal)) { if (!spur_second_pass) { // If first spur pass spur_RSSI = pureRSSI; // remember measure RSSI spur_second_pass = true; @@ -2624,7 +2622,7 @@ sweep_again: // stay in sweep loop when output mo palSetPad(GPIOB, GPIOB_LED); #endif #ifdef TINYSA4 - palSetPad(GPIOC, GPIOC_LED); + palSetLine(LINE_LED); #endif return true;