Commit aa95124d authored by Alessandro Rubini's avatar Alessandro Rubini

gui: print a new status screen whenever the wr servo runs

The gui is timely: it refreshes every that many seconds, but I'd
better see a change immediated when it happens.  This commit
introduces monitoring of the wr-servo update count, so if anything
changed an information scree is dumped.

This is different from stats (two commits ago), because we want to
refresh timely in any case, so the user sees the thing is active.

You can verify the effect of the commit after "refresh 4": timely
refresh is now slower than servo updated and you'll see how gui
updates are synced with the ptp protocol.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 684fa5cd
......@@ -74,7 +74,8 @@ static int wrc_mon_status(void)
void wrc_mon_gui(void)
{
static uint32_t last;
static uint32_t last_jiffies;
static uint32_t last_servo_count;
struct hal_port_state state;
int tx, rx;
int aux_stat;
......@@ -87,12 +88,14 @@ void wrc_mon_gui(void)
&((struct wr_data *)ppi->ext_data)->servo_state;
int64_t crtt;
int64_t total_asymmetry;
if (!last)
last = timer_get_tics() - 1 - wrc_ui_refperiod;
if (time_before(timer_get_tics(), last + wrc_ui_refperiod))
return;
last = timer_get_tics();
if (!last_jiffies)
last_jiffies = timer_get_tics() - 1 - wrc_ui_refperiod;
if (time_before(timer_get_tics(), last_jiffies + wrc_ui_refperiod)
&& last_servo_count == s->update_count)
return;
last_jiffies = timer_get_tics();
last_servo_count = s->update_count;
term_clear();
......
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