Merge branch 'master' into tinySA-V4-SI4463

Removed_REF_marker
erikkaashoek 5 years ago
commit 6dfe1be073

@ -1619,6 +1619,7 @@ VNA_SHELL_FUNCTION(cmd_cal)
}
shell_printf("usage: cal [%s]\r\n", cmd_cal_list);
}
#endif
VNA_SHELL_FUNCTION(cmd_save)
{
@ -1653,7 +1654,6 @@ VNA_SHELL_FUNCTION(cmd_recall)
usage:
shell_printf("recall {id}\r\n");
}
#endif
static const struct {
const char *name;
@ -1784,7 +1784,7 @@ VNA_SHELL_FUNCTION(cmd_trace)
set_unit(type);
goto update;
}
goto usage;
// goto usage;
}
static const char cmd_store_list[] = "store|clear|subtract";
if (argc == 1) {
@ -1802,7 +1802,7 @@ VNA_SHELL_FUNCTION(cmd_trace)
goto update;
}
}
goto usage;
// goto usage;
}
// 0 1
static const char cmd_scale_ref_list[] = "scale|reflevel";
@ -2307,9 +2307,9 @@ static const VNAShellCommand commands[] =
{"resume" , cmd_resume , 0},
#ifdef __VNA__
{"cal" , cmd_cal , CMD_WAIT_MUTEX},
#endif
{"save" , cmd_save , 0},
{"recall" , cmd_recall , CMD_WAIT_MUTEX},
#endif
{"trace" , cmd_trace , CMD_WAIT_MUTEX},
{"trigger" , cmd_trigger , 0},
{"marker" , cmd_marker , 0},

@ -518,6 +518,7 @@ void marker_position(int m, int t, int *x, int *y);
int search_nearest_index(int x, int y, int t);
void set_marker_search(int mode);
int marker_search(void);
int marker_search_max(void);
int marker_search_left(int from);
int marker_search_right(int from);
int marker_search_left_max(int from);

@ -2097,8 +2097,9 @@ static void cell_draw_marker_info(int x0, int y0)
// buf[k++] = 0;
ili9341_set_background(DEFAULT_BG_COLOR);
uint16_t color;
if ((setting.mode == M_LOW && temppeakLevel - get_attenuation() + setting.offset > -1) ||
(setting.mode == M_HIGH && temppeakLevel - get_attenuation()+ setting.offset > -10))
if ((!setting.subtract_stored) && // Disabled when normalized
((setting.mode == M_LOW && temppeakLevel - get_attenuation() + setting.offset > -1) ||
(setting.mode == M_HIGH && temppeakLevel - get_attenuation()+ setting.offset > -10) ))
color = BRIGHT_COLOR_RED;
else
color = marker_color(markers[i].mtype);

@ -2091,18 +2091,18 @@ sweep_again: // stay in sweep loop when output mo
// -------------------------- auto attenuate ----------------------------------
#define AUTO_TARGET_LEVEL -30
if (!in_selftest && setting.mode == M_LOW && setting.auto_attenuation && max_index[0] > 0) { // calculate and apply auto attenuate
setting.atten_step = false; // No step attenuate in low mode auto attenuate
int changed = false;
float actual_max_level = actual_t[max_index[0]] - get_attenuation();
if (actual_max_level < - 31 && setting.attenuate >= 10) {
if (actual_max_level < AUTO_TARGET_LEVEL - 11 && setting.attenuate >= 10) {
setting.attenuate -= 10.0;
changed = true;
} else if (actual_max_level < - 26 && setting.attenuate >= 5) {
} else if (actual_max_level < AUTO_TARGET_LEVEL - 6 && setting.attenuate >= 5) {
setting.attenuate -= 5.0;
changed = true;
} else if (actual_max_level > - 19 && setting.attenuate <= 20) {
} else if (actual_max_level > AUTO_TARGET_LEVEL + 2 && setting.attenuate <= 20) {
setting.attenuate += 10.0;
changed = true;
}
@ -2339,9 +2339,9 @@ marker_search_left_max(int from)
if (uistat.current_trace == -1)
return -1;
int value = actual_t[from];
float value = actual_t[from];
for (i = from - 1; i >= 0; i--) {
int new_value = actual_t[i];
float new_value = actual_t[i];
if (new_value < value) {
value = new_value;
found = i;
@ -2350,7 +2350,7 @@ marker_search_left_max(int from)
}
for (; i >= 0; i--) {
int new_value = actual_t[i];
float new_value = actual_t[i];
if (new_value > value) {
value = new_value;
found = i;
@ -2368,9 +2368,9 @@ marker_search_right_max(int from)
if (uistat.current_trace == -1)
return -1;
int value = actual_t[from];
float value = actual_t[from];
for (i = from + 1; i < sweep_points; i++) {
int new_value = actual_t[i];
float new_value = actual_t[i];
if (new_value < value) { // follow down
value = new_value;
found = i;
@ -2378,7 +2378,7 @@ marker_search_right_max(int from)
break; // past the minimum
}
for (; i < sweep_points; i++) {
int new_value = actual_t[i];
float new_value = actual_t[i];
if (new_value > value) { // follow up
value = new_value;
found = i;
@ -2388,6 +2388,22 @@ marker_search_right_max(int from)
return found;
}
int marker_search_max(void)
{
int i = 0;
int found = 0;
float value = actual_t[i];
for (; i < sweep_points; i++) {
int new_value = actual_t[i];
if (new_value > value) { // follow up
value = new_value;
found = i;
}
}
return found;
}
#define MINMAX_DELTA 10
@ -2399,9 +2415,9 @@ marker_search_left_min(int from)
if (uistat.current_trace == -1)
return -1;
int value = actual_t[from];
float value = actual_t[from];
for (i = from - 1; i >= 0; i--) {
int new_value = actual_t[i];
float new_value = actual_t[i];
if (new_value > value) {
value = new_value; // follow up
// found = i;
@ -2410,7 +2426,7 @@ marker_search_left_min(int from)
}
for (; i >= 0; i--) {
int new_value = actual_t[i];
float new_value = actual_t[i];
if (new_value < value) {
value = new_value; // follow down
found = i;
@ -2428,9 +2444,9 @@ marker_search_right_min(int from)
if (uistat.current_trace == -1)
return -1;
int value = actual_t[from];
float value = actual_t[from];
for (i = from + 1; i < sweep_points; i++) {
int new_value = actual_t[i];
float new_value = actual_t[i];
if (new_value > value) { // follow up
value = new_value;
// found = i;
@ -2438,7 +2454,7 @@ marker_search_right_min(int from)
break; // past the maximum
}
for (; i < sweep_points; i++) {
int new_value = actual_t[i];
float new_value = actual_t[i];
if (new_value < value) { // follow down
value = new_value;
found = i;

25
ui.c

@ -809,8 +809,7 @@ static UI_FUNCTION_CALLBACK(menu_marker_search_cb)
int i = -1;
if (active_marker == -1)
return;
if (data < 4)
markers[active_marker].mtype &= ~M_TRACKING;
markers[active_marker].mtype &= ~M_TRACKING;
switch (data) {
case 0: /* search Left */
i = marker_search_left_min(markers[active_marker].index);
@ -831,15 +830,20 @@ static UI_FUNCTION_CALLBACK(menu_marker_search_cb)
case 3: /* search right */
i = marker_search_right_max(markers[active_marker].index);
break;
case 4: /* tracking */
markers[active_marker].mtype ^= M_TRACKING;
case 4: /* peak search */
i = marker_search_max();
break;
}
if (i != -1)
if (i != -1) {
markers[active_marker].index = i;
markers[active_marker].frequency = frequencies[i];
}
draw_menu();
redraw_marker(active_marker);
select_lever_mode(LM_SEARCH);
// if (data == 4)
select_lever_mode(LM_MARKER); // Allow any position with level
// else
// select_lever_mode(LM_SEARCH); // Jump from maximum to maximum
}
static UI_FUNCTION_ADV_CALLBACK(menu_marker_tracking_acb){
@ -2088,11 +2092,13 @@ lever_search_marker(int status)
int i = -1;
if (active_marker >= 0) {
if (status & EVT_DOWN)
i = marker_search_left(markers[active_marker].index);
i = marker_search_left_max(markers[active_marker].index);
else if (status & EVT_UP)
i = marker_search_right(markers[active_marker].index);
if (i != -1)
i = marker_search_right_max(markers[active_marker].index);
if (i != -1) {
markers[active_marker].index = i;
markers[active_marker].frequency = frequencies[i];
}
redraw_marker(active_marker);
}
}
@ -2533,6 +2539,7 @@ touch_marker_select(void)
if (markers[i].enabled) {
if (selected_marker == 0) {
active_marker = i;
redraw_marker(active_marker);
break;
}
selected_marker --;

@ -899,7 +899,8 @@ static UI_FUNCTION_ADV_CALLBACK(menu_storage_acb)
ui_mode_keypad(KM_REFLEVEL);
ui_process_keypad();
// setting.normalize_level = uistat.value;
}
} else
set_auto_reflevel(true);
break;
}
ui_mode_normal();
@ -1412,7 +1413,7 @@ static const menuitem_t menu_reflevel[] = {
};
const menuitem_t menu_marker_search[] = {
//{ MT_CALLBACK, "OFF", menu_marker_search_cb },
{ MT_CALLBACK, 4, "PEAK\n SEARCH", menu_marker_search_cb },
{ MT_CALLBACK, 0, "MIN\n" S_LARROW" LEFT", menu_marker_search_cb },
{ MT_CALLBACK, 1, "MIN\n" S_RARROW" RIGHT", menu_marker_search_cb },
{ MT_CALLBACK, 2, "MAX\n" S_LARROW" LEFT", menu_marker_search_cb },

Loading…
Cancel
Save

Powered by TurnKey Linux.