Commit a5b2ac85 authored by Alessandro Rubini's avatar Alessandro Rubini

servo: use new diagnostics

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent f613b296
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
void pp_init_clock(struct pp_instance *ppi) void pp_init_clock(struct pp_instance *ppi)
{ {
PP_PRINTF("SERVO init clock\n"); pp_diag(ppi, servo, 1, "Initializing\n");
/* clear vars */ /* clear vars */
clear_TimeInternal(&SRV(ppi)->m_to_s_dly); clear_TimeInternal(&SRV(ppi)->m_to_s_dly);
...@@ -21,6 +21,7 @@ void pp_init_clock(struct pp_instance *ppi) ...@@ -21,6 +21,7 @@ void pp_init_clock(struct pp_instance *ppi)
ppi->t_ops->adjust(ppi, 0, 0); ppi->t_ops->adjust(ppi, 0, 0);
} }
/* called by slave states */
void pp_update_delay(struct pp_instance *ppi, TimeInternal *correction_field) void pp_update_delay(struct pp_instance *ppi, TimeInternal *correction_field)
{ {
TimeInternal s_to_m_dly; TimeInternal s_to_m_dly;
...@@ -97,11 +98,12 @@ void pp_update_delay(struct pp_instance *ppi, TimeInternal *correction_field) ...@@ -97,11 +98,12 @@ void pp_update_delay(struct pp_instance *ppi, TimeInternal *correction_field)
owd_fltr->nsec_prev = DSCUR(ppi)->meanPathDelay.nanoseconds; owd_fltr->nsec_prev = DSCUR(ppi)->meanPathDelay.nanoseconds;
DSCUR(ppi)->meanPathDelay.nanoseconds = owd_fltr->y; DSCUR(ppi)->meanPathDelay.nanoseconds = owd_fltr->y;
PP_VPRINTF("delay filter %d, %d\n", pp_diag(ppi, servo, 1, "delay filter %d, %d\n",
owd_fltr->y, owd_fltr->s_exp); owd_fltr->y, owd_fltr->s_exp);
} }
} }
/* called by slave and uncalib. (through common function handle_sync/followup) */
void pp_update_offset(struct pp_instance *ppi, TimeInternal *send_time, void pp_update_offset(struct pp_instance *ppi, TimeInternal *send_time,
TimeInternal *recv_time, TimeInternal *correction_field) TimeInternal *recv_time, TimeInternal *correction_field)
{ {
...@@ -158,6 +160,7 @@ void pp_update_offset(struct pp_instance *ppi, TimeInternal *send_time, ...@@ -158,6 +160,7 @@ void pp_update_offset(struct pp_instance *ppi, TimeInternal *send_time,
OPTS(ppi)->ofst_first_updated = 1; OPTS(ppi)->ofst_first_updated = 1;
} }
/* called only *exactly* after calling pp_update_offset above */
void pp_update_clock(struct pp_instance *ppi) void pp_update_clock(struct pp_instance *ppi)
{ {
Integer32 adj; Integer32 adj;
...@@ -221,32 +224,24 @@ void pp_update_clock(struct pp_instance *ppi) ...@@ -221,32 +224,24 @@ void pp_update_clock(struct pp_instance *ppi)
dc++; dc++;
if (dc % 2 == 0) { /* Prints statistics every 8s */ if (dc % 2 == 0) { /* Prints statistics every 8s */
PP_PRINTF("ofst %d, raw ofst %d, mean-dly %d, adj %d\n", pp_diag(ppi, servo, 1,
DSCUR(ppi)->offsetFromMaster.nanoseconds, "ofst %d, raw ofst %d, mean-dly %d, adj %d\n",
SRV(ppi)->m_to_s_dly.nanoseconds, DSCUR(ppi)->offsetFromMaster.nanoseconds,
DSCUR(ppi)->meanPathDelay.nanoseconds, SRV(ppi)->m_to_s_dly.nanoseconds,
adj); DSCUR(ppi)->meanPathDelay.nanoseconds,
adj);
} }
} }
display: display:
if (__PP_DIAG_ALLOW_FLAGS(pp_global_flags, pp_dt_servo, 1)) { pp_diag(ppi, servo, 2, "Raw offset from master: %9i.%09i\n",
PP_VPRINTF("\n--Offset Correction--\n"); SRV(ppi)->m_to_s_dly.seconds,
PP_VPRINTF("Raw offset from master: %10ds %11dns\n", SRV(ppi)->m_to_s_dly.nanoseconds);
SRV(ppi)->m_to_s_dly.seconds, pp_diag(ppi, servo, 2, "One-way delay averaged: %9i.%09i\n",
SRV(ppi)->m_to_s_dly.nanoseconds); DSCUR(ppi)->meanPathDelay.seconds,
DSCUR(ppi)->meanPathDelay.nanoseconds);
PP_VPRINTF("\n--Offset and Delay filtered--\n"); pp_diag(ppi, servo, 2, "Offset from master: %9i.%09i\n",
DSCUR(ppi)->offsetFromMaster.seconds,
PP_VPRINTF("one-way delay averaged (E2E): %9i.%09i\n", DSCUR(ppi)->offsetFromMaster.nanoseconds);
DSCUR(ppi)->meanPathDelay.seconds, pp_diag(ppi, servo, 2, "Observed drift: %9i\n", SRV(ppi)->obs_drift);
DSCUR(ppi)->meanPathDelay.nanoseconds);
PP_VPRINTF("offset from master: %9i.%09i\n",
DSCUR(ppi)->offsetFromMaster.seconds,
DSCUR(ppi)->offsetFromMaster.nanoseconds);
PP_VPRINTF("observed drift: %10d\n",
SRV(ppi)->obs_drift);
}
} }
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