diff --git a/flash.c b/flash.c index 52775a7..2e575c7 100644 --- a/flash.c +++ b/flash.c @@ -237,6 +237,7 @@ caldata_recall(uint16_t id) set_reflevel(setting.reflevel); set_waterfall(); set_level_meter(); + update_rbw(); sweep_mode = SWEEP_ENABLE; #ifdef __ULTRA__ ultra_start = (config.ultra_start == ULTRA_AUTO ? DEFAULT_ULTRA_THRESHOLD : config.ultra_start); diff --git a/nanovna.h b/nanovna.h index 1e3e9ec..e107483 100644 --- a/nanovna.h +++ b/nanovna.h @@ -18,7 +18,7 @@ */ #include "ch.h" -#ifdef TINYSA_F303 +//#ifdef TINYSA_F303 #ifdef TINYSA_F072 #error "Remove comment for #ifdef TINYSA_F303" #endif @@ -26,7 +26,7 @@ #define TINYSA4 #endif #define TINYSA4_PROTO -#endif +//#endif #ifdef TINYSA_F072 #ifdef TINYSA_F303 diff --git a/plot.c b/plot.c index 081ad94..2d48a44 100644 --- a/plot.c +++ b/plot.c @@ -575,15 +575,31 @@ markmap_upperarea(void) #endif } -static uint16_t get_trigger_level(void){ +static uint16_t get_trigger_level( +#ifdef __BANDS__ + int x +#else + void +#endif + ){ index_y_t trigger; +#ifdef __BANDS__ + if (setting.multi_band && !setting.multi_trace) { + int b = getBand(x); + setting.trigger_level = setting.bands[b].level; + } +#endif trace_into_index_y_array(&trigger, &setting.trigger_level, 1); return trigger; } static inline void markmap_trigger_area(void){ +#ifdef __BANDS__ + uint16_t tp = get_trigger_level(0); +#else uint16_t tp = get_trigger_level(); +#endif markmap[current_mappage][tp/CELLWIDTH] = (map_t)0xFFFFFFFF; } @@ -1142,12 +1158,19 @@ draw_cell(int m, int n) || setting.draw_line #endif ) { - c = GET_PALTETTE_COLOR(LCD_TRIGGER_COLOR); + c = GET_PALTETTE_COLOR(LCD_TRIGGER_COLOR); +#ifndef __BANDS__ int tp = get_trigger_level() - y0; if (tp>=0 && tp < h) - for (x = 0; x < w; x++) - if ((uint32_t)(x + x0 - CELLOFFSETX) <= WIDTH + CELLOFFSETX) - cell_buffer[tp * CELLWIDTH + x] = c; +#endif + for (x = 0; x < w; x++) { +#ifdef __BANDS__ + int tp = get_trigger_level(x + x0 - CELLOFFSETX) - y0; + if (tp>=0 && tp < h) +#endif + if ((uint32_t)(x + x0 - CELLOFFSETX) <= WIDTH + CELLOFFSETX) + cell_buffer[tp * CELLWIDTH + x] = c; + } } #if 1 // Only right cells diff --git a/sa_core.c b/sa_core.c index f4e6ff7..b405128 100644 --- a/sa_core.c +++ b/sa_core.c @@ -4880,6 +4880,8 @@ static bool sweep(bool break_on_operation) if (setting.multi_band && ! setting.multi_trace) { set_frequencies(0,0,sweep_points); update_rbw(); + current_band = getBand(0); + setting.trigger_level = setting.bands[current_band].level; } #endif sweep_counter = 0; @@ -4975,6 +4977,15 @@ static bool sweep(bool break_on_operation) debug_avoid_label: debug_avoid_second = debug_avoid_second; freq_t current_freq = getFrequency(i); +#ifdef __BANDS__ + if (setting.multi_band && !setting.multi_trace) { + int new_band = getBand(i); + if (current_band != new_band) { + current_band = new_band; + setting.trigger_level = setting.bands[current_band].level; + } + } +#endif // --------------------- measure ------------------------- pureRSSI_t rssi = perform(break_on_operation, i, current_freq, setting.tracking); // Measure RSSI for one of the frequencies #ifdef TINYSA4 diff --git a/ui.c b/ui.c index 83fef5a..f64a00d 100644 --- a/ui.c +++ b/ui.c @@ -2997,7 +2997,9 @@ static UI_FUNCTION_ADV_CALLBACK(menu_trigger_level_acb) if (data == 254) { if (setting.trigger_trace == 255) { char *format; - if (UNIT_IS_LINEAR(setting.unit)) + if (setting.multi_band) + format = "LEVEL\n\bMULTI"; + else if (UNIT_IS_LINEAR(setting.unit)) format = "LEVEL\n\b%.3F%s"; // 5 characters incl u, m, etc... else format = "LEVEL\n\b%.1f%s"; @@ -3024,7 +3026,8 @@ static UI_FUNCTION_ADV_CALLBACK(menu_trigger_level_acb) } if (data == 255) { setting.trigger_trace = data; - ui_mode_keypad(KM_TRIGGER); + if (!setting.multi_band) + ui_mode_keypad(KM_TRIGGER); return; } else { if (IS_TRACE_ENABLE(data) && data != setting.trigger_trace)