diff --git a/sa_core.c b/sa_core.c index 2f06bf9..781e54d 100644 --- a/sa_core.c +++ b/sa_core.c @@ -168,17 +168,17 @@ void reset_settings(int m) uint32_t calc_min_sweep_time_us(void) // Calculate minimum sweep time in uS needed just because of the delays for the RSSI to become stable { - float t; - float a = (SI4432_step_delay + MEASURE_TIME); // Single RSSI delay and measurement time in uS while scanning + uint32_t t; if (MODE_OUTPUT(setting.mode)) t = 100; else { + uint32_t a = (SI4432_step_delay + MEASURE_TIME) * (sweep_points - 1); // Single RSSI delay and measurement time in uS while scanning if (FREQ_IS_CW()) { - a = MINIMUM_SWEEP_TIME / (sweep_points - 1); // time per step in fast CW mode + a = MINIMUM_SWEEP_TIME; // time per step in fast CW mode if (setting.repeat != 1 || setting.sweep_time_us >= ONE_SECOND_TIME || setting.spur != 0) - a = 15000.0 / (sweep_points - 1); // time per step in CW mode with repeat too long for fast delay + a = 15000; // time per step in CW mode with repeat too long for fast delay } - t = vbwSteps * (sweep_points - 1) * (setting.spur ? 2 : 1) * ( (a + (setting.repeat - 1)* REPEAT_TIME)); + t = vbwSteps * (setting.spur ? 2 : 1) * ( (a + (setting.repeat - 1)* ( REPEAT_TIME * (sweep_points - 1)))); } return t; } @@ -1653,6 +1653,7 @@ sweep_again: // stay in sweep loop when output mo // if (prev_sweep_time > ONE_SECOND_TIME) { ili9341_fill(OFFSETX, HEIGHT_NOSCROLL+1, WIDTH, 1, 0); // } + setting.actual_sweep_time_us = prev_sweep_time; // restore last sweep time when aborting return false; } diff --git a/ui_sa.c b/ui_sa.c index d0a391d..c4c52b3 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -1803,7 +1803,7 @@ static void fetch_numeric_target(void) break; case KM_SAMPLETIME: uistat.value = setting.step_delay; - plot_printf(uistat.text, sizeof uistat.text, "%3duS", ((int32_t)uistat.value)); + plot_printf(uistat.text, sizeof uistat.text, "%3dus", ((int32_t)uistat.value)); break; case KM_REPEAT: uistat.value = setting.repeat; @@ -1851,7 +1851,7 @@ static void fetch_numeric_target(void) else uistat.value = setting.sweep_time_us; uistat.value /= (float)ONE_SECOND_TIME; - plot_printf(uistat.text, sizeof uistat.text, "%.3FS", uistat.value); + plot_printf(uistat.text, sizeof uistat.text, "%.3Fs", uistat.value); break; case KM_TRIGGER: uistat.value = setting.trigger_level;