UI draw update

>Multiline text - now possible output multiline in one print (for 2 line buttons for example)
>But syntax is "1_line_text\n2_line_text" possible 3 line and bigger (need only more bigger height for output)
pull/4/head
DiSlord 6 years ago
parent f9803e4d4f
commit 72ab183296

@ -586,8 +586,10 @@ void ili9341_drawchar(uint8_t ch, int x, int y)
void ili9341_drawstring(const char *str, int x, int y)
{
int x_pos = x;
while (*str) {
uint8_t ch = *str++;
if (ch == '\n') {x = x_pos; y+=FONT_STR_HEIGHT; continue;}
const uint8_t *char_buf = FONT_GET_DATA(ch);
uint16_t w = FONT_GET_WIDTH(ch);
blit8BitWidthBitmap(x, y, w, FONT_GET_HEIGHT, char_buf);
@ -597,8 +599,10 @@ void ili9341_drawstring(const char *str, int x, int y)
void ili9341_drawstring_7x13(const char *str, int x, int y)
{
int x_pos = x;
while (*str) {
uint8_t ch = *str++;
if (ch == '\n') {x = x_pos; y+=bFONT_STR_HEIGHT; continue;}
const uint8_t *char_buf = bFONT_GET_DATA(ch);
uint16_t w = bFONT_GET_WIDTH(ch);
blit8BitWidthBitmap(x, y, w, bFONT_GET_HEIGHT, char_buf);

@ -333,6 +333,7 @@ extern const uint8_t x7x11b_bits [];
#define FONT_GET_WIDTH(ch) (8-(x5x7_bits[ch*7]&7))
#define FONT_MAX_WIDTH 7
#define FONT_GET_HEIGHT 7
#define FONT_STR_HEIGHT 8
#define bFONT_GET_DATA(ch) (&x7x11b_bits[ch*11])
#define bFONT_GET_WIDTH(ch) (8-(x7x11b_bits[ch*11]&7))
@ -818,10 +819,10 @@ enum marker_smithvalue {
};
typedef struct uistat {
float value; // for editing at numeric input area
int8_t digit; /* 0~5 */
int8_t digit_mode;
int8_t current_trace; /* 0..3 */
float value; // for editing at numeric input area
// uint32_t previous_value;
uint8_t lever_mode;
uint8_t marker_delta;
@ -830,6 +831,12 @@ typedef struct uistat {
char text[20];
} uistat_t;
typedef struct ui_button {
uint16_t fg;
uint16_t bg;
char text[32];
} ui_button_t;
extern uistat_t uistat;
void ui_init(void);
void ui_show(void);

91
ui.c

@ -422,9 +422,8 @@ enter_dfu(void)
ili9341_set_background(DEFAULT_BG_COLOR);
// leave a last message
ili9341_clear_screen();
ili9341_drawstring_7x13("DFU: Device Firmware Update Mode", x, y += bFONT_STR_HEIGHT);
ili9341_drawstring_7x13("To exit DFU mode, please reset device yourself.", x, y += bFONT_STR_HEIGHT);
ili9341_drawstring_7x13("DFU: Device Firmware Update Mode\n"
"To exit DFU mode, please reset device yourself.", x, y);
// see __early_init in ./NANOVNA_STM32_F072/board.c
*((unsigned long *)BOOT_FROM_SYTEM_MEMORY_MAGIC_ADDRESS) = BOOT_FROM_SYTEM_MEMORY_MAGIC;
NVIC_SystemReset();
@ -1427,23 +1426,26 @@ draw_keypad(void)
i++;
}
}
static int
menu_is_multiline(const char *label, const char **l1, const char **l2);
menu_is_multiline(const char *label)
{
int n = 1;
while (*label)
if (*label++ == '\n')
n++;
return n;
}
static void
draw_numeric_area_frame(void)
{
const char *l1;
const char *l2;
ili9341_fill(0, LCD_HEIGHT-NUM_INPUT_HEIGHT, LCD_WIDTH, NUM_INPUT_HEIGHT, config.menu_normal_color);
ili9341_set_foreground(DEFAULT_MENU_TEXT_COLOR);
ili9341_set_background(config.menu_normal_color);
char *name = keypads_mode_tbl[keypad_mode].name;
if (menu_is_multiline(name, &l1, &l2)) {
ili9341_drawstring_7x13(l1, 10, LCD_HEIGHT-NUM_INPUT_HEIGHT+1);
ili9341_drawstring_7x13(l2, 10, LCD_HEIGHT-NUM_INPUT_HEIGHT/2 + 1);
} else
ili9341_drawstring_7x13(name, 10, LCD_HEIGHT-(bFONT_GET_HEIGHT+NUM_INPUT_HEIGHT)/2);
int lines = menu_is_multiline(name);
ili9341_drawstring_7x13(name, 10, LCD_HEIGHT-(lines*bFONT_STR_HEIGHT-NUM_INPUT_HEIGHT)/2);
//ili9341_drawfont(KP_KEYPAD, 300, 216);
}
@ -1489,26 +1491,11 @@ draw_numeric_input(const char *buf)
if (buf[0] == 0 && kp_help_text != NULL) {
ili9341_set_foreground(fg);
ili9341_set_background(bg);
const char *l1,*l2;
if (menu_is_multiline(kp_help_text, &l1, &l2)) {
ili9341_drawstring_7x13(l1, 64+NUM_FONT_GET_WIDTH+2, LCD_HEIGHT-NUM_INPUT_HEIGHT+1);
ili9341_drawstring_7x13(l2, 64+NUM_FONT_GET_WIDTH+2, LCD_HEIGHT-NUM_INPUT_HEIGHT/2 + 1);
} else
ili9341_drawstring_7x13(kp_help_text, 64+NUM_FONT_GET_WIDTH+2, LCD_HEIGHT-(bFONT_GET_HEIGHT+NUM_INPUT_HEIGHT)/2);
int lines = menu_is_multiline(kp_help_text);
ili9341_drawstring_7x13(kp_help_text, 64+NUM_FONT_GET_WIDTH+2, LCD_HEIGHT-(lines*bFONT_GET_HEIGHT+NUM_INPUT_HEIGHT)/2);
}
}
static int
menu_is_multiline(const char *label, const char **l1, const char **l2)
{
if (label[0] != '\2')
return FALSE;
*l1 = &label[1];
*l2 = &label[1] + strlen(&label[1]) + 1;
return TRUE;
}
#ifdef __VNA__
static void
menu_item_modify_attribute(const menuitem_t *menu, int item,
@ -1588,7 +1575,7 @@ menu_item_modify_attribute(const menuitem_t *menu, int item,
#ifndef __VNA__
extern void menu_item_modify_attribute(
const menuitem_t *menu, int item, uint16_t *fg, uint16_t *bg);
const menuitem_t *menu, int item, ui_button_t *button);
#endif
static bool menuDisabled(uint8_t type){
@ -1605,48 +1592,45 @@ static void
draw_menu_buttons(const menuitem_t *menu)
{
int i = 0;
char text[30];
int y = 0;
ui_button_t button;
for (i = 0; i < MENU_BUTTON_MAX; i++) {
const char *l1, *l2;
if (menuDisabled(menu[i].type)) //not applicable to mode
continue;
if (MT_MASK(menu[i].type) == MT_NONE)
break;
uint16_t bg;
uint16_t fg;
if (MT_MASK(menu[i].type) == MT_TITLE) {
fg = config.menu_normal_color;
bg = DEFAULT_MENU_TEXT_COLOR;
button.fg = config.menu_normal_color;
button.bg = DEFAULT_MENU_TEXT_COLOR;
} else {
bg = config.menu_normal_color;
fg = DEFAULT_MENU_TEXT_COLOR;
button.bg = config.menu_normal_color;
button.fg = DEFAULT_MENU_TEXT_COLOR;
}
// focus only in MENU mode but not in KEYPAD mode
if (ui_mode == UI_MENU && i == selection)
bg = config.menu_active_color;
button.bg = config.menu_active_color;
uint16_t old_bg = bg;
uint16_t old_bg = button.bg;
menu_item_modify_attribute(menu, i, &fg, &bg); // before plot_printf to create status text
menu_item_modify_attribute(menu, i, &button); // before plot_printf to create status text
if (menu[i].type & MT_FORM) {
if (MT_MASK(menu[i].type) == MT_KEYPAD) { // Only keypad retrieves value
keypad_mode = menu[i].data;
fetch_numeric_target();
}
plot_printf(text, sizeof text, menu[i].label, uistat.text);
}
plot_printf(button.text, sizeof button.text, menu[i].label, uistat.text);
ili9341_set_foreground(fg);
ili9341_set_background(bg);
ili9341_set_foreground(button.fg);
ili9341_set_background(button.bg);
if (menu[i].type & MT_FORM) {
int button_width = MENU_FORM_WIDTH;
int button_start = (LCD_WIDTH - MENU_FORM_WIDTH)/2; // At center of screen
int button_height = MENU_BUTTON_HEIGHT-2;
// draw_button(button_start, y, button_width, button_height, bg == old_bg? fg : DARK_GREY, bg);
ili9341_fill(button_start, y, button_width, button_height, old_bg); // Set button to unmodified background color
ili9341_fill(button_start+2, y+2, button_width-4, button_height-4, bg);
ili9341_drawstring_size(text, button_start+6, y+(button_height-2*FONT_GET_HEIGHT)/2, 2);
ili9341_fill(button_start+2, y+2, button_width-4, button_height-4, button.bg);
ili9341_drawstring_size(button.text, button_start+6, y+(button_height-2*FONT_GET_HEIGHT)/2, 2);
#ifdef __ICONS__
if (menu[i].type & MT_ICON) {
blit16BitWidthBitmap(button_start+MENU_FORM_WIDTH-40 ,y+(button_height-16)/2,16,16,& left_icons[((menu[i].data >>4)&0xf)*16]);
@ -1658,24 +1642,15 @@ draw_menu_buttons(const menuitem_t *menu)
int button_start = LCD_WIDTH - MENU_BUTTON_WIDTH;
int button_height = MENU_BUTTON_HEIGHT-2;
ili9341_fill(button_start, y, button_width, button_height, old_bg); // Set button to unmodified background color
ili9341_fill(button_start+1, y+1, button_width-2, button_height - 2, bg);
ili9341_fill(button_start+1, y+1, button_width-2, button_height - 2, button.bg);
// draw_button(button_start, y, button_width, button_height, bg == old_bg? fg : DARK_GREY, bg);
if (menu_is_multiline(menu[i].label, &l1, &l2)) {
int lines = menu_is_multiline(button.text);
#define BIG_BUTTON_FONT 1
#ifdef BIG_BUTTON_FONT
ili9341_drawstring_7x13(l1, button_start+5, y+button_height/2-bFONT_GET_HEIGHT);
ili9341_drawstring_7x13(l2, button_start+5, y+button_height/2);
ili9341_drawstring_7x13(button.text, button_start+5, y+(button_height-lines*bFONT_GET_HEIGHT)/2);
#else
ili9341_drawstring(l1, button_start+5, y+button_height/2-FONT_GET_HEIGHT);
ili9341_drawstring(l2, button_start+5, y+button_height/2);
ili9341_drawstring(button.text, button_start+5, y+(button_height-linesFONT_GET_HEIGHT)/2);
#endif
} else {
#ifdef BIG_BUTTON_FONT
ili9341_drawstring_7x13(menu[i].label, button_start+5, y+(button_height-bFONT_GET_HEIGHT)/2);
#else
ili9341_drawstring(menu[i].label, button_start+5, y+(button_height-FONT_GET_HEIGHT)/2);
#endif
}
}
y += MENU_BUTTON_HEIGHT;
}

@ -502,24 +502,24 @@ static const struct {
{keypads_freq , "CENTER"}, // center
{keypads_freq , "SPAN"}, // span
{keypads_freq , "FREQ"}, // cw freq
{keypads_plusmin_unit, "\2REF\0LEVEL"}, // reflevel
{keypads_plusmin_unit, "REF\nLEVEL"}, // reflevel
{keypads_pos_unit , "SCALE"}, // scale
{keypads_positive , "ATTENUATE"}, // attenuation
{keypads_plusmin_unit, "\2ACTUAL\0POWER"}, // actual power
{keypads_plusmin_unit, "ACTUAL\nPOWER"}, // actual power
{keypads_freq , "IF"}, // IF
{keypads_positive , "\2SAMPLE\0DELAY"}, // sample delay
{keypads_positive , "SAMPLE\nDELAY"}, // sample delay
{keypads_positive , "DRIVE"}, // drive
{keypads_plusmin , "LEVEL"}, // KM_LOWOUTLEVEL
{keypads_positive , "SCANS"}, // KM_DECAY
{keypads_positive , "LEVEL"}, // KM_NOISE
{keypads_freq , "FREQ"}, // KM_10MHz
{keypads_positive , "\2SAMPLE\0REPEAT"}, // KM_REPEA
{keypads_positive , "SAMPLE\nREPEAT"}, // KM_REPEA
{keypads_plusmin , "OFFSET"}, // KM_OFFSET
{keypads_plusmin_unit, "\2TRIGGER\0LEVEL"}, // KM_TRIGGER
{keypads_plusmin , "\2LEVEL\0SWEEP"}, // KM_LEVELSWEEP
{keypads_time , "\2SWEEP\0SECONDS"}, // KM_SWEEP_TIME
{keypads_positive , "\2OFFSET\0DELAY"}, // KM_OFFSET_DELAY
{keypads_positive , "\2FAST\0SPEEDUP"}, // KM_FAST_SPEEDUP
{keypads_plusmin_unit, "TRIGGER\nLEVEL"}, // KM_TRIGGER
{keypads_plusmin , "LEVEL\nSWEEP"}, // KM_LEVELSWEEP
{keypads_time , "SWEEP\nSECONDS"}, // KM_SWEEP_TIME
{keypads_positive , "OFFSET\nDELAY"}, // KM_OFFSET_DELAY
{keypads_positive , "FAST\nSPEEDUP"}, // KM_FAST_SPEEDUP
};
// ===[MENU CALLBACKS]=========================================================
@ -1077,19 +1077,19 @@ const char *menu_drive_text[]={"-38dBm","-35dBm","-33dBm","-30dBm","-27dBm","-24
static const menuitem_t menu_store_preset_high[8] =
{
{ MT_CALLBACK, 0, "\2STORE\0STARTUP",menu_store_preset_cb},
{ MT_CALLBACK, 0, "STORE\nSTARTUP",menu_store_preset_cb},
{ MT_CALLBACK, 5, "STORE 5" , menu_store_preset_cb},
{ MT_CALLBACK, 6, "STORE 6" , menu_store_preset_cb},
{ MT_CALLBACK, 7, "STORE 7" , menu_store_preset_cb},
{ MT_CALLBACK, 8, "STORE 8" , menu_store_preset_cb},
{ MT_CALLBACK, 100, "\2FACTORY\0DEFAULTS",menu_store_preset_cb},
{ MT_CALLBACK, 100, "FACTORY\nDEFAULTS",menu_store_preset_cb},
{ MT_CANCEL, 255, "\032 BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
static const menuitem_t menu_load_preset_high[] =
{
{ MT_CALLBACK, 0, "\2LOAD\0STARTUP",menu_load_preset_cb},
{ MT_CALLBACK, 0, "LOAD\nSTARTUP",menu_load_preset_cb},
{ MT_CALLBACK, 5, "LOAD 5" , menu_load_preset_cb},
{ MT_CALLBACK, 6, "LOAD 6" , menu_load_preset_cb},
{ MT_CALLBACK, 7, "LOAD 7" , menu_load_preset_cb},
@ -1101,19 +1101,19 @@ static const menuitem_t menu_load_preset_high[] =
static const menuitem_t menu_store_preset[] =
{
{ MT_CALLBACK, 0, "\2STORE AS\0STARTUP",menu_store_preset_cb},
{ MT_CALLBACK, 0, "STORE AS\nSTARTUP",menu_store_preset_cb},
{ MT_CALLBACK, 1, "STORE 1" , menu_store_preset_cb},
{ MT_CALLBACK, 2, "STORE 2" , menu_store_preset_cb},
{ MT_CALLBACK, 3, "STORE 3" , menu_store_preset_cb},
{ MT_CALLBACK, 4, "STORE 4" , menu_store_preset_cb},
{ MT_CALLBACK, 100, "\2FACTORY\0DEFAULTS",menu_store_preset_cb},
{ MT_CALLBACK, 100, "FACTORY\nDEFAULTS",menu_store_preset_cb},
{ MT_CANCEL, 255, "\032 BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
static const menuitem_t menu_load_preset[] =
{
{ MT_CALLBACK, 0, "\2LOAD\0STARTUP",menu_load_preset_cb},
{ MT_CALLBACK, 0, "LOAD\nSTARTUP",menu_load_preset_cb},
{ MT_CALLBACK, 1, "LOAD 1" , menu_load_preset_cb},
{ MT_CALLBACK, 2, "LOAD 2" , menu_load_preset_cb},
{ MT_CALLBACK, 3, "LOAD 3" , menu_load_preset_cb},
@ -1202,9 +1202,9 @@ const menuitem_t menu_highoutputmode[] = {
static const menuitem_t menu_average[] = {
{ MT_CALLBACK, 0, "OFF", menu_average_cb},
{ MT_CALLBACK, 1, "\2MIN\0HOLD", menu_average_cb},
{ MT_CALLBACK, 2, "\2MAX\0HOLD", menu_average_cb},
{ MT_CALLBACK, 3, "\2MAX\0DECAY", menu_average_cb},
{ MT_CALLBACK, 1, "MIN\nHOLD", menu_average_cb},
{ MT_CALLBACK, 2, "MAX\nHOLD", menu_average_cb},
{ MT_CALLBACK, 3, "MAX\nDECAY", menu_average_cb},
{ MT_CALLBACK, 4, "AVER 4", menu_average_cb},
{ MT_CALLBACK, 5, "AVER 16", menu_average_cb},
{ MT_CANCEL, 0, "\032 BACK", NULL },
@ -1276,7 +1276,7 @@ static const menuitem_t menu_atten[] = {
{ MT_CALLBACK | MT_LOW, 0, "AUTO", menu_atten_cb},
{ MT_KEYPAD | MT_LOW, KM_ATTENUATION, "MANUAL", "0..30"},
{ MT_CALLBACK | MT_HIGH,0, "0dB", menu_atten_high_cb},
{ MT_CALLBACK | MT_HIGH,30, "\00225..40dB", menu_atten_high_cb},
{ MT_CALLBACK | MT_HIGH,30, "\n0225..40dB", menu_atten_high_cb},
{ MT_CANCEL, 0, "\032 BACK", NULL },
{ MT_FORM | MT_NONE, 0, NULL, NULL } // sentinel
};
@ -1290,10 +1290,10 @@ static const menuitem_t menu_reflevel[] = {
const menuitem_t menu_marker_search[] = {
//{ MT_CALLBACK, "OFF", menu_marker_search_cb },
{ MT_CALLBACK, 0, "\2MIN\0" "\032 LEFT", menu_marker_search_cb },
{ MT_CALLBACK, 1, "\2MIN\0" "\033 RIGHT", menu_marker_search_cb },
{ MT_CALLBACK, 2, "\2MAX\0" "\032 LEFT", menu_marker_search_cb },
{ MT_CALLBACK, 3, "\2MAX\0" "\033 RIGHT", menu_marker_search_cb },
{ MT_CALLBACK, 0, "MIN\n" "\032 LEFT", menu_marker_search_cb },
{ MT_CALLBACK, 1, "MIN\n" "\033 RIGHT", menu_marker_search_cb },
{ MT_CALLBACK, 2, "MAX\n" "\032 LEFT", menu_marker_search_cb },
{ MT_CALLBACK, 3, "MAX\n" "\033 RIGHT", menu_marker_search_cb },
{ MT_CALLBACK, 4, "TRACKING", menu_marker_search_cb },
{ MT_CANCEL, 0, "\032 BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
@ -1346,10 +1346,10 @@ const menuitem_t menu_marker_ops[] = {
static const menuitem_t menu_marker[] = {
// { MT_SUBMENU, 0, "\2SELECT\0MARKER", menu_marker_sel},
{ MT_SUBMENU, 0, "\2MODIFY\0MARKERS", menu_marker_select},
{ MT_SUBMENU, 0, "\2MARKER\0OPS", menu_marker_ops},
{ MT_SUBMENU, 0, "\2SEARCH\0MARKER", menu_marker_search},
// { MT_SUBMENU, 0, "SELECT\nMARKER", menu_marker_sel},
{ MT_SUBMENU, 0, "MODIFY\nMARKERS", menu_marker_select},
{ MT_SUBMENU, 0, "MARKER\nOPS", menu_marker_ops},
{ MT_SUBMENU, 0, "SEARCH\nMARKER", menu_marker_search},
{ MT_CANCEL, 0, "\032 BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
@ -1378,9 +1378,9 @@ static const menuitem_t menu_scanning_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 | MT_LOW,SD_FAST, "FAST", menu_scanning_speed_cb},
{ MT_KEYPAD | MT_LOW,KM_FAST_SPEEDUP, "\2FAST\0SPEEDUP", "2..20"},
{ MT_KEYPAD, KM_SAMPLETIME, "\2SAMPLE\0DELAY", "300..30000"}, // item number must match SD_MANUAL
{ MT_KEYPAD, KM_OFFSET_DELAY, "\2OFFSET\0DELAY", "300..30000"}, // item number must match SD_MANUAL
{ MT_KEYPAD | MT_LOW,KM_FAST_SPEEDUP, "FAST\nSPEEDUP", "2..20"},
{ MT_KEYPAD, KM_SAMPLETIME, "SAMPLE\nDELAY", "300..30000"}, // item number must match SD_MANUAL
{ MT_KEYPAD, KM_OFFSET_DELAY, "OFFSET\nDELAY", "300..30000"}, // item number must match SD_MANUAL
{ MT_CANCEL, 0, "\032 BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
@ -1397,8 +1397,8 @@ 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, "\2SWEEP\0TIME", "0..600s"},
{ MT_SUBMENU, 0, "\2SWEEP\0POINTS", menu_sweep_points},
{ MT_KEYPAD, KM_SWEEP_TIME, "SWEEP\nTIME", "0..600s"},
{ MT_SUBMENU, 0, "SWEEP\nPOINTS", menu_sweep_points},
{ MT_CANCEL, 0, "\032 BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
@ -1409,10 +1409,10 @@ static const menuitem_t menu_settings2[] =
{ MT_CALLBACK, 1, "AGC", menu_settings2_cb},
{ MT_CALLBACK, 2, "LNA", menu_settings2_cb},
{ MT_CALLBACK | MT_LOW, 3, "BPF", menu_settings2_cb},
{ MT_CALLBACK | MT_LOW, 4, "\2BELOW\0IF", menu_settings2_cb},
{ MT_KEYPAD, KM_DECAY, "\2HOLD\0SWEEPS", "1..1000 sweeps"},
{ MT_KEYPAD, KM_NOISE, "\2NOISE\0LEVEL", "2..20 dB"},
{ MT_KEYPAD, KM_10MHZ, "\2CORRECT\0FREQUENCY", "Enter actual l0MHz frequency"},
{ MT_CALLBACK | MT_LOW, 4, "BELOW\nIF", menu_settings2_cb},
{ MT_KEYPAD, KM_DECAY, "HOLD\nSWEEPS", "1..1000 sweeps"},
{ MT_KEYPAD, KM_NOISE, "NOISE\nLEVEL", "2..20 dB"},
{ MT_KEYPAD, KM_10MHZ, "CORRECT\nFREQUENCY", "Enter actual l0MHz frequency"},
#ifdef __ULTRA__
{ MT_SUBMENU,0, "HARMONIC", menu_harmonic},
#endif
@ -1422,12 +1422,12 @@ static const menuitem_t menu_settings2[] =
static const menuitem_t menu_settings[] =
{
{ MT_CALLBACK | MT_LOW, 5, "\2LO\0OUTPUT",menu_settings2_cb},
{ MT_KEYPAD, KM_ACTUALPOWER, "\2ACTUAL\0POWER", NULL},
{ MT_KEYPAD | MT_LOW, KM_IF, "\2IF\0FREQ", "Set to zero for auto IF"},
{ MT_SUBMENU,0, "\2SCAN\0SPEED", menu_scanning_speed},
{ MT_KEYPAD, KM_REPEAT, "\2SAMPLE\0REPEAT", "1..100"},
{ MT_SUBMENU | MT_LOW,0, "\2MIXER\0DRIVE", menu_drive},
{ MT_CALLBACK | MT_LOW, 5, "LO\nOUTPUT",menu_settings2_cb},
{ MT_KEYPAD, KM_ACTUALPOWER, "ACTUAL\nPOWER", NULL},
{ MT_KEYPAD | MT_LOW, KM_IF, "IF\nFREQ", "Set to zero for auto IF"},
{ MT_SUBMENU,0, "SCAN\nSPEED", menu_scanning_speed},
{ MT_KEYPAD, KM_REPEAT, "SAMPLE\nREPEAT", "1..100"},
{ MT_SUBMENU | MT_LOW,0, "MIXER\nDRIVE", menu_drive},
{ MT_SUBMENU, 0, "\033 MORE", menu_settings2},
{ MT_CANCEL, 0, "\032 BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
@ -1437,9 +1437,9 @@ static const menuitem_t menu_measure[] = {
{ MT_CALLBACK, M_OFF, "OFF", menu_measure_cb},
{ MT_CALLBACK, M_IMD, "HARMONIC", menu_measure_cb},
{ MT_CALLBACK, M_OIP3, "OIP3", menu_measure_cb},
{ MT_CALLBACK, M_PHASE_NOISE,"\2PHASE\0NOISE", menu_measure_cb},
{ MT_CALLBACK, M_STOP_BAND, "\2STOP\0BAND", menu_measure_cb},
{ MT_CALLBACK, M_PASS_BAND, "\2PASS\0BAND", menu_measure_cb},
{ MT_CALLBACK, M_PHASE_NOISE,"PHASE\nNOISE", menu_measure_cb},
{ MT_CALLBACK, M_STOP_BAND, "STOP\nBAND", menu_measure_cb},
{ MT_CALLBACK, M_PASS_BAND, "PASS\nBAND", menu_measure_cb},
{ MT_CALLBACK | MT_LOW, M_LINEARITY, "LINEAR", menu_measure_cb},
{ MT_CANCEL, 0, "\032 BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
@ -1455,26 +1455,26 @@ static const menuitem_t menu_calibrate[] =
};
static const menuitem_t menu_config[] = {
{ MT_CALLBACK, 0, "\2TOUCH\0CAL", menu_config_cb},
{ MT_CALLBACK, 0, "\2TOUCH\0TEST", menu_config_cb},
{ MT_CALLBACK, 0, "\2SELF\0TEST", menu_config_cb},
{ MT_SUBMENU, 0, "\2LEVEL\0CAL", menu_calibrate},
{ MT_CALLBACK, 0, "TOUCH\nCAL", menu_config_cb},
{ MT_CALLBACK, 0, "TOUCH\nTEST", menu_config_cb},
{ MT_CALLBACK, 0, "SELF\nTEST", menu_config_cb},
{ MT_SUBMENU, 0, "LEVEL\nCAL", menu_calibrate},
{ MT_CALLBACK, 0, "VERSION", menu_config_cb},
{ MT_SUBMENU, 0, "\2EXPERT\0CONFIG", menu_settings},
{ MT_SUBMENU, 0, "EXPERT\nCONFIG", menu_settings},
{ MT_SUBMENU, 0, "\033DFU", menu_dfu},
{ MT_CANCEL, 0, "\032 BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
static const menuitem_t menu_display[] = {
{ MT_CALLBACK,0, "\2PAUSE\0SWEEP", menu_pause_cb},
{ MT_CALLBACK,0, "\2STORE\0TRACE", menu_storage_cb},
{ MT_CALLBACK,1, "\2CLEAR\0STORED", menu_storage_cb},
{ MT_CALLBACK,2, "\2SUBTRACT\0STORED",menu_storage_cb},
{ MT_CALLBACK,0, "PAUSE\nSWEEP", menu_pause_cb},
{ MT_CALLBACK,0, "STORE\nTRACE", menu_storage_cb},
{ MT_CALLBACK,1, "CLEAR\nSTORED", menu_storage_cb},
{ MT_CALLBACK,2, "SUBTRACT\nSTORED",menu_storage_cb},
{ MT_CALLBACK,3, "NORMALIZE", menu_storage_cb},
{ MT_CALLBACK,4, "WATERFALL", menu_storage_cb},
{ MT_SUBMENU, 0, "\2SWEEP\0SETTINGS", menu_sweep_speed},
// { MT_KEYPAD, KM_SWEEP_TIME, "\2SWEEP\0TIME", NULL},
{ MT_SUBMENU, 0, "SWEEP\nSETTINGS", menu_sweep_speed},
// { MT_KEYPAD, KM_SWEEP_TIME, "SWEEP\nTIME", NULL},
{ MT_CANCEL, 0, "\032 BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
@ -1497,21 +1497,21 @@ static const menuitem_t menu_trigger[] = {
{ MT_CALLBACK,T_AUTO, "AUTO", menu_trigger_cb},
{ MT_CALLBACK,T_NORMAL, "NORMAL", menu_trigger_cb},
{ MT_CALLBACK,T_SINGLE, "SINGLE", menu_trigger_cb},
{ MT_KEYPAD, KM_TRIGGER, "\2TRIGGER\0LEVEL", NULL},
{ MT_CALLBACK,T_UP, "\2UP\0EDGE", menu_trigger_cb},
{ MT_CALLBACK,T_DOWN, "\2DOWN\0EDGE", menu_trigger_cb},
{ MT_KEYPAD, KM_TRIGGER, "TRIGGER\nLEVEL", NULL},
{ MT_CALLBACK,T_UP, "UP\nEDGE", menu_trigger_cb},
{ MT_CALLBACK,T_DOWN, "DOWN\nEDGE", menu_trigger_cb},
{ MT_CANCEL, 0, "\032 BACK",NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
static const menuitem_t menu_level[] = {
{ MT_SUBMENU, 0, "\2REF\0LEVEL", menu_reflevel},
// { MT_SUBMENU, 0, "\2SCALE/\0DIV",menu_scale_per},
{ MT_KEYPAD, KM_SCALE, "\2SCALE/\0DIV",NULL},
{ MT_SUBMENU, 0, "REF\nLEVEL", menu_reflevel},
// { MT_SUBMENU, 0, "SCALE/\nDIV",menu_scale_per},
{ MT_KEYPAD, KM_SCALE, "SCALE/\nDIV",NULL},
{ MT_SUBMENU, 0, "ATTEN", menu_atten},
{ MT_SUBMENU,0, "CALC", menu_average},
{ MT_SUBMENU, 0, "UNIT", menu_unit},
{ MT_KEYPAD, KM_OFFSET, "\2EXTERN\0AMP",NULL},
{ MT_KEYPAD, KM_OFFSET, "EXTERN\nAMP",NULL},
{ MT_SUBMENU, 0, "TRIGGER", menu_trigger},
{ MT_CANCEL, 0, "\032 BACK",NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
@ -1522,10 +1522,10 @@ static const menuitem_t menu_stimulus[] = {
{ MT_KEYPAD, KM_STOP, "STOP", NULL},
{ MT_KEYPAD, KM_CENTER, "CENTER", NULL},
{ MT_KEYPAD, KM_SPAN, "SPAN", NULL},
{ MT_KEYPAD, KM_CW, "\2ZERO\0SPAN", NULL},
{ MT_KEYPAD, KM_CW, "ZERO\nSPAN", NULL},
{ MT_SUBMENU,0, "RBW", menu_rbw},
#ifdef __SPUR__
{ MT_CALLBACK | MT_LOW,0, "\2SPUR\0REMOVAL", menu_spur_cb},
{ MT_CALLBACK | MT_LOW,0, "SPUR\nREMOVAL", menu_spur_cb},
#endif
{ MT_CANCEL, 0, "\032 BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
@ -1588,9 +1588,8 @@ int menu_is_form(const menuitem_t *menu)
return(false);
}
static void menu_item_modify_attribute(
const menuitem_t *menu, int item, uint16_t *fg, uint16_t *bg)
const menuitem_t *menu, int item, ui_button_t *button)
{
int mark = false;
int m_auto = false;
@ -1752,11 +1751,11 @@ static void menu_item_modify_attribute(
}
}
if (m_auto) {
*bg = LIGHT_GREY;
*fg = config.menu_normal_color;
button->bg = LIGHT_GREY;
button->fg = config.menu_normal_color;
} else if (mark) {
*bg = DEFAULT_MENU_TEXT_COLOR;
*fg = config.menu_normal_color;
button->bg = DEFAULT_MENU_TEXT_COLOR;
button->fg = config.menu_normal_color;
}
if (ui_mode == UI_MENU && menu_is_form(menu)) {
// if (item == 0)

Loading…
Cancel
Save

Powered by TurnKey Linux.