Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bpd-software
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carlo Alessandro Nicolau
bpd-software
Commits
faaceaa5
Commit
faaceaa5
authored
3 years ago
by
Carlo Alessandro Nicolau
Browse files
Options
Downloads
Patches
Plain Diff
Under Development (added conversion for *_GETALL functions, python side only)
parent
73d7f57f
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
host/python/console/sendcommand.py
+28
-1
28 additions, 1 deletion
host/python/console/sendcommand.py
with
28 additions
and
1 deletion
host/python/console/sendcommand.py
+
28
−
1
View file @
faaceaa5
...
...
@@ -29,6 +29,23 @@ def ask_confirm():
return
answer
==
"
y
"
def
getconvertedvals
(
command
,
fields
):
vals
=
list
()
if
command
.
name
in
[
'
SENSOR_VALUES_GETALL
'
,
'
SENSOR_AVERAGE_GETALL
'
,
'
SENSOR_OFFSETS_GETALL
'
,
'
SENSOR_MAXVALUES_GETALL
'
]:
vals
.
append
([
convert_chn2meas_DUL_BOARDTEMP
(
fields
[
0
]),
'
C
'
])
vals
.
append
([
convert_chn2meas_TEMP2
(
fields
[
1
]),
'
C
'
])
vals
.
append
([
convert_chn2meas_TEMP1
(
fields
[
2
]),
'
C
'
])
vals
.
append
([
convert_chn2meas_VEOC_RTN_I
(
fields
[
3
]),
'
A
'
])
vals
.
append
([
convert_chn2meas_VEOC_FWR_I
(
fields
[
4
]),
'
A
'
])
vals
.
append
([
convert_chn2meas_HYDRO_I
(
fields
[
5
]),
'
A
'
])
vals
.
append
([
convert_chn2meas_INPUT_V
(
fields
[
6
]),
'
V
'
])
vals
.
append
([
convert_chn2meas_LBL_I
(
fields
[
7
]),
'
A
'
])
vals
.
append
([
convert_chn2meas_GLRA_I
(
fields
[
8
]),
'
A
'
])
vals
.
append
([
convert_chn2meas_GLRB_I
(
fields
[
9
]),
'
A
'
])
vals
.
append
([
convert_chn2meas_PWB_I
(
fields
[
10
]),
'
A
'
])
return
vals
if
__name__
==
'
__main__
'
:
# command line options
# example
...
...
@@ -161,6 +178,7 @@ if __name__ == '__main__':
# print ' Payload data: {} (raw data: {})'.format(payload_field_values, payload_data)
print
'
Response payload:
'
byte_idx
=
0
rawvalues
=
list
()
for
field
in
command
.
response_payload
:
value
=
-
1
if
isinstance
(
field
,
PayloadFieldU8
):
...
...
@@ -181,5 +199,14 @@ if __name__ == '__main__':
byte_idx
+=
1
else
:
assert
False
,
'
Unmanaged type {}
'
.
format
(
field
.
__class__
.
__name__
)
print
'
{} = {}
'
.
format
(
field
.
name
,
value
)
rawvalues
.
append
(
value
)
convertedvals
=
getconvertedvals
(
command
,
rawvalues
)
if
convertedvals
:
print
"
CONVERTED VALUES:
"
field_idx
=
0
for
field
in
command
.
response_payload
:
s
=
'
{} = {:0.3} {}
'
.
format
(
field
.
name
,
convertedvals
[
field_idx
][
0
],
convertedvals
[
field_idx
][
1
])
print
s
field_idx
+=
1
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