diff --git a/python/AmptekPX5.py b/python/AmptekPX5.py index 82e1dfaf16a77e14ca11e3454c0bf8b8350e3bd7..2d094c8bfd3759e485fd11646674ce2b92737cb9 100644 --- a/python/AmptekPX5.py +++ b/python/AmptekPX5.py @@ -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.UpdateStatus() + status = self.interface.updateStatus(0) outstring = template.format( dev_type = status.DeviceType(), serial_nb = status.SerialNb(), diff --git a/src/AmptekHardwareInterface.cpp b/src/AmptekHardwareInterface.cpp index 832a8af53309d8da9ae2862dd3403f3193cf9594..256c8c540ec57a7f8d279b86f2e4018d7a647fc5 100644 --- a/src/AmptekHardwareInterface.cpp +++ b/src/AmptekHardwareInterface.cpp @@ -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; }