Commit 98521ef1 authored by Miguel Jimenez Lopez's avatar Miguel Jimenez Lopez Committed by Grzegorz Daniluk

cmd_refresh: A new CLI command added to change update time period of gui and stat statistics

	- Add new command "refresh" to change update period of gui and stat
	- Delete "stat cont" command
	- Update "stat" command to work as older "stat cont" one
	- Update the wrc_main.c file to check if the log messages must be generated one time

Note: If you set period to 0, the log messages are only generated one time.
parent 8accf456
......@@ -23,7 +23,7 @@
#include "lib/ipv4.h"
#define UI_REFRESH_PERIOD TICS_PER_SECOND /* 1 sec */
int UI_REFRESH_PERIOD = TICS_PER_SECOND; /* 1 sec */
#define PRINT64_FACTOR 1000000000
char* print64(unsigned long long x)
......
......@@ -23,7 +23,7 @@
#include "hal_exports.h"
#include "lib/ipv4.h"
#define UI_REFRESH_PERIOD TICS_PER_SECOND /* 1 sec */
int UI_REFRESH_PERIOD = TICS_PER_SECOND; /* 1 sec */
struct ptpdexp_sync_state_t;
extern ptpdexp_sync_state_t cur_servo_state;
......
/*
* This work is part of the White Rabbit project
*
* Copyright (C) 2014 UGR (www.ugr.es)
* Author: Miguel Jimenez Lopez <klyone@ugr.es>
*
* Released according to the GNU GPL, version 2 or any later version.
*/
/* Command: refresh
Arguments: seconds: Time interval to update gui/stat statistics (>= 0)
Description: Configures time interval to update gui/stat statistics by monitor. */
#include "shell.h"
#include "wrc_ptp.h"
#include <syscon.h>
extern int UI_REFRESH_PERIOD;
static int cmd_refresh(const char *args[])
{
int sec;
if (args[0] && !args[1]) {
fromdec(args[0], &sec);
}
else {
mprintf("Usage: refresh <seconds>\n");
return 0;
}
UI_REFRESH_PERIOD = sec*TICS_PER_SECOND;
mprintf("\n");
}
DEFINE_WRC_COMMAND(refresh) = {
.name = "refresh",
.exec = cmd_refresh,
};
......@@ -5,12 +5,10 @@
static int cmd_stat(const char *args[])
{
if (!strcasecmp(args[0], "cont")) {
wrc_ui_mode = UI_STAT_MODE;
} else if (!strcasecmp(args[0], "bts"))
if (!strcasecmp(args[0], "bts"))
mprintf("%d ps\n", ep_get_bitslide());
else
wrc_log_stats(1);
wrc_ui_mode = UI_STAT_MODE;
return 0;
}
......
......@@ -13,7 +13,8 @@ obj-y += \
shell/cmd_mac.o \
shell/cmd_init.o \
shell/cmd_ptrack.o \
shell/cmd_help.o
shell/cmd_help.o \
shell/cmd_refresh.o
obj-$(CONFIG_ETHERBONE) += shell/cmd_ip.o
obj-$(CONFIG_PPSI) += shell/cmd_verbose.o
......
......@@ -34,6 +34,8 @@
int wrc_ui_mode = UI_SHELL_MODE;
int wrc_phase_tracking = 1;
extern int UI_REFRESH_PERIOD;
///////////////////////////////////
//Calibration data (from EEPROM if available)
int32_t sfp_alpha = 73622176; //default values if could not read EEPROM
......@@ -142,13 +144,13 @@ static void ui_update()
if (wrc_ui_mode == UI_GUI_MODE) {
wrc_mon_gui();
if (uart_read_byte() == 27) {
if (uart_read_byte() == 27 || UI_REFRESH_PERIOD == 0) {
shell_init();
wrc_ui_mode = UI_SHELL_MODE;
}
} else if (wrc_ui_mode == UI_STAT_MODE) {
wrc_log_stats(0);
if (uart_read_byte() == 27) {
if (uart_read_byte() == 27 || UI_REFRESH_PERIOD == 0) {
shell_init();
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