Commit 9f3bcfa0 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

declare global variable for refresh command and monitors in wrc_main where also UI mode is stored

parent a41d4f11
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "lib/ipv4.h" #include "lib/ipv4.h"
int UI_REFRESH_PERIOD = TICS_PER_SECOND; /* 1 sec */ extern int wrc_ui_refperiod;
#define PRINT64_FACTOR 1000000000 #define PRINT64_FACTOR 1000000000
char* print64(unsigned long long x) char* print64(unsigned long long x)
...@@ -55,7 +55,7 @@ void wrc_mon_gui(void) ...@@ -55,7 +55,7 @@ void wrc_mon_gui(void)
uint8_t ip[4]; uint8_t ip[4];
#endif #endif
if (timer_get_tics() - last < UI_REFRESH_PERIOD) if (timer_get_tics() - last < wrc_ui_refperiod)
return; return;
last = timer_get_tics(); last = timer_get_tics();
...@@ -200,7 +200,7 @@ int wrc_log_stats(uint8_t onetime) ...@@ -200,7 +200,7 @@ int wrc_log_stats(uint8_t onetime)
uint64_t sec; uint64_t sec;
uint32_t nsec; uint32_t nsec;
if (!onetime && timer_get_tics() - last < UI_REFRESH_PERIOD) if (!onetime && timer_get_tics() - last < wrc_ui_refperiod)
return 0; return 0;
last = timer_get_tics(); last = timer_get_tics();
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "hal_exports.h" #include "hal_exports.h"
#include "lib/ipv4.h" #include "lib/ipv4.h"
int UI_REFRESH_PERIOD = TICS_PER_SECOND; /* 1 sec */ extern int wrc_ui_refperiod;
struct ptpdexp_sync_state_t; struct ptpdexp_sync_state_t;
extern ptpdexp_sync_state_t cur_servo_state; extern ptpdexp_sync_state_t cur_servo_state;
...@@ -86,7 +86,7 @@ void wrc_mon_gui(void) ...@@ -86,7 +86,7 @@ void wrc_mon_gui(void)
uint8_t ip[4]; uint8_t ip[4];
#endif #endif
if (timer_get_tics() - last < UI_REFRESH_PERIOD) if (timer_get_tics() - last < wrc_ui_refperiod)
return; return;
last = timer_get_tics(); last = timer_get_tics();
...@@ -265,7 +265,7 @@ int wrc_log_stats(uint8_t onetime) ...@@ -265,7 +265,7 @@ int wrc_log_stats(uint8_t onetime)
uint64_t sec; uint64_t sec;
uint32_t nsec; uint32_t nsec;
if (!onetime && timer_get_tics() - last < UI_REFRESH_PERIOD) if (!onetime && timer_get_tics() - last < wrc_ui_refperiod)
return 0; return 0;
last = timer_get_tics(); last = timer_get_tics();
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "wrc_ptp.h" #include "wrc_ptp.h"
#include <syscon.h> #include <syscon.h>
extern int UI_REFRESH_PERIOD; extern int wrc_ui_refperiod;
static int cmd_refresh(const char *args[]) static int cmd_refresh(const char *args[])
{ {
...@@ -29,7 +29,7 @@ static int cmd_refresh(const char *args[]) ...@@ -29,7 +29,7 @@ static int cmd_refresh(const char *args[])
return 0; return 0;
} }
UI_REFRESH_PERIOD = sec*TICS_PER_SECOND; wrc_ui_refperiod = sec*TICS_PER_SECOND;
mprintf("\n"); mprintf("\n");
} }
......
...@@ -32,10 +32,9 @@ ...@@ -32,10 +32,9 @@
#include "wrc_ptp.h" #include "wrc_ptp.h"
int wrc_ui_mode = UI_SHELL_MODE; int wrc_ui_mode = UI_SHELL_MODE;
int wrc_ui_refperiod = TICS_PER_SECOND; /* 1 sec */
int wrc_phase_tracking = 1; int wrc_phase_tracking = 1;
extern int UI_REFRESH_PERIOD;
/////////////////////////////////// ///////////////////////////////////
//Calibration data (from EEPROM if available) //Calibration data (from EEPROM if available)
int32_t sfp_alpha = 73622176; //default values if could not read EEPROM int32_t sfp_alpha = 73622176; //default values if could not read EEPROM
...@@ -144,13 +143,13 @@ static void ui_update() ...@@ -144,13 +143,13 @@ static void ui_update()
if (wrc_ui_mode == UI_GUI_MODE) { if (wrc_ui_mode == UI_GUI_MODE) {
wrc_mon_gui(); wrc_mon_gui();
if (uart_read_byte() == 27 || UI_REFRESH_PERIOD == 0) { if (uart_read_byte() == 27 || wrc_ui_refperiod == 0) {
shell_init(); shell_init();
wrc_ui_mode = UI_SHELL_MODE; wrc_ui_mode = UI_SHELL_MODE;
} }
} else if (wrc_ui_mode == UI_STAT_MODE) { } else if (wrc_ui_mode == UI_STAT_MODE) {
wrc_log_stats(0); wrc_log_stats(0);
if (uart_read_byte() == 27 || UI_REFRESH_PERIOD == 0) { if (uart_read_byte() == 27 || wrc_ui_refperiod == 0) {
shell_init(); shell_init();
wrc_ui_mode = UI_SHELL_MODE; wrc_ui_mode = UI_SHELL_MODE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment