From 9a1e3208f8714e2c9c5fa204920a12b62a77c369 Mon Sep 17 00:00:00 2001 From: armink Date: Sat, 15 Sep 2018 14:46:57 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E8=87=B3=202.0.2=EF=BC=9B=20=E3=80=90?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E3=80=91demo=20=E4=B8=AD=20setenv=20?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E6=97=A0=E6=B3=95=E5=88=A0=E9=99=A4=20env=20?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: armink --- .../rtt/components/easyflash/port/ef_port.c | 17 ++++++++--------- .../components/easyflash/port/ef_port.c | 17 ++++++++--------- easyflash/inc/easyflash.h | 4 ++-- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/demo/env/stm32f10x/rtt/components/easyflash/port/ef_port.c b/demo/env/stm32f10x/rtt/components/easyflash/port/ef_port.c index f0e0007..0729666 100644 --- a/demo/env/stm32f10x/rtt/components/easyflash/port/ef_port.c +++ b/demo/env/stm32f10x/rtt/components/easyflash/port/ef_port.c @@ -237,10 +237,9 @@ void ef_print(const char *format, ...) { #if defined(RT_USING_FINSH) && defined(FINSH_USING_MSH) #include #if defined(EF_USING_ENV) -void setenv(uint8_t argc, char **argv) { +static void setenv(uint8_t argc, char **argv) { uint8_t i; - char c_value = NULL; - char *value = &c_value; + if (argc > 3) { /* environment variable value string together */ for (i = 0; i < argc - 2; i++) { @@ -248,26 +247,26 @@ void setenv(uint8_t argc, char **argv) { } } if (argc == 1) { - ef_set_env(value, value); + rt_kprintf("Please input: setenv [value]\n"); } else if (argc == 2) { - ef_set_env(argv[1], value); + ef_set_env(argv[1], NULL); } else { ef_set_env(argv[1], argv[2]); } } MSH_CMD_EXPORT(setenv, Set an envrionment variable.); -void printenv(uint8_t argc, char **argv) { +static void printenv(uint8_t argc, char **argv) { ef_print_env(); } MSH_CMD_EXPORT(printenv, Print all envrionment variables.); -void saveenv(uint8_t argc, char **argv) { +static void saveenv(uint8_t argc, char **argv) { ef_save_env(); } MSH_CMD_EXPORT(saveenv, Save all envrionment variables to flash.); -void getvalue(uint8_t argc, char **argv) { +static void getvalue(uint8_t argc, char **argv) { char *value = NULL; value = ef_get_env(argv[1]); if (value) { @@ -278,7 +277,7 @@ void getvalue(uint8_t argc, char **argv) { } MSH_CMD_EXPORT(getvalue, Get an envrionment variable by name.); -void resetenv(uint8_t argc, char **argv) { +static void resetenv(uint8_t argc, char **argv) { ef_env_set_default(); } MSH_CMD_EXPORT(resetenv, Reset all envrionment variable to default.); diff --git a/demo/env/stm32f4xx/components/easyflash/port/ef_port.c b/demo/env/stm32f4xx/components/easyflash/port/ef_port.c index 7eed62a..eb67890 100644 --- a/demo/env/stm32f4xx/components/easyflash/port/ef_port.c +++ b/demo/env/stm32f4xx/components/easyflash/port/ef_port.c @@ -368,10 +368,9 @@ void ef_print(const char *format, ...) { #if defined(RT_USING_FINSH) && defined(FINSH_USING_MSH) #include #if defined(EF_USING_ENV) -void setenv(uint8_t argc, char **argv) { +static void setenv(uint8_t argc, char **argv) { uint8_t i; - char c_value = NULL; - char *value = &c_value; + if (argc > 3) { /* environment variable value string together */ for (i = 0; i < argc - 2; i++) { @@ -379,26 +378,26 @@ void setenv(uint8_t argc, char **argv) { } } if (argc == 1) { - ef_set_env(value, value); + rt_kprintf("Please input: setenv [value]\n"); } else if (argc == 2) { - ef_set_env(argv[1], value); + ef_set_env(argv[1], NULL); } else { ef_set_env(argv[1], argv[2]); } } MSH_CMD_EXPORT(setenv, Set an envrionment variable.); -void printenv(uint8_t argc, char **argv) { +static void printenv(uint8_t argc, char **argv) { ef_print_env(); } MSH_CMD_EXPORT(printenv, Print all envrionment variables.); -void saveenv(uint8_t argc, char **argv) { +static void saveenv(uint8_t argc, char **argv) { ef_save_env(); } MSH_CMD_EXPORT(saveenv, Save all envrionment variables to flash.); -void getvalue(uint8_t argc, char **argv) { +static void getvalue(uint8_t argc, char **argv) { char *value = NULL; value = ef_get_env(argv[1]); if (value) { @@ -409,7 +408,7 @@ void getvalue(uint8_t argc, char **argv) { } MSH_CMD_EXPORT(getvalue, Get an envrionment variable by name.); -void resetenv(uint8_t argc, char **argv) { +static void resetenv(uint8_t argc, char **argv) { ef_env_set_default(); } MSH_CMD_EXPORT(resetenv, Reset all envrionment variable to default.); diff --git a/easyflash/inc/easyflash.h b/easyflash/inc/easyflash.h index 641875d..8bb3115 100644 --- a/easyflash/inc/easyflash.h +++ b/easyflash/inc/easyflash.h @@ -76,8 +76,8 @@ if (!(EXPR)) \ #endif /* EasyFlash software version number */ -#define EF_SW_VERSION "3.2.1" -#define EF_SW_VERSION_NUM 0x30201 +#define EF_SW_VERSION "3.2.2" +#define EF_SW_VERSION_NUM 0x30202 typedef struct _ef_env { char *key;