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
86a89061
Commit
86a89061
authored
18 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Output state names instead of codes in change FSM.
parent
c1886f5f
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
+21
-12
21 additions, 12 deletions
master/fsm_change.c
with
21 additions
and
12 deletions
master/fsm_change.c
+
21
−
12
View file @
86a89061
...
...
@@ -167,10 +167,11 @@ void ec_fsm_change_check(ec_fsm_change_t *fsm /**< finite state machine */)
if
(
datagram
->
working_counter
!=
1
)
{
if
(
datagram
->
jiffies_received
-
fsm
->
jiffies_start
>=
3
*
HZ
)
{
char
state_str
[
EC_STATE_STRING_SIZE
];
ec_state_string
(
fsm
->
requested_state
,
state_str
);
fsm
->
state
=
ec_fsm_change_error
;
EC_ERR
(
"Failed to set state 0x%02X on slave %i: Slave did not"
" respond.
\n
"
,
fsm
->
requested_state
,
fsm
->
slave
->
ring_position
);
EC_ERR
(
"Failed to set state %s on slave %i: Slave did not"
" respond.
\n
"
,
state_str
,
fsm
->
slave
->
ring_position
);
return
;
}
...
...
@@ -223,9 +224,11 @@ void ec_fsm_change_status(ec_fsm_change_t *fsm /**< finite state machine */)
if
(
slave
->
current_state
&
EC_SLAVE_STATE_ACK_ERR
)
{
// state change error
EC_ERR
(
"Failed to set state 0x%02X - Slave %i refused state change"
" (code 0x%02X)!
\n
"
,
fsm
->
requested_state
,
slave
->
ring_position
,
slave
->
current_state
);
char
req_state
[
EC_STATE_STRING_SIZE
],
cur_state
[
EC_STATE_STRING_SIZE
];
ec_state_string
(
fsm
->
requested_state
,
req_state
);
ec_state_string
(
slave
->
current_state
,
cur_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
);
...
...
@@ -236,9 +239,11 @@ void ec_fsm_change_status(ec_fsm_change_t *fsm /**< finite state machine */)
if
(
datagram
->
jiffies_received
-
fsm
->
jiffies_start
>=
100
*
HZ
/
1000
)
{
// 100ms
// timeout while checking
char
state_str
[
EC_STATE_STRING_SIZE
];
ec_state_string
(
fsm
->
requested_state
,
state_str
);
fsm
->
state
=
ec_fsm_change_error
;
EC_ERR
(
"Timeout while setting state
0x%02X
on slave %i.
\n
"
,
fsm
->
reques
te
d
_st
ate
,
slave
->
ring_position
);
EC_ERR
(
"Timeout while setting state
%s
on slave %i.
\n
"
,
sta
te_st
r
,
slave
->
ring_position
);
return
;
}
...
...
@@ -376,19 +381,23 @@ void ec_fsm_change_check_ack(ec_fsm_change_t *fsm /**< finite state machine */)
slave
->
current_state
=
EC_READ_U8
(
datagram
->
data
);
if
(
!
(
slave
->
current_state
&
EC_SLAVE_STATE_ACK_ERR
))
{
char
state_str
[
EC_STATE_STRING_SIZE
];
ec_state_string
(
slave
->
current_state
,
state_str
);
fsm
->
state
=
ec_fsm_change_error
;
EC_INFO
(
"Acknowledged state
0x%02X
on slave %i.
\n
"
,
s
lave
->
current_s
tate
,
slave
->
ring_position
);
EC_INFO
(
"Acknowledged state
%s
on slave %i.
\n
"
,
state
_str
,
slave
->
ring_position
);
return
;
}
if
(
datagram
->
jiffies_received
-
fsm
->
jiffies_start
>=
100
*
HZ
/
1000
)
{
// 100ms
char
state_str
[
EC_STATE_STRING_SIZE
];
ec_state_string
(
fsm
->
requested_state
,
state_str
);
// timeout while checking
slave
->
current_state
=
EC_SLAVE_STATE_UNKNOWN
;
fsm
->
state
=
ec_fsm_change_error
;
EC_ERR
(
"Timeout while acknowledging state
0x%02X
on slave %i.
\n
"
,
fsm
->
reques
te
d
_st
ate
,
slave
->
ring_position
);
EC_ERR
(
"Timeout while acknowledging state
%s
on slave %i.
\n
"
,
sta
te_st
r
,
slave
->
ring_position
);
return
;
}
...
...
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