Improved DC sync at startup: Abort iterating though slaves and first correct
system time offsets, then begin configuring at slave 0.
This commit is contained in:
parent
2b8cee1651
commit
a877b8583c
|
|
@ -37,6 +37,7 @@ digraph master {
|
||||||
action_configure [shape=point,label=""]
|
action_configure [shape=point,label=""]
|
||||||
action_configure -> configure_slave [weight=10]
|
action_configure -> configure_slave [weight=10]
|
||||||
action_configure -> action_next_slave_state
|
action_configure -> action_next_slave_state
|
||||||
|
action_configure -> write_system_times
|
||||||
|
|
||||||
read_state -> acknowledge [weight=10]
|
read_state -> acknowledge [weight=10]
|
||||||
read_state -> action_configure
|
read_state -> action_configure
|
||||||
|
|
|
||||||
|
|
@ -566,6 +566,17 @@ void ec_fsm_master_action_configure(
|
||||||
ec_master_t *master = fsm->master;
|
ec_master_t *master = fsm->master;
|
||||||
ec_slave_t *slave = fsm->slave;
|
ec_slave_t *slave = fsm->slave;
|
||||||
|
|
||||||
|
if (master->config_changed) {
|
||||||
|
// abort iterating through slaves,
|
||||||
|
// first compensate DC system time offsets,
|
||||||
|
// then begin configuring at slave 0
|
||||||
|
EC_MASTER_DBG(master, 1, "Configuration changed"
|
||||||
|
" (aborting state check).\n");
|
||||||
|
|
||||||
|
fsm->slave = master->slaves; // begin with first slave
|
||||||
|
ec_fsm_master_enter_write_system_times(fsm);
|
||||||
|
}
|
||||||
|
|
||||||
// Does the slave have to be configured?
|
// Does the slave have to be configured?
|
||||||
if ((slave->current_state != slave->requested_state
|
if ((slave->current_state != slave->requested_state
|
||||||
|| slave->force_config) && !slave->error_flag) {
|
|| slave->force_config) && !slave->error_flag) {
|
||||||
|
|
@ -857,6 +868,7 @@ void ec_fsm_master_enter_write_system_times(
|
||||||
EC_MASTER_DBG(master, 1, "Writing system time offsets...\n");
|
EC_MASTER_DBG(master, 1, "Writing system time offsets...\n");
|
||||||
|
|
||||||
if (master->has_app_time) {
|
if (master->has_app_time) {
|
||||||
|
|
||||||
while (fsm->slave < master->slaves + master->slave_count) {
|
while (fsm->slave < master->slaves + master->slave_count) {
|
||||||
if (!fsm->slave->base_dc_supported
|
if (!fsm->slave->base_dc_supported
|
||||||
|| !fsm->slave->has_dc_system_time) {
|
|| !fsm->slave->has_dc_system_time) {
|
||||||
|
|
@ -873,8 +885,14 @@ void ec_fsm_master_enter_write_system_times(
|
||||||
fsm->state = ec_fsm_master_state_dc_read_offset;
|
fsm->state = ec_fsm_master_state_dc_read_offset;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
EC_MASTER_DBG(master, 1, "No app_time received up to now.\n");
|
if (master->active) {
|
||||||
|
EC_MASTER_ERR(master, "No app_time received up to now,"
|
||||||
|
" but master already active).\n");
|
||||||
|
} else {
|
||||||
|
EC_MASTER_DBG(master, 1, "No app_time received up to now.\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ec_master_request_op(master);
|
ec_master_request_op(master);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue