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
5a159ffe
Commit
5a159ffe
authored
Jan 23, 2004
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integer attributes for AnalogColor and AnalogShift
parent
a473d9de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
18 deletions
+74
-18
xtt/lib/ge/src/ge_dyn.cpp
xtt/lib/ge/src/ge_dyn.cpp
+72
-18
xtt/lib/ge/src/ge_dyn.h
xtt/lib/ge/src/ge_dyn.h
+2
-0
No files found.
xtt/lib/ge/src/ge_dyn.cpp
View file @
5a159ffe
...
...
@@ -3016,7 +3016,6 @@ void GeAnalogColor::open( ifstream& fp)
int
GeAnalogColor
::
connect
(
grow_tObject
object
,
glow_sTraceData
*
trace_data
)
{
int
attr_type
,
attr_size
;
char
parsed_name
[
120
];
int
inverted
;
int
sts
;
...
...
@@ -3043,10 +3042,18 @@ int GeAnalogColor::connect( grow_tObject object, glow_sTraceData *trace_data)
if
(
e
->
p
==
0
)
{
e
->
size
=
4
;
db
=
dyn
->
graph
->
parse_attr_name
(
e
->
attribute
,
parsed_name
,
&
inverted
,
&
attr_type
,
&
attr_
size
);
&
inverted
,
&
e
->
type
,
&
e
->
size
);
if
(
strcmp
(
parsed_name
,
""
)
==
0
)
return
1
;
switch
(
e
->
type
)
{
case
pwr_eType_Float32
:
case
pwr_eType_Int32
:
break
;
default:
return
1
;
}
sts
=
dyn
->
graph
->
ref_object_info
(
dyn
->
cycle
,
parsed_name
,
(
void
**
)
&
e
->
p
,
&
e
->
subid
,
e
->
size
);
if
(
EVEN
(
sts
))
return
sts
;
...
...
@@ -3054,6 +3061,7 @@ int GeAnalogColor::connect( grow_tObject object, glow_sTraceData *trace_data)
if
(
e
->
p
)
trace_data
->
p
=
e
->
p
;
}
type
=
e
->
type
;
size
=
e
->
size
;
p
=
e
->
p
;
...
...
@@ -3075,11 +3083,22 @@ int GeAnalogColor::scan( grow_tObject object)
return
1
;
if
(
!
first_scan
)
{
if
(
!
dyn
->
reset_color
&&
fabs
(
old_value
-
*
p
)
<
FLT_EPSILON
)
{
// No change since last time
if
(
old_state
)
dyn
->
ignore_color
=
true
;
return
1
;
switch
(
type
)
{
case
pwr_eType_Float32
:
if
(
!
dyn
->
reset_color
&&
fabs
(
old_value
-
*
p
)
<
FLT_EPSILON
)
{
// No change since last time
if
(
old_state
)
dyn
->
ignore_color
=
true
;
return
1
;
}
break
;
default:
if
(
!
dyn
->
reset_color
&&
memcmp
(
&
old_value
,
p
,
size
)
==
0
)
{
// No change since last time
if
(
old_state
)
dyn
->
ignore_color
=
true
;
return
1
;
}
}
}
else
...
...
@@ -3089,10 +3108,24 @@ int GeAnalogColor::scan( grow_tObject object)
bool
set_color
=
false
;
bool
reset_color
=
false
;
if
(
limit_type
==
ge_eLimitType_Gt
)
state
=
*
p
>
limit
;
else
state
=
*
p
<
limit
;
if
(
limit_type
==
ge_eLimitType_Gt
)
{
switch
(
type
)
{
case
pwr_eType_Float32
:
state
=
*
p
>
limit
;
case
pwr_eType_Int32
:
state
=
*
(
pwr_tInt32
*
)
p
>
limit
;
default:
;
}
}
else
{
switch
(
type
)
{
case
pwr_eType_Float32
:
state
=
*
p
<
limit
;
case
pwr_eType_Int32
:
state
=
*
(
pwr_tInt32
*
)
p
<=
limit
;
default:
;
}
}
if
(
state
!=
old_state
||
dyn
->
reset_color
||
first_scan
)
{
if
(
state
)
{
...
...
@@ -3107,7 +3140,8 @@ int GeAnalogColor::scan( grow_tObject object)
}
else
if
(
state
)
dyn
->
ignore_color
=
true
;
old_value
=
*
p
;
memcpy
(
&
old_value
,
p
,
size
);
if
(
!
set_color
&&
!
reset_color
)
{
return
1
;
...
...
@@ -3726,7 +3760,6 @@ void GeAnalogShift::open( ifstream& fp)
int
GeAnalogShift
::
connect
(
grow_tObject
object
,
glow_sTraceData
*
trace_data
)
{
int
attr_type
,
attr_size
;
char
parsed_name
[
120
];
int
inverted
;
int
sts
;
...
...
@@ -3734,10 +3767,18 @@ int GeAnalogShift::connect( grow_tObject object, glow_sTraceData *trace_data)
size
=
4
;
p
=
0
;
db
=
dyn
->
graph
->
parse_attr_name
(
attribute
,
parsed_name
,
&
inverted
,
&
attr_type
,
&
attr_
size
);
&
inverted
,
&
type
,
&
size
);
if
(
strcmp
(
parsed_name
,
""
)
==
0
)
return
1
;
switch
(
type
)
{
case
pwr_eType_Float32
:
case
pwr_eType_Int32
:
break
;
default:
return
1
;
}
sts
=
dyn
->
graph
->
ref_object_info
(
dyn
->
cycle
,
parsed_name
,
(
void
**
)
&
p
,
&
subid
,
size
);
if
(
EVEN
(
sts
))
return
sts
;
...
...
@@ -3758,15 +3799,28 @@ int GeAnalogShift::disconnect( grow_tObject object)
int
GeAnalogShift
::
scan
(
grow_tObject
object
)
{
if
(
!
first_scan
)
{
if
(
fabs
(
old_value
-
*
p
)
<
FLT_EPSILON
)
{
// No change since last time
return
1
;
switch
(
type
)
{
case
pwr_eType_Float32
:
if
(
fabs
(
old_value
-
*
p
)
<
FLT_EPSILON
)
return
1
;
break
;
default:
if
(
memcmp
(
&
old_value
,
p
,
size
)
==
0
)
return
1
;
}
}
else
first_scan
=
false
;
int
index
=
int
(
*
p
+
0.5
);
int
index
;
switch
(
type
)
{
case
pwr_eType_Float32
:
index
=
int
(
*
p
+
0.5
);
break
;
default:
index
=
*
(
pwr_tInt32
*
)
p
;
}
grow_SetObjectNodeClassByIndex
(
object
,
index
);
old_value
=
*
p
;
return
1
;
...
...
xtt/lib/ge/src/ge_dyn.h
View file @
5a159ffe
...
...
@@ -1024,6 +1024,7 @@ class GeAnalogColor : public GeDynElem {
pwr_tFloat32
*
p
;
pwr_tSubid
subid
;
int
size
;
int
type
;
graph_eDatabase
db
;
bool
first_scan
;
pwr_tFloat32
old_value
;
...
...
@@ -1160,6 +1161,7 @@ class GeAnalogShift : public GeDynElem {
pwr_tFloat32
*
p
;
pwr_tSubid
subid
;
int
size
;
int
type
;
graph_eDatabase
db
;
bool
first_scan
;
pwr_tFloat32
old_value
;
...
...
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