fix: apply cal on scan

This commit is contained in:
TT 2019-09-28 10:01:19 +09:00
parent 5fea75f92f
commit b552d04f96

13
main.c
View file

@ -224,8 +224,13 @@ static void cmd_resume(BaseSequentialStream *chp, int argc, char *argv[])
(void)chp; (void)chp;
(void)argc; (void)argc;
(void)argv; (void)argv;
resume_sweep();
// restore frequencies array and cal
update_frequencies(); update_frequencies();
if (cal_auto_interpolate && (cal_status & CALSTAT_APPLY))
cal_interpolate(lastsaveid);
resume_sweep();
} }
static void cmd_reset(BaseSequentialStream *chp, int argc, char *argv[]) static void cmd_reset(BaseSequentialStream *chp, int argc, char *argv[])
@ -704,6 +709,9 @@ static void cmd_scan(BaseSequentialStream *chp, int argc, char *argv[])
pause_sweep(); pause_sweep();
chMtxLock(&mutex); chMtxLock(&mutex);
set_frequencies(start, stop, points); set_frequencies(start, stop, points);
if (cal_auto_interpolate && (cal_status & CALSTAT_APPLY))
cal_interpolate(lastsaveid);
sweep_once = TRUE; sweep_once = TRUE;
chMtxUnlock(&mutex); chMtxUnlock(&mutex);
@ -808,7 +816,6 @@ void
set_sweep_frequency(int type, float frequency) set_sweep_frequency(int type, float frequency)
{ {
int32_t freq = frequency; int32_t freq = frequency;
bool cal_applied = cal_status & CALSTAT_APPLY;
switch (type) { switch (type) {
case ST_START: case ST_START:
freq_mode_startstop(); freq_mode_startstop();
@ -888,7 +895,7 @@ set_sweep_frequency(int type, float frequency)
break; break;
} }
if (cal_auto_interpolate && cal_applied) if (cal_auto_interpolate && (cal_status & CALSTAT_APPLY))
cal_interpolate(lastsaveid); cal_interpolate(lastsaveid);
} }