Many marker and measurement related updates

tinySA
erikkaashoek 6 years ago
parent e749f7f8ac
commit 1a2664943f

@ -5,8 +5,8 @@
# Compiler options here. # Compiler options here.
ifeq ($(USE_OPT),) ifeq ($(USE_OPT),)
# USE_OPT = -O2 -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage USE_OPT = -Og -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage
USE_OPT = -fdce -fdse -fmerge-constants -fstore-merging -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage # USE_OPT = -fdce -fdse -fmerge-constants -fstore-merging -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage
endif endif
# C specific options here (added to USE_OPT). # C specific options here (added to USE_OPT).

@ -827,10 +827,10 @@ static const trace_t def_trace[TRACES_MAX] = {//enable, type, channel, reserved,
}; };
static const marker_t def_markers[MARKERS_MAX] = { static const marker_t def_markers[MARKERS_MAX] = {
{ M_TRACKING_ENABLED, M_REFERENCE, 30, 0 }, { M_ENABLED, M_REFERENCE | M_TRACKING, 30, 0 },
{ M_DISABLED, M_NORMAL, 40, 0 }, { M_DISABLED, M_NORMAL, 40, 0 },
{ M_DISABLED, M_NORMAL, 60, 0 }, { M_DISABLED, M_NORMAL, 60, 0 },
{ M_DISABLED, M_NORMAL, 80, 0 } { M_DISABLED, M_NORMAL, 80, 0 }
}; };
// Load propeties default settings // Load propeties default settings

@ -319,11 +319,11 @@ float groupdelay_from_array(int i, float array[POINTS_COUNT][2]);
#endif #endif
// marker // marker
enum { enum {
M_REFERENCE, M_NORMAL, M_DELTA, M_TRACKING M_NORMAL=0,M_REFERENCE=1, M_DELTA=2, M_NOISE=4, M_TRACKING=8 // Tracking must be last.
}; };
enum { enum {
M_DISABLED, M_ENABLED, M_TRACKING_ENABLED M_DISABLED = false, M_ENABLED = true
}; };
typedef struct { typedef struct {
@ -333,7 +333,6 @@ typedef struct {
uint32_t frequency; uint32_t frequency;
} marker_t; } marker_t;
#define MARKERS_MAX 4 #define MARKERS_MAX 4
extern int8_t previous_marker; extern int8_t previous_marker;
@ -568,6 +567,7 @@ typedef struct uistat {
// uint32_t previous_value; // uint32_t previous_value;
uint8_t lever_mode; uint8_t lever_mode;
uint8_t marker_delta; uint8_t marker_delta;
uint8_t marker_noise;
uint8_t marker_tracking; uint8_t marker_tracking;
char text[20]; char text[20];
} uistat_t; } uistat_t;
@ -647,7 +647,7 @@ void wait_user(void);
void calibrate(void); void calibrate(void);
enum { enum {
M_OFF, M_IMD, M_OIP3 M_OFF, M_IMD, M_OIP3, M_PHASE_NOISE
}; };
/*EOF*/ /*EOF*/

@ -63,18 +63,28 @@ typedef uint16_t map_t;
typedef uint32_t map_t; typedef uint32_t map_t;
#endif #endif
uint16_t marker_color[3] = uint16_t marker_color(int mtype)
{ {
RGBHEX(0xFFFFFF), if (mtype & M_REFERENCE)
RGBHEX(0xFFFF00), return(RGBHEX(0xFFFFFF));
RGBHEX(0x00FF00) if (mtype & M_DELTA)
}; return(RGBHEX(0x00FF00));
if (mtype & M_NOISE)
return(RGBHEX(0x00FFFF));
return(RGBHEX(0xFFFF00));
}
//#if 4 != M_TRACKING
//#error "Wrong marker numbers"
//#endif
char marker_letter[3] = char marker_letter[5] =
{ {
'R', 'R',
' ',
'D',
'N', 'N',
'D' 'T'
}; };
map_t markmap[2][MAX_MARKMAP_Y]; map_t markmap[2][MAX_MARKMAP_Y];
@ -782,7 +792,7 @@ static void trace_get_value_string(
buf2[0]=' '; buf2[0]=' ';
uint32_t dfreq = 0; uint32_t dfreq = 0;
float rlevel = 0; float rlevel = 0;
if (mtype == M_DELTA) { if (mtype & M_DELTA) {
if (ri > i) { if (ri > i) {
dfreq = frequencies[ri] - frequencies[i]; dfreq = frequencies[ri] - frequencies[i];
buf2[0] = '-'; buf2[0] = '-';
@ -803,10 +813,12 @@ static void trace_get_value_string(
// frequency_string(&buf2[1], sizeof(buf2) -1, dfreq); // frequency_string(&buf2[1], sizeof(buf2) -1, dfreq);
v = logmag(&coeff[i]); v = logmag(&coeff[i]);
if (mtype & M_NOISE)
v = v - 10*log10(GetActualRBW()*1000.0);
if (v == -INFINITY) if (v == -INFINITY)
plot_printf(buf, len, "-INF"); plot_printf(buf, len, "-INF");
else else
plot_printf(buf, len, "%s %.1f", buf2, v - rlevel); plot_printf(buf, len, "%s %.1f%s", buf2, v - rlevel,(mtype & M_NOISE?"/Hz":""));
} }
#ifdef __VNA__ #ifdef __VNA__
static int static int
@ -1401,12 +1413,12 @@ draw_cell(int m, int n)
if (x + MARKER_WIDTH >= 0 && x < CELLWIDTH && if (x + MARKER_WIDTH >= 0 && x < CELLWIDTH &&
y + MARKER_HEIGHT >= 0 && y < CELLHEIGHT) y + MARKER_HEIGHT >= 0 && y < CELLHEIGHT)
draw_marker(x, y, marker_color[markers[i].mtype], i); draw_marker(x, y, marker_color(markers[i].mtype), i);
#else #else
if (x + MARKER_WIDTH >= 0 && x - MARKER_WIDTH < CELLWIDTH && if (x + MARKER_WIDTH >= 0 && x - MARKER_WIDTH < CELLWIDTH &&
y + MARKER_HEIGHT >= 0 && y - MARKER_HEIGHT < CELLHEIGHT) y + MARKER_HEIGHT >= 0 && y - MARKER_HEIGHT < CELLHEIGHT)
draw_marker(x, y, marker_color[markers[i].mtype], i); draw_marker(x, y, marker_color(markers[i].mtype), i);
#endif #endif
// draw_marker(x, y, config.trace_color[t], i); // draw_marker(x, y, config.trace_color[t], i);
// } // }
@ -1820,7 +1832,7 @@ static void cell_draw_marker_info(int x0, int y0)
int ref_marker = 0; int ref_marker = 0;
int j = 0; int j = 0;
for (int i = 0; i < MARKER_COUNT; i++) { for (int i = 0; i < MARKER_COUNT; i++) {
if (markers[i].enabled && markers[i].mtype == M_REFERENCE) { if (markers[i].enabled && markers[i].mtype & M_REFERENCE) {
ref_marker = i; ref_marker = i;
break; break;
} }
@ -1843,6 +1855,7 @@ static void cell_draw_marker_info(int x0, int y0)
cell_drawstring_7x13(buf, xpos, ypos); cell_drawstring_7x13(buf, xpos, ypos);
break; break;
} }
#if 0
if (i >= 2 && in_selftest) { if (i >= 2 && in_selftest) {
plot_printf(buf, sizeof buf, "DO NOT SWITCH OFF!!"); plot_printf(buf, sizeof buf, "DO NOT SWITCH OFF!!");
j = 2; j = 2;
@ -1852,6 +1865,7 @@ static void cell_draw_marker_info(int x0, int y0)
cell_drawstring_7x13(buf, xpos, ypos); cell_drawstring_7x13(buf, xpos, ypos);
break; break;
} }
#endif
if (!markers[i].enabled) if (!markers[i].enabled)
continue; continue;
int idx = markers[i].index; int idx = markers[i].index;
@ -1870,25 +1884,31 @@ static void cell_draw_marker_info(int x0, int y0)
int k = 0; int k = 0;
if (i == active_marker) { if (i == active_marker) {
// ili9341_set_foreground(DEFAULT_BG_COLOR); // ili9341_set_foreground(DEFAULT_BG_COLOR);
// ili9341_set_background(marker_color[markers[i].mtype]); // ili9341_set_background(marker_color(markers[i].mtype));
buf[k++] = '\033'; // Right arrow (?) buf[k++] = '\033'; // Right arrow (?)
} else { } else {
// ili9341_set_background(DEFAULT_BG_COLOR); // ili9341_set_background(DEFAULT_BG_COLOR);
// ili9341_set_foreground(marker_color[markers[i].mtype]); // ili9341_set_foreground(marker_color(markers[i].mtype));
buf[k++] = ' '; buf[k++] = ' ';
// buf[k++] = ' '; // buf[k++] = ' ';
} }
buf[k++] = i+'1'; buf[k++] = i+'1';
// buf[k++] = marker_letter[markers[i].mtype]; if (markers[i].mtype & M_REFERENCE)
buf[k++] = 'R';
if (markers[i].mtype & M_DELTA)
buf[k++] = 'D';
if (markers[i].mtype & M_NOISE)
buf[k++] = 'N';
buf[k++] = 0; buf[k++] = 0;
ili9341_set_background(DEFAULT_BG_COLOR); ili9341_set_background(DEFAULT_BG_COLOR);
ili9341_set_foreground(marker_color[markers[i].mtype]); ili9341_set_foreground(marker_color(markers[i].mtype));
cell_drawstring_7x13(buf, xpos, ypos); cell_drawstring_7x13(buf, xpos, ypos);
xpos += strlen(buf)*7;
// cell_drawstring_size(buf, xpos, ypos, 2); // cell_drawstring_size(buf, xpos, ypos, 2);
trace_get_value_string( trace_get_value_string(
t, buf, sizeof buf, t, buf, sizeof buf,
idx, measured[trace[t].channel], frequencies, sweep_points, ridx, markers[i].mtype); idx, measured[trace[t].channel], frequencies, sweep_points, ridx, markers[i].mtype);
cell_drawstring_7x13(buf, xpos+3*7, ypos); cell_drawstring_7x13(buf, xpos, ypos);
// cell_drawstring_size(buf, xpos+3*7, ypos, 2); // cell_drawstring_size(buf, xpos+3*7, ypos, 2);
j++; j++;
} }

@ -736,7 +736,7 @@ int binary_search(int f)
int avoid_spur(int f) int avoid_spur(int f)
{ {
int window = ((int)actual_rbw ) * 1000*2; // int window = ((int)actual_rbw ) * 1000*2;
// if (window < 50000) // if (window < 50000)
// window = 50000; // window = 50000;
if (! setting_mode == M_LOW || frequency_IF != spur_IF || actual_rbw > 300.0) if (! setting_mode == M_LOW || frequency_IF != spur_IF || actual_rbw > 300.0)
@ -826,7 +826,12 @@ float perform(bool break_on_operation, int i, int32_t f, int tracking)
setFreq (1, local_IF + lf); setFreq (1, local_IF + lf);
if (MODE_OUTPUT(setting_mode)) // No substepping in output mode if (MODE_OUTPUT(setting_mode)) // No substepping in output mode
return(0); return(0);
float subRSSI = SI4432_RSSI(lf, MODE_SELECT(setting_mode))+settingLevelOffset()+setting_attenuate; float signal_path_loss;
if (setting_mode == M_LOW)
signal_path_loss = -9.5; // Loss in dB
else
signal_path_loss = 7; // Loss in dB (+ is gain)
float subRSSI = SI4432_RSSI(lf, MODE_SELECT(setting_mode))+settingLevelOffset()+ setting_attenuate - signal_path_loss;
if (RSSI < subRSSI) if (RSSI < subRSSI)
RSSI = subRSSI; RSSI = subRSSI;
t++; t++;
@ -965,11 +970,11 @@ static bool sweep(bool break_on_operation)
draw_cal_status(); draw_cal_status();
} }
if (!in_selftest && setting_mode == M_LOW && setting_auto_attenuation && max_index[0] > 0) { if (!in_selftest && setting_mode == M_LOW && setting_auto_attenuation && max_index[0] > 0) {
if (actual_t[max_index[0]] - setting_attenuate < -30 && setting_attenuate >= 10) { if (actual_t[max_index[0]] - setting_attenuate < -32 && setting_attenuate >= 10) {
setting_attenuate -= setting_scale; setting_attenuate -= setting_scale;
redraw_request |= REDRAW_CAL_STATUS; redraw_request |= REDRAW_CAL_STATUS;
dirty = true; // Must be above if(scandirty!!!!!) dirty = true; // Must be above if(scandirty!!!!!)
} else if (actual_t[max_index[0]] - setting_attenuate > -20 && setting_attenuate <= 20) { } else if (actual_t[max_index[0]] - setting_attenuate > -18 && setting_attenuate <= 20) {
setting_attenuate += setting_scale; setting_attenuate += setting_scale;
redraw_request |= REDRAW_CAL_STATUS; redraw_request |= REDRAW_CAL_STATUS;
dirty = true; // Must be above if(scandirty!!!!!) dirty = true; // Must be above if(scandirty!!!!!)
@ -980,11 +985,11 @@ static bool sweep(bool break_on_operation)
SetReflevel(setting_reflevel + setting_scale); SetReflevel(setting_reflevel + setting_scale);
redraw_request |= REDRAW_CAL_STATUS; redraw_request |= REDRAW_CAL_STATUS;
dirty = true; // Must be above if(scandirty!!!!!) dirty = true; // Must be above if(scandirty!!!!!)
} else if (temp_min_level < setting_reflevel - 9 * setting_scale && actual_t[max_index[0]] < setting_reflevel - setting_scale * 3 / 2) { } else if (temp_min_level < setting_reflevel - 9 * setting_scale - 2 && actual_t[max_index[0]] < setting_reflevel - setting_scale * 3 / 2) {
SetReflevel(setting_reflevel - setting_scale); SetReflevel(setting_reflevel - setting_scale);
redraw_request |= REDRAW_CAL_STATUS; redraw_request |= REDRAW_CAL_STATUS;
dirty = true; // Must be above if(scandirty!!!!!) dirty = true; // Must be above if(scandirty!!!!!)
} else if (temp_min_level > setting_reflevel - 9 * setting_scale + setting_scale * 3 / 2) { } else if (temp_min_level > setting_reflevel - 9 * setting_scale + setting_scale + 2) {
SetReflevel(setting_reflevel + setting_scale); SetReflevel(setting_reflevel + setting_scale);
redraw_request |= REDRAW_CAL_STATUS; redraw_request |= REDRAW_CAL_STATUS;
dirty = true; // Must be above if(scandirty!!!!!) dirty = true; // Must be above if(scandirty!!!!!)
@ -996,7 +1001,7 @@ static bool sweep(bool break_on_operation)
int m = 0; int m = 0;
while (i < cur_max) { // For all maxima found while (i < cur_max) { // For all maxima found
while (m < MARKERS_MAX) { while (m < MARKERS_MAX) {
if (markers[m].enabled == M_TRACKING_ENABLED) { // Available marker found if (markers[m].enabled && markers[m].mtype & M_TRACKING) { // Available marker found
markers[m].index = max_index[i]; markers[m].index = max_index[i];
markers[m].frequency = frequencies[markers[m].index]; markers[m].frequency = frequencies[markers[m].index];
m++; m++;
@ -1007,7 +1012,7 @@ static bool sweep(bool break_on_operation)
i++; i++;
} }
while (m < MARKERS_MAX) { while (m < MARKERS_MAX) {
if (markers[m].enabled == M_TRACKING_ENABLED ) { // More available markers found if (markers[m].enabled && markers[m].mtype & M_TRACKING) { // More available markers found
markers[m].index = 0; // Enabled but no max markers[m].index = 0; // Enabled but no max
markers[m].frequency = frequencies[markers[m].index]; markers[m].frequency = frequencies[markers[m].index];
} }
@ -1024,8 +1029,8 @@ static bool sweep(bool break_on_operation)
l = markers[1].index; l = markers[1].index;
r = markers[0].index; r = markers[0].index;
} }
markers[2].enabled = search_maximum(2, l - (r-l), 10); } else if (setting_measurement == M_PHASE_NOISE && markers[0].index > 10) {
markers[3].enabled = search_maximum(3, r + (r-l), 10); markers[1].index = markers[0].index + (setting_mode == M_LOW ? 290/4 : -290/4); // Position phase noise marker at requested offset
} }
peakIndex = max_index[0]; peakIndex = max_index[0];
peakLevel = actual_t[peakIndex]; peakLevel = actual_t[peakIndex];
@ -1238,21 +1243,21 @@ static const struct {
float stop; float stop;
} test_case [TEST_COUNT] = } test_case [TEST_COUNT] =
{// Condition Preparation Center Span Pass Width Stop {// Condition Preparation Center Span Pass Width Stop
{TC_BELOW, TP_SILENT, 0.005, 0.01, -10,0, 0}, // 1 Zero Hz leakage {TC_BELOW, TP_SILENT, 0.005, 0.01, 0,0, 0}, // 1 Zero Hz leakage
{TC_BELOW, TP_SILENT, 0.01, 0.01, -40, 0, 0}, // 2 Phase noise of zero Hz {TC_BELOW, TP_SILENT, 0.01, 0.01, -30, 0, 0}, // 2 Phase noise of zero Hz
{TC_SIGNAL, TP_10MHZ, 20, 7, -40, 30, -90 }, // 3 {TC_SIGNAL, TP_10MHZ, 20, 7, -37, 30, -80 }, // 3
{TC_SIGNAL, TP_10MHZ, 30, 7, -30, 30, -90 }, // 4 {TC_SIGNAL, TP_10MHZ, 30, 7, -32, 30, -80 }, // 4
{TC_BELOW, TP_SILENT, 200, 100, -75, 0, 0}, // 5 Wide band noise floor low mode {TC_BELOW, TP_SILENT, 200, 100, -70, 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_BELOW, TPH_SILENT, 600, 720, -65, 0, 0}, // 6 Wide band noise floor high mode
{TC_SIGNAL, TP_10MHZEXTRA, 10, 8, -20, 50, -70 }, // 7 BPF loss and stop band {TC_SIGNAL, TP_10MHZEXTRA, 10, 8, -13, 55, -60 }, // 7 BPF loss and stop band
{TC_FLAT, TP_10MHZEXTRA, 10, 4, -25, 20, -70}, // 8 BPF pass band flatness {TC_FLAT, TP_10MHZEXTRA, 10, 4, -18, 20, -60}, // 8 BPF pass band flatness
{TC_BELOW, TP_30MHZ, 430, 60, -75, 0, -85}, // 9 LPF cutoff {TC_BELOW, TP_30MHZ, 430, 60, -65, 0, -75}, // 9 LPF cutoff
{TC_END, 0, 0, 0, 0, 0, 0}, {TC_END, 0, 0, 0, 0, 0, 0},
{TC_MEASURE, TP_30MHZ, 30, 7, -30, 30, -80 }, // 11 Measure power level and noise {TC_MEASURE, TP_30MHZ, 30, 7, -22.5, 30, -70 }, // 11 Measure power level and noise
{TC_MEASURE, TP_30MHZ, 270, 4, -50, 30, -85 }, // 12 Measure powerlevel and noise {TC_MEASURE, TP_30MHZ, 270, 4, -45, 30, -75 }, // 12 Measure powerlevel and noise
{TC_MEASURE, TPH_30MHZ, 270, 4, -35, 30, -50 }, // 13 Calibrate power high mode {TC_MEASURE, TPH_30MHZ, 270, 4, -45, 30, -75 }, // 13 Calibrate power high mode
{TC_END, 0, 0, 0, 0, 0, 0}, {TC_END, 0, 0, 0, 0, 0, 0},
{TC_MEASURE, TP_30MHZ, 30, 1, -30, 30, -80 }, // 15 Measure RBW step time {TC_MEASURE, TP_30MHZ, 30, 1, -20, 30, -70 }, // 15 Measure RBW step time
{TC_END, 0, 0, 0, 0, 0, 0}, {TC_END, 0, 0, 0, 0, 0, 0},
}; };

113
ui.c

@ -29,6 +29,7 @@ uistat_t uistat = {
current_trace: 0, current_trace: 0,
lever_mode: LM_MARKER, lever_mode: LM_MARKER,
marker_delta: FALSE, marker_delta: FALSE,
marker_noise: FALSE,
marker_tracking : FALSE, marker_tracking : FALSE,
text : "", text : "",
}; };
@ -441,6 +442,7 @@ enum {
#define MT_FORM 0x80 // Or with menu type to get large button with current value #define MT_FORM 0x80 // Or with menu type to get large button with current value
#define MT_BACK 0x40 #define MT_BACK 0x40
#define MT_LEAVE 0x20 #define MT_LEAVE 0x20
#define MT_ICON 0x10
#define MT_MASK(x) (0xF & (x)) #define MT_MASK(x) (0xF & (x))
typedef void (*menuaction_cb_t)(int item, uint8_t data); typedef void (*menuaction_cb_t)(int item, uint8_t data);
@ -791,7 +793,7 @@ menu_marker_search_cb(int item, uint8_t data)
i = marker_search_right(markers[active_marker].index); i = marker_search_right(markers[active_marker].index);
break; break;
case 4: /* tracking */ case 4: /* tracking */
uistat.marker_tracking = !uistat.marker_tracking; markers[active_marker].mtype ^= M_TRACKING;
break; break;
} }
if (i != -1) if (i != -1)
@ -831,7 +833,7 @@ static void
menu_marker_sel_cb(int item, uint8_t data) menu_marker_sel_cb(int item, uint8_t data)
{ {
(void)data; (void)data;
int t; // int t;
if (item >= 0 && item < MARKERS_MAX) { if (item >= 0 && item < MARKERS_MAX) {
if (markers[item].enabled) { if (markers[item].enabled) {
if (item == active_marker) { if (item == active_marker) {
@ -842,19 +844,30 @@ menu_marker_sel_cb(int item, uint8_t data)
active_marker_select(item); active_marker_select(item);
} }
} else { } else {
markers[item].enabled = M_ENABLED; // default tracking enabled markers[item].enabled = M_ENABLED;
active_marker_select(item); active_marker_select(item);
markers[item].mtype = M_NORMAL;
markers[item].mtype |= (uistat.marker_delta ? M_DELTA : 0);
markers[item].mtype |= (uistat.marker_noise ? M_NOISE : 0);
markers[item].mtype |= (uistat.marker_tracking ? M_TRACKING : 0);
} }
if (markers[item].enabled) // if (markers[item].enabled)
menu_push_submenu(menu_marker_type); // menu_push_submenu(menu_marker_type);
#if 0
} else if (item == 4) { /* all off */ } else if (item == 4) { /* all off */
for (t = 0; t < MARKERS_MAX; t++) for (t = 0; t < MARKERS_MAX; t++)
markers[t].enabled = M_DISABLED; markers[t].enabled = M_DISABLED;
previous_marker = -1; previous_marker = -1;
active_marker = -1; active_marker = -1;
} else if (item == 5) { /* marker delta */ #endif
} else if (item == 4) { /* marker delta */
uistat.marker_delta = !uistat.marker_delta; uistat.marker_delta = !uistat.marker_delta;
} else if (item == 5) { /* marker noise */
uistat.marker_noise = !uistat.marker_noise;
// if (uistat.marker_noise) uistat.marker_delta = true; //Default behavior
} else if (item == 6) { /* marker tracking */
uistat.marker_tracking = !uistat.marker_tracking;
// if (uistat.marker_tracking) uistat.marker_noise = false; //Default behavior
} }
redraw_marker(active_marker); redraw_marker(active_marker);
draw_menu(); draw_menu();
@ -1554,32 +1567,33 @@ draw_menu_buttons(const menuitem_t *menu)
if (menu[i].type & MT_FORM) { if (menu[i].type & MT_FORM) {
ili9341_fill(active_button_start+2, y+2, active_button_width-4, FONT_GET_HEIGHT*2+8, bg); ili9341_fill(active_button_start+2, y+2, active_button_width-4, FONT_GET_HEIGHT*2+8, bg);
ili9341_drawstring_size(text, active_button_start+6, y+6, 2); ili9341_drawstring_size(text, active_button_start+6, y+6, 2);
// blit16BitWidthBitmap(240,y+6,16,16,&icons[3*16]); if (menu[i].type & MT_ICON) {
// blit16BitWidthBitmap(256,y+6,16,16,&icons[0]); blit16BitWidthBitmap(240,y+6,16,16,&left_icons[((menu[i].data >>4)&0xf)*16]);
blit16BitWidthBitmap(256,y+6,16,16,&right_icons[((menu[i].data >>0)&0xf)*16]);
}
} else { } else {
if (menu_is_multiline(menu[i].label, &l1, &l2)) { if (menu_is_multiline(menu[i].label, &l1, &l2)) {
#define BIG_BUTTON_FONT 1 #define BIG_BUTTON_FONT 1
#ifdef BIG_BUTTON_FONT #ifdef BIG_BUTTON_FONT
#undef FONT_HEIGHT #undef FONT_HEIGHT
#define FONT_HEIGHT 13 #define FONT_HEIGHT 13
ili9341_fill(active_button_start+1, y+1, active_button_width-2, 13+13 -2, bg); ili9341_fill(active_button_start+1, y+1, active_button_width-2, 13+13 -2, bg);
ili9341_drawstring_7x13(l1, active_button_start+2, y+1); ili9341_drawstring_7x13(l1, active_button_start+2, y+1);
ili9341_drawstring_7x13(l2, active_button_start+2, y+1+13-1); ili9341_drawstring_7x13(l2, active_button_start+2, y+1+13-1);
#else #else
ili9341_fill(active_button_start+3, y+5, active_button_width-6, 2+FONT_GET_HEIGHT+1+FONT_GET_HEIGHT+2, bg); ili9341_fill(active_button_start+3, y+5, active_button_width-6, 2+FONT_GET_HEIGHT+1+FONT_GET_HEIGHT+2, bg);
ili9341_drawstring(l1, active_button_start+5, y+7); ili9341_drawstring(l1, active_button_start+5, y+7);
ili9341_drawstring(l2, active_button_start+5, y+7+FONT_GET_HEIGHT+1); ili9341_drawstring(l2, active_button_start+5, y+7+FONT_GET_HEIGHT+1);
#endif #endif
} else { } else {
#ifdef BIG_BUTTON_FONT #ifdef BIG_BUTTON_FONT
ili9341_fill(active_button_start+1, y+1, active_button_width-2, 13+13 -2, bg); ili9341_fill(active_button_start+1, y+1, active_button_width-2, 13+13 -2, bg);
ili9341_drawstring_7x13(menu[i].label, active_button_start+2, y+6); ili9341_drawstring_7x13(menu[i].label, active_button_start+2, y+6);
#else #else
ili9341_fill(active_button_start+3, y+8, active_button_width-6, 2+FONT_GET_HEIGHT+2, bg); ili9341_fill(active_button_start+3, y+8, active_button_width-6, 2+FONT_GET_HEIGHT+2, bg);
ili9341_drawstring(menu[i].label, active_button_start+5, y+10); ili9341_drawstring(menu[i].label, active_button_start+5, y+10);
#endif #endif
} }
} }
} }
} }
@ -1799,7 +1813,7 @@ ui_mode_keypad(int _keypad_mode)
ui_mode = UI_KEYPAD; ui_mode = UI_KEYPAD;
area_width = AREA_WIDTH_NORMAL - MENU_BUTTON_WIDTH; area_width = AREA_WIDTH_NORMAL - MENU_BUTTON_WIDTH;
area_height = HEIGHT - 32; area_height = HEIGHT - 32;
if (!menu_is_form(menu_stack[menu_current_level])) if (!current_menu_is_form())
draw_menu(); draw_menu();
draw_keypad(); draw_keypad();
draw_numeric_area_frame(); draw_numeric_area_frame();
@ -1821,18 +1835,25 @@ ui_mode_normal(void)
static void static void
lever_move_marker(int status) lever_move_marker(int status)
{ {
int step = 1;
int count = 0;
do { do {
if (active_marker >= 0 && markers[active_marker].enabled) { if (active_marker >= 0 && markers[active_marker].enabled) {
if ((status & EVT_DOWN) && markers[active_marker].index > 0) { if ((status & EVT_DOWN) && markers[active_marker].index > 0) {
markers[active_marker].index--; markers[active_marker].index -= step;
markers[active_marker].frequency = frequencies[markers[active_marker].index]; markers[active_marker].frequency = frequencies[markers[active_marker].index];
redraw_marker(active_marker); redraw_marker(active_marker);
} }
if ((status & EVT_UP) && markers[active_marker].index < sweep_points-1) { if ((status & EVT_UP) && markers[active_marker].index < sweep_points-1) {
markers[active_marker].index++; markers[active_marker].index += step;
markers[active_marker].frequency = frequencies[markers[active_marker].index]; markers[active_marker].frequency = frequencies[markers[active_marker].index];
redraw_marker(active_marker); redraw_marker(active_marker);
} }
count++;
if (count > 10) {
step *= 2;
count = 0;
}
} }
status = btn_wait_release(); status = btn_wait_release();
} while (status != 0); } while (status != 0);
@ -2227,7 +2248,7 @@ ui_process_keypad(void)
} }
redraw_frame(); redraw_frame();
if (menu_is_form(menu_stack[menu_current_level])) { if (current_menu_is_form()) {
ui_mode_menu(); //Reactivate menu after keypad ui_mode_menu(); //Reactivate menu after keypad
selection = -1; selection = -1;
ensure_selection(); ensure_selection();
@ -2342,6 +2363,41 @@ touch_lever_mode_select(void)
return FALSE; return FALSE;
} }
static int
touch_marker_select(void)
{
int selected_marker = 0;
int touch_x, touch_y;
touch_position(&touch_x, &touch_y);
if (current_menu_is_form() || touch_x > 320-MENU_BUTTON_WIDTH || touch_x < 25 || touch_y > 30)
return FALSE;
if (touch_y > 15)
selected_marker = 2;
selected_marker += (touch_x >150 ? 1 : 0);
for (int i = 0; i < MARKERS_MAX; i++) {
if (markers[i].enabled) {
if (selected_marker == 0) {
active_marker = i;
break;
}
selected_marker --;
}
}
if (touch_y < 25) {
#ifdef __VNA__
if (touch_x < FREQUENCIES_XPOS2 && get_electrical_delay() != 0.0) {
select_lever_mode(LM_EDELAY);
} else {
#endif
select_lever_mode(LM_MARKER);
#ifdef __VNA__
}
#endif
return TRUE;
}
return FALSE;
}
static static
void ui_process_touch(void) void ui_process_touch(void)
{ {
@ -2355,11 +2411,14 @@ void ui_process_touch(void)
// Try drag marker // Try drag marker
if (touch_pickup_marker()) if (touch_pickup_marker())
break; break;
if (touch_marker_select())
break;
// Try select lever mode (top and bottom screen) // Try select lever mode (top and bottom screen)
if (touch_lever_mode_select()) { if (touch_lever_mode_select()) {
touch_wait_release(); touch_wait_release();
break; break;
} }
// switch menu mode after release // switch menu mode after release
touch_wait_release(); touch_wait_release();
selection = -1; // hide keyboard mode selection selection = -1; // hide keyboard mode selection

@ -65,54 +65,33 @@ extern int setting_step_delay;
void blit16BitWidthBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height, void blit16BitWidthBitmap(uint16_t x, uint16_t y, uint16_t width, uint16_t height,
const uint16_t *bitmap); const uint16_t *bitmap);
const uint16_t icons [] = const uint16_t left_icons [] =
{ {
#define I_EMPTY 0*16
/* Character 0 (0x00): 0x0000,
width 16 0x0000,
+-----------------+ 0x0000,
| | 0x0001,
| *************** | 0x0001,
| * * | 0x0001,
|** * | 0x0000,
| * * * | 0x0000,
| * * * | 0x0000,
| * * * * | 0x0000,
| * * * * | 0x0001,
| * * * * * | 0x0001,
| * * * * * * | 0x0001,
| * * * * * * * | 0x0000,
| * * * * * * * |
|** *********** * |
| * * |
| *************** |
| |
+-----------------+ */
0x0000, 0x0000,
0x7fff,
0x4001,
0xc001,
0x4001,
0x4001,
0x4801,
0x4801,
0x4a89,
0x4aa9,
0x4aa9,
0x5ffd,
0xc001,
0x4001,
0x7fff,
0x0000, 0x0000,
/* Character 1 (0x01: #define I_HIGH_INPUT 1*16
width 16 /* +-----------------+
+-----------------+
| | | |
| ** | | ** |
| **** | | *** |
| ************ | | ************ |
| **** | | *** |
| ** | | ** |
| | | |
| | | |
@ -126,25 +105,24 @@ const uint16_t icons [] =
| | | |
+-----------------+ */ +-----------------+ */
0x0000, 0x0000,
0x0000,
0x0060, 0x0060,
0x0038, 0x0039,
0x0ffe, 0x0fff,
0x0038, 0x0039,
0x0060, 0x0060,
0x0000, 0x0000,
0x0000, 0x0000,
0x0000, 0x0000,
0x0000, 0x0001,
0x0000, 0x0001,
0x0000, 0x0001,
0x0000,
0x0000, 0x0000,
0x0000, 0x0000,
0x0000, 0x0000,
/* Character 2 (0x02): #define I_LOW_INPUT 2*16
width 16 /* +-----------------+
+-----------------+
| | | |
| | | |
| | | |
@ -165,38 +143,194 @@ const uint16_t icons [] =
0x0000, 0x0000,
0x0000, 0x0000,
0x0000, 0x0000,
0x0000, 0x0001,
0x0000, 0x0001,
0x0000, 0x0001,
0x0000, 0x0000,
0x0000, 0x0000,
0x0000, 0x0000,
0x0000, 0x0000,
0x0060, 0x0060,
0x0038, 0x0039,
0x0ffe, 0x0fff,
0x0038, 0x0039,
0x0060, 0x0060,
0x0000, 0x0000,
/* High arrow left 0x03 */ #define I_LOW_OUTPUT 3*16
0b0000000000000000, 0b0000000000000000,
0b0000000000000000, 0b0000000000000000,
0b0000000000000000, 0b0000000000000000,
0b0000000000000001,
0b0000000000000001,
0b0000000000000001,
0b0000000000000000, 0b0000000000000000,
0b0000000000000000, 0b0000000000000000,
0b0000000000000000, 0b0000000000000000,
0b0000000110000000,
0b0000011110000001,
0b0000111111111111,
0b0000011110000001,
0b0000000110000000,
0b0000000000000000, 0b0000000000000000,
0b0000000000000000, 0b0000000000000000,
#define I_HIGH_OUTPUT 4*16
0b0000000000000000, 0b0000000000000000,
0b0000000000000000, 0b0000000000000000,
0b0000000110000000, 0b0000000110000000,
0b0000011110000000, 0b0000011110000001,
0b0000111111111110, 0b0000111111111111,
0b0000011110000000, 0b0000011110000001,
0b0000000110000000, 0b0000000110000000,
0b0000000000000000, 0b0000000000000000,
0b0000000000000000,
0b0000000000000000,
0b0000000000000001,
0b0000000000000001,
0b0000000000000001,
0b0000000000000000,
0b0000000000000000,
0b0000000000000000,
#define I_CONNECT 5*16
0b0000000000000000,
0b0000000000000000,
0b0000000000110000,
0b0000000000111101,
0b0000001111111111,
0b0000010000111101,
0b0000100000110000,
0b0001000000000000,
0b0001000000000000,
0b0000100000110000,
0b0000010000111101,
0b0000001111111111,
0b0000000000111101,
0b0000000000110000,
0b0000000000000000,
0b0000000000000000,
};
const uint16_t right_icons [] =
{
#define I_SA 0
/* Character 0 (0x00):
width 16
+-----------------+
| |
| *************** |
| * * |
|** * |
| * * * |
| * * * |
| * * * * |
| * * * * |
| * * * * * |
| * * * * * * |
| * * * * * * * |
| * * * * * * * |
|** *********** * |
| * * |
| *************** |
| |
+-----------------+ */
0x0000,
0x7fff,
0x4001,
0xc001,
0xc001,
0xc001,
0x4801,
0x4801,
0x4a89,
0x4aa9,
0xcaa9,
0xdffd,
0xc001,
0x4001,
0x7fff,
0x0000,
#define I_GEN 1
/* Character 0 (0x00):
width 16
+-----------------+
| |
| *************** |
| * * |
|** * |
| * ***** ** * |
| * * * * * |
| * * * * * |
| * * * * * |
| * * * * * |
| * * * * * |
| * * * * * |
| * ** ***** * |
|** * |
| * * |
| *************** |
| |
+-----------------+ */
0x0000,
0x7fff,
0x4001,
0xc001,
0xcf8d,
0xc889,
0x4889,
0x4889,
0x4889,
0x4889,
0xc889,
0xd8f9,
0xc001,
0x4001,
0x7fff,
0x0000,
#define I_CONFIG 2
0b0000000000000000,
0b0111111111111111,
0b0100000000000001,
0b1100000011000001,
0b1100001110001001,
0b1100011100011101,
0b0100001110111001,
0b0100001111111001,
0b0100011111110001,
0b0100111110000001,
0b1101111100000001,
0b1101111000000001,
0b1100100000000001,
0b0100000000000001,
0b0111111111111111,
0b0000000000000000,
#define I_SINUS 3
0b0000000000000000,
0b0111111111111111, // 1
0b0100000000000001, // 2
0b1100000000000001, // 3
0b1100000000110001, // 4
0b1100000001001001, // 5
0b0100000010000101, // 6
0b0101000010000101, // 7
0b0101000010000101, // 8
0b0101000010000001, // 9
0b1100100100000001, //10
0b1100011000000001, //11
0b1100000000000001, //12
0b0100000000000001, //13
0b0111111111111111, //14
0b0000000000000000,
}; };
@ -369,8 +503,8 @@ void menu_autosettings_cb(int item, uint8_t data)
for (int i = 1; i<MARKER_COUNT; i++ ) { for (int i = 1; i<MARKER_COUNT; i++ ) {
markers[i].enabled = M_DISABLED; markers[i].enabled = M_DISABLED;
} }
markers[0].enabled = M_TRACKING_ENABLED; markers[0].enabled = M_ENABLED;
markers[0].mtype = M_REFERENCE; markers[0].mtype = M_REFERENCE | M_TRACKING;
// set_refer_output(1); // set_refer_output(1);
@ -495,6 +629,7 @@ static void menu_spur_cb(int item, uint8_t data)
static void menu_measure_cb(int item, uint8_t data) static void menu_measure_cb(int item, uint8_t data)
{ {
(void)item; (void)item;
menu_move_back();
switch(data) { switch(data) {
case M_OFF: // Off case M_OFF: // Off
reset_settings(GetMode()); reset_settings(GetMode());
@ -503,10 +638,10 @@ static void menu_measure_cb(int item, uint8_t data)
case M_IMD: // IMD case M_IMD: // IMD
reset_settings(GetMode()); reset_settings(GetMode());
for (int i = 0; i< MARKERS_MAX; i++) { for (int i = 0; i< MARKERS_MAX; i++) {
markers[i].enabled = M_TRACKING_ENABLED; markers[i].enabled = M_ENABLED;
markers[i].mtype = M_DELTA; markers[i].mtype = M_DELTA | M_TRACKING;
} }
markers[0].mtype = M_REFERENCE; markers[0].mtype = M_REFERENCE | M_TRACKING;
ui_mode_keypad(KM_CENTER); ui_mode_keypad(KM_CENTER);
ui_process_keypad(); ui_process_keypad();
set_sweep_frequency(ST_START, 0); set_sweep_frequency(ST_START, 0);
@ -516,19 +651,38 @@ static void menu_measure_cb(int item, uint8_t data)
case M_OIP3: // OIP3 case M_OIP3: // OIP3
reset_settings(GetMode()); reset_settings(GetMode());
for (int i = 0; i< MARKERS_MAX; i++) { for (int i = 0; i< MARKERS_MAX; i++) {
markers[i].enabled = M_TRACKING_ENABLED; markers[i].enabled = M_ENABLED;
markers[i].mtype = M_DELTA; markers[i].mtype = M_DELTA | M_TRACKING;
} }
markers[0].mtype = M_REFERENCE; markers[0].mtype = M_REFERENCE | M_TRACKING;
ui_mode_keypad(KM_CENTER); ui_mode_keypad(KM_CENTER);
ui_process_keypad(); ui_process_keypad();
ui_mode_keypad(KM_SPAN); ui_mode_keypad(KM_SPAN);
ui_process_keypad(); ui_process_keypad();
set_sweep_frequency(ST_SPAN, uistat.value*4); set_sweep_frequency(ST_SPAN, uistat.value*4);
set_measurement(M_OIP3); set_measurement(M_OIP3);
break;
case M_PHASE_NOISE: // Phase noise
reset_settings(GetMode());
for (int i = 0; i< MARKERS_MAX; i++) {
markers[i].enabled = M_DISABLED;
markers[i].mtype = M_NORMAL;
}
markers[0].enabled = M_ENABLED;
markers[0].mtype = M_REFERENCE | M_TRACKING;
markers[1].enabled = M_ENABLED;
markers[1].mtype = M_DELTA | M_NOISE;
ui_mode_keypad(KM_CENTER);
ui_process_keypad();
ui_mode_keypad(KM_SPAN);
ui_process_keypad();
set_sweep_frequency(ST_SPAN, uistat.value*4);
set_measurement(M_PHASE_NOISE);
SetAverage(4);
break; break;
} }
menu_move_back(); // selection = -1;
ui_mode_normal(); ui_mode_normal();
// draw_cal_status(); // draw_cal_status();
} }
@ -585,25 +739,28 @@ static void menu_average_cb(int item, uint8_t data)
static void menu_marker_type_cb(int item, uint8_t data) static void menu_marker_type_cb(int item, uint8_t data)
{ {
(void)item; (void)item;
if (markers[active_marker].enabled) if (markers[active_marker].enabled == M_ENABLED)
{ {
if (data == M_REFERENCE) { if (data == M_NORMAL) {
markers[active_marker].mtype = M_NORMAL;
} else if (data == M_REFERENCE) {
for (int i = 0; i<MARKER_COUNT; i++ ) { for (int i = 0; i<MARKER_COUNT; i++ ) {
if (markers[i].mtype ==M_REFERENCE) if (markers[i].mtype & M_REFERENCE)
markers[i].mtype = M_NORMAL; markers[i].mtype &= ~M_REFERENCE;
} }
} markers[active_marker].mtype |= M_REFERENCE;
if (data == M_TRACKING) { } else {
if (markers[active_marker].enabled == M_ENABLED) if (data == M_DELTA && (markers[active_marker].mtype & M_REFERENCE))
markers[active_marker].enabled = M_TRACKING_ENABLED; markers[active_marker].mtype &= ~M_REFERENCE;
if (markers[active_marker].mtype & data)
markers[active_marker].mtype &= ~data;
else else
markers[active_marker].enabled = M_ENABLED; markers[active_marker].mtype |= data;
} else }
markers[active_marker].mtype = data;
} }
markmap_all_markers(); markmap_all_markers();
// redraw_marker(active_marker, TRUE); // redraw_marker(active_marker, TRUE);
menu_move_back(); // menu_move_back();
draw_menu(); draw_menu();
} }
@ -648,7 +805,7 @@ static void choose_active_marker(void)
{ {
int i; int i;
for (i = 0; i < MARKER_COUNT; i++) for (i = 0; i < MARKER_COUNT; i++)
if (markers[i].enabled) { if (markers[i].enabled == M_ENABLED) {
active_marker = i; active_marker = i;
return; return;
} }
@ -836,9 +993,10 @@ static const menuitem_t menu_reflevel[] = {
static const menuitem_t menu_marker_type[] = { static const menuitem_t menu_marker_type[] = {
{ MT_CALLBACK, M_REFERENCE, "REFERENCE", menu_marker_type_cb}, { MT_CALLBACK, M_REFERENCE, "REFERENCE", menu_marker_type_cb},
{ MT_CALLBACK, M_NORMAL, "NORMAL", menu_marker_type_cb},
{ MT_CALLBACK, M_DELTA, "DELTA", menu_marker_type_cb}, { MT_CALLBACK, M_DELTA, "DELTA", menu_marker_type_cb},
{ MT_CALLBACK, M_NOISE, "NOISE", menu_marker_type_cb},
{ MT_CALLBACK, M_TRACKING, "TRACKING", menu_marker_type_cb}, { MT_CALLBACK, M_TRACKING, "TRACKING", menu_marker_type_cb},
{ MT_CALLBACK, M_NORMAL, "NORMAL", menu_marker_type_cb},
{ MT_CANCEL, 0, S_LARROW" BACK", NULL }, { MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel { MT_NONE, 0, NULL, NULL } // sentinel
}; };
@ -854,6 +1012,22 @@ const menuitem_t menu_marker_search[] = {
{ MT_NONE, 0, NULL, NULL } // sentinel { MT_NONE, 0, NULL, NULL } // sentinel
}; };
const menuitem_t menu_marker_sel[] = {
{ MT_CALLBACK, 1, "MARKER 1", menu_marker_sel_cb },
{ MT_CALLBACK, 2, "MARKER 2", menu_marker_sel_cb },
{ MT_CALLBACK, 3, "MARKER 3", menu_marker_sel_cb },
{ MT_CALLBACK, 4, "MARKER 4", menu_marker_sel_cb },
// { MT_CALLBACK, 0, "ALL OFF", menu_marker_sel_cb },
{ MT_CALLBACK, 0, "DELTA", menu_marker_sel_cb },
{ MT_CALLBACK, 0, "NOISE", menu_marker_sel_cb },
{ MT_CALLBACK, 0, "TRACKING", menu_marker_sel_cb },
{ MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
#if 0
static const menuitem_t menu_marker_sel[] = { static const menuitem_t menu_marker_sel[] = {
{ MT_CALLBACK, 0, "MARKER 1", menu_marker_sel_cb}, { MT_CALLBACK, 0, "MARKER 1", menu_marker_sel_cb},
{ MT_CALLBACK, 0, "MARKER 2", menu_marker_sel_cb}, { MT_CALLBACK, 0, "MARKER 2", menu_marker_sel_cb},
@ -864,14 +1038,25 @@ static const menuitem_t menu_marker_sel[] = {
{ MT_CANCEL, 0, S_LARROW" BACK", NULL }, { MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel { MT_NONE, 0, NULL, NULL } // sentinel
}; };
#endif
const menuitem_t menu_marker_ops[] = {
{ MT_CALLBACK, ST_START, S_RARROW"START", menu_marker_op_cb },
{ MT_CALLBACK, ST_STOP, S_RARROW"STOP", menu_marker_op_cb },
{ MT_CALLBACK, ST_CENTER, S_RARROW"CENTER", menu_marker_op_cb },
{ MT_CALLBACK, ST_SPAN, S_RARROW"SPAN", menu_marker_op_cb },
// { MT_CALLBACK, 0, S_RARROW"EDELAY", menu_marker_op_cb },
{ MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
static const menuitem_t menu_marker[] = { static const menuitem_t menu_marker[] = {
{ MT_SUBMENU, 0, "\2SELECT\0MARKER", menu_marker_sel}, { MT_SUBMENU, 0, "\2SELECT\0MARKERS", menu_marker_sel},
{ MT_SUBMENU, 0, "\2MARKER\0TYPE", menu_marker_type}, { MT_SUBMENU, 0, "\2MARKER\0TYPE", menu_marker_type},
{ MT_CALLBACK, ST_START, S_RARROW"START", menu_marker_op_cb}, { MT_SUBMENU, 0, "\2MARKER\0OPS", menu_marker_ops},
{ MT_CALLBACK, ST_STOP, S_RARROW"STOP", menu_marker_op_cb}, { MT_SUBMENU, 0, "\2SEARCH\0MARKER", menu_marker_search},
{ MT_CALLBACK, ST_CENTER, S_RARROW"CENTER", menu_marker_op_cb},
{ MT_CALLBACK, ST_SPAN, S_RARROW"SPAN", menu_marker_op_cb},
{ MT_CANCEL, 0, S_LARROW" BACK", NULL }, { MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel { MT_NONE, 0, NULL, NULL } // sentinel
}; };
@ -884,12 +1069,12 @@ static const menuitem_t menu_dfu[] = {
static const menuitem_t menu_settings2[] = static const menuitem_t menu_settings2[] =
{ {
{ MT_CALLBACK, 0, "AGC", menu_settings2_cb}, { MT_CALLBACK, 0, "AGC", menu_settings2_cb},
{ MT_CALLBACK, 1, "LNA", menu_settings2_cb}, { MT_CALLBACK, 1, "LNA", menu_settings2_cb},
{ MT_CALLBACK, 2, "BPF", menu_settings2_cb}, { MT_CALLBACK, 2, "BPF", menu_settings2_cb},
{ MT_KEYPAD, KM_DECAY, "\2HOLD\0TIME", NULL}, { MT_KEYPAD, KM_DECAY,"\2HOLD\0TIME", NULL},
{ MT_KEYPAD, KM_NOISE, "\2NOISE\0LEVEL", NULL}, { MT_KEYPAD, KM_NOISE,"\2NOISE\0LEVEL", NULL},
{ MT_KEYPAD, KM_10MHZ, "\00210MHZ\0ACTUAL", NULL}, { MT_KEYPAD, KM_10MHZ,"\00210MHZ\0ACTUAL", NULL},
{ MT_CANCEL, 0, S_LARROW" BACK", NULL }, { MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel { MT_NONE, 0, NULL, NULL } // sentinel
}; };
@ -906,9 +1091,10 @@ static const menuitem_t menu_settings[] =
}; };
static const menuitem_t menu_measure[] = { static const menuitem_t menu_measure[] = {
{ MT_CALLBACK, M_OFF, "OFF", menu_measure_cb}, { MT_CALLBACK, M_OFF, "OFF", menu_measure_cb},
{ MT_CALLBACK, M_IMD, "IMD", menu_measure_cb}, { MT_CALLBACK, M_IMD, "IMD", menu_measure_cb},
{ MT_CALLBACK, M_OIP3, "OIP3", menu_measure_cb}, { MT_CALLBACK, M_OIP3, "OIP3", menu_measure_cb},
{ MT_CALLBACK, M_PHASE_NOISE, "\2PHASE\0NOISE",menu_measure_cb},
{ MT_CANCEL, 0, S_LARROW" BACK", NULL }, { MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel { MT_NONE, 0, NULL, NULL } // sentinel
}; };
@ -1015,12 +1201,12 @@ static const menuitem_t menu_stimulus[] = {
static const menuitem_t menu_mode[] = { static const menuitem_t menu_mode[] = {
{ MT_FORM | MT_TITLE, 0, "MODE", NULL}, { MT_FORM | MT_TITLE, 0, "MODE", NULL},
{ MT_FORM | MT_CALLBACK, 0, "LOW INPUT", menu_mode_cb}, { MT_FORM | MT_CALLBACK | MT_ICON, I_LOW_INPUT+I_SA, "LOW INPUT", menu_mode_cb},
{ MT_FORM | MT_CALLBACK, 0, "HIGH INPUT", menu_mode_cb}, { MT_FORM | MT_CALLBACK | MT_ICON, I_HIGH_INPUT+I_SA, "HIGH INPUT", menu_mode_cb},
{ MT_FORM | MT_CALLBACK, 0, "LOW OUTPUT", menu_mode_cb}, { MT_FORM | MT_CALLBACK | MT_ICON, I_LOW_OUTPUT+I_SINUS, "LOW OUTPUT", menu_mode_cb},
{ MT_FORM | MT_CALLBACK, 0, "HIGH OUTPUT", menu_mode_cb}, { MT_FORM | MT_CALLBACK | MT_ICON, I_HIGH_OUTPUT+I_GEN,"HIGH OUTPUT", menu_mode_cb},
{ MT_FORM | MT_SUBMENU, 0, "CAL OUTPUT: %s", menu_reffer}, { MT_FORM | MT_SUBMENU | MT_ICON, I_CONNECT+I_GEN, "CAL OUTPUT: %s", menu_reffer},
{ MT_FORM | MT_SUBMENU, 0, "CONFIG", menu_config}, { MT_FORM | MT_SUBMENU | MT_ICON, I_EMPTY+I_CONFIG,"CONFIG", menu_config},
// { MT_CANCEL, 0, S_LARROW" BACK", NULL }, // { MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_FORM | MT_NONE, 0, NULL, NULL } // sentinel { MT_FORM | MT_NONE, 0, NULL, NULL } // sentinel
}; };
@ -1137,7 +1323,7 @@ static void menu_item_modify_attribute(
mark = true; mark = true;
} }
} else if (menu == menu_drive || menu == menu_drive_wide || menu == menu_drive_wide2|| menu == menu_drive_wide3) { } else if (MT_MASK(menu[item].type) != MT_CALLBACK && (menu == menu_drive || menu == menu_drive_wide || menu == menu_drive_wide2|| menu == menu_drive_wide3)) {
if (data == setting_drive){ if (data == setting_drive){
mark = true; mark = true;
} }
@ -1165,14 +1351,23 @@ static void menu_item_modify_attribute(
if (item == 2 && setting_tracking){ // should not happen in high mode if (item == 2 && setting_tracking){ // should not happen in high mode
mark = true; mark = true;
} }
} else if (menu == menu_marker_type && active_marker >= 0 && markers[active_marker].enabled) { } else if (menu == menu_marker_type && active_marker >= 0 && markers[active_marker].enabled == M_ENABLED) {
if (item == 3 && markers[active_marker].enabled == M_TRACKING_ENABLED) if (data & markers[active_marker].mtype)
mark = true;
else if (data==markers[active_marker].mtype) // This catches the M_NORMAL case
mark = true; mark = true;
else if (item == markers[active_marker].mtype) } else if (menu == menu_marker_search) {
if (item == 4 && markers[active_marker].mtype & M_TRACKING)
mark = true; mark = true;
} else if (menu == menu_marker_sel) { } else if (menu == menu_marker_sel) {
if (item < MARKERS_MAX && markers[item].enabled) if (item < MARKERS_MAX && markers[item].enabled)
mark = true; mark = true;
else if (item == 4 && uistat.marker_delta)
mark = true;
else if (item == 5 && uistat.marker_noise)
mark = true;
else if (item == 6 && uistat.marker_tracking)
mark = true;
} else if (menu == menu_reflevel) { } else if (menu == menu_reflevel) {
if ((item == 0 && setting_auto_reflevel) || (item == 1 && !setting_auto_reflevel)) if ((item == 0 && setting_auto_reflevel) || (item == 1 && !setting_auto_reflevel))
mark = true; mark = true;

Loading…
Cancel
Save

Powered by TurnKey Linux.