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.
copilot/add-multi-platform-rf-scan-exports
erikkaashoek 2 weeks ago
parent c051d52ad8
commit 5a4ccbd910

@ -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);
}
}

@ -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++;
}

Loading…
Cancel
Save

Powered by TurnKey Linux.