Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AmptekHardwareInterface
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package 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
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Körnig, Christian Gabriel
AmptekHardwareInterface
Commits
11c4b50e
Commit
11c4b50e
authored
4 years ago
by
Christian Koernig
Browse files
Options
Downloads
Patches
Plain Diff
Fixes and added a "Clear Alarm" Tango command
parent
b8c6c5a4
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/AmptekPX5.py
+12
-2
12 additions, 2 deletions
python/AmptekPX5.py
src/AmptekHardwareInterface.cpp
+13
-1
13 additions, 1 deletion
src/AmptekHardwareInterface.cpp
with
25 additions
and
3 deletions
python/AmptekPX5.py
+
12
−
2
View file @
11c4b50e
...
...
@@ -420,8 +420,15 @@ class AmptekPX5(Device):
self
.
warn_stream
(
"
Cannot interpret line
'
%s
'
. Will be ignored for configuration loading!
"
%
line
.
strip
())
success
=
self
.
interface
.
SetTextConfiguration
(
[
"
RESC=YES
"
]
+
self
.
sort_commands
(
cmds
,
vals
)
)
if
not
success
:
for
cmd_str
in
self
.
sort_commands
(
cmds
,
vals
):
print
(
cmd_str
)
success
=
self
.
interface
.
SetTextConfiguration
(
[
cmd_str
]
)
if
not
success
:
print
(
"
Failed sending command %s
"
%
cmd_str
)
self
.
set_state
(
tango
.
DevState
.
ALARM
)
self
.
error_stream
(
"
Failed Setting the text configuration!
"
)
for
_
,
c
in
self
.
parameter_dicts
.
items
():
self
.
load_config_dict
(
c
)
@command
(
dtype_in
=
str
)
def
SaveConfigurationFile
(
self
,
filepath
):
...
...
@@ -540,7 +547,10 @@ class AmptekPX5(Device):
def
GetTecVoltage
(
self
,
max_age_ms
):
return
self
.
get_status_attribute
(
max_age_ms
,
"
TecVoltage
"
)
@command
def
ClearAlarm
(
self
):
self
.
set_state
(
DevState
.
On
)
self
.
dev_state
()
def
set_calibrationslope
(
self
,
val
):
self
.
_calibrationslope
=
val
...
...
@@ -670,7 +680,7 @@ class AmptekPX5(Device):
"
TEC Temp: {detector_temp:.1f}K
\n
"
"
Board Temp: {board_temp:.1f}C
\n
"
"
<<DPP STATUS END>>
\n
"
)
status
=
self
.
interface
.
U
pdateStatus
()
status
=
self
.
interface
.
u
pdateStatus
(
0
)
outstring
=
template
.
format
(
dev_type
=
status
.
DeviceType
(),
serial_nb
=
status
.
SerialNb
(),
...
...
This diff is collapsed.
Click to expand it.
src/AmptekHardwareInterface.cpp
+
13
−
1
View file @
11c4b50e
...
...
@@ -247,6 +247,11 @@ bool AmptekHardwareInterface::SetPresetCounts(int c){
* @return false on failure
*/
bool
AmptekHardwareInterface
::
SetTextConfiguration
(
std
::
vector
<
std
::
string
>
commands
){
std
::
cout
<<
"Configuration is
\n
"
;
for
(
auto
cmd
:
commands
){
std
::
cout
<<
"
\t
"
<<
cmd
<<
"
\n
"
;
}
std
::
cout
<<
std
::
endl
;
try
{
stringstream
cmdstream
;
...
...
@@ -258,6 +263,7 @@ bool AmptekHardwareInterface::SetTextConfiguration(std::vector<std::string> comm
// if max packet size (512) would be exceeded when adding this command, send the previous commands and clear the input stringstream
if
(
streamsize
+
cmd
.
size
()
>
511
){
std
::
cout
<<
"Send "
<<
cmdstream
.
str
()
<<
std
::
endl
;
expectAcknowledge
(
connection_handler
->
sendAndReceive
(
Packet
::
gernerateSetConfigurationRequest
(
cmdstream
.
str
()
)
)
);
cmdstream
=
stringstream
();
}
...
...
@@ -268,12 +274,18 @@ bool AmptekHardwareInterface::SetTextConfiguration(std::vector<std::string> comm
// if this is the last command in the loop, send the stringstream even if max size is not reached
if
(
i
==
commands
.
size
()
-
1
){
std
::
cout
<<
"Send "
<<
cmdstream
.
str
()
<<
std
::
endl
;
expectAcknowledge
(
connection_handler
->
sendAndReceive
(
Packet
::
gernerateSetConfigurationRequest
(
cmdstream
.
str
()
)
)
);
}
}
}
catch
(
AmptekException
&
e
){
std
::
cerr
<<
e
.
what
()
<<
std
::
endl
;
std
::
cerr
<<
"Failed sending Text Config: "
<<
e
.
what
()
<<
"
\n
"
;
std
::
cerr
<<
"Configuration was
\n
"
;
for
(
auto
cmd
:
commands
){
std
::
cerr
<<
"
\t
"
<<
cmd
<<
"
\n
"
;
}
std
::
cerr
<<
std
::
endl
;
current_state
=
ERROR
;
return
false
;
}
...
...
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