Commit 3f3c7ee7 authored by baujc's avatar baujc

Bug fix: Update offsetFromMaster and meanDelay in currentDS

offsetFromMaster and meanDelay are updated in currentDS only when a PPSi
instance is SLAVE.
parent c81db09e
......@@ -180,7 +180,8 @@ void update_meanDelay(struct pp_instance *ppi, TimeInterval meanDelay) {
if ( ppi->state != PPS_SLAVE )
return;
}
DSCUR(ppi)->meanDelay=meanDelay;
if (ppi->state == PPS_SLAVE )
DSCUR(ppi)->meanDelay=meanDelay;
}
......
......@@ -171,5 +171,6 @@ int __send_and_log(struct pp_instance *ppi, int msglen, int chtype,enum pp_msg_f
* This function can be redeclared if P2P mechanism is compiled
*/
void __attribute__((weak)) update_meanDelay(struct pp_instance *ppi, TimeInterval meanDelay) {
DSCUR(ppi)->meanDelay=meanDelay;
if (ppi->state == PPS_SLAVE )
DSCUR(ppi)->meanDelay=meanDelay;
}
......@@ -211,7 +211,8 @@ int pp_servo_calculate_delays(struct pp_instance *ppi) {
pp_time_sub(&servo->offsetFromMaster, &servo->t2);
pp_time_add(&servo->offsetFromMaster, &servo->delayMS); /* Add delayMS */
DSCUR(ppi)->offsetFromMaster = pp_time_to_interval(&servo->offsetFromMaster); /* Update currentDS.offsetFromMaster */
if ( ppi->state==PPS_SLAVE )
DSCUR(ppi)->offsetFromMaster = pp_time_to_interval(&servo->offsetFromMaster); /* Update currentDS.offsetFromMaster */
picos_to_pp_time(meanDelay_ps,&servo->meanDelay); /* update servo.meanDelay */
update_meanDelay(ppi,picos_to_interval(meanDelay_ps)); /* update currentDS.meanDelay and portDS.meanLinkDelay (if needed) */
......
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