From d312fb3986253e6d5edcc826c162a6a27e775e0e Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Mon, 6 Jul 2020 19:02:12 +0200 Subject: [PATCH] Ensure high mode attenuation and offset is working correctly and --- plot.c | 4 ++-- sa_core.c | 13 +++++++++++++ ui_sa.c | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/plot.c b/plot.c index cfdf78a..4dc30ae 100644 --- a/plot.c +++ b/plot.c @@ -2057,8 +2057,8 @@ static void cell_draw_marker_info(int x0, int y0) // buf[k++] = 0; ili9341_set_background(DEFAULT_BG_COLOR); uint16_t color; - if ((setting.mode == M_LOW && temppeakLevel - get_attenuation() > -1) || - (setting.mode == M_HIGH && temppeakLevel - get_attenuation() > -10)) + if ((setting.mode == M_LOW && temppeakLevel - get_attenuation() - setting.offset > -1) || + (setting.mode == M_HIGH && temppeakLevel - get_attenuation()- setting.offset > -10)) color = BRIGHT_COLOR_RED; else color = marker_color(markers[i].mtype); diff --git a/sa_core.c b/sa_core.c index 090d55a..1850e43 100644 --- a/sa_core.c +++ b/sa_core.c @@ -412,6 +412,7 @@ void set_attenuation(float a) // Is used both in output mode and input mod } else setting.atten_step = 0; setting.auto_attenuation = false; + dirty = true; } if (a<0.0) a = 0; @@ -800,6 +801,17 @@ void calculate_step_delay(void) if (setting.frequency_step == 0) { // zero span mode, not dependent on selected RBW SI4432_step_delay = 0; } else { +#if 1 + if (actual_rbw_x10 >= 1910) { SI4432_step_delay = 150; SI4432_offset_delay = 10; } + else if (actual_rbw_x10 >= 1420) { SI4432_step_delay = 350; SI4432_offset_delay = 10; } + else if (actual_rbw_x10 >= 750) { SI4432_step_delay = 450; SI4432_offset_delay = 10; } + else if (actual_rbw_x10 >= 560) { SI4432_step_delay = 650; SI4432_offset_delay = 10; } + else if (actual_rbw_x10 >= 370) { SI4432_step_delay = 700; SI4432_offset_delay = 10; } + else if (actual_rbw_x10 >= 180) { SI4432_step_delay = 1100; SI4432_offset_delay = 100; } + else if (actual_rbw_x10 >= 90) { SI4432_step_delay = 1700; SI4432_offset_delay = 400; } + else if (actual_rbw_x10 >= 48) { SI4432_step_delay = 3300; SI4432_offset_delay = 400; } + else { SI4432_step_delay = 6400; SI4432_offset_delay = 800; } +#else if (actual_rbw_x10 >= 1910) { SI4432_step_delay = 280; SI4432_offset_delay = 100; } else if (actual_rbw_x10 >= 1420) { SI4432_step_delay = 350; SI4432_offset_delay = 100; } else if (actual_rbw_x10 >= 750) { SI4432_step_delay = 450; SI4432_offset_delay = 100; } @@ -809,6 +821,7 @@ void calculate_step_delay(void) else if (actual_rbw_x10 >= 90) { SI4432_step_delay = 1700; SI4432_offset_delay = 400; } else if (actual_rbw_x10 >= 50) { SI4432_step_delay = 3300; SI4432_offset_delay = 400; } else { SI4432_step_delay = 6400; SI4432_offset_delay =1600; } +#endif if (setting.step_delay_mode == SD_PRECISE) // In precise mode wait twice as long for RSSI to stabalize SI4432_step_delay *= 2; } diff --git a/ui_sa.c b/ui_sa.c index 859462f..adfd902 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -1291,7 +1291,7 @@ static const menuitem_t menu_atten[] = { { MT_CALLBACK | MT_LOW, 0, "AUTO", menu_atten_cb}, { MT_KEYPAD | MT_LOW, KM_ATTENUATION, "MANUAL", "0..30"}, { MT_CALLBACK | MT_HIGH,0, "0dB", menu_atten_high_cb}, - { MT_CALLBACK | MT_HIGH,30, "30dB", menu_atten_high_cb}, + { MT_CALLBACK | MT_HIGH,30, "\00225..30dB", menu_atten_high_cb}, { MT_CANCEL, 0, "\032 BACK", NULL }, { MT_FORM | MT_NONE, 0, NULL, NULL } // sentinel };