Multi band under frequency menu

segmented
erikkaashoek 3 years ago
parent d781c3e6cd
commit 4ad3b092e2

@ -1345,7 +1345,7 @@ static void
set_frequencies(freq_t start, freq_t stop, uint16_t points) set_frequencies(freq_t start, freq_t stop, uint16_t points)
{ {
#ifdef __BANDS__ #ifdef __BANDS__
if (setting.measurement == M_BANDS) { if (setting.multi_band) {
freq_t span = 0; freq_t span = 0;
for (int i=0; i<BANDS_MAX; i++) { 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) { freq_t getFrequency(uint16_t idx) {
#ifdef __BANDS__ #ifdef __BANDS__
if (setting.measurement == M_BANDS) { if (setting.multi_band) {
if (idx >= POINTS_COUNT) if (idx >= POINTS_COUNT)
idx = POINTS_COUNT-1; idx = POINTS_COUNT-1;
int b = _f_band_index[idx]; int b = _f_band_index[idx];
@ -1402,7 +1402,7 @@ freq_t getFrequency(uint16_t idx) {
#ifdef __BANDS__ #ifdef __BANDS__
int getBand(uint16_t idx) { int getBand(uint16_t idx) {
if (setting.measurement == M_BANDS) if (setting.multi_band)
return _f_band_index[idx]; return _f_band_index[idx];
return 0; return 0;
} }
@ -1495,7 +1495,7 @@ freq_t
get_sweep_frequency(int type) get_sweep_frequency(int type)
{ {
#ifdef __BANDS__ #ifdef __BANDS__
if (setting.measurement == M_BANDS) { if (setting.multi_band) {
switch (type) { switch (type) {
case ST_START: return getFrequency(0); case ST_START: return getFrequency(0);
case ST_STOP: return getFrequency(sweep_points); case ST_STOP: return getFrequency(sweep_points);

@ -1229,6 +1229,9 @@ typedef struct setting
uint8_t draw_line; // uses the trigger level setting uint8_t draw_line; // uses the trigger level setting
#ifdef TINYSA4 #ifdef TINYSA4
uint8_t lock_display; uint8_t lock_display;
#endif
#ifdef __BANDS__
uint8_t multi_band;
#endif #endif
uint16_t repeat; // 1...100 uint16_t repeat; // 1...100
uint16_t linearity_step; // range equal POINTS_COUNT uint16_t linearity_step; // range equal POINTS_COUNT
@ -1773,9 +1776,9 @@ void interpolate_maximum(int m);
void calibrate_modulation(int modulation, int8_t *correction); void calibrate_modulation(int modulation, int8_t *correction);
enum { enum {
M_OFF, M_IMD, M_OIP3, M_PHASE_NOISE, M_SNR, M_PASS_BAND, M_LINEARITY, M_AM, M_FM, M_THD, M_CP, M_NF_TINYSA, M_NF_STORE, M_NF_VALIDATE, M_NF_AMPLIFIER, M_BANDS, M_DECONV,M_MAX M_OFF, M_IMD, M_OIP3, M_PHASE_NOISE, M_SNR, M_PASS_BAND, M_LINEARITY, M_AM, M_FM, M_THD, M_CP, M_NF_TINYSA, M_NF_STORE, M_NF_VALIDATE, M_NF_AMPLIFIER, M_DECONV,M_MAX
}; };
#define MEASUREMENT_TEXT "OFF","IMD","OIP3","PN","SNR","PASS","LIN","AM","FM","THD","CP","NF T","NF S","NF V","NF A","MULTI","DECONF" #define MEASUREMENT_TEXT "OFF","IMD","OIP3","PN","SNR","PASS","LIN","AM","FM","THD","CP","NF T","NF S","NF V","NF A", "DECONF"
enum { enum {
T_AUTO, T_NORMAL, T_SINGLE, T_DONE, T_UP, T_DOWN, T_MODE, T_PRE, T_POST, T_MID, T_BEEP, T_AUTO, T_NORMAL, T_SINGLE, T_DONE, T_UP, T_DOWN, T_MODE, T_PRE, T_POST, T_MID, T_BEEP,

@ -1102,7 +1102,7 @@ draw_cell(int m, int n)
} }
#endif #endif
#ifdef __CHANNEL_POWER__ #ifdef __CHANNEL_POWER__
if (setting.measurement == M_BANDS) { if (setting.multi_band) {
c = GET_PALTETTE_COLOR(LCD_TRIGGER_COLOR); c = GET_PALTETTE_COLOR(LCD_TRIGGER_COLOR);
for (x = 0; x < w; x++) { for (x = 0; x < w; x++) {
int idx1 = ((x+x0) * sweep_points) / WIDTH; int idx1 = ((x+x0) * sweep_points) / WIDTH;

@ -4848,7 +4848,7 @@ static bool sweep(bool break_on_operation)
if (dirty) { // Calculate new scanning solution if (dirty) { // Calculate new scanning solution
#ifdef __BANDS__ #ifdef __BANDS__
if (setting.measurement == M_BANDS) { if (setting.multi_band) {
set_frequencies(0,0,sweep_points); set_frequencies(0,0,sweep_points);
update_rbw(); update_rbw();
} }
@ -4886,7 +4886,7 @@ static bool sweep(bool break_on_operation)
again: // Waiting for a trigger jumps back to here again: // Waiting for a trigger jumps back to here
#ifdef __BANDS__xx #ifdef __BANDS__xx
if (setting.measurement == M_BANDS) { if (setting.multi_band) {
do { do {
current_band++; current_band++;
if (current_band > BANDS_MAX) if (current_band > BANDS_MAX)

50
ui.c

@ -1468,8 +1468,8 @@ static const menuitem_t menu_limit_modify[];
static const menuitem_t menu_limit_select[]; static const menuitem_t menu_limit_select[];
#endif #endif
#ifdef __BANDS__ #ifdef __BANDS__
static const menuitem_t menu_BAND_modify[]; static const menuitem_t menu_band_modify[];
static const menuitem_t menu_BAND_select[]; static const menuitem_t menu_band_select[];
#endif #endif
static const menuitem_t menu_average[]; static const menuitem_t menu_average[];
static const menuitem_t menu_reffer[]; static const menuitem_t menu_reffer[];
@ -2874,9 +2874,9 @@ validate:
} }
break; break;
#endif #endif
#ifdef __BANDS__ #ifdef __BANDS__xx
case M_BANDS: case M_BANDS:
menu_push_submenu(menu_BAND_select); menu_push_submenu(menu_band_select);
goto leave; goto leave;
break; break;
#endif #endif
@ -3200,9 +3200,24 @@ static UI_FUNCTION_ADV_CALLBACK(menu_band_select_acb)
setting.bands[active_band].enabled = true; setting.bands[active_band].enabled = true;
dirty = true; dirty = true;
// BANDs_update(); // BANDs_update();
menu_push_submenu(menu_BAND_modify); menu_push_submenu(menu_band_modify);
}
static UI_FUNCTION_ADV_CALLBACK(menu_multi_band_acb)
{
(void)item;
(void)data;
if(b){
b->icon = (setting.multi_band?BUTTON_ICON_CHECK:BUTTON_ICON_NOCHECK) ;
return;
}
dirty = true;
setting.multi_band = ! setting.multi_band;
redraw_request|= REDRAW_AREA | REDRAW_FREQUENCY | REDRAW_CAL_STATUS;
if (setting.multi_band) menu_push_submenu(menu_band_select);
} }
#
#endif #endif
extern const menuitem_t menu_marker_select[]; extern const menuitem_t menu_marker_select[];
@ -4158,16 +4173,16 @@ static const menuitem_t menu_limit_select[] = {
#endif #endif
#ifdef __BANDS__ #ifdef __BANDS__
static const menuitem_t menu_BAND_modify[] = static const menuitem_t menu_band_modify[] =
{ {
{ MT_KEYPAD, KM_BAND_START, "START\n\b%s", "Start"}, { MT_KEYPAD, KM_BAND_START, "START\n\b%s", "Start"},
{ MT_KEYPAD, KM_BAND_END, "STOP\n\b%s", "Stop"}, { MT_KEYPAD, KM_BAND_END, "STOP\n\b%s", "Stop"},
{ MT_KEYPAD, KM_BAND_LEVEL, "LEVEL\n\b%s", "Level"}, { MT_KEYPAD, KM_BAND_LEVEL, "LEVEL\n\b%s", "Level"},
{ MT_CALLBACK,0, "DISABLE", menu_BAND_disable_cb}, { MT_CALLBACK,0, "DISABLE", menu_BAND_disable_cb},
{ MT_NONE, 0, NULL, menu_back} // next-> menu_back { MT_NONE, 0, NULL, menu_back} // next-> menu_back
}; };
static const menuitem_t menu_BAND_select[] = { 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 },
#ifdef __USE_SD_CARD__ #ifdef __USE_SD_CARD__
{ MT_CALLBACK, FMT_BND_FILE, "BANDS"S_RARROW"\nSD", menu_sdcard_cb}, { MT_CALLBACK, FMT_BND_FILE, "BANDS"S_RARROW"\nSD", menu_sdcard_cb},
@ -4509,9 +4524,9 @@ static const menuitem_t menu_measure2[] = {
#ifdef __NOISE_FIGURE__ #ifdef __NOISE_FIGURE__
{ MT_SUBMENU | MT_LOW, 0, "NOISE\nFIGURE", menu_measure_noise_figure}, { MT_SUBMENU | MT_LOW, 0, "NOISE\nFIGURE", menu_measure_noise_figure},
#endif #endif
#ifdef __BANDS__ //#ifdef __BANDS__
{ MT_ADV_CALLBACK, M_BANDS, "MULTI\nBAND", menu_measure_acb}, //{ MT_ADV_CALLBACK, M_BANDS, "MULTI\nBAND", menu_measure_acb},
#endif //#endif
#ifdef __FFT_DECONV__ #ifdef __FFT_DECONV__
{ MT_ADV_CALLBACK, M_DECONV, "DECONV", menu_measure_acb}, { MT_ADV_CALLBACK, M_DECONV, "DECONV", menu_measure_acb},
#endif #endif
@ -4773,6 +4788,9 @@ static const menuitem_t menu_stimulus[] = {
{ MT_KEYPAD, KM_CENTER, "CENTER\n\b%s", NULL}, { MT_KEYPAD, KM_CENTER, "CENTER\n\b%s", NULL},
{ MT_KEYPAD, KM_SPAN, "SPAN\n\b%s", NULL}, { MT_KEYPAD, KM_SPAN, "SPAN\n\b%s", NULL},
{ MT_KEYPAD, KM_CW, "ZERO SPAN", NULL}, { MT_KEYPAD, KM_CW, "ZERO SPAN", NULL},
#ifdef __BANDS__
{ MT_ADV_CALLBACK, 0, "MULTI\nBAND", menu_multi_band_acb},
#endif
{ MT_SUBMENU,0, "RBW", menu_rbw}, { MT_SUBMENU,0, "RBW", menu_rbw},
#ifdef __VBW__ #ifdef __VBW__
{ MT_SUBMENU, 0, "VBW", menu_vbw}, { MT_SUBMENU, 0, "VBW", menu_vbw},
@ -5567,7 +5585,13 @@ redraw_cal_status:
} }
quick_menu_y[max_quick_menu] = y; quick_menu_y[max_quick_menu] = y;
quick_menu[max_quick_menu++] = (menuitem_t *)NULL; quick_menu[max_quick_menu++] = (menuitem_t *)NULL;
#ifdef __BANDS__
if (setting.multi_band){
ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN);
lcd_printf(x, y, "MULTI");
y += 2*YSTEP + YSTEP/2;
}
#endif
#ifdef TINYSA4 #ifdef TINYSA4
if (setting.measurement != M_OFF){ if (setting.measurement != M_OFF){
ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN); ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN);

Loading…
Cancel
Save

Powered by TurnKey Linux.