From d039205b6302e93eaf2708ef35cf8d6b8002c797 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Wed, 5 Aug 2026 09:12:47 +0200 Subject: [PATCH] Auto rebuild and small fixes --- Makefile | 17 ++++++++++++++++- nanovna.h | 2 +- sa_core.c | 31 +++++++++++++++---------------- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 85410be..d67ecfc 100644 --- a/Makefile +++ b/Makefile @@ -70,8 +70,21 @@ endif # or va.b-nnn-gxxxxxxx # or ... +VERSION_FILE = version.txt +GIT_VERSION = $(strip $(shell git describe --tags --long --always --dirty 2>/dev/null)) + +ifeq ($(GIT_VERSION),) + GIT_VERSION = unknown +endif + +FILE_VERSION = $(strip $(shell cat $(VERSION_FILE) 2>/dev/null)) + +ifneq ($(FILE_VERSION),$(GIT_VERSION)) + $(shell printf '%s\n' '$(GIT_VERSION)' > $(VERSION_FILE)) +endif + ifeq ($(VERSION),) - VERSION="$(PROJECT)_$(shell git describe --tags --long)" + VERSION="$(PROJECT)_$(GIT_VERSION)" endif ############################################################################## @@ -296,6 +309,8 @@ RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC include $(RULESPATH)/rules.mk #include $(CHIBIOS)/memory.mk +$(OBJS): $(VERSION_FILE) + ifeq ($(TARGET),F303) clean: diff --git a/nanovna.h b/nanovna.h index 5f1485a..fc3b1cd 100644 --- a/nanovna.h +++ b/nanovna.h @@ -1835,7 +1835,7 @@ int plot_printf(char *str, int, const char *fmt, ...); #define define_to_STR(x) STR1(x) // sa_core.c - +#define MIN_RSSI_VALUE ( -150 ) typedef uint8_t deviceRSSI_t; typedef int16_t pureRSSI_t; extern int current_index; diff --git a/sa_core.c b/sa_core.c index 85013ab..e72625d 100644 --- a/sa_core.c +++ b/sa_core.c @@ -71,7 +71,7 @@ freq_t frequency_step_x10 = 0; uint16_t vbwSteps = 1; freq_t minFreq = 0; freq_t maxFreq = 520000000; -static float prev_output_level_dBm = -150; // cached output level to reduce redundant hardware writes +static float prev_output_level_dBm = MIN_RSSI_VALUE; // cached output level to reduce redundant hardware writes int spur_gate = 100; #ifdef __BANDS__ @@ -710,7 +710,7 @@ void reset_settings(int m) setting.trigger_mode = T_MID; setting.fast_speedup = 0; setting.faster_speedup = 0; - setting.trigger_level = -150.0; + setting.trigger_level = MIN_RSSI_VALUE; #ifdef __TRIGGER_TRACE__ setting.trigger_trace = 255; #endif @@ -930,7 +930,7 @@ void set_measurement(int m) setting.stored[TRACE_STORED] = true; if (m == M_LINEARITY) { for (int j = 0; j < setting._sweep_points; j++) - stored_t[j] = -150; + stored_t[j] = MIN_RSSI_VALUE; setting.linearity_step = 0; setting.attenuate_x2 = 29*2; setting.auto_attenuation = false; @@ -3418,7 +3418,7 @@ int avoid_spur(freq_t f) // find if this frequency should be a static uint16_t max_index[MAX_MAX]; static uint16_t cur_max = 0; -float temppeakLevel = -150; +float temppeakLevel = MIN_RSSI_VALUE; int16_t downslope = true; int peak_finding_index; float peak_finding_level; @@ -3672,7 +3672,7 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) / set_calibration_freq(setting.refer); update_rbw(); calculate_step_delay(); - prev_output_level_dBm = -150; // clear cached level setting + prev_output_level_dBm = MIN_RSSI_VALUE; // clear cached level setting // Initialize HW scandirty = true; // This is the first pass with new settings for (int t=0;t m+25) @@ -5612,8 +5611,8 @@ static volatile int dummy; #endif break; #ifdef __QUASI_PEAK__ - case AV_QUASI: - { static float old_RSSI = -150.0; + case AV_QUASI: + { static float old_RSSI = MIN_RSSI_VALUE; if (setting.frequency_step == 0) { if (i == 0) old_RSSI = trace_data[sweep_points-1]; @@ -6489,7 +6488,7 @@ void determine_direct_test_freq(void) { } int old_ultra = config.ultra; config.ultra = true; - float max_level = -150; + float max_level = MIN_RSSI_VALUE; set_refer_output(0); for (freq_t test_freq = test_start; test_freq < test_stop; test_freq += 30000000) { dirty = true;