From ca9f856c1e10cb180f45b0eb13e854d676e5c989 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Fri, 8 May 2020 19:05:19 +0200 Subject: [PATCH] Trial for low mode only meny options --- sa_core.c | 14 +++++++------- ui.c | 28 ++++++++++++++++++++-------- ui_sa.c | 4 ++-- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/sa_core.c b/sa_core.c index 32b45ed..584ff33 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1569,14 +1569,14 @@ static const struct { {// Condition Preparation Center Span Pass Width Stop {TC_BELOW, TP_SILENT, 0.005, 0.01, 0,0, 0}, // 1 Zero Hz leakage {TC_BELOW, TP_SILENT, 0.01, 0.01, -30, 0, 0}, // 2 Phase noise of zero Hz - {TC_SIGNAL, TP_10MHZ, 20, 7, -37, 30, -80 }, // 3 - {TC_SIGNAL, TP_10MHZ, 30, 7, -32, 30, -80 }, // 4 - {TC_BELOW, TP_SILENT, 200, 100, -70, 0, 0}, // 5 Wide band noise floor low mode - {TC_BELOW, TPH_SILENT, 600, 720, -65, 0, 0}, // 6 Wide band noise floor high mode - {TC_SIGNAL, TP_10MHZEXTRA, 10, 8, -20, 80, -60 }, // 7 BPF loss and stop band + {TC_SIGNAL, TP_10MHZ, 20, 7, -37, 30, -90 }, // 3 + {TC_SIGNAL, TP_10MHZ, 30, 7, -32, 30, -90 }, // 4 + {TC_BELOW, TP_SILENT, 200, 100, -75, 0, 0}, // 5 Wide band noise floor low mode + {TC_BELOW, TPH_SILENT, 600, 720, -75, 0, 0}, // 6 Wide band noise floor high mode + {TC_SIGNAL, TP_10MHZEXTRA, 10, 8, -20, 80, -80 }, // 7 BPF loss and stop band {TC_FLAT, TP_10MHZEXTRA, 10, 4, -18, 20, -60}, // 8 BPF pass band flatness - {TC_BELOW, TP_30MHZ, 430, 60, -65, 0, -75}, // 9 LPF cutoff - {TC_SIGNAL, TP_10MHZ_SWITCH,20, 7, -58, 30, -90 }, // 10 Switch isolation + {TC_BELOW, TP_30MHZ, 430, 60, -80, 0, -80}, // 9 LPF cutoff + {TC_SIGNAL, TP_10MHZ_SWITCH,20, 7, -58, 30, -95 }, // 10 Switch isolation {TC_END, 0, 0, 0, 0, 0, 0}, {TC_MEASURE, TP_30MHZ, 30, 7, -22.5, 30, -70 }, // 12 Measure power level and noise {TC_MEASURE, TP_30MHZ, 270, 4, -50, 30, -75 }, // 13 Measure powerlevel and noise diff --git a/ui.c b/ui.c index 53e3954..f38017e 100644 --- a/ui.c +++ b/ui.c @@ -87,7 +87,7 @@ static char kp_buf[NUMINPUT_LEN+1]; static int8_t kp_index = 0; static char *kp_help_text = NULL; static uint8_t menu_current_level = 0; -static int8_t selection = 0; +static int selection = 0; // Set structure align as WORD (save flash memory) #pragma pack(push, 2) @@ -442,9 +442,10 @@ enum { MT_CANCEL, MT_TITLE, MT_CLOSE, - MT_KEYPAD + MT_KEYPAD, + MT_LOW = 0x40, // Only applicable to low mode + MT_FORM = 0x80, // Large button menu }; -#define MT_FORM 0x80 // Or with menu type to get large button with current value #define MT_BACK 0x40 #define MT_LEAVE 0x20 #define MT_ICON 0x10 @@ -1127,7 +1128,7 @@ ensure_selection(void) selection = 1; return; } - for (i = 0; MT_MASK(menu[i].type) != MT_NONE ; i++) + for (i = 0; MT_MASK(menu[i].type) != MT_NONE; i++) ; if (selection >= i) selection = i-1; @@ -1537,13 +1538,15 @@ draw_menu_buttons(const menuitem_t *menu) { int i = 0; char text[30]; + int y = 0; for (i = 0; i < 8; i++) { const char *l1, *l2; + if ((menu[i].type & MT_LOW) && !MODE_LOW(setting.mode)) //not applicable to mode + continue; if (MT_MASK(menu[i].type) == MT_NONE) break; if (MT_MASK(menu[i].type) == MT_BLANK) continue; - int y = MENU_BUTTON_HEIGHT*i; uint16_t bg; uint16_t fg; if (MT_MASK(menu[i].type) == MT_TITLE) { @@ -1622,6 +1625,7 @@ draw_menu_buttons(const menuitem_t *menu) #endif } } + y += MENU_BUTTON_HEIGHT; } } @@ -1641,14 +1645,17 @@ menu_apply_touch(void) int touch_x, touch_y; const menuitem_t *menu = menu_stack[menu_current_level]; int i; - + int y = 0; touch_position(&touch_x, &touch_y); for (i = 0; i < 8; i++) { + if ((menu[i].type & MT_LOW) && !MODE_LOW(setting.mode)) //not applicable to mode + continue; if (MT_MASK(menu[i].type) == MT_NONE) break; - if (MT_MASK(menu[i].type == MT_BLANK) || MT_MASK(menu[i].type) == MT_TITLE) + if (MT_MASK(menu[i].type == MT_BLANK) || MT_MASK(menu[i].type) == MT_TITLE) { + y += MENU_BUTTON_HEIGHT; continue; - int y = MENU_BUTTON_HEIGHT*i; + } int active_button_width; if (menu[i].type & MT_FORM) active_button_width = MENU_FORM_WIDTH; @@ -1659,6 +1666,7 @@ menu_apply_touch(void) menu_select_touch(i); return; } + y += MENU_BUTTON_HEIGHT; } if (menu_is_form(menu)) return; @@ -2018,12 +2026,16 @@ ui_process_menu(void) do { if (status & EVT_UP) { // close menu if next item is sentinel + while ((menu_stack[menu_current_level][selection+1].type & MT_LOW) && !MODE_LOW(setting.mode)) + selection++; if (menu_stack[menu_current_level][selection+1].type == MT_NONE) goto menuclose; if (!(menu_stack[menu_current_level][selection+1].type == (MT_FORM | MT_NONE))) selection++; } if (status & EVT_DOWN) { + while ((menu_stack[menu_current_level][selection+1].type & MT_LOW) && !MODE_LOW(setting.mode)) + selection--; if (! ( selection == 0 && menu_stack[menu_current_level][0].type & MT_FORM)) selection--; } diff --git a/ui_sa.c b/ui_sa.c index 19a2c96..245559d 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -1387,9 +1387,9 @@ static const menuitem_t menu_levelhigh[] = { // { MT_SUBMENU, 0, "\2SCALE/\0DIV",menu_scale_per}, { MT_KEYPAD, KM_SCALE, "\2SCALE/\0DIV", NULL}, { MT_SUBMENU,0, "AVER", menu_average}, - { MT_CANCEL, 0, S_LARROW" BACK",NULL }, { MT_SUBMENU, 0, "UNIT", menu_unit}, { MT_KEYPAD, KM_OFFSET, "\2EXTERN\0AMP", NULL}, + { MT_CANCEL, 0, S_LARROW" BACK",NULL }, { MT_NONE, 0, NULL, NULL } // sentinel }; @@ -1413,7 +1413,7 @@ static const menuitem_t menu_stimulus[] = { { MT_KEYPAD, KM_CW, "\2ZERO\0SPAN", NULL}, { MT_SUBMENU,0, "RBW", menu_rbw}, #ifdef __SPUR__ - { MT_CALLBACK,0, "\2SPUR\0REMOVAL", menu_spur_cb}, + { MT_CALLBACK | MT_LOW,0, "\2SPUR\0REMOVAL", menu_spur_cb}, #endif { MT_CANCEL, 0, S_LARROW" BACK", NULL }, { MT_NONE, 0, NULL, NULL } // sentinel