You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2019/12/18 12:03:46 UTC

[mynewt-core] branch master updated: sys/reboot; fix issue where 'config dump' was not showing reboot counter value.

This is an automated email from the ASF dual-hosted git repository.

marko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b60f5d  sys/reboot; fix issue where 'config dump' was not showing reboot counter value.
4b60f5d is described below

commit 4b60f5d2f99eeaaaf15af07c6d6a23f82a244974
Author: Marko Kiiskila <ma...@apache.org>
AuthorDate: Tue Dec 17 16:34:01 2019 +0200

    sys/reboot; fix issue where 'config dump' was not showing reboot
    counter value.
---
 sys/reboot/src/log_reboot.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/sys/reboot/src/log_reboot.c b/sys/reboot/src/log_reboot.c
index 31d8d19..0f4e42d 100644
--- a/sys/reboot/src/log_reboot.c
+++ b/sys/reboot/src/log_reboot.c
@@ -33,8 +33,6 @@
 #include "tinycbor/cbor_buf_writer.h"
 
 uint16_t reboot_cnt;
-static char reboot_cnt_str[12];
-static char log_reboot_written_str[12];
 static int8_t log_reboot_written;
 
 static char *reboot_conf_get(int argc, char **argv, char *buf, int max_len);
@@ -346,12 +344,10 @@ reboot_conf_get(int argc, char **argv, char *buf, int max_len)
 {
     if (argc == 1) {
         if (!strcmp(argv[0], "reboot_cnt")) {
-            return conf_str_from_value(CONF_INT16, &reboot_cnt,
-                                       reboot_cnt_str, sizeof reboot_cnt_str);
+            return conf_str_from_value(CONF_INT16, &reboot_cnt, buf, max_len);
         } else if (!strcmp(argv[0], "written")) {
             return conf_str_from_value(CONF_BOOL, &log_reboot_written,
-                                       log_reboot_written_str,
-                                       sizeof log_reboot_written_str);
+                                       buf, max_len);
         }
     }
     return NULL;
@@ -375,9 +371,14 @@ static int
 reboot_conf_export(void (*func)(char *name, char *val),
                    enum conf_export_tgt tgt)
 {
+    char str[12];
+
     if (tgt == CONF_EXPORT_SHOW) {
-        func("reboot/reboot_cnt", reboot_cnt_str);
-        func("reboot/written", log_reboot_written_str);
+        func("reboot/reboot_cnt",
+             conf_str_from_value(CONF_INT16, &reboot_cnt, str, sizeof str));
+        func("reboot/written",
+             conf_str_from_value(CONF_BOOL, &log_reboot_written, str,
+                                 sizeof str));
     }
     return 0;
 }