From 5a4ccbd9108524656e46dcff1cfa19fd119dd29d Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Mon, 2 Nov 2026 14:19:57 +0100 Subject: [PATCH] Band names in .bnd files (issue #136) BANDS->SD stored start, end and level only, so the band names were lost. The name is now written as a quoted fourth field (older firmware ignores it) and loaded when present (files of older firmware keep the current names). A line needs start, end and level: the level was read from lines with only two fields as well. Tested on a ZS407: band named FMRADIO stored as 0, 900000000, 0.000000000, "FMRADIO" renamed, loaded from SD: FMRADIO again. tinySA Ultra only. --- ui.c | 3 +-- vna_browser.c | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ui.c b/ui.c index 7912c1f..41b2fea 100644 --- a/ui.c +++ b/ui.c @@ -8449,8 +8449,7 @@ static void sa_save_file(uint8_t format) { char *buf = (char *)spi_buffer; buf += plot_printf(buf, 100, "%U, ", setting.bands[i].start); buf += plot_printf(buf, 100, "%U, ", setting.bands[i].end); - buf += plot_printf(buf, 100, "%f ", setting.bands[i].level); - buf += plot_printf(buf, 100, "\r\n"); + buf += plot_printf(buf, 100, "%f, \"%s\"\r\n", setting.bands[i].level, setting.bands[i].name); // name: older firmware ignores it res = f_write(fs_file, (char *)spi_buffer, buf - (char *)spi_buffer, &size); } } diff --git a/vna_browser.c b/vna_browser.c index 4d40e44..f991d1d 100644 --- a/vna_browser.c +++ b/vna_browser.c @@ -177,11 +177,13 @@ finish2: line[j] = 0; j = 0; char *args[16]; int nargs = parse_line(line, args, 16); // Parse line to 16 args - if (nargs < 2 || args[0][0] == '#' || args[0][0] == '!') continue; // No data or comment or settings + if (nargs < 3 || args[0][0] == '#' || args[0][0] == '!') continue; // No data or comment or settings if (count >= BANDS_MAX) {error = "Format err"; goto finish3;} setting.bands[count].start = my_atoui(args[0]);// Get frequency setting.bands[count].end = my_atoui(args[1]);// Get frequency setting.bands[count].level = my_atof(args[2]); // Get frequency + if (nargs > 3) // Name, files of older firmware have none + plot_printf(setting.bands[count].name, BAND_NAME_SIZE, "%s", args[3]); setting.bands[count].enabled = true; // Get frequency count++; }