mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
Merge branch 'master' of git://github.com/ttrftech/NanoVNA
This commit is contained in:
commit
ce9fed2914
17
main.c
17
main.c
|
|
@ -80,10 +80,8 @@ static THD_FUNCTION(Thread1, arg)
|
||||||
|
|
||||||
chMtxLock(&mutex);
|
chMtxLock(&mutex);
|
||||||
ui_process();
|
ui_process();
|
||||||
chMtxUnlock(&mutex);
|
|
||||||
|
|
||||||
if (sweep_enabled) {
|
if (sweep_enabled) {
|
||||||
chMtxLock(&mutex);
|
|
||||||
if (vbat != -1) {
|
if (vbat != -1) {
|
||||||
adc_stop(ADC1);
|
adc_stop(ADC1);
|
||||||
vbat = adc_vbat_read(ADC1);
|
vbat = adc_vbat_read(ADC1);
|
||||||
|
|
@ -96,12 +94,11 @@ static THD_FUNCTION(Thread1, arg)
|
||||||
plot_into_index(measured);
|
plot_into_index(measured);
|
||||||
redraw_request |= REDRAW_CELLS;
|
redraw_request |= REDRAW_CELLS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* plot trace and other indications as raster */
|
|
||||||
draw_all(completed); // flush markmap only if scan completed to prevent remaining traces
|
|
||||||
|
|
||||||
chMtxUnlock(&mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* plot trace and other indications as raster */
|
||||||
|
draw_all(completed); // flush markmap only if scan completed to prevent remaining traces
|
||||||
|
chMtxUnlock(&mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -765,8 +762,10 @@ static void set_frequencies(uint32_t start, uint32_t stop, int16_t points)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
float span = stop - start;
|
float span = stop - start;
|
||||||
for (i = 0; i < points; i++)
|
for (i = 0; i < points; i++) {
|
||||||
frequencies[i] = start + i * span / (float)(points - 1);
|
float offset = i * span / (float)(points - 1);
|
||||||
|
frequencies[i] = start + (uint32_t)offset;
|
||||||
|
}
|
||||||
// disable at out of sweep range
|
// disable at out of sweep range
|
||||||
for (; i < sweep_points; i++)
|
for (; i < sweep_points; i++)
|
||||||
frequencies[i] = 0;
|
frequencies[i] = 0;
|
||||||
|
|
|
||||||
12
plot.c
12
plot.c
|
|
@ -942,11 +942,15 @@ search_index_range_x(int x, uint32_t index[101], int *i0, int *i1)
|
||||||
i = (head + tail) / 2;
|
i = (head + tail) / 2;
|
||||||
if (x == CELL_X0(index[i]))
|
if (x == CELL_X0(index[i]))
|
||||||
break;
|
break;
|
||||||
|
else if (x < CELL_X0(index[i])) {
|
||||||
if (x < CELL_X0(index[i]))
|
if (tail == i+1)
|
||||||
tail = i+1;
|
break;
|
||||||
else
|
tail = i+1;
|
||||||
|
} else {
|
||||||
|
if (head == i)
|
||||||
|
break;
|
||||||
head = i;
|
head = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x != CELL_X0(index[i]))
|
if (x != CELL_X0(index[i]))
|
||||||
|
|
|
||||||
51
ui.c
51
ui.c
|
|
@ -599,15 +599,17 @@ menu_trace_cb(int item)
|
||||||
if (item < 0 || item >= 4)
|
if (item < 0 || item >= 4)
|
||||||
return;
|
return;
|
||||||
if (trace[item].enabled) {
|
if (trace[item].enabled) {
|
||||||
trace[item].enabled = FALSE;
|
if (item == uistat.current_trace) {
|
||||||
choose_active_trace();
|
// disable if active trace is selected
|
||||||
|
trace[item].enabled = FALSE;
|
||||||
|
choose_active_trace();
|
||||||
|
} else {
|
||||||
|
// make active selected trace
|
||||||
|
uistat.current_trace = item;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
trace[item].enabled = TRUE;
|
trace[item].enabled = TRUE;
|
||||||
uistat.current_trace = item;
|
uistat.current_trace = item;
|
||||||
//menu_move_back();
|
|
||||||
//request_to_redraw_grid();
|
|
||||||
//ui_mode_normal();
|
|
||||||
//redraw_all();
|
|
||||||
}
|
}
|
||||||
request_to_redraw_grid();
|
request_to_redraw_grid();
|
||||||
draw_menu();
|
draw_menu();
|
||||||
|
|
@ -844,15 +846,38 @@ menu_marker_op_cb(int item)
|
||||||
//redraw_all();
|
//redraw_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
active_marker_select(int item)
|
||||||
|
{
|
||||||
|
if (item == -1) {
|
||||||
|
active_marker = previous_marker;
|
||||||
|
previous_marker = -1;
|
||||||
|
if (active_marker == -1) {
|
||||||
|
choose_active_marker();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (previous_marker != active_marker)
|
||||||
|
previous_marker = active_marker;
|
||||||
|
active_marker = item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
menu_marker_sel_cb(int item)
|
menu_marker_sel_cb(int item)
|
||||||
{
|
{
|
||||||
if (item >= 0 && item < 4) {
|
if (item >= 0 && item < 4) {
|
||||||
// enable specified marker
|
if (markers[item].enabled) {
|
||||||
markers[item].enabled = TRUE;
|
if (item == active_marker) {
|
||||||
if (previous_marker != active_marker)
|
// disable if active trace is selected
|
||||||
previous_marker = active_marker;
|
markers[item].enabled = FALSE;
|
||||||
active_marker = item;
|
active_marker_select(-1);
|
||||||
|
} else {
|
||||||
|
active_marker_select(item);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
markers[item].enabled = TRUE;
|
||||||
|
active_marker_select(item);
|
||||||
|
}
|
||||||
} else if (item == 4) { /* all off */
|
} else if (item == 4) { /* all off */
|
||||||
markers[0].enabled = FALSE;
|
markers[0].enabled = FALSE;
|
||||||
markers[1].enabled = FALSE;
|
markers[1].enabled = FALSE;
|
||||||
|
|
@ -861,10 +886,8 @@ menu_marker_sel_cb(int item)
|
||||||
previous_marker = -1;
|
previous_marker = -1;
|
||||||
active_marker = -1;
|
active_marker = -1;
|
||||||
}
|
}
|
||||||
if (active_marker >= 0)
|
redraw_marker(active_marker, TRUE);
|
||||||
redraw_marker(active_marker, TRUE);
|
|
||||||
draw_menu();
|
draw_menu();
|
||||||
//ui_mode_normal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const menuitem_t menu_calop[] = {
|
const menuitem_t menu_calop[] = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue