From 935b75b82721e4572baa4ea9632d1f89bea8771c Mon Sep 17 00:00:00 2001 From: Christian Koernig <ckoernig@mail.desy.de> Date: Fri, 26 Mar 2021 12:09:44 +0100 Subject: [PATCH] Removed a lot of debug output in the C++ core code --- examples/simple_connection.py | 11 +++++++---- src/AmptekHardwareInterface.cpp | 17 ++++++++--------- src/AmptekSimulatorConnectionHandler.cpp | 1 - 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/examples/simple_connection.py b/examples/simple_connection.py index 03f03df..f04106c 100644 --- a/examples/simple_connection.py +++ b/examples/simple_connection.py @@ -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,11 +59,12 @@ print("Acquisition started") while True: time.sleep(1) status = amptek.updateStatus(-1) + print("\rAccumulation 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("\rAccumulation Time: {:.2f}s, Fast Counts: {:d}, Slow Counts: {:d}".format( status.AccTime(), status.FastCount(), status.SlowCount() ), end="", flush=True) print("Acquisition finished") diff --git a/src/AmptekHardwareInterface.cpp b/src/AmptekHardwareInterface.cpp index cd486e3..44c92da 100644 --- a/src/AmptekHardwareInterface.cpp +++ b/src/AmptekHardwareInterface.cpp @@ -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){ diff --git a/src/AmptekSimulatorConnectionHandler.cpp b/src/AmptekSimulatorConnectionHandler.cpp index c70ce8c..eb52b5a 100644 --- a/src/AmptekSimulatorConnectionHandler.cpp +++ b/src/AmptekSimulatorConnectionHandler.cpp @@ -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); -- GitLab