mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
fix: keep freq mode in each save slot
This commit is contained in:
parent
5a10105b1a
commit
fe7a1ac4de
13
main.c
13
main.c
|
|
@ -779,7 +779,6 @@ config_t config = {
|
||||||
.trace_color = { DEFAULT_TRACE_1_COLOR, DEFAULT_TRACE_2_COLOR, DEFAULT_TRACE_3_COLOR, DEFAULT_TRACE_4_COLOR },
|
.trace_color = { DEFAULT_TRACE_1_COLOR, DEFAULT_TRACE_2_COLOR, DEFAULT_TRACE_3_COLOR, DEFAULT_TRACE_4_COLOR },
|
||||||
// .touch_cal = { 693, 605, 124, 171 }, // 2.4 inch LCD panel
|
// .touch_cal = { 693, 605, 124, 171 }, // 2.4 inch LCD panel
|
||||||
.touch_cal = { 338, 522, 153, 192 }, // 2.8 inch LCD panel
|
.touch_cal = { 338, 522, 153, 192 }, // 2.8 inch LCD panel
|
||||||
.freq_mode = FREQ_MODE_START_STOP,
|
|
||||||
.harmonic_freq_threshold = 300000000,
|
.harmonic_freq_threshold = 300000000,
|
||||||
.vbat_offset = 500
|
.vbat_offset = 500
|
||||||
};
|
};
|
||||||
|
|
@ -819,6 +818,8 @@ void load_default_properties(void)
|
||||||
current_props._active_marker = 0;
|
current_props._active_marker = 0;
|
||||||
current_props._domain_mode = 0;
|
current_props._domain_mode = 0;
|
||||||
current_props._marker_smith_format = MS_RLC;
|
current_props._marker_smith_format = MS_RLC;
|
||||||
|
current_props._freq_mode = FREQ_MODE_START_STOP;
|
||||||
|
|
||||||
//Checksum add on caldata_save
|
//Checksum add on caldata_save
|
||||||
//current_props.checksum = 0;
|
//current_props.checksum = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1003,7 +1004,7 @@ set_sweep_frequency(int type, uint32_t freq)
|
||||||
ensure_edit_config();
|
ensure_edit_config();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ST_START:
|
case ST_START:
|
||||||
config.freq_mode &= ~FREQ_MODE_CENTER_SPAN;
|
freq_mode &= ~FREQ_MODE_CENTER_SPAN;
|
||||||
if (frequency0 != freq) {
|
if (frequency0 != freq) {
|
||||||
frequency0 = freq;
|
frequency0 = freq;
|
||||||
// if start > stop then make start = stop
|
// if start > stop then make start = stop
|
||||||
|
|
@ -1011,7 +1012,7 @@ set_sweep_frequency(int type, uint32_t freq)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ST_STOP:
|
case ST_STOP:
|
||||||
config.freq_mode &= ~FREQ_MODE_CENTER_SPAN;
|
freq_mode &= ~FREQ_MODE_CENTER_SPAN;
|
||||||
if (frequency1 != freq) {
|
if (frequency1 != freq) {
|
||||||
frequency1 = freq;
|
frequency1 = freq;
|
||||||
// if start > stop then make start = stop
|
// if start > stop then make start = stop
|
||||||
|
|
@ -1019,7 +1020,7 @@ set_sweep_frequency(int type, uint32_t freq)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ST_CENTER:
|
case ST_CENTER:
|
||||||
config.freq_mode |= FREQ_MODE_CENTER_SPAN;
|
freq_mode |= FREQ_MODE_CENTER_SPAN;
|
||||||
uint32_t center = frequency0 / 2 + frequency1 / 2;
|
uint32_t center = frequency0 / 2 + frequency1 / 2;
|
||||||
if (center != freq) {
|
if (center != freq) {
|
||||||
uint32_t span = frequency1 - frequency0;
|
uint32_t span = frequency1 - frequency0;
|
||||||
|
|
@ -1034,7 +1035,7 @@ set_sweep_frequency(int type, uint32_t freq)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ST_SPAN:
|
case ST_SPAN:
|
||||||
config.freq_mode |= FREQ_MODE_CENTER_SPAN;
|
freq_mode |= FREQ_MODE_CENTER_SPAN;
|
||||||
if (frequency1 - frequency0 != freq) {
|
if (frequency1 - frequency0 != freq) {
|
||||||
uint32_t center = frequency0 / 2 + frequency1 / 2;
|
uint32_t center = frequency0 / 2 + frequency1 / 2;
|
||||||
if (center < START_MIN + freq / 2) {
|
if (center < START_MIN + freq / 2) {
|
||||||
|
|
@ -1048,7 +1049,7 @@ set_sweep_frequency(int type, uint32_t freq)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ST_CW:
|
case ST_CW:
|
||||||
config.freq_mode |= FREQ_MODE_CENTER_SPAN;
|
freq_mode |= FREQ_MODE_CENTER_SPAN;
|
||||||
if (frequency0 != freq || frequency1 != freq) {
|
if (frequency0 != freq || frequency1 != freq) {
|
||||||
frequency0 = freq;
|
frequency0 = freq;
|
||||||
frequency1 = freq;
|
frequency1 = freq;
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,6 @@ typedef struct config {
|
||||||
uint16_t menu_active_color;
|
uint16_t menu_active_color;
|
||||||
uint16_t trace_color[TRACES_MAX];
|
uint16_t trace_color[TRACES_MAX];
|
||||||
int16_t touch_cal[4];
|
int16_t touch_cal[4];
|
||||||
int8_t freq_mode;
|
|
||||||
uint32_t harmonic_freq_threshold;
|
uint32_t harmonic_freq_threshold;
|
||||||
uint16_t vbat_offset;
|
uint16_t vbat_offset;
|
||||||
uint8_t _reserved[22];
|
uint8_t _reserved[22];
|
||||||
|
|
@ -380,7 +379,8 @@ typedef struct properties {
|
||||||
uint8_t _domain_mode; /* 0bxxxxxffm : where ff: TD_FUNC m: DOMAIN_MODE */
|
uint8_t _domain_mode; /* 0bxxxxxffm : where ff: TD_FUNC m: DOMAIN_MODE */
|
||||||
uint8_t _marker_smith_format;
|
uint8_t _marker_smith_format;
|
||||||
uint8_t _bandwidth;
|
uint8_t _bandwidth;
|
||||||
uint8_t _reserved[50];
|
int8_t _freq_mode;
|
||||||
|
uint8_t _reserved[49];
|
||||||
uint32_t checksum;
|
uint32_t checksum;
|
||||||
} properties_t;
|
} properties_t;
|
||||||
|
|
||||||
|
|
@ -407,9 +407,10 @@ extern properties_t current_props;
|
||||||
#define velocity_factor current_props._velocity_factor
|
#define velocity_factor current_props._velocity_factor
|
||||||
#define marker_smith_format current_props._marker_smith_format
|
#define marker_smith_format current_props._marker_smith_format
|
||||||
#define bandwidth current_props._bandwidth
|
#define bandwidth current_props._bandwidth
|
||||||
|
#define freq_mode current_props._freq_mode
|
||||||
|
|
||||||
#define FREQ_IS_STARTSTOP() (!(config.freq_mode&FREQ_MODE_CENTER_SPAN))
|
#define FREQ_IS_STARTSTOP() (!(freq_mode & FREQ_MODE_CENTER_SPAN))
|
||||||
#define FREQ_IS_CENTERSPAN() (config.freq_mode&FREQ_MODE_CENTER_SPAN)
|
#define FREQ_IS_CENTERSPAN() (freq_mode & FREQ_MODE_CENTER_SPAN)
|
||||||
#define FREQ_IS_CW() (frequency0 == frequency1)
|
#define FREQ_IS_CW() (frequency0 == frequency1)
|
||||||
|
|
||||||
int caldata_save(int id);
|
int caldata_save(int id);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue