diff --git a/shell/shell.h b/include/shell.h similarity index 89% rename from shell/shell.h rename to include/shell.h index 47b468401714b4aa39e9fdca60d5d7afa21cf60f..30c48636e33fdad9d377ab6b8b049aa8be3d4726 100644 --- a/shell/shell.h +++ b/include/shell.h @@ -1,6 +1,12 @@ #ifndef __SHELL_H #define __SHELL_H +#define UI_SHELL_MODE 0 +#define UI_GUI_MODE 1 +#define UI_STAT_MODE 2 + +extern int wrc_ui_mode; + const char* fromhex(const char* hex, int* v); const char* fromdec(const char* dec, int* v); diff --git a/shell/cmd_gui.c b/shell/cmd_gui.c index c904971cda9e4922424262e39e769f99edf5f8ee..93afdcec001c433c4649fcb3d824bdf12c5cf3a6 100644 --- a/shell/cmd_gui.c +++ b/shell/cmd_gui.c @@ -5,10 +5,8 @@ #include "shell.h" -extern int wrc_gui_mode; - int cmd_gui(const char *args[]) { - wrc_gui_mode = 1; + wrc_ui_mode = UI_GUI_MODE; return 0; -} \ No newline at end of file +} diff --git a/wrc_main.c b/wrc_main.c index 4cf8fcce48595083305d4c9f21d175534b8f6087..d1b9c3d563f3b92362b7821f21f88f828c6d9f58 100644 --- a/wrc_main.c +++ b/wrc_main.c @@ -14,10 +14,13 @@ //#include "eeprom.h" #include "softpll_ng.h" #include "onewire.h" +#include "shell.h" #include "lib/ipv4.h" #include "wrc_ptp.h" +int wrc_ui_mode = 0; + /////////////////////////////////// //Calibration data (from EEPROM if available) #ifdef WRPC_MASTER @@ -99,13 +102,12 @@ int wrc_check_link() } int wrc_extra_debug = 0; -int wrc_gui_mode = 0; void wrc_debug_printf(int subsys, const char *fmt, ...) { va_list ap; - if(wrc_gui_mode) return; + if(wrc_ui_mode) return; va_start(ap, fmt); @@ -122,13 +124,13 @@ int wrc_man_phase = 0; static void ui_update() { - if(wrc_gui_mode) + if(wrc_ui_mode == UI_GUI_MODE) { wrc_mon_gui(); if(uart_read_byte() == 27) { shell_init(); - wrc_gui_mode = 0; + wrc_ui_mode = UI_SHELL_MODE; } } else @@ -139,7 +141,7 @@ static void ui_update() int main(void) { wrc_extra_debug = 1; - wrc_gui_mode = 0; + wrc_ui_mode = UI_SHELL_MODE; wrc_initialize(); shell_init();