From eb85400e0e0e576f6bbd303abf7dfcc7f49e8d9d Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Tue, 14 Jul 2020 12:08:52 +0200 Subject: [PATCH] Added deviceid command. Use saveconfig to store --- flash.c | 2 +- main.c | 1 + nanovna.h | 1 + sa_cmd.c | 13 +++++++++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/flash.c b/flash.c index 62dc281..9ab6519 100644 --- a/flash.c +++ b/flash.c @@ -95,7 +95,7 @@ config_save(void) /* erase flash pages */ flash_erase_page((uint32_t)dst); - /* write to flahs */ + /* write to flash */ while (count-- > 0) { flash_program_half_word((uint32_t)dst, *src++); dst++; diff --git a/main.c b/main.c index 16d6a54..9bacaea 100644 --- a/main.c +++ b/main.c @@ -2344,6 +2344,7 @@ static const VNAShellCommand commands[] = { "spur", cmd_spur, 0 }, { "load", cmd_load, 0 }, { "output", cmd_output, 0 }, + { "deviceid", cmd_deviceid, 0 }, { "selftest", cmd_selftest, 0 }, { "correction", cmd_correction, 0 }, #ifdef ENABLE_THREADS_COMMAND diff --git a/nanovna.h b/nanovna.h index 7b4a7f7..eda710d 100644 --- a/nanovna.h +++ b/nanovna.h @@ -428,6 +428,7 @@ typedef struct config { int16_t high_level_offset; uint32_t correction_frequency[CORRECTION_POINTS]; float correction_value[CORRECTION_POINTS]; + uint32_t deviceid; // uint8_t _reserved[22]; uint32_t checksum; } config_t; diff --git a/sa_cmd.c b/sa_cmd.c index 88b05ac..9e6498a 100644 --- a/sa_cmd.c +++ b/sa_cmd.c @@ -192,6 +192,19 @@ VNA_SHELL_FUNCTION(cmd_leveloffset) } } +VNA_SHELL_FUNCTION(cmd_deviceid) +{ + if (argc == 0) { + shell_printf("deviceid %d\r\n", config.deviceid); + return; + } else if (argc == 1) { + float v = my_atoui(argv[0]); + config.deviceid = v; + } else { + shell_printf("deviceid []\r\n"); + } +} + VNA_SHELL_FUNCTION(cmd_rbw) {