mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
rewind sweep again when frequency updated
This commit is contained in:
parent
fd38f249ce
commit
6a704c8588
13
main.c
13
main.c
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014-2015, TAKAHASHI Tomohiro (TTRFTECH) edy555@gmail.com
|
||||
* Copyright (c) 2016-2017, TAKAHASHI Tomohiro (TTRFTECH) edy555@gmail.com
|
||||
* All rights reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
|
|
@ -39,7 +39,7 @@ static MUTEX_DECL(mutex);
|
|||
int32_t frequency_offset = 5000;
|
||||
int32_t frequency = 10000000;
|
||||
uint8_t drive_strength = SI5351_CLK_DRIVE_STRENGTH_2MA;
|
||||
|
||||
int8_t frequency_updated = FALSE;
|
||||
|
||||
static THD_WORKING_AREA(waThread1, 440);
|
||||
static THD_FUNCTION(Thread1, arg)
|
||||
|
|
@ -376,11 +376,15 @@ void scan_lcd(void)
|
|||
int delay;
|
||||
//int first = TRUE;
|
||||
|
||||
rewind:
|
||||
frequency_updated = FALSE;
|
||||
|
||||
delay = set_frequency(frequencies[0]);
|
||||
delay += 2;
|
||||
for (i = 0; i < sweep_points; i++) {
|
||||
tlv320aic3204_select_in3();
|
||||
wait_dsp(delay+2);
|
||||
// blink LED while scanning
|
||||
palClearPad(GPIOC, GPIOC_LED);
|
||||
|
||||
/* calculate reflection coeficient */
|
||||
|
|
@ -393,8 +397,12 @@ void scan_lcd(void)
|
|||
calculate_gamma(measured[1][i]);
|
||||
|
||||
delay = set_frequency(frequencies[(i+1)%sweep_points]);
|
||||
// blink LED while scanning
|
||||
palSetPad(GPIOC, GPIOC_LED);
|
||||
ui_process();
|
||||
|
||||
if (frequency_updated)
|
||||
goto rewind;
|
||||
}
|
||||
|
||||
if (cal_status & CALSTAT_APPLY)
|
||||
|
|
@ -435,6 +443,7 @@ update_frequencies(void)
|
|||
for (i = 0; i < sweep_points; i++)
|
||||
frequencies[i] = start + span * i / (sweep_points - 1) * 100;
|
||||
|
||||
frequency_updated = TRUE;
|
||||
// set grid layout
|
||||
update_grid();
|
||||
}
|
||||
|
|
|
|||
17
ui.c
17
ui.c
|
|
@ -69,7 +69,7 @@ enum {
|
|||
|
||||
uint8_t ui_mode = UI_NORMAL;
|
||||
uint8_t keypad_mode;
|
||||
uint8_t selection = 0;
|
||||
int8_t selection = 0;
|
||||
|
||||
typedef struct {
|
||||
uint8_t type;
|
||||
|
|
@ -471,14 +471,16 @@ static void
|
|||
menu_stimulus_cb(int item)
|
||||
{
|
||||
switch (item) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 0: /* START */
|
||||
case 1: /* STOP */
|
||||
case 2: /* CENTER */
|
||||
case 3: /* SPAN */
|
||||
case 4: /* CW */
|
||||
ui_mode_keypad(item);
|
||||
ui_process_keypad();
|
||||
break;
|
||||
case 5: /* pause && resume */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -583,6 +585,7 @@ const menuitem_t menu_stimulus[] = {
|
|||
{ MT_CALLBACK, "CENTER", menu_stimulus_cb },
|
||||
{ MT_CALLBACK, "SPAN", menu_stimulus_cb },
|
||||
{ MT_CALLBACK, "CW", menu_stimulus_cb },
|
||||
{ MT_CALLBACK, "PAUSE", menu_stimulus_cb },
|
||||
{ MT_CANCEL, "BACK", NULL },
|
||||
{ MT_NONE, NULL, NULL } // sentinel
|
||||
};
|
||||
|
|
@ -855,6 +858,7 @@ ui_mode_menu(void)
|
|||
return;
|
||||
|
||||
ui_mode = UI_MENU;
|
||||
/* narrowen plotting area */
|
||||
area_width = WIDTH - (64-14-4);
|
||||
area_height = HEIGHT;
|
||||
ensure_selection();
|
||||
|
|
@ -1090,6 +1094,7 @@ void ui_process_touch(void)
|
|||
switch (ui_mode) {
|
||||
case UI_NORMAL:
|
||||
touch_wait_release();
|
||||
selection = -1;
|
||||
ui_mode_menu();
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue