Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
etherlabmaster
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ICS Control System Infrastructure
etherlabmaster
Commits
ef514219
Commit
ef514219
authored
18 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Fixed state change FSM again.
parent
7d6bdb63
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
master/fsm_change.c
+25
-19
25 additions, 19 deletions
master/fsm_change.c
with
25 additions
and
19 deletions
master/fsm_change.c
+
25
−
19
View file @
ef514219
...
...
@@ -225,9 +225,11 @@ void ec_fsm_change_state_status(ec_fsm_change_t *fsm
if
(
datagram
->
state
!=
EC_DATAGRAM_RECEIVED
||
datagram
->
working_counter
!=
1
)
{
char
req_state
[
EC_STATE_STRING_SIZE
];
ec_state_string
(
fsm
->
requested_state
,
req_state
);
fsm
->
state
=
ec_fsm_change_state_error
;
EC_ERR
(
"Failed to check state
0x%02X
on slave %i.
\n
"
,
fsm
->
requested
_state
,
slave
->
ring_position
);
EC_ERR
(
"Failed to check state
%s
on slave %i.
\n
"
,
req
_state
,
slave
->
ring_position
);
return
;
}
...
...
@@ -247,26 +249,29 @@ void ec_fsm_change_state_status(ec_fsm_change_t *fsm
if
(
slave
->
current_state
!=
fsm
->
old_state
)
{
// state changed
char
req_state
[
EC_STATE_STRING_SIZE
],
cur_state
[
EC_STATE_STRING_SIZE
];
slave
->
error_flag
=
1
;
ec_state_string
(
fsm
->
requested_state
,
req_state
);
ec_state_string
(
slave
->
current_state
,
cur_state
);
if
(
slave
->
current_state
&
EC_SLAVE_STATE_ACK_ERR
)
{
// state change error
EC_ERR
(
"Failed to set %s state,"
" slave %i refused state change (%s).
\n
"
,
req_state
,
slave
->
ring_position
,
cur_state
);
// fetch AL status error code
ec_datagram_nprd
(
datagram
,
slave
->
station_address
,
0x0134
,
2
);
ec_master_queue_datagram
(
fsm
->
slave
->
master
,
datagram
);
fsm
->
state
=
ec_fsm_change_state_code
;
return
;
if
((
slave
->
current_state
&
0x0F
)
!=
(
fsm
->
old_state
&
0x0F
))
{
// Slave spontaneously changed its state just before the new state
// was written. Accept current state as old state and wait for
// state change
fsm
->
old_state
=
slave
->
current_state
;
EC_WARN
(
"Slave %i changed to %s in the meantime.
\n
"
,
slave
->
ring_position
,
cur_state
);
goto
again
;
}
// state change to unrequested state
EC_ERR
(
"Slave %i changed to unrequested state %s!
\n
"
,
slave
->
ring_position
,
cur_state
);
fsm
->
state
=
ec_fsm_change_state_error
;
// state change error
slave
->
error_flag
=
1
;
ec_state_string
(
fsm
->
requested_state
,
req_state
);
EC_ERR
(
"Failed to set %s state, slave %i refused state change (%s).
\n
"
,
req_state
,
slave
->
ring_position
,
cur_state
);
// fetch AL status error code
ec_datagram_nprd
(
datagram
,
slave
->
station_address
,
0x0134
,
2
);
ec_master_queue_datagram
(
fsm
->
slave
->
master
,
datagram
);
fsm
->
state
=
ec_fsm_change_state_code
;
return
;
}
...
...
@@ -282,7 +287,8 @@ void ec_fsm_change_state_status(ec_fsm_change_t *fsm
return
;
}
// check again
again:
// no timeout yet. check again
ec_datagram_nprd
(
datagram
,
slave
->
station_address
,
0x0130
,
2
);
ec_master_queue_datagram
(
fsm
->
slave
->
master
,
datagram
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment