menu, text and remark commands added

pull/73/head
erikkaashoek 2 years ago
parent f4ca8520a7
commit 090fcb80e1

@ -800,6 +800,48 @@ VNA_SHELL_FUNCTION(cmd_dump)
} }
#endif #endif
uint8_t in_menu_command;
VNA_SHELL_FUNCTION(cmd_menu)
{
menu_current_level = 0;
if (argc == 0) {
return;
}
in_menu_command = true;
if (argc >= 1)
menu_invoke(my_atoi(argv[0]));
if (argc >= 2)
menu_invoke(my_atoi(argv[1]));
if (argc >= 3)
menu_invoke(my_atoi(argv[2]));
if (argc >= 4)
menu_invoke(my_atoi(argv[3]));
in_menu_command = false;
}
VNA_SHELL_FUNCTION(cmd_text)
{
if (argc!= 1)
return;
char *p = argv[0];
char *t = kp_buf;
while (*p) {
*t++ = *p++;
}
*t = 0;
uistat.value = my_atof(kp_buf);
uistat.freq_value = my_atoui(kp_buf);
set_numeric_value();
ui_mode_normal();
}
VNA_SHELL_FUNCTION(cmd_remark)
{
(void) argc;
(void) argv;
}
#ifdef __REMOTE_DESKTOP__ #ifdef __REMOTE_DESKTOP__
uint8_t remote_mouse_down = false; uint8_t remote_mouse_down = false;
uint8_t auto_capture = false; uint8_t auto_capture = false;
@ -2251,6 +2293,9 @@ static const VNAShellCommand commands[] =
{ "selftest", cmd_selftest, 0 }, { "selftest", cmd_selftest, 0 },
{ "correction", cmd_correction, CMD_RUN_IN_LOAD }, { "correction", cmd_correction, CMD_RUN_IN_LOAD },
{ "calc", cmd_calc, CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD}, { "calc", cmd_calc, CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD},
{ "menu", cmd_menu, CMD_WAIT_MUTEX },
{ "text", cmd_text, CMD_WAIT_MUTEX },
{ "remark", cmd_remark, CMD_WAIT_MUTEX },
#ifdef ENABLE_SD_CARD_CMD #ifdef ENABLE_SD_CARD_CMD
{ "sd_list", cmd_sd_list, CMD_WAIT_MUTEX }, { "sd_list", cmd_sd_list, CMD_WAIT_MUTEX },
{ "sd_read", cmd_sd_read, CMD_WAIT_MUTEX }, { "sd_read", cmd_sd_read, CMD_WAIT_MUTEX },

@ -1531,6 +1531,10 @@ extern void ui_process(void);
int current_menu_is_form(void); int current_menu_is_form(void);
extern float nf_gain; extern float nf_gain;
extern const char * const averageText[]; extern const char * const averageText[];
extern uint8_t menu_current_level;
void menu_invoke(int item);
extern char kp_buf[];
void set_numeric_value(void);
void ui_mode_normal(void); void ui_mode_normal(void);
void ui_mode_menu(void); void ui_mode_menu(void);

14
ui.c

@ -89,14 +89,14 @@ enum {
#endif #endif
#if NUMINPUT_LEN + 2 > TXTINPUT_LEN + 1 #if NUMINPUT_LEN + 2 > TXTINPUT_LEN + 1
static char kp_buf[NUMINPUT_LEN+2]; // !!!!!! WARNING size must be + 2 from NUMINPUT_LEN or TXTINPUT_LEN + 1 char kp_buf[NUMINPUT_LEN+2]; // !!!!!! WARNING size must be + 2 from NUMINPUT_LEN or TXTINPUT_LEN + 1
#else #else
static char kp_buf[TXTINPUT_LEN+1]; // !!!!!! WARNING size must be + 2 from NUMINPUT_LEN or TXTINPUT_LEN + 1 char kp_buf[TXTINPUT_LEN+1]; // !!!!!! WARNING size must be + 2 from NUMINPUT_LEN or TXTINPUT_LEN + 1
#endif #endif
static uint8_t ui_mode = UI_NORMAL; static uint8_t ui_mode = UI_NORMAL;
static uint8_t keypad_mode; static uint8_t keypad_mode;
static char *kp_help_text = NULL; static char *kp_help_text = NULL;
static uint8_t menu_current_level = 0; uint8_t menu_current_level = 0;
static int selection = 0; static int selection = 0;
static const uint8_t slider_bitmap[]= static const uint8_t slider_bitmap[]=
{ {
@ -5355,7 +5355,7 @@ static void fetch_numeric_target(uint8_t mode)
} }
} }
static void void
set_numeric_value(void) set_numeric_value(void)
{ {
switch (keypad_mode) { switch (keypad_mode) {
@ -6204,7 +6204,7 @@ menu_move_top(void)
} }
*/ */
static void void
menu_invoke(int item) menu_invoke(int item)
{ {
int sub_item; int sub_item;
@ -7278,12 +7278,14 @@ keypad_apply_touch(void)
return -1; return -1;
} }
extern uint8_t in_menu_command;
static void static void
ui_process_keypad(void) ui_process_keypad(void)
{ {
int status; int status;
int keypads_last_index = keypads[0].pos - 1; int keypads_last_index = keypads[0].pos - 1;
kp_buf[0] = 0; kp_buf[0] = 0;
if (in_menu_command) return;
while (TRUE) { while (TRUE) {
status = btn_check(); status = btn_check();
if (status & (EVT_UP|EVT_DOWN)) { if (status & (EVT_UP|EVT_DOWN)) {
@ -7843,6 +7845,4 @@ int check_touched(void)
return touched; return touched;
} }
#pragma GCC pop_options #pragma GCC pop_options

Loading…
Cancel
Save

Powered by TurnKey Linux.