michallenc commented on code in PR #3068:
URL: https://github.com/apache/nuttx-apps/pull/3068#discussion_r2106272165


##########
boot/nxboot/nxboot_main.c:
##########
@@ -28,28 +28,233 @@
 
 #include <stdio.h>
 #include <syslog.h>
+#include <nuttx/ascii.h>
+#include <sys/param.h>
 
 #include <nxboot.h>
 #include <sys/boardctl.h>
 
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+typedef struct progress_msgs_s
+{
+  enum progress_msg_e idx; /* Index to the message */
+  const char         *msg; /* Corresponsing text message */
+} progress_msgs_t;
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+bool progress_dots_started = false;

Review Comment:
   This can be static?



##########
boot/nxboot/nxboot_main.c:
##########
@@ -28,28 +28,233 @@
 
 #include <stdio.h>
 #include <syslog.h>
+#include <nuttx/ascii.h>
+#include <sys/param.h>
 
 #include <nxboot.h>
 #include <sys/boardctl.h>
 
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+typedef struct progress_msgs_s
+{
+  enum progress_msg_e idx; /* Index to the message */
+  const char         *msg; /* Corresponsing text message */
+} progress_msgs_t;
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+bool progress_dots_started = false;
+#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS_PERCENT
+bool progress_percent_started = false;
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS
+
+#  ifdef CONFIG_NXBOOT_PRINTF_PROGRESS_PERCENT  
+static const char backtab[] =
+{
+  ASCII_BS, ASCII_BS, ASCII_BS, ASCII_BS, '\0',
+};
+#  endif
+
+static const progress_msgs_t progress_msgs[] =

Review Comment:
   I would do 
   
   ```
   static const char *progress_msgs[] = {
       [startup_msg] = "*** nxboot ***",
       [power_reset] = "Power Reset detected, check images only",
      ...
   }
   ```
   
   This way it will basically be a lookup table and we can drop `get_msg` call 
and access it directly (and `struct progress_msgs_s` should not be needed 
either).
   



##########
boot/nxboot/nxboot_main.c:
##########
@@ -28,28 +28,233 @@
 
 #include <stdio.h>
 #include <syslog.h>
+#include <nuttx/ascii.h>
+#include <sys/param.h>
 
 #include <nxboot.h>
 #include <sys/boardctl.h>
 
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+typedef struct progress_msgs_s
+{
+  enum progress_msg_e idx; /* Index to the message */
+  const char         *msg; /* Corresponsing text message */
+} progress_msgs_t;
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+bool progress_dots_started = false;
+#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS_PERCENT
+bool progress_percent_started = false;

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to