mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
feat: toggle on trace menu (omit sub menu)
This commit is contained in:
parent
eedf0e1aa7
commit
e29a46ca28
73
ui.c
73
ui.c
|
|
@ -476,24 +476,38 @@ menu_save_cb(int item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
choose_active_trace(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
if (trace[uistat.current_trace].enabled)
|
||||||
|
// do nothing
|
||||||
|
return;
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
if (trace[i].enabled) {
|
||||||
|
uistat.current_trace = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
menu_trace_cb(int item)
|
menu_trace_cb(int item)
|
||||||
{
|
{
|
||||||
extern const menuitem_t menu_trace_op[];
|
|
||||||
|
|
||||||
if (item < 0 || item >= 4)
|
if (item < 0 || item >= 4)
|
||||||
return;
|
return;
|
||||||
if (trace[item].enabled) {
|
if (trace[item].enabled) {
|
||||||
uistat.current_trace = item;
|
trace[item].enabled = FALSE;
|
||||||
menu_push_submenu(menu_trace_op);
|
choose_active_trace();
|
||||||
} else {
|
} else {
|
||||||
trace[item].enabled = TRUE;
|
trace[item].enabled = TRUE;
|
||||||
uistat.current_trace = item;
|
uistat.current_trace = item;
|
||||||
menu_move_back();
|
//menu_move_back();
|
||||||
request_to_redraw_grid();
|
//request_to_redraw_grid();
|
||||||
ui_mode_normal();
|
//ui_mode_normal();
|
||||||
//redraw_all();
|
//redraw_all();
|
||||||
}
|
}
|
||||||
|
request_to_redraw_grid();
|
||||||
|
draw_menu();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -560,43 +574,6 @@ choose_active_marker(void)
|
||||||
active_marker = -1;
|
active_marker = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
choose_active_trace(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < 4; i++)
|
|
||||||
if (trace[i].enabled) {
|
|
||||||
uistat.current_trace = i;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
menu_trace_op_cb(int item)
|
|
||||||
{
|
|
||||||
(void)item;
|
|
||||||
int t;
|
|
||||||
switch (item) {
|
|
||||||
case 0: // OFF
|
|
||||||
if (uistat.current_trace >= 0) {
|
|
||||||
trace[uistat.current_trace].enabled = FALSE;
|
|
||||||
choose_active_trace();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1: // SINGLE
|
|
||||||
for (t = 0; t < 4; t++)
|
|
||||||
if (uistat.current_trace != t) {
|
|
||||||
trace[t].enabled = FALSE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
menu_move_back();
|
|
||||||
request_to_redraw_grid();
|
|
||||||
ui_mode_normal();
|
|
||||||
//redraw_all();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
menu_scale_cb(int item)
|
menu_scale_cb(int item)
|
||||||
{
|
{
|
||||||
|
|
@ -752,13 +729,6 @@ const menuitem_t menu_cal[] = {
|
||||||
{ MT_NONE, NULL, NULL } // sentinel
|
{ MT_NONE, NULL, NULL } // sentinel
|
||||||
};
|
};
|
||||||
|
|
||||||
const menuitem_t menu_trace_op[] = {
|
|
||||||
{ MT_CALLBACK, "OFF", menu_trace_op_cb },
|
|
||||||
{ MT_CALLBACK, "SINGLE", menu_trace_op_cb },
|
|
||||||
{ MT_CANCEL, S_LARROW" BACK", NULL },
|
|
||||||
{ MT_NONE, NULL, NULL } // sentinel
|
|
||||||
};
|
|
||||||
|
|
||||||
const menuitem_t menu_trace[] = {
|
const menuitem_t menu_trace[] = {
|
||||||
{ MT_CALLBACK, "TRACE 0", menu_trace_cb },
|
{ MT_CALLBACK, "TRACE 0", menu_trace_cb },
|
||||||
{ MT_CALLBACK, "TRACE 1", menu_trace_cb },
|
{ MT_CALLBACK, "TRACE 1", menu_trace_cb },
|
||||||
|
|
@ -1119,6 +1089,7 @@ menu_item_modify_attribute(const menuitem_t *menu, int item,
|
||||||
uint16_t *fg, uint16_t *bg)
|
uint16_t *fg, uint16_t *bg)
|
||||||
{
|
{
|
||||||
if (menu == menu_trace && item < 4) {
|
if (menu == menu_trace && item < 4) {
|
||||||
|
if (trace[item].enabled)
|
||||||
*bg = config.trace_color[item];
|
*bg = config.trace_color[item];
|
||||||
} else if (menu == menu_calop) {
|
} else if (menu == menu_calop) {
|
||||||
if ((item == 0 && (cal_status & CALSTAT_OPEN))
|
if ((item == 0 && (cal_status & CALSTAT_OPEN))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue