From c40a01f22a08163ce85c3a27d6305b3a24a7ec5d Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Wed, 1 Apr 2020 07:57:55 +0200 Subject: [PATCH] Large value text --- ui.c | 10 +++++++- ui_sa.c | 80 +++++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 73 insertions(+), 17 deletions(-) diff --git a/ui.c b/ui.c index 82f58c3..0f7de2f 100644 --- a/ui.c +++ b/ui.c @@ -1328,14 +1328,22 @@ draw_keypad(void) i++; } } +static int +menu_is_multiline(const char *label, const char **l1, const char **l2); static void draw_numeric_area_frame(void) { + char *l1; + char *l2; ili9341_fill(0, 240-NUM_INPUT_HEIGHT, 320, NUM_INPUT_HEIGHT, config.menu_normal_color); ili9341_set_foreground(DEFAULT_MENU_TEXT_COLOR); ili9341_set_background(config.menu_normal_color); - ili9341_drawstring(keypad_mode_label[keypad_mode], 10, 240-(FONT_GET_HEIGHT+NUM_INPUT_HEIGHT)/2); + if (menu_is_multiline(keypad_mode_label[keypad_mode], &l1, &l2)) { + ili9341_drawstring_7x13(l1, 10, 240-NUM_INPUT_HEIGHT+1); + ili9341_drawstring_7x13(l2, 10, 240-NUM_INPUT_HEIGHT/2 + 1); + } else + ili9341_drawstring_7x13(keypad_mode_label[keypad_mode], 10, 240-(FONT_GET_HEIGHT+NUM_INPUT_HEIGHT)/2); //ili9341_drawfont(KP_KEYPAD, 300, 216); } diff --git a/ui_sa.c b/ui_sa.c index 1b3d87a..319b4ea 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -167,7 +167,7 @@ static const char * const keypad_mode_label[] = { #endif #ifdef __SA__ static const char * const keypad_mode_label[] = { - "error", "START", "STOP", "CENTER", "SPAN", "CW FREQ", "REFPOS", "SCALE", "ATTENUATION", "ACTUALPOWER", "IF", "SAMPLE TIME", "DRIVE", "LEVEL", "LEVEL" + "error", "START", "STOP", "CENTER", "SPAN", "CW FREQ", "REFPOS", "SCALE", "\2ATTENUATE\0 0-31dB", "ACTUALPOWER", "IF", "SAMPLE TIME", "DRIVE", "LEVEL", "LEVEL" }; #endif @@ -326,12 +326,12 @@ static void menu_drive_cb(int item, uint8_t data) +#if 0 static void menu_spur_cb(int item, uint8_t data) { (void)data; (void)item; -#if 0 if (GetSpur()) SetSpur(0); else @@ -339,8 +339,8 @@ static void menu_spur_cb(int item, uint8_t data) // menu_move_back(); ui_mode_normal(); draw_cal_status(); -#endif } +#endif static void menu_storage_cb(int item, uint8_t data) { @@ -527,7 +527,7 @@ static const menuitem_t menu_average[] = { { MT_CANCEL, 0, S_LARROW" BACK", NULL }, { MT_NONE, 0, NULL, NULL } // sentinel }; - +#if 0 static const menuitem_t menu_storage[] = { { MT_CALLBACK, 0, "STORE", menu_storage_cb}, { MT_CALLBACK, 1, "CLEAR", menu_storage_cb}, @@ -536,6 +536,7 @@ static const menuitem_t menu_storage[] = { { MT_CANCEL, 0, S_LARROW" BACK", NULL }, { MT_NONE, 0, NULL, NULL } // sentinel }; +#endif static const menuitem_t menu_rbw[] = { { MT_CALLBACK, 0, " AUTO", menu_rbw_cb}, @@ -578,6 +579,36 @@ static const menuitem_t menu_reffer[] = { { MT_NONE, 0, NULL, NULL } // sentinel }; +static const menuitem_t menu_acquire[] = { + { MT_CALLBACK, 0, "AUTO", menu_autosettings_cb}, + { MT_KEYPAD, KM_ATTENUATION, "ATTEN", NULL}, + { MT_SUBMENU,0, "RBW", menu_rbw}, + { MT_SUBMENU,0, "AVERAGE", menu_average}, + { MT_CANCEL, 0, S_LARROW" BACK", NULL }, + { MT_NONE, 0, NULL, NULL } // sentinel +}; + +static const menuitem_t menu_acquirehigh[] = { + { MT_CALLBACK, 0, "AUTO", menu_autosettings_cb}, + { MT_SUBMENU,0, "RBW", menu_rbw}, + { MT_SUBMENU,0, "AVERAGE", menu_average}, + { MT_CANCEL, 0, S_LARROW" BACK", NULL }, + { MT_NONE, 0, NULL, NULL } // sentinel +}; + + +static const menuitem_t menu_display[] = { + { MT_KEYPAD, KM_REFPOS, "\2REF\0LEVEL", NULL}, + { MT_SUBMENU,0, "\2SCALE/\0DIV", menu_dBper}, + { MT_CALLBACK, 0, "STORE", menu_storage_cb}, + { MT_CALLBACK, 1, "CLEAR", menu_storage_cb}, + { MT_CALLBACK, 2, "SUBTRACT", menu_storage_cb}, + { MT_CALLBACK, 3, "WATERFALL",menu_storage_cb}, + { MT_CANCEL, 0, S_LARROW" BACK", NULL }, + { MT_NONE, 0, NULL, NULL } // sentinel +}; + +#if 0 static const menuitem_t menu_scale[] = { { MT_KEYPAD, KM_REFPOS, "\2REF\0LEVEL", NULL}, { MT_SUBMENU,0, "\2SCALE/\0DIV", menu_dBper}, @@ -598,7 +629,7 @@ static const menuitem_t menu_scalehigh[] = { { MT_NONE, 0, NULL, NULL } // sentinel }; - +#endif static const menuitem_t menu_stimulus[8] = { { MT_KEYPAD, KM_START, "START", NULL}, @@ -730,7 +761,30 @@ static const menuitem_t menu_mode[] = { // { MT_CANCEL, 0, S_LARROW" BACK", NULL }, { MT_NONE, 0, NULL, NULL } // sentinel }; +#if 1 +const menuitem_t menu_top[] = { + { MT_SUBMENU, 0, "ACQUIRE", menu_acquire}, + { MT_SUBMENU, 0, "SCAN", menu_stimulus}, + { MT_SUBMENU, 0, "DISPLAY", menu_display}, + { MT_SUBMENU, 0, "MARKER", menu_marker}, + { MT_SUBMENU, 0, "SETTINGS", menu_settings}, + { MT_CANCEL, 0, S_LARROW" MODE",NULL}, + { MT_NONE, 0, NULL, NULL } // sentinel, + // MENUITEM_CLOSE, +}; +const menuitem_t menu_tophigh[] = +{ + { MT_SUBMENU, 0, "ACQUIRE", menu_acquirehigh}, + { MT_SUBMENU, 0, "SCAN", menu_stimulus}, + { MT_SUBMENU, 0, "DISPLAY", menu_display}, + { MT_SUBMENU, 0, "MARKER", menu_marker}, + { MT_SUBMENU, 0, "SETTINGS", menu_settings}, + { MT_CANCEL, 0, S_LARROW" MODE",NULL}, + { MT_NONE, 0, NULL, NULL } // sentinel, + // MENUITEM_CLOSE, +}; +#else const menuitem_t menu_top[] = { { MT_CALLBACK, 0, "AUTO", menu_autosettings_cb}, { MT_SUBMENU, 0, "SCAN", menu_stimulus}, @@ -754,7 +808,7 @@ const menuitem_t menu_tophigh[] = { { MT_NONE, 0, NULL, NULL } // sentinel, // MENUITEM_CLOSE, }; - +#endif // ===[MENU DEFINITION END]====================================================== #undef BOARD_NAME @@ -802,12 +856,6 @@ static void menu_item_modify_attribute( if (item == 5 /* PAUSE */ && !(sweep_mode&SWEEP_ENABLE)) { mark = true; } - } else if (menu == menu_scale) { -#if 0 - if (item == 4 /* Spur reduction */ && GetSpur()) { - mark = true; - } -#endif } else if (menu == menu_average) { if (item == GetAverage()){ mark = true; @@ -826,14 +874,14 @@ static void menu_item_modify_attribute( mark = true; } - } else if (menu == menu_storage) { - if (item ==0 && GetStorage()){ + } else if (menu == menu_display) { + if (item ==2 && GetStorage()){ mark = true; } - if (item == 2 && GetSubtractStorage()){ + if (item == 4 && GetSubtractStorage()){ mark = true; } - if (item == 3 && get_waterfall()){ + if (item == 5 && get_waterfall()){ mark = true; } } else if (menu == menu_settings2 || menu == menu_settingshigh2) {