Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
fc46b03c
Commit
fc46b03c
authored
Nov 16, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default values for slave extuserprmdata was not set
parent
b634e4ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
8 deletions
+32
-8
profibus/lib/rt/src/rt_pb_gsd.cpp
profibus/lib/rt/src/rt_pb_gsd.cpp
+30
-7
profibus/lib/rt/src/rt_pb_gsd.h
profibus/lib/rt/src/rt_pb_gsd.h
+2
-1
No files found.
profibus/lib/rt/src/rt_pb_gsd.cpp
View file @
fc46b03c
/*
* Proview $Id: rt_pb_gsd.cpp,v 1.1
0 2007-11-15 17:28:18
claes Exp $
* Proview $Id: rt_pb_gsd.cpp,v 1.1
1 2007-11-16 07:52:54
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -874,11 +874,6 @@ int pb_gsd::read( char *filename)
}
else
{
if
(
(
s
=
strchr
(
line
,
'='
)))
{
// Pad with zero
for
(
int
i
=
e
->
Const_Offset
+
e
->
len
;
i
<
const_offset
-
e
->
Const_Offset
;
i
++
)
{
if
(
i
<
(
int
)
sizeof
(
e
->
Const_Prm_Data
))
e
->
Const_Prm_Data
[
i
]
=
'0'
;
}
str_to_ostring
(
&
t
,
s
+
1
,
sizeof
(
e
->
Const_Prm_Data
),
&
data_len
);
memcpy
(
(
char
*
)
e
->
Const_Prm_Data
+
const_offset
,
(
char
*
)
t
,
data_len
);
e
->
len
=
const_offset
+
data_len
-
e
->
Const_Offset
;
...
...
@@ -1106,6 +1101,10 @@ int pb_gsd::build()
if
(
!
extuserprmdataconst
)
extuserprmdataconst
=
(
gsd_sExtUserPrmDataConst
*
)
calloc
(
1
,
sizeof
(
gsd_sExtUserPrmDataConst
));
// Set default values to items
prm_items_set_default_data
(
prm_dataitems
,
prm_dataitems_cnt
);
return
1
;
}
...
...
@@ -1143,6 +1142,30 @@ int pb_gsd::prm_len( gsd_sPrmDataItem *item, int item_size)
return
len
;
}
int
pb_gsd
::
prm_items_set_default_data
(
gsd_sPrmDataItem
*
item
,
int
item_size
)
{
gsd_sExtUserPrmData
*
pd
;
for
(
int
i
=
0
;
i
<
item_size
;
i
++
)
{
pd
=
item
[
i
].
ref
->
prm_data
;
switch
(
pd
->
data_type
)
{
case
gsd_BitArea
:
case
gsd_Unsigned8
:
case
gsd_Signed8
:
case
gsd_Unsigned16
:
case
gsd_Signed16
:
case
gsd_Unsigned32
:
case
gsd_Signed32
:
item
[
i
].
value
=
pd
->
Default_Value
;
break
;
default:
;
}
}
return
1
;
}
int
pb_gsd
::
prm_items_to_data
(
gsd_sPrmDataItem
*
item
,
int
item_size
,
unsigned
char
*
data
,
int
data_size
)
{
...
...
@@ -2042,7 +2065,7 @@ int pb_gsd::configure_module( gsd_sModuleConf *m)
if
(
m
->
module
->
extuserprmdataconst
)
{
memcpy
(
m
->
prm_data
,
m
->
module
->
extuserprmdataconst
->
Const_Prm_Data
,
m
->
module
->
extuserprmdataconst
->
len
);
prm_data_to_items
(
m
->
prm_dataitems
,
m
->
prm_dataitems_cnt
,
prm_data_to_items
(
m
->
prm_dataitems
,
m
->
prm_dataitems_cnt
,
m
->
prm_data
,
m
->
module
->
Ext_Module_Prm_Data_Len
,
1
);
// Test Remove this !!!
...
...
profibus/lib/rt/src/rt_pb_gsd.h
View file @
fc46b03c
/*
* Proview $Id: rt_pb_gsd.h,v 1.
6 2007-08-21 15:12:40
claes Exp $
* Proview $Id: rt_pb_gsd.h,v 1.
7 2007-11-16 07:52:54
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -220,6 +220,7 @@ class pb_gsd {
int
build
();
int
configure_module
(
gsd_sModuleConf
*
mclist
);
int
prm_len
(
gsd_sPrmDataItem
*
item
,
int
item_size
);
int
prm_items_set_default_data
(
gsd_sPrmDataItem
*
item
,
int
item_size
);
int
prm_items_to_data
(
gsd_sPrmDataItem
*
item
,
int
item_size
,
unsigned
char
*
data
,
int
data_size
);
int
prm_data_to_items
(
gsd_sPrmDataItem
*
item
,
int
item_size
,
unsigned
char
*
data
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment