From 0d3662141100992b1afefc9d2448207c26d953ba Mon Sep 17 00:00:00 2001 From: TT Date: Sat, 28 Sep 2019 16:07:39 +0900 Subject: [PATCH 1/3] fix: unexpectedly cal reset on changing frequency range --- main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 0ca6be8..e4ab024 100644 --- a/main.c +++ b/main.c @@ -816,6 +816,7 @@ void set_sweep_frequency(int type, float frequency) { int32_t freq = frequency; + int cal_applied = cal_status & CALSTAT_APPLY; switch (type) { case ST_START: freq_mode_startstop(); @@ -895,7 +896,7 @@ set_sweep_frequency(int type, float frequency) break; } - if (cal_auto_interpolate && (cal_status & CALSTAT_APPLY)) + if (cal_auto_interpolate && cal_applied) cal_interpolate(lastsaveid); } From 4e2036ba36953023f7e193b289e10111e3978d43 Mon Sep 17 00:00:00 2001 From: TT Date: Sat, 28 Sep 2019 21:49:59 +0900 Subject: [PATCH 2/3] fix: #52 --- main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index e4ab024..63177b1 100644 --- a/main.c +++ b/main.c @@ -755,9 +755,10 @@ void set_frequencies(uint32_t start, uint32_t stop, int16_t points) { int i; - uint32_t span = (stop - start) / 1000; /* prevents overflow because of maximum of int32_t(2.147e+9) */ + float span = stop - start; for (i = 0; i < points; i++) - frequencies[i] = start + span * i / (points - 1) * 1000; + frequencies[i] = start + i * span / (float)(points - 1); + // disable at out of sweep range for (; i < sweep_points; i++) frequencies[i] = 0; } From 064477291afc408d593818077e7b65f0bed4722d Mon Sep 17 00:00:00 2001 From: TT Date: Sat, 28 Sep 2019 22:28:00 +0900 Subject: [PATCH 3/3] fixed: freeze device by clicking pause --- main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 63177b1..a9adaf0 100644 --- a/main.c +++ b/main.c @@ -72,10 +72,12 @@ static THD_FUNCTION(Thread1, arg) __WFI(); } + chMtxLock(&mutex); + ui_process(); + chMtxUnlock(&mutex); + if (sweep_enabled) { chMtxLock(&mutex); - ui_process(); - if (vbat != -1) { adc_stop(ADC1); vbat = adc_vbat_read(ADC1);