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
935b75b8
Commit
935b75b8
authored
4 years ago
by
Christian Koernig
Browse files
Options
Downloads
Patches
Plain Diff
Removed a lot of debug output in the C++ core code
parent
5d74bf64
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/simple_connection.py
+7
-4
7 additions, 4 deletions
examples/simple_connection.py
src/AmptekHardwareInterface.cpp
+8
-9
8 additions, 9 deletions
src/AmptekHardwareInterface.cpp
src/AmptekSimulatorConnectionHandler.cpp
+0
-1
0 additions, 1 deletion
src/AmptekSimulatorConnectionHandler.cpp
with
15 additions
and
14 deletions
examples/simple_connection.py
+
7
−
4
View file @
935b75b8
...
...
@@ -41,12 +41,14 @@ config_names = ["RESC", "CLCK", "TPEA", "GAIF", "GAIN", "RESL", "TFLA", "TPFA",
"
SCOT
"
,
"
SCOG
"
,
"
MCSL
"
,
"
MCSH
"
,
"
MCST
"
,
"
AUO2
"
,
"
TPMO
"
,
"
GPED
"
,
"
GPGA
"
,
"
GPMC
"
,
"
MCAE
"
,
"
VOLU
"
,
"
CON1
"
,
"
CON2
"
]
configs
=
amptek
.
GetTextConfiguration
(
config_names
)
print
(
"
----CURRENT CONFIG-----
"
)
for
config
in
configs
:
print
(
config
)
print
(
"
-----------------------
\n\n
"
)
# prepare a 10 second acquisition
amptek
.
ClearSpectrum
()
amptek
.
SetPresetAccumulationTime
(
4
)
amptek
.
SetPresetAccumulationTime
(
10
)
# start acquisition
amptek
.
Enable
()
...
...
@@ -57,12 +59,13 @@ print("Acquisition started")
while
True
:
time
.
sleep
(
1
)
status
=
amptek
.
updateStatus
(
-
1
)
print
(
"
\r
Accumulation Time: {:.2f}s, Fast Counts: {:d}, Slow Counts: {:d}
"
.
format
(
status
.
AccTime
(),
status
.
FastCount
(),
status
.
SlowCount
()
),
end
=
""
,
flush
=
True
)
# test if finished
if
not
status
.
IsEnabled
():
print
(
""
)
break
print
(
"
\r
Accumulation Time: {:.2f}s, Fast Counts: {:d}, Slow Counts: {:d}
"
.
format
(
status
.
AccTime
(),
status
.
FastCount
(),
status
.
SlowCount
()
),
end
=
""
,
flush
=
True
)
print
(
"
Acquisition finished
"
)
# plot finished spectrum
...
...
This diff is collapsed.
Click to expand it.
src/AmptekHardwareInterface.cpp
+
8
−
9
View file @
935b75b8
...
...
@@ -247,11 +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
;
//
std::cout << "Configuration is\n";
//
for (auto cmd :commands){
//
std::cout << "\t" << cmd << "\n";
//
}
//
std::cout << std::endl;
try
{
stringstream
cmdstream
;
...
...
@@ -263,7 +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
;
//
std::cout << "Send " << cmdstream.str() << std::endl;
expectAcknowledge
(
connection_handler
->
sendAndReceive
(
Packet
::
gernerateSetConfigurationRequest
(
cmdstream
.
str
()
)
)
);
cmdstream
=
stringstream
();
}
...
...
@@ -274,7 +274,7 @@ 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
;
//
std::cout << "Send " << cmdstream.str() << std::endl;
expectAcknowledge
(
connection_handler
->
sendAndReceive
(
Packet
::
gernerateSetConfigurationRequest
(
cmdstream
.
str
()
)
)
);
}
}
...
...
@@ -661,7 +661,7 @@ std::pair<AmptekSpectrum, AmptekStatus> AmptekHardwareInterface::GetBufferedSpe
int
spectrum_bytesize
=
3
*
spectrum_length
;
AmptekSpectrum
buffered_spectrum
(
&
(
spectrumResponse
.
at
(
DATA
)
),
spectrum_length
);
AmptekStatus
buffered_status
(
&
(
spectrumResponse
.
at
(
DATA
+
spectrum_bytesize
)));
std
:
cout
<<
buffered_status
.
SlowCount
()
<<
std
::
endl
;
//
std:cout << buffered_status.SlowCount() << std::endl;
return
std
::
pair
<
AmptekSpectrum
,
AmptekStatus
>
(
buffered_spectrum
,
buffered_status
);
}
...
...
@@ -689,7 +689,6 @@ bool AmptekHardwareInterface::StartCommtestStreaming(uint16_t min_channel,uint16
std
::
cout
<<
"Pulse Period: "
<<
period
<<
std
::
endl
;
try
{
Packet
commtest_packet
=
Packet
::
generateCommtestStreamingRequest
(
min_channel
,
max_channel
,
increment
,
period
);
std
::
cout
<<
commtest_packet
.
toString
()
<<
std
::
endl
;
expectAcknowledge
(
connection_handler
->
sendAndReceive
(
commtest_packet
)
);
}
catch
(
AmptekException
&
e
){
...
...
This diff is collapsed.
Click to expand it.
src/AmptekSimulatorConnectionHandler.cpp
+
0
−
1
View file @
935b75b8
...
...
@@ -95,7 +95,6 @@ Packet AmptekSimulatorConnectionHandler::sendAndReceive( const Packet& request){
char
configs
[
request
.
dataLength
+
1
];
byteToChar
(
(
byte
*
)
&
(
request
.
at
(
DATA
)),
configs
,
request
.
dataLength
);
string
configstring
=
buildConfigResponse
(
configs
);
std
::
cout
<<
configstring
<<
std
::
endl
;
word16
len
=
configstring
.
size
();
byte
arr
[
len
];
charToByte
(
configstring
.
c_str
(),
arr
,
len
);
...
...
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