From 0a76ffd749dba9158081f473c860fe748e3578ff Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 7 Aug 2025 11:40:52 +0200 Subject: [PATCH] fix tinySA3 build (issue #138) - Modification of the tinySA3 repo source to re-enable a build from the current repo content even if there are no relevant changes for the little tinySA3. - Fix also a warning about strncpy truncation in "ui.c". Signed-off-by: Martin --- chconf.h | 2 ++ main.c | 9 +++++++-- nanovna.h | 4 ++-- sa_cmd.c | 6 ++++-- ui.c | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/chconf.h b/chconf.h index 29c99d7..682a459 100644 --- a/chconf.h +++ b/chconf.h @@ -158,6 +158,8 @@ */ #ifdef TINYSA4 #define CH_CFG_USE_WAITEXIT TRUE +#else +#define CH_CFG_USE_WAITEXIT FALSE #endif /** diff --git a/main.c b/main.c index 3aea4c4..1009b77 100644 --- a/main.c +++ b/main.c @@ -2266,13 +2266,18 @@ VNA_SHELL_FUNCTION(cmd_info) (void)argc; (void)argv; int i = 0; +#ifdef TINYSA3 while (info_about[i]) { - shell_printf("%s%s\r\n", info_about[i], (i == 0 ? hw_text : "")); + shell_printf("%s\r\n", info_about[i]); i++; } -#ifdef TINYSA3 if (has_esd) shell_printf("ESD protected\r\n"); +#else + while (info_about[i]) { + shell_printf("%s%s\r\n", info_about[i], (i == 0 ? hw_text : "")); + i++; + } #endif } #endif diff --git a/nanovna.h b/nanovna.h index 42911d5..a075298 100644 --- a/nanovna.h +++ b/nanovna.h @@ -18,7 +18,7 @@ */ #include "ch.h" -//#ifdef TINYSA_F303 +#ifdef TINYSA_F303 #ifdef TINYSA_F072 #error "Remove comment for #ifdef TINYSA_F303" #endif @@ -26,7 +26,7 @@ #define TINYSA4 #endif #define TINYSA4_PROTO -//#endif +#endif #ifdef TINYSA_F072 #ifdef TINYSA_F303 diff --git a/sa_cmd.c b/sa_cmd.c index 61abde1..8245b10 100644 --- a/sa_cmd.c +++ b/sa_cmd.c @@ -608,16 +608,18 @@ VNA_SHELL_FUNCTION(cmd_if) #ifdef TINYSA4 if (hw_if) t = "1067M..1073M"; - usage_printf("usage: if {%s}\r\n%QHz\r\n", t, setting.frequency_IF); #else - usage_printf("usage: if {433M..435M}\r\n%QHz\r\n", setting.frequency_IF); + t = "433M..435M"; #endif + usage_printf("usage: if {%s}\r\n%QHz\r\n", t, setting.frequency_IF); return; } freq_t a = (freq_t)my_atoi(argv[0]); freq_t f = DEFAULT_IF; +#ifdef TINYSA4 if (hw_if) f = DEFAULT_IF_PLUS; +#endif if (a!= 0 &&( a < (f - (freq_t)5000000) || a>(f + (freq_t)5000000))) goto usage; setting.auto_IF = false; diff --git a/ui.c b/ui.c index e0d52c7..16771b8 100644 --- a/ui.c +++ b/ui.c @@ -6396,7 +6396,7 @@ redraw_cal_status: // Compact status string // ili9341_set_background(LCD_FG_COLOR); ili9341_set_foreground(LCD_FG_COLOR); - strncpy(buf," ",BLEN-1); + strncpy(buf," ",BLEN); if (setting.auto_IF) buf[0] = 'f'; else