diff --git a/examples/simple_connection.py b/examples/simple_connection.py index 03f03df3cb1f8f68b3dda66696f1c2ca97fa248d..f04106cc59e98928e8a31231c23364977ebfcd92 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 cd486e3effd2ef3e965433ad206b8f1661ebdde1..44c92da50481bf7138d70436550b16415fd441b9 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 c70ce8c035b55be97ca51af93663a97d8a92231e..eb52b5a751dba2bfb87c3c0c293d72c298940a51 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);