Commit e7c84b82 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

shell: add \stat cont\ command to enter debugging mode and print statistics every second

parent 2148903b
...@@ -114,7 +114,7 @@ int wrc_mon_gui(void) ...@@ -114,7 +114,7 @@ int wrc_mon_gui(void)
return 0; return 0;
} }
int wrc_log_stats(void) int wrc_log_stats(uint8_t onetime)
{ {
static char* slave_states[] = {"Uninitialized", "SYNC_SEC", "SYNC_NSEC", "SYNC_PHASE", "TRACK_PHASE"}; static char* slave_states[] = {"Uninitialized", "SYNC_SEC", "SYNC_NSEC", "SYNC_PHASE", "TRACK_PHASE"};
static uint32_t last = 0; static uint32_t last = 0;
...@@ -126,6 +126,11 @@ int wrc_log_stats(void) ...@@ -126,6 +126,11 @@ int wrc_log_stats(void)
int16_t brd_temp = 0; int16_t brd_temp = 0;
int16_t brd_temp_frac = 0; int16_t brd_temp_frac = 0;
if(!onetime && timer_get_tics() - last < UI_REFRESH_PERIOD)
return 0;
last = timer_get_tics();
pps_gen_get_time(&sec, &nsec); pps_gen_get_time(&sec, &nsec);
halexp_get_port_state(&ps, NULL); halexp_get_port_state(&ps, NULL);
minic_get_stats(&tx, &rx); minic_get_stats(&tx, &rx);
......
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
int cmd_stat(const char *args[]) int cmd_stat(const char *args[])
{ {
wrc_log_stats(); if(!strcasecmp(args[0], "cont") )
{
wrc_ui_mode = UI_STAT_MODE;
}
else
wrc_log_stats(1);
return 0; return 0;
} }
\ No newline at end of file
...@@ -133,6 +133,15 @@ static void ui_update() ...@@ -133,6 +133,15 @@ static void ui_update()
wrc_ui_mode = UI_SHELL_MODE; wrc_ui_mode = UI_SHELL_MODE;
} }
} }
else if(wrc_ui_mode == UI_STAT_MODE)
{
wrc_log_stats(0);
if(uart_read_byte() == 27)
{
shell_init();
wrc_ui_mode = UI_SHELL_MODE;
}
}
else else
shell_interactive(); shell_interactive();
......
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