Added multi trace mode

segmented
erikkaashoek 3 years ago
parent 4ad3b092e2
commit f91dad70e7

@ -1345,7 +1345,7 @@ static void
set_frequencies(freq_t start, freq_t stop, uint16_t points)
{
#ifdef __BANDS__
if (setting.multi_band) {
if (setting.multi_band && !setting.multi_trace) {
freq_t span = 0;
for (int i=0; i<BANDS_MAX; i++) {
@ -1388,7 +1388,7 @@ set_frequencies(freq_t start, freq_t stop, uint16_t points)
}
freq_t getFrequency(uint16_t idx) {
#ifdef __BANDS__
if (setting.multi_band) {
if (setting.multi_band && !setting.multi_trace) {
if (idx >= POINTS_COUNT)
idx = POINTS_COUNT-1;
int b = _f_band_index[idx];
@ -1402,7 +1402,7 @@ freq_t getFrequency(uint16_t idx) {
#ifdef __BANDS__
int getBand(uint16_t idx) {
if (setting.multi_band)
if (setting.multi_band && !setting.multi_trace)
return _f_band_index[idx];
return 0;
}
@ -1495,12 +1495,21 @@ freq_t
get_sweep_frequency(int type)
{
#ifdef __BANDS__
if (setting.multi_band) {
if (setting.multi_band && !setting.multi_trace) {
switch (type) {
case ST_START: return getFrequency(0);
case ST_STOP: return getFrequency(sweep_points);
case ST_CENTER: return (getFrequency(sweep_points) + getFrequency(0))/2;
case ST_SPAN: return (getFrequency(sweep_points) - getFrequency(0))/2;
case ST_SPAN:
{
freq_t span = 0;
for (int i=0; i<BANDS_MAX; i++) {
if (setting.bands[i].enabled) {
span += setting.bands[i].end - setting.bands[i].start;
}
}
return span;
}
case ST_CW: return getFrequency(0); // Should never happen
}
}

@ -1232,6 +1232,7 @@ typedef struct setting
#endif
#ifdef __BANDS__
uint8_t multi_band;
uint8_t multi_trace;
#endif
uint16_t repeat; // 1...100
uint16_t linearity_step; // range equal POINTS_COUNT
@ -1439,7 +1440,7 @@ typedef struct properties {
//sizeof(properties_t) == 0x1200
#define CONFIG_MAGIC 0x434f4e60 /* 'CONF' */
#define SETTING_MAGIC 0x434f4e61
#define SETTING_MAGIC 0x434f4e62
extern int16_t lastsaveid;
//extern properties_t *active_props;

@ -1101,8 +1101,8 @@ draw_cell(int m, int n)
}
}
#endif
#ifdef __CHANNEL_POWER__
if (setting.multi_band) {
#ifdef __BANDS__
if (setting.multi_band && !setting.multi_trace) {
c = GET_PALTETTE_COLOR(LCD_TRIGGER_COLOR);
for (x = 0; x < w; x++) {
int idx1 = ((x+x0) * sweep_points) / WIDTH;
@ -1835,7 +1835,22 @@ draw_frequencies(void)
return;
if (current_menu_is_form() && !in_selftest)
return;
#ifdef __BANDS__
if (setting.multi_band && !setting.multi_trace) {
ili9341_set_foreground(LCD_FG_COLOR);
ili9341_set_background(LCD_BG_COLOR);
ili9341_fill(FREQUENCIES_XPOS1, CHART_BOTTOM + 1, LCD_WIDTH - FREQUENCIES_XPOS1, LCD_HEIGHT - CHART_BOTTOM - 1);
int idx=0;
do {
int b = getBand(idx);
// plot_printf(buf1, sizeof(buf1), "%.3QHz-%.3QHz %5.1QHz/", setting.bands[b].start + (setting.frequency_offset - FREQUENCY_SHIFT), setting.bands[b].end + (setting.frequency_offset - FREQUENCY_SHIFT), grid_span);
plot_printf(buf1, sizeof(buf1), "%.3QHz %5.1QHz/", setting.bands[b].start + (setting.frequency_offset - FREQUENCY_SHIFT), grid_span);
ili9341_drawstring(buf1, FREQUENCIES_XPOS1+idx, FREQUENCIES_YPOS);
while (b == getBand(++idx));
} while (idx < sweep_points - 10);
return;
}
#endif
char *shift = (setting.frequency_offset == FREQUENCY_SHIFT ? "" : "shifted");
if (FREQ_IS_CW()) {
plot_printf(buf1, sizeof(buf1), " CW %QHz", get_sweep_frequency(ST_CW) + (setting.frequency_offset - FREQUENCY_SHIFT));

@ -4848,7 +4848,7 @@ static bool sweep(bool break_on_operation)
if (dirty) { // Calculate new scanning solution
#ifdef __BANDS__
if (setting.multi_band) {
if (setting.multi_band && ! setting.multi_trace) {
set_frequencies(0,0,sweep_points);
update_rbw();
}
@ -4885,8 +4885,8 @@ static bool sweep(bool break_on_operation)
uint16_t triggered = false;
again: // Waiting for a trigger jumps back to here
#ifdef __BANDS__xx
if (setting.multi_band) {
#ifdef __BANDS__
if (setting.multi_band && setting.multi_trace) {
do {
current_band++;
if (current_band > BANDS_MAX)
@ -4897,9 +4897,9 @@ static bool sweep(bool break_on_operation)
last_band = current_band;
set_sweep_frequency(ST_START, setting.bands[current_band].start);
set_sweep_frequency(ST_STOP, setting.bands[current_band].end);
set_step_delay(SD_FAST);
set_rbw(8000);
set_sweep_points((setting.bands[current_band].end - setting.bands[current_band].start) / 800000);
// set_step_delay(SD_FAST);
// set_rbw(8000);
// set_sweep_points((setting.bands[current_band].end - setting.bands[current_band].start) / 800000);
setting.trigger_level = setting.bands[current_band].level;
setting.auto_attenuation = false;
}

23
ui.c

@ -3199,6 +3199,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_band_select_acb)
active_band = data;
setting.bands[active_band].enabled = true;
dirty = true;
update_grid();
// BANDs_update();
menu_push_submenu(menu_band_modify);
}
@ -3217,6 +3218,19 @@ static UI_FUNCTION_ADV_CALLBACK(menu_multi_band_acb)
if (setting.multi_band) menu_push_submenu(menu_band_select);
}
static UI_FUNCTION_ADV_CALLBACK(menu_multi_trace_acb)
{
(void)item;
(void)data;
if(b){
b->icon = (setting.multi_trace?BUTTON_ICON_CHECK:BUTTON_ICON_NOCHECK) ;
return;
}
dirty = true;
setting.multi_trace = ! setting.multi_trace;
redraw_request|= REDRAW_AREA | REDRAW_FREQUENCY | REDRAW_CAL_STATUS;
}
#
#endif
@ -3358,6 +3372,7 @@ static UI_FUNCTION_CALLBACK(menu_BAND_disable_cb)
if (active_band<BANDS_MAX){
setting.bands[active_band].enabled = false;
dirty = true;
update_grid();
// BANDs_update();
menu_move_back(false);
}
@ -3783,7 +3798,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_enter_marker_acb)
}
#ifdef TINYSA4
static const uint16_t points_setting[] = {51, 101, 201, 256, 290, 450};
static const uint16_t points_setting[] = {25, 50, 100, 200, 290, 450};
#else
static const uint16_t points_setting[] = {51, 101, 145, 290};
#endif
@ -4183,7 +4198,8 @@ static const menuitem_t menu_band_modify[] =
};
static const menuitem_t menu_band_select[] = {
{ MT_ADV_CALLBACK | MT_REPEATS, DATA_STARTS_REPEATS(0,BANDS_MAX), MT_CUSTOM_LABEL, menu_band_select_acb },
{ MT_ADV_CALLBACK | MT_REPEATS, DATA_STARTS_REPEATS(0,BANDS_MAX), MT_CUSTOM_LABEL, menu_band_select_acb },
{ MT_ADV_CALLBACK, 0 , "MULTI\nTRACE", menu_multi_trace_acb },
#ifdef __USE_SD_CARD__
{ MT_CALLBACK, FMT_BND_FILE, "BANDS"S_RARROW"\nSD", menu_sdcard_cb},
#ifdef __SD_FILE_BROWSER__
@ -5273,16 +5289,19 @@ set_numeric_value(void)
case KM_BAND_START:
setting.bands[active_band].start = uistat.freq_value - (setting.frequency_offset - FREQUENCY_SHIFT);
dirty = true;
update_grid();
// BANDs_update();
break;
case KM_BAND_END:
setting.bands[active_band].end = uistat.freq_value - (setting.frequency_offset - FREQUENCY_SHIFT);
dirty = true;
update_grid();
// BANDs_update();
break;
case KM_BAND_LEVEL:
setting.bands[active_band].level = to_dBm(uistat.value);
dirty = true;
update_grid();
// BANDs_update();
break;
#endif

Loading…
Cancel
Save

Powered by TurnKey Linux.