diff --git a/Makefile b/Makefile index bec51b8..4d06148 100644 --- a/Makefile +++ b/Makefile @@ -81,6 +81,10 @@ endif # Project, sources and paths # +# Dvice node to flash +DEVICE = /dev/cu.usbmodem401 +#DEVICE = /dev/ttyACM0 + # Define project name here PROJECT = ch @@ -225,6 +229,4 @@ flash: build/ch.bin dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D build/ch.bin dfu: - -@printf "reset dfu\r" >/dev/cu.usbmodem401 - - + -printf "reset dfu\r" >$(DEVICE) && sleep 1 diff --git a/main.c b/main.c index fedbfe4..d5a5430 100644 --- a/main.c +++ b/main.c @@ -708,7 +708,6 @@ config_t config = { // .touch_cal = { 693, 605, 124, 171 }, // 2.4 inch LCD panel .touch_cal = { 338, 522, 153, 192 }, // 2.8 inch LCD panel // .touch_cal = { 252, 450, 111, 150 }, //4.0" LCD - .freq_mode = FREQ_MODE_START_STOP, .harmonic_freq_threshold = FREQUENCY_THRESHOLD, .vbat_offset = 500, .bandwidth = BANDWIDTH_1000 @@ -748,6 +747,8 @@ void load_default_properties(void) current_props._active_marker = 0; current_props._domain_mode = 0; current_props._marker_smith_format = MS_RLC; + current_props._freq_mode = FREQ_MODE_START_STOP; + //Checksum add on caldata_save //current_props.checksum = 0; } @@ -1036,7 +1037,7 @@ set_sweep_frequency(int type, uint32_t freq) ensure_edit_config(); switch (type) { case ST_START: - config.freq_mode &= ~FREQ_MODE_CENTER_SPAN; + freq_mode &= ~FREQ_MODE_CENTER_SPAN; if (frequency0 != freq) { frequency0 = freq; // if start > stop then make start = stop @@ -1044,7 +1045,7 @@ set_sweep_frequency(int type, uint32_t freq) } break; case ST_STOP: - config.freq_mode &= ~FREQ_MODE_CENTER_SPAN; + freq_mode &= ~FREQ_MODE_CENTER_SPAN; if (frequency1 != freq) { frequency1 = freq; // if start > stop then make start = stop @@ -1052,7 +1053,7 @@ set_sweep_frequency(int type, uint32_t freq) } break; case ST_CENTER: - config.freq_mode |= FREQ_MODE_CENTER_SPAN; + freq_mode |= FREQ_MODE_CENTER_SPAN; uint32_t center = frequency0 / 2 + frequency1 / 2; if (center != freq) { uint32_t span = frequency1 - frequency0; @@ -1067,7 +1068,7 @@ set_sweep_frequency(int type, uint32_t freq) } break; case ST_SPAN: - config.freq_mode |= FREQ_MODE_CENTER_SPAN; + freq_mode |= FREQ_MODE_CENTER_SPAN; if (frequency1 - frequency0 != freq) { uint32_t center = frequency0 / 2 + frequency1 / 2; if (center < START_MIN + freq / 2) { @@ -1081,7 +1082,7 @@ set_sweep_frequency(int type, uint32_t freq) } break; case ST_CW: - config.freq_mode |= FREQ_MODE_CENTER_SPAN; + freq_mode |= FREQ_MODE_CENTER_SPAN; if (frequency0 != freq || frequency1 != freq) { frequency0 = freq; frequency1 = freq; diff --git a/nanovna.h b/nanovna.h index f822983..3774c9f 100644 --- a/nanovna.h +++ b/nanovna.h @@ -295,7 +295,7 @@ typedef struct properties { int8_t _active_marker; uint8_t _domain_mode; /* 0bxxxxxffm : where ff: TD_FUNC m: DOMAIN_MODE */ uint8_t _marker_smith_format; - uint8_t reserved; + uint8_t _freq_mode; uint32_t checksum; } properties_t; //on POINTS_COUNT = 101, sizeof(properties_t) == 4152 (need reduce size on 56 bytes to 4096 for more compact save slot size) @@ -414,7 +414,6 @@ void show_logo(void); #define SAVE_CONFIG_SIZE 0x00000800 // Depend from properties_t size, should be aligned by FLASH_PAGESIZE #define SAVE_PROP_CONFIG_SIZE 0x00001800 - // Save config_t and properties_t flash area (see flash7 : org = 0x08018000, len = 32k from *.ld settings) // Properties save area follow after config // len = SAVE_CONFIG_SIZE + SAVEAREA_MAX * SAVE_PROP_CONFIG_SIZE 0x00008000 32k @@ -439,9 +438,10 @@ extern int16_t lastsaveid; #define domain_mode current_props._domain_mode #define velocity_factor current_props._velocity_factor #define marker_smith_format current_props._marker_smith_format +#define freq_mode current_props._freq_mode -#define FREQ_IS_STARTSTOP() (!(config.freq_mode&FREQ_MODE_CENTER_SPAN)) -#define FREQ_IS_CENTERSPAN() (config.freq_mode&FREQ_MODE_CENTER_SPAN) +#define FREQ_IS_STARTSTOP() (!(freq_mode & FREQ_MODE_CENTER_SPAN)) +#define FREQ_IS_CENTERSPAN() (freq_mode & FREQ_MODE_CENTER_SPAN) #define FREQ_IS_CW() (frequency0 == frequency1) int caldata_save(uint32_t id); diff --git a/ui.c b/ui.c index a366466..a0bca5d 100644 --- a/ui.c +++ b/ui.c @@ -636,7 +636,7 @@ menu_points_cb(int item, uint8_t data) draw_menu(); } -static void +static void choose_active_marker(void) { int i; @@ -766,9 +766,11 @@ menu_marker_search_cb(int item, uint8_t data) break; case 2: /* search Left */ i = marker_search_left(markers[active_marker].index); + uistat.marker_tracking = false; break; case 3: /* search right */ i = marker_search_right(markers[active_marker].index); + uistat.marker_tracking = false; break; case 4: /* tracking */ uistat.marker_tracking = !uistat.marker_tracking;