Limit lines and console commands updated

tinySA-V4-SI4463
erikkaashoek 5 years ago
parent 6596a9fa8c
commit 932a5808fb

@ -1363,28 +1363,33 @@ void set_trace_refpos(float refpos)
VNA_SHELL_FUNCTION(cmd_trace) VNA_SHELL_FUNCTION(cmd_trace)
{ {
int t; int t = 0;
bool do_one = false;
if (argc == 0) { if (argc == 0) {
for (t = 0; t < TRACES_MAX; t++) { for (t = 0; t < TRACES_MAX; t++) {
show_one:
if (IS_TRACE_ENABLE(t)) { if (IS_TRACE_ENABLE(t)) {
const char *type = unit_string[setting.unit]; // get_trace_typename(t); const char *type = unit_string[setting.unit]; // get_trace_typename(t);
const char *channel = trc_channel_name[t]; // const char *channel = trc_channel_name[t];
float scale = get_trace_scale(); float scale = get_trace_scale();
float refpos = get_trace_refpos(); float refpos = get_trace_refpos();
shell_printf("%d %s %s %f %f\r\n", t, type, channel, scale, refpos); shell_printf("%d: %s %f %f \r\n", t+1, type, refpos, scale, (setting.stored[t]?", frozen":""));
} }
if (do_one) break;
} }
return; return;
} }
int next_arg = 0;
if ('0' <= argv[0][0] && argv[0][0] <= '9') { if ('0' <= argv[0][0] && argv[0][0] <= '9') {
t = my_atoi(argv[0]); t = my_atoi(argv[0]) - 1;
if (argc != 1 || t < 0 || t >= TRACES_MAX) next_arg++;
argc--;
if (t < 0 || t >= TRACES_MAX)
goto usage; goto usage;
const char *type = "LOGMAG";//unit_string[setting.unit]; if (argc >= 1)
const char *channel = trc_channel_name[t]; goto process;
shell_printf("%d %s %s\r\n", t, type, channel); do_one = true;
return; goto show_one;
} }
#if MAX_UNIT_TYPE != 4 #if MAX_UNIT_TYPE != 4
#error "Unit type enum possibly changed, check cmd_trace function" #error "Unit type enum possibly changed, check cmd_trace function"
@ -1398,23 +1403,15 @@ VNA_SHELL_FUNCTION(cmd_trace)
} }
// goto usage; // goto usage;
} }
static const char cmd_store_list[] = "store|clear|subtract|value"; static const char cmd_store_list[] = "value";
process:
if (argc == 1) { if (argc == 1) {
int type = get_str_index(argv[0], cmd_store_list); int type = get_str_index(argv[next_arg], cmd_store_list);
if (type >= 0) { if (type >= 0) {
switch(type) { switch(type) {
case 0: case 0:
store_trace(0,2);
goto update;
case 1:
set_clear_storage();
goto update;
case 2:
set_subtract_storage();
goto update;
case 3:
for (int i=0;i<sweep_points;i++) { for (int i=0;i<sweep_points;i++) {
shell_printf("trace value %d %.2f\r\n", i, actual_t[i]); shell_printf("trace %d value %d %.2f\r\n", t+1, i, measured[t][i]);
} }
} }
} }
@ -1440,18 +1437,26 @@ VNA_SHELL_FUNCTION(cmd_trace)
} }
goto update; goto update;
} }
goto usage;
} }
static const char cmd_load_list[] = "value"; static const char cmd_load_list[] = "copy|freeze|subtract|view|value";
if (argc == 3) { if (argc >= 2) {
switch (get_str_index(argv[0], cmd_load_list)) { switch (get_str_index(argv[next_arg++], cmd_load_list)) {
case 0: case 0:
store_trace(t, my_atoi(argv[next_arg++]));
goto update;
case 1:
setting.stored[t]= true;;
goto update;
case 2:
subtract_trace(t,my_atoi(argv[next_arg++]));
goto update;
case 4:
{ {
int i = my_atoi(argv[1]); int i = my_atoi(argv[next_arg++]);
if (i>= sweep_points) if (i>= sweep_points)
goto usage; goto usage;
float v = my_atof(argv[2]); float v = my_atof(argv[next_arg]);
stored_t[i] = v; measured[t][i] = v;
goto update; goto update;
} }
} }
@ -1461,14 +1466,14 @@ update:
redraw_request |= REDRAW_CAL_STATUS; redraw_request |= REDRAW_CAL_STATUS;
return; return;
usage: usage:
shell_printf("trace {%s}\r\n"\ shell_printf("trace {trace} {%s}\r\n"\
"trace {%s}\r\n"\ "trace {%s}\r\n"\
"trace {%s} {value|auto}\r\n", cmd_store_list, cmd_type_list, cmd_scale_ref_list); "trace {%s} {value|auto}\r\n", cmd_store_list, cmd_type_list, cmd_scale_ref_list);
} }
VNA_SHELL_FUNCTION(cmd_marker) VNA_SHELL_FUNCTION(cmd_marker)
{ {
int t; int t,tr;
if (argc == 0) { if (argc == 0) {
for (t = 0; t < MARKERS_MAX; t++) { for (t = 0; t < MARKERS_MAX; t++) {
if (markers[t].enabled) { if (markers[t].enabled) {
@ -1496,7 +1501,7 @@ VNA_SHELL_FUNCTION(cmd_marker)
return; return;
} }
#ifdef TINYSA4 #ifdef TINYSA4
static const char cmd_marker_list[] = "on|off|peak|delta|noise|tracking|stored|trace_aver"; static const char cmd_marker_list[] = "on|off|peak|delta|noise|tracking|trace|trace_aver";
static const char cmd_marker_on_off[] = "off|on"; static const char cmd_marker_on_off[] = "off|on";
int marker_mask = 0; int marker_mask = 0;
#else #else
@ -1526,8 +1531,15 @@ VNA_SHELL_FUNCTION(cmd_marker)
#ifdef TINYSA4 #ifdef TINYSA4
// M_NORMAL=0,M_REFERENCE=1, M_DELTA=2, M_NOISE=4, M_STORED=8, M_AVER=16, M_TRACKING=32, M_DELETE=64 // Tracking must be last. // M_NORMAL=0,M_REFERENCE=1, M_DELTA=2, M_NOISE=4, M_STORED=8, M_AVER=16, M_TRACKING=32, M_DELETE=64 // Tracking must be last.
case 3: case 3:
marker_mask = M_DELTA; tr=0;
goto set_mask; if (argc == 3 &&( argv[2][0] < '0' || argv[2][0] > '9' )) {
tr = my_atoui(argv[2]);
markers[t].mtype |= M_DELTA;
markers[t].ref= tr;
} else if (get_str_index(argv[2],cmd_marker_on_off) == 0) {
markers[t].mtype &= ~M_DELTA;
}
return;
case 4: case 4:
marker_mask = M_NOISE; marker_mask = M_NOISE;
goto set_mask; goto set_mask;
@ -1535,8 +1547,12 @@ VNA_SHELL_FUNCTION(cmd_marker)
marker_mask = M_TRACKING; marker_mask = M_TRACKING;
goto set_mask; goto set_mask;
case 6: case 6:
marker_mask = M_STORED; tr=2;
goto set_mask; if (argc == 3 &&( argv[2][0] < '0' || argv[2][0] > '9' )) {
tr = my_atoui(argv[2]);
}
markers[t].trace= tr;
return;
case 7: case 7:
marker_mask = M_AVER; marker_mask = M_AVER;
set_mask: set_mask:
@ -1547,6 +1563,7 @@ VNA_SHELL_FUNCTION(cmd_marker)
case 1: markers[t].mtype |= marker_mask; return; case 1: markers[t].mtype |= marker_mask; return;
} }
} }
return;
#endif #endif
} }
usage: usage:

@ -76,7 +76,6 @@
#define __CHANNEL_POWER__ #define __CHANNEL_POWER__
#define __LIMITS__ #define __LIMITS__
#define __MCU_CLOCK_SHIFT__ #define __MCU_CLOCK_SHIFT__
#define __TRACE_MENU__
#ifdef TINYSA4 #ifdef TINYSA4
#define __USE_RTC__ // Enable RTC clock #define __USE_RTC__ // Enable RTC clock
#define __USE_SD_CARD__ // Enable SD card support #define __USE_SD_CARD__ // Enable SD card support
@ -96,8 +95,8 @@
//#define __FFT_DECONV__ //#define __FFT_DECONV__
#else #else
//#define __HARMONIC__ //#define __HARMONIC__
#endif
#define __USE_FREQ_TABLE__ // Enable use table for frequency list #define __USE_FREQ_TABLE__ // Enable use table for frequency list
#endif
#ifdef TINYSA3 #ifdef TINYSA3
#define VARIANT(X,Y) (X) #define VARIANT(X,Y) (X)
@ -134,7 +133,7 @@
#endif #endif
#ifdef TINYSA4 #ifdef TINYSA4
#define MARKER_COUNT 8 #define MARKER_COUNT 8
#define TRACES_MAX 3 #define TRACES_MAX 4
#else #else
#define MARKER_COUNT 4 #define MARKER_COUNT 4
#define TRACES_MAX 3 #define TRACES_MAX 3
@ -867,8 +866,8 @@ typedef uint16_t pixel_t;
[LCD_MENU_TEXT_COLOR ] = RGB565( 0, 0, 0), \ [LCD_MENU_TEXT_COLOR ] = RGB565( 0, 0, 0), \
[LCD_MENU_ACTIVE_COLOR] = RGB565(210,210,210), \ [LCD_MENU_ACTIVE_COLOR] = RGB565(210,210,210), \
[LCD_TRACE_1_COLOR ] = RGB565(255,255, 0), \ [LCD_TRACE_1_COLOR ] = RGB565(255,255, 0), \
[LCD_TRACE_2_COLOR ] = RGB565(255, 0, 0), \ [LCD_TRACE_2_COLOR ] = RGB565(255, 64, 64), \
[LCD_TRACE_3_COLOR ] = RGB565( 0,255, 0), \ [LCD_TRACE_3_COLOR ] = RGB565( 64,255, 64), \
[LCD_TRACE_4_COLOR ] = RGB565(255, 0,255), \ [LCD_TRACE_4_COLOR ] = RGB565(255, 0,255), \
[LCD_NORMAL_BAT_COLOR ] = RGB565( 31,227, 0), \ [LCD_NORMAL_BAT_COLOR ] = RGB565( 31,227, 0), \
[LCD_LOW_BAT_COLOR ] = RGB565(255, 0, 0), \ [LCD_LOW_BAT_COLOR ] = RGB565(255, 0, 0), \

@ -242,6 +242,8 @@ void reset_settings(int m)
setting.stored[t] = false; setting.stored[t] = false;
setting.subtract[t] = 0; // Disabled setting.subtract[t] = 0; // Disabled
} }
setting.stored[TRACE_STORED] = true;
TRACE_DISABLE(TRACE_STORED_FLAG|TRACE_TEMP_FLAG);
#ifdef TINYSA4 #ifdef TINYSA4
setting.harmonic = 3; // Automatically used when above ULTRA_MAX_FREQ setting.harmonic = 3; // Automatically used when above ULTRA_MAX_FREQ
#else #else
@ -290,7 +292,6 @@ void reset_settings(int m)
setting.fast_speedup = 0; setting.fast_speedup = 0;
setting.trigger_level = -150.0; setting.trigger_level = -150.0;
setting.linearity_step = 0; setting.linearity_step = 0;
TRACE_DISABLE(TRACE_STORED_FLAG|TRACE_TEMP_FLAG);
// setting.refer = -1; // do not reset reffer when switching modes // setting.refer = -1; // do not reset reffer when switching modes
setting.mute = true; setting.mute = true;
#ifdef __SPUR__ #ifdef __SPUR__
@ -489,6 +490,7 @@ static setting_t saved_setting;
void set_measurement(int m) void set_measurement(int m)
{ {
#ifdef __LINEARITY__ #ifdef __LINEARITY__
setting.stored[TRACE_STORED] = true;
if (m == M_LINEARITY) { if (m == M_LINEARITY) {
for (int j = 0; j < setting._sweep_points; j++) for (int j = 0; j < setting._sweep_points; j++)
stored_t[j] = -150; stored_t[j] = -150;
@ -915,8 +917,15 @@ void limits_update(void)
{ {
if (setting.limits[i].enabled) { if (setting.limits[i].enabled) {
active = true; active = true;
while (j < sweep_points && (getFrequency(j) < setting.limits[i].frequency || setting.limits[i].frequency == 0)) while (j < sweep_points && (getFrequency(j) < setting.limits[i].frequency || setting.limits[i].frequency == 0)) {
stored_t[j++] = setting.limits[i].level; if (i == 0)
stored_t[j] = setting.limits[i].level;
else
stored_t[j] = setting.limits[i-1].level +
(getFrequency(j) - setting.limits[i-1].frequency) * (setting.limits[i].level - setting.limits[i-1].level) /
(setting.limits[i].frequency-setting.limits[i-1].frequency);
j++;
}
} }
} }
if (active) if (active)
@ -973,7 +982,7 @@ void subtract_trace(int t, int f)
if (t == f) if (t == f)
return; return;
if (!setting.subtract[t]) { if (!setting.subtract[t]) {
setting.subtract[t] = f; setting.subtract[t] = f+1;
setting.normalize_level = 0.0; setting.normalize_level = 0.0;
setting.auto_attenuation = false; // Otherwise noise level may move leading to strange measurements setting.auto_attenuation = false; // Otherwise noise level may move leading to strange measurements
} else } else
@ -1173,7 +1182,7 @@ void set_average(int t, int v)
#endif #endif
); );
#ifndef __TRACES_MENU__ #ifndef __TRACES_MENU__
if (enable) { if (enable && !IS_TRACES_ENABLED(TRACE_TEMP_FLAG)) {
enableTracesAtComplete(TRACE_TEMP_FLAG); enableTracesAtComplete(TRACE_TEMP_FLAG);
scan_after_dirty = 0; scan_after_dirty = 0;
} else } else
@ -2697,6 +2706,7 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) /
clear_frequency_cache(); clear_frequency_cache();
#endif #endif
calculate_correction(); // pre-calculate correction factor dividers to avoid float division calculate_correction(); // pre-calculate correction factor dividers to avoid float division
limits_update();
apply_settings(); apply_settings();
old_a = -150; // clear cached level setting old_a = -150; // clear cached level setting
// Initialize HW // Initialize HW
@ -4676,6 +4686,7 @@ static volatile int dummy;
if (setting.measurement == M_LINEARITY && setting.linearity_step < sweep_points) { if (setting.measurement == M_LINEARITY && setting.linearity_step < sweep_points) {
setting.attenuate_x2 = (29.0 - setting.linearity_step * 30.0 / (sweep_points))*2.0; setting.attenuate_x2 = (29.0 - setting.linearity_step * 30.0 / (sweep_points))*2.0;
dirty = true; dirty = true;
setting.stored[TRACE_STORED]=true;
stored_t[setting.linearity_step] = peakLevel; stored_t[setting.linearity_step] = peakLevel;
setting.linearity_step++; setting.linearity_step++;
} }
@ -4910,8 +4921,8 @@ const test_case_t test_case [] =
TEST_CASE_STRUCT(TC_FLAT, TP_10MHZEXTRA, 30, 14, -18, 9, -60), // 8 BPF pass band flatness TEST_CASE_STRUCT(TC_FLAT, TP_10MHZEXTRA, 30, 14, -18, 9, -60), // 8 BPF pass band flatness
TEST_CASE_STRUCT(TC_BELOW, TP_30MHZ, 900, 1, -90, 0, -90), // 9 LPF cutoff TEST_CASE_STRUCT(TC_BELOW, TP_30MHZ, 900, 1, -90, 0, -90), // 9 LPF cutoff
TEST_CASE_STRUCT(TC_SIGNAL, TP_30MHZ_SWITCH,30, 7, -23, 10, -50), // 10 Switch isolation using high attenuation TEST_CASE_STRUCT(TC_SIGNAL, TP_30MHZ_SWITCH,30, 7, -23, 10, -50), // 10 Switch isolation using high attenuation
TEST_CASE_STRUCT(TC_DISPLAY, TP_30MHZ, 30, 0, -25, 145, -60), // 11 test display TEST_CASE_STRUCT(TC_DISPLAY, TP_30MHZ, 30, 0, -25, 50, -60), // 11 test display
TEST_CASE_STRUCT(TC_ATTEN, TP_30MHZ, 30, 0, CAL_LEVEL, 145, -60), // 12 Measure atten step accuracy TEST_CASE_STRUCT(TC_ATTEN, TP_30MHZ, 30, 0, CAL_LEVEL, 50, -60), // 12 Measure atten step accuracy
TEST_CASE_STRUCT(TC_SIGNAL, TP_30MHZ_LNA, 30, 5, -23, 10, -75), // 13 Measure LNA TEST_CASE_STRUCT(TC_SIGNAL, TP_30MHZ_LNA, 30, 5, -23, 10, -75), // 13 Measure LNA
#define TEST_END 13 #define TEST_END 13
TEST_CASE_STRUCT(TC_END, 0, 0, 0, 0, 0, 0), TEST_CASE_STRUCT(TC_END, 0, 0, 0, 0, 0, 0),
@ -4926,15 +4937,15 @@ const test_case_t test_case [] =
TEST_CASE_STRUCT(TC_MEASURE, TPH_30MHZ, 300, 4, -48, 10, -65), // 14 Calibrate power high mode TEST_CASE_STRUCT(TC_MEASURE, TPH_30MHZ, 300, 4, -48, 10, -65), // 14 Calibrate power high mode
TEST_CASE_STRUCT(TC_MEASURE, TPH_30MHZ_SWITCH,300, 4, -40, 10, -65), // 14 Calibrate power high mode TEST_CASE_STRUCT(TC_MEASURE, TPH_30MHZ_SWITCH,300, 4, -40, 10, -65), // 14 Calibrate power high mode
#define TEST_ATTEN 22 #define TEST_ATTEN 22
TEST_CASE_STRUCT(TC_ATTEN, TP_30MHZ, 30, 0, -25, 145, -60), // 20 Measure atten step accuracy TEST_CASE_STRUCT(TC_ATTEN, TP_30MHZ, 30, 0, -25, 50, -60), // 20 Measure atten step accuracy
#define TEST_SPUR 23 #define TEST_SPUR 23
TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 144, 8, -95, 0, 0), // 22 Measure 48MHz spur TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 144, 8, -95, 0, 0), // 22 Measure 48MHz spur
#define TEST_LEVEL 24 #define TEST_LEVEL 24
TEST_CASE_STRUCT(TC_LEVEL, TP_30MHZ, 30.000, 0, CAL_LEVEL, 145, -55), // 23 Measure level TEST_CASE_STRUCT(TC_LEVEL, TP_30MHZ, 30.000, 0, CAL_LEVEL, 50, -55), // 23 Measure level
TEST_CASE_STRUCT(TC_LEVEL, TP_30MHZ_LNA, 30.000, 0, CAL_LEVEL, 145, -55), // 23 Measure level TEST_CASE_STRUCT(TC_LEVEL, TP_30MHZ_LNA, 30.000, 0, CAL_LEVEL, 50, -55), // 23 Measure level
TEST_CASE_STRUCT(TC_LEVEL, TPH_30MHZ, 150, 0, CAL_LEVEL-30, 145, -55), // 23 Measure level TEST_CASE_STRUCT(TC_LEVEL, TPH_30MHZ, 150, 0, CAL_LEVEL-30, 50, -55), // 23 Measure level
#define TEST_NOISE 27 #define TEST_NOISE 27
TEST_CASE_STRUCT(TC_LEVEL, TP_SILENT, 201.000, 0, -166, 145, -166), // 23 Measure level TEST_CASE_STRUCT(TC_LEVEL, TP_SILENT, 201.000, 0, -166, 50, -166), // 23 Measure level
#define TEST_NOISE_RBW 28 #define TEST_NOISE_RBW 28
TEST_CASE_STRUCT(TC_MEASURE, TP_SILENT, 201, 1, -166, 10, -166), // 16 Measure RBW step time TEST_CASE_STRUCT(TC_MEASURE, TP_SILENT, 201, 1, -166, 10, -166), // 16 Measure RBW step time
}; };
@ -5250,6 +5261,7 @@ void test_prepare(int i)
setting.measurement = M_OFF; setting.measurement = M_OFF;
markers[1].enabled = M_DISABLED; markers[1].enabled = M_DISABLED;
markers[2].enabled = M_DISABLED; markers[2].enabled = M_DISABLED;
setting.stored[TRACE_STORED] = true;
setting.tracking = false; //Default test setup setting.tracking = false; //Default test setup
setting.atten_step = false; setting.atten_step = false;
#ifdef TINYSA4 #ifdef TINYSA4
@ -5274,6 +5286,7 @@ void test_prepare(int i)
set_mode(M_LOW); set_mode(M_LOW);
common_silent: common_silent:
set_refer_output(-1); set_refer_output(-1);
setting.stored[TRACE_STORED] = true;
for (int j = 0; j < setting._sweep_points; j++) for (int j = 0; j < setting._sweep_points; j++)
stored_t[j] = test_case[i].pass; stored_t[j] = test_case[i].pass;
in_selftest = false; // Otherwise spurs will be visible in_selftest = false; // Otherwise spurs will be visible
@ -5312,7 +5325,7 @@ common_silent:
#endif #endif
#endif #endif
common: common:
setting.stored[TRACE_STORED] = true;
for (int j = 0; j < setting._sweep_points/2 - W2P(test_case[i].width); j++) for (int j = 0; j < setting._sweep_points/2 - W2P(test_case[i].width); j++)
stored_t[j] = test_case[i].stop; stored_t[j] = test_case[i].stop;
for (int j = setting._sweep_points/2 + W2P(test_case[i].width); j < setting._sweep_points; j++) for (int j = setting._sweep_points/2 + W2P(test_case[i].width); j < setting._sweep_points; j++)

@ -1516,10 +1516,6 @@ static UI_FUNCTION_ADV_CALLBACK(menu_average_acb)
// menu_move_back(true); // menu_move_back(true);
} }
#ifdef __TRACE_MENU__
static UI_FUNCTION_ADV_CALLBACK(menu_trace_acb) static UI_FUNCTION_ADV_CALLBACK(menu_trace_acb)
{ {
(void)item; (void)item;
@ -1570,13 +1566,13 @@ static UI_FUNCTION_ADV_CALLBACK(menu_subtract_trace_acb)
b->bg = LCD_TRACE_1_COLOR+data-1; b->bg = LCD_TRACE_1_COLOR+data-1;
} }
else else
plot_printf(b->text, sizeof(b->text), "SUBTRACT\nDISABLED"); plot_printf(b->text, sizeof(b->text), "SUBTRACT\nOFF");
b->icon = (data == setting.subtract[current_trace]) ? BUTTON_ICON_GROUP_CHECKED : BUTTON_ICON_GROUP; b->icon = (data == setting.subtract[current_trace]) ? BUTTON_ICON_GROUP_CHECKED : BUTTON_ICON_GROUP;
if (data - 1 == current_trace) if (data - 1 == current_trace)
b->fg = LCD_DARK_GREY; b->fg = LCD_DARK_GREY;
return; return;
} }
subtract_trace(current_trace,data); subtract_trace(current_trace,data-1);
menu_move_back(false); menu_move_back(false);
} }
@ -1600,7 +1596,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_traces_acb)
if (setting.subtract[current_trace]) if (setting.subtract[current_trace])
plot_printf(b->text, sizeof(b->text), "SUBTRACT\nTRACE %d", setting.subtract[current_trace]); plot_printf(b->text, sizeof(b->text), "SUBTRACT\nTRACE %d", setting.subtract[current_trace]);
else else
plot_printf(b->text, sizeof(b->text), "SUBTRACT\nDISABLED"); plot_printf(b->text, sizeof(b->text), "SUBTRACT\nOFF");
} }
return; return;
} }
@ -1633,10 +1629,6 @@ static UI_FUNCTION_ADV_CALLBACK(menu_traces_acb)
// draw_cal_status(); // draw_cal_status();
} }
#endif
static UI_FUNCTION_ADV_CALLBACK(menu_storage_acb) static UI_FUNCTION_ADV_CALLBACK(menu_storage_acb)
{ {
(void)item; (void)item;
@ -1718,8 +1710,13 @@ static UI_FUNCTION_ADV_CALLBACK(menu_limit_select_acb)
{ {
(void)item; (void)item;
if(b){ if(b){
b->icon = setting.limits[data-1].enabled ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK; if (setting.limits[data-1].enabled) {
b->param_1.i = data; plot_printf(b->text, sizeof(b->text), "%.6FHz\n%.6fdBm", (float)setting.limits[data-1].frequency, setting.limits[data-1].level);
b->icon = BUTTON_ICON_CHECK;
} else {
plot_printf(b->text, sizeof(b->text), "EMPTY");
b->icon = BUTTON_ICON_NOCHECK;
}
return; return;
} }
active_limit = data -1; active_limit = data -1;
@ -1736,6 +1733,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_marker_modify_acb)
if (active_marker == MARKER_INVALID) return; if (active_marker == MARKER_INVALID) return;
if(b){ if(b){
uistat.text[0] = 0; uistat.text[0] = 0;
uistat.text[1] = 0;
switch(data) { switch(data) {
case M_DELTA: case M_DELTA:
case M_NOISE: case M_NOISE:
@ -2222,6 +2220,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_connection_acb)
#endif #endif
// ===[MENU DEFINITION]========================================================= // ===[MENU DEFINITION]=========================================================
// Back button submenu list // Back button submenu list
static const menuitem_t menu_back[] = { static const menuitem_t menu_back[] = {
{ 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
@ -2487,19 +2486,19 @@ const menuitem_t menu_marker_modify[] = {
#ifdef __LIMITS__ #ifdef __LIMITS__
static const menuitem_t menu_limit_modify[] = static const menuitem_t menu_limit_modify[] =
{ {
{ MT_KEYPAD, KM_LIMIT_FREQ, "END\nFREQUENCY", "End frequency"}, { MT_KEYPAD, KM_LIMIT_FREQ, "FREQUENCY", "End frequency"},
{ MT_KEYPAD, KM_LIMIT_LEVEL, "LEVEL", "Limit level"}, { MT_KEYPAD, KM_LIMIT_LEVEL, "LEVEL", "Limit level"},
{ MT_CALLBACK, 0, "DISABLE", menu_limit_disable_cb}, { MT_CALLBACK, 0, "DISABLE", menu_limit_disable_cb},
{ MT_NONE, 0, NULL, menu_back} // next-> menu_back { MT_NONE, 0, NULL, menu_back} // next-> menu_back
}; };
const menuitem_t menu_limit_select[] = { const menuitem_t menu_limit_select[] = {
{ MT_ADV_CALLBACK, 1, "LIMIT %d", menu_limit_select_acb }, { MT_ADV_CALLBACK, 1, MT_CUSTOM_LABEL, menu_limit_select_acb },
{ MT_ADV_CALLBACK, 2, "LIMIT %d", menu_limit_select_acb }, { MT_ADV_CALLBACK, 2, MT_CUSTOM_LABEL, menu_limit_select_acb },
{ MT_ADV_CALLBACK, 3, "LIMIT %d", menu_limit_select_acb }, { MT_ADV_CALLBACK, 3, MT_CUSTOM_LABEL, menu_limit_select_acb },
{ MT_ADV_CALLBACK, 4, "LIMIT %d", menu_limit_select_acb }, { MT_ADV_CALLBACK, 4, MT_CUSTOM_LABEL, menu_limit_select_acb },
{ MT_ADV_CALLBACK, 5, "LIMIT %d", menu_limit_select_acb }, { MT_ADV_CALLBACK, 5, MT_CUSTOM_LABEL, menu_limit_select_acb },
{ MT_ADV_CALLBACK, 6, "LIMIT %d", menu_limit_select_acb }, { MT_ADV_CALLBACK, 6, MT_CUSTOM_LABEL, menu_limit_select_acb },
{ MT_NONE, 0, NULL, menu_back} // next-> menu_back { MT_NONE, 0, NULL, menu_back} // next-> menu_back
}; };
#endif #endif
@ -2640,8 +2639,6 @@ static const menuitem_t menu_sweep_speed[] =
#else #else
{ MT_ADV_CALLBACK | MT_LOW,SD_FAST, "FAST", menu_scanning_speed_acb}, { MT_ADV_CALLBACK | MT_LOW,SD_FAST, "FAST", menu_scanning_speed_acb},
#endif #endif
{ MT_KEYPAD, KM_SWEEP_TIME, "SWEEP\nTIME", "0..600s, 0=disable"}, // This must be item 3 to match highlighting
{ MT_SUBMENU, 0, "SWEEP\nPOINTS", menu_sweep_points},
#ifdef TINYSA4 #ifdef TINYSA4
{ MT_KEYPAD, KM_FAST_SPEEDUP,"FAST\nSPEEDUP", "2..20, 0=disable"}, { MT_KEYPAD, KM_FAST_SPEEDUP,"FAST\nSPEEDUP", "2..20, 0=disable"},
#else #else
@ -2925,7 +2922,6 @@ static const menuitem_t menu_config[] = {
static const menuitem_t menu_storage[] = static const menuitem_t menu_storage[] =
{ {
#ifdef __TRACE_MENU__
{ MT_ADV_CALLBACK,0, "TRACE %d", menu_storage_acb}, { MT_ADV_CALLBACK,0, "TRACE %d", menu_storage_acb},
{ MT_ADV_CALLBACK,1, "%s", menu_storage_acb}, { MT_ADV_CALLBACK,1, "%s", menu_storage_acb},
{ MT_ADV_CALLBACK,1, "DISPLAY", menu_storage_acb}, { MT_ADV_CALLBACK,1, "DISPLAY", menu_storage_acb},
@ -2933,20 +2929,9 @@ static const menuitem_t menu_storage[] =
{ MT_ADV_CALLBACK,3, "SUBTRACT", menu_storage_acb}, { MT_ADV_CALLBACK,3, "SUBTRACT", menu_storage_acb},
{ MT_ADV_CALLBACK,4, "NORMALIZE", menu_storage_acb}, { MT_ADV_CALLBACK,4, "NORMALIZE", menu_storage_acb},
{ MT_ADV_CALLBACK,5, "WRITE\n"S_RARROW"SD",menu_storage_acb}, { MT_ADV_CALLBACK,5, "WRITE\n"S_RARROW"SD",menu_storage_acb},
#else
{ MT_ADV_CALLBACK,0, "STORE\nTRACE", menu_storage_acb},
{ MT_ADV_CALLBACK,1, "CLEAR\nSTORED", menu_storage_acb},
{ MT_ADV_CALLBACK,2, "SUBTRACT\nSTORED",menu_storage_acb},
{ MT_ADV_CALLBACK,3, "NORMALIZE", menu_storage_acb},
#ifdef TINYSA4
{ MT_ADV_CALLBACK,4, "ACTUAL\n"S_RARROW"SD", menu_storage_acb},
{ MT_ADV_CALLBACK,5, "STORED\n"S_RARROW"SD", menu_storage_acb},
#endif
#endif
{ MT_NONE, 0, NULL, menu_back} // next-> menu_back { MT_NONE, 0, NULL, menu_back} // next-> menu_back
}; };
#ifdef __TRACE_MENU__
static const menuitem_t menu_trace[] = static const menuitem_t menu_trace[] =
{ {
{ MT_ADV_CALLBACK,0, "TRACE %d", menu_trace_acb}, { MT_ADV_CALLBACK,0, "TRACE %d", menu_trace_acb},
@ -2995,7 +2980,7 @@ static const menuitem_t menu_subtract_trace[] =
static const menuitem_t menu_traces[] = static const menuitem_t menu_traces[] =
{ {
{ MT_ADV_CALLBACK,0, "TRACE %d", menu_traces_acb}, { MT_ADV_CALLBACK,0, "TRACE %d", menu_traces_acb},
{ MT_ADV_CALLBACK,1, "VIEW", menu_traces_acb}, { MT_ADV_CALLBACK,1, "ENABLE", menu_traces_acb},
{ MT_ADV_CALLBACK,2, "FREEZE", menu_traces_acb}, { MT_ADV_CALLBACK,2, "FREEZE", menu_traces_acb},
{ MT_ADV_CALLBACK,3, MT_CUSTOM_LABEL, menu_traces_acb}, { MT_ADV_CALLBACK,3, MT_CUSTOM_LABEL, menu_traces_acb},
{ MT_SUBMENU, 0, "CALC", menu_average}, { MT_SUBMENU, 0, "CALC", menu_average},
@ -3005,34 +2990,16 @@ static const menuitem_t menu_traces[] =
#endif #endif
{ MT_NONE, 0, NULL, menu_back} // next-> menu_back { MT_NONE, 0, NULL, menu_back} // next-> menu_back
}; };
#endif
static const menuitem_t menu_display[] = { static const menuitem_t menu_display[] = {
{ MT_ADV_CALLBACK,0, "PAUSE\nSWEEP", menu_pause_acb}, { MT_ADV_CALLBACK,0, "PAUSE\nSWEEP", menu_pause_acb},
#ifndef __TRACE_MENU__ { MT_ADV_CALLBACK,1, "WATER\nFALL", menu_waterfall_acb},
{ MT_SUBMENU, 0, "CALC", menu_average},
{ MT_SUBMENU, 0, "STORAGE", menu_storage},
// { MT_ADV_CALLBACK,0, "STORE\nTRACE", menu_storage_acb},
// { MT_ADV_CALLBACK,1, "CLEAR\nSTORED", menu_storage_acb},
// { MT_ADV_CALLBACK,2, "SUBTRACT\nSTORED",menu_storage_acb},
#ifdef __VBW__
{ MT_SUBMENU, 0, "VBW", menu_vbw},
{ MT_KEYPAD, KM_EXP_AVER, "EXP\nAVER", NULL},
#endif
#ifdef __LIMITS__ #ifdef __LIMITS__
{ MT_SUBMENU, 0, "LIMITS", menu_limit_select}, { MT_SUBMENU, 0, "LIMITS", menu_limit_select},
#endif
#endif #endif
{ MT_ADV_CALLBACK,4, "WATER\nFALL", menu_waterfall_acb}, { MT_KEYPAD, KM_SWEEP_TIME, "SWEEP\nTIME", "0..600s, 0=disable"}, // This must be item 3 to match highlighting
{ MT_SUBMENU, 0, "SWEEP\nSETTINGS", menu_sweep_speed}, { MT_SUBMENU, 0, "SWEEP\nPOINTS", menu_sweep_points},
{ MT_KEYPAD, KM_SWEEP_TIME, "SWEEP\nTIME", "0..600s, 0=disable"}, // This must be item 3 to match highlighting { MT_SUBMENU, 0, "SWEEP\nACCURACY", menu_sweep_speed},
{ MT_SUBMENU, 0, "SWEEP\nPOINTS", menu_sweep_points},
#ifdef TINYSA4
{ MT_KEYPAD, KM_FAST_SPEEDUP,"FAST\nSPEEDUP", "2..20, 0=disable"},
#else
{ MT_KEYPAD | MT_LOW,KM_FAST_SPEEDUP,"FAST\nSPEEDUP", "2..20, 0=disable"},
#endif
//#ifdef __REMOTE_DESKTOP__ //#ifdef __REMOTE_DESKTOP__
// { MT_ADV_CALLBACK,0, "SEND\nDISPLAY", menu_send_display_acb}, // { MT_ADV_CALLBACK,0, "SEND\nDISPLAY", menu_send_display_acb},
//#endif //#endif
@ -3111,9 +3078,7 @@ static const menuitem_t menu_top[] = {
{ MT_SUBMENU, 0, "PRESET", menu_load_preset}, { MT_SUBMENU, 0, "PRESET", menu_load_preset},
{ MT_SUBMENU, 0, "FREQUENCY", menu_stimulus}, { MT_SUBMENU, 0, "FREQUENCY", menu_stimulus},
{ MT_SUBMENU, 0, "LEVEL", menu_level}, { MT_SUBMENU, 0, "LEVEL", menu_level},
#ifdef __TRACE_MENU__
{ MT_SUBMENU, 0, "TRACE", menu_traces}, { MT_SUBMENU, 0, "TRACE", menu_traces},
#endif
{ MT_SUBMENU, 0, "DISPLAY", menu_display}, { MT_SUBMENU, 0, "DISPLAY", menu_display},
{ MT_SUBMENU, 0, "MARKER", menu_marker}, { MT_SUBMENU, 0, "MARKER", menu_marker},
{ MT_SUBMENU, 0, "MEASURE", menu_measure}, { MT_SUBMENU, 0, "MEASURE", menu_measure},
@ -3127,7 +3092,7 @@ static const menuitem_t menu_top[] = {
#define ACTIVE_COLOR RGBHEX(0x007FFF) #define ACTIVE_COLOR RGBHEX(0x007FFF)
static void menu_item_modify_attribute( static void menu_item_modify_attribute( // To modify menu buttons with keypad modes
const menuitem_t *menu, int item, ui_button_t *button) const menuitem_t *menu, int item, ui_button_t *button)
{ {
if (menu == menu_settings) { if (menu == menu_settings) {
@ -3138,11 +3103,12 @@ static void menu_item_modify_attribute(
button->icon = setting.step_delay > 0 ? BUTTON_ICON_CHECK_MANUAL : BUTTON_ICON_CHECK_AUTO; button->icon = setting.step_delay > 0 ? BUTTON_ICON_CHECK_MANUAL : BUTTON_ICON_CHECK_AUTO;
else if (item == 1) else if (item == 1)
button->icon =setting.offset_delay > 0 ? BUTTON_ICON_CHECK_MANUAL : BUTTON_ICON_CHECK_AUTO; button->icon =setting.offset_delay > 0 ? BUTTON_ICON_CHECK_MANUAL : BUTTON_ICON_CHECK_AUTO;
} else if (menu == menu_sweep_speed) { } else if (menu == menu_display) {
if (item == 3) if (item == 2)
button->icon = setting.sweep_time_us != 0 ? BUTTON_ICON_CHECK_MANUAL : BUTTON_ICON_CHECK_AUTO; button->icon = setting.sweep_time_us != 0 ? BUTTON_ICON_CHECK_MANUAL : BUTTON_ICON_CHECK_AUTO;
else if (item == 5) } else if (menu == menu_sweep_speed) {
button->icon = setting.fast_speedup != 0 ? BUTTON_ICON_CHECK_MANUAL : BUTTON_ICON_CHECK_AUTO; if (item == 4)
button->icon = setting.fast_speedup != 0 ? BUTTON_ICON_CHECK_MANUAL : BUTTON_ICON_CHECK_AUTO;
} else if (menu == menu_reflevel) { } else if (menu == menu_reflevel) {
if (item == 1) if (item == 1)
button->icon = setting.auto_reflevel ? BUTTON_ICON_GROUP: BUTTON_ICON_GROUP_CHECKED; button->icon = setting.auto_reflevel ? BUTTON_ICON_GROUP: BUTTON_ICON_GROUP_CHECKED;

Loading…
Cancel
Save

Powered by TurnKey Linux.