diff --git a/sa_core.c b/sa_core.c index 0abff57..8c4c3e8 100644 --- a/sa_core.c +++ b/sa_core.c @@ -900,7 +900,7 @@ void setupSA(void) RESTART_PROFILE // measure 290 points to get real added time for 200 points SI4432_Fill(0,0); int t2 = DELTA_TIME; - int t = (t2 - t1) * 100 * POINTS_COUNT / 200; // And calculate real time excluding overhead for all points + int t = (t2 - t1) * 100 * (sweep_points) / 200; // And calculate real time excluding overhead for all points #endif } extern int SI4432_frequency_changed; @@ -1685,8 +1685,9 @@ sweep_again: // stay in sweep loop when output mo if (MODE_INPUT(setting.mode)) { if (setting.actual_sweep_time_us > ONE_SECOND_TIME && (i & 0x07) == 0) { // if required - ili9341_fill(OFFSETX, HEIGHT_NOSCROLL+1, i, 1, BRIGHT_COLOR_GREEN); // update sweep progress bar - ili9341_fill(OFFSETX+i, HEIGHT_NOSCROLL+1, WIDTH-i, 1, 0); + int pos = i * sweep_points / (WIDTH+1); + ili9341_fill(OFFSETX, HEIGHT_NOSCROLL+1, pos, 1, BRIGHT_COLOR_GREEN); // update sweep progress bar + ili9341_fill(OFFSETX+i, HEIGHT_NOSCROLL+1, WIDTH-pos, 1, 0); } // ------------------------ do all RSSI calculations from CALC menu ------------------- @@ -2025,8 +2026,8 @@ sweep_again: // stay in sweep loop when output mo //---------------- in Linearity measurement the attenuation has to be adapted ------------------ - if (setting.measurement == M_LINEARITY && setting.linearity_step < setting._sweep_points) { - setting.attenuate = 29.0 - setting.linearity_step * 30.0 / POINTS_COUNT; + if (setting.measurement == M_LINEARITY && setting.linearity_step < sweep_points) { + setting.attenuate = 29.0 - setting.linearity_step * 30.0 / (sweep_points); dirty = true; stored_t[setting.linearity_step] = peakLevel; setting.linearity_step++; @@ -3006,7 +3007,7 @@ do_again: #endif setting.offset_delay = 1600; test_value = saved_peakLevel; - if ((uint32_t)(setting.rbw_x10 * 1000) / 290 < 8000) { // fast mode possible + if ((uint32_t)(setting.rbw_x10 * 1000) / (sweep_points) < 8000) { // fast mode possible while (setting.offset_delay > 0 && test_value != 0 && test_value > saved_peakLevel - 1.5) { test_prepare(i); setting.step_delay_mode = SD_FAST; diff --git a/ui_sa.c b/ui_sa.c index 053ea62..43a6802 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -1077,6 +1077,13 @@ static void menu_outputmode_cb(int item, uint8_t data) draw_menu(); } +static const uint16_t points_setting[] = {145, 290, -1}; +static void menu_points_cb(int item, uint8_t data){ + (void)item; + set_sweep_points(points_setting[data]); + draw_menu(); +} + //const int menu_drive_value[]={5,10,15,20}; const char *menu_drive_text[]={"-38dBm","-35dBm","-33dBm","-30dBm","-27dBm","-24dBm","-21dBm"," -19dBm", " -7dBm"," -4dBm"," -2dBm"," 1dBm"," 4dBm"," 7dBm"," 10dBm"," 13dBm"}; @@ -1392,12 +1399,20 @@ static const menuitem_t menu_scanning_speed[] = { MT_NONE, 0, NULL, NULL } // sentinel }; +const menuitem_t menu_sweep_points[] = { + { MT_CALLBACK, 0, "145p", menu_points_cb }, + { MT_CALLBACK, 1, "290p", menu_points_cb }, + { MT_CANCEL, -1, S_LARROW" BACK", NULL }, + { MT_NONE, 0, NULL, NULL } // sentinel +}; + static const menuitem_t menu_sweep_speed[] = { { MT_CALLBACK, SD_NORMAL, "NORMAL", menu_scanning_speed_cb}, // order must match definition of enum { MT_CALLBACK, SD_PRECISE, "PRECISE", menu_scanning_speed_cb}, { MT_CALLBACK, SD_FAST, "FAST", menu_scanning_speed_cb}, { MT_KEYPAD, KM_SWEEP_TIME, "MANUAL", "0..600s"}, + { MT_SUBMENU, 0, "\2SWEEP\0POINTS", menu_sweep_points}, { MT_CANCEL, 0, "\032 BACK", NULL }, { MT_NONE, 0, NULL, NULL } // sentinel }; @@ -1691,7 +1706,12 @@ static void menu_item_modify_attribute( if (item == setting.step_delay_mode){ mark = true; } - } else if (menu == menu_sweep_speed) { + } else if (menu == menu_sweep_points) { + if (points_setting[data] == sweep_points){ + mark = true; + } + } + else if (menu == menu_sweep_speed) { if (item == 3 && setting.sweep_time_us != 0){ mark = true; }