Commit 7b57ad8a authored by Sebastien Petitdemange's avatar Sebastien Petitdemange Committed by Operator for ID31
Browse files

new command resetHighVoltage for Cdte detector.

This command power cycle module and High Voltage.
parent a6a2578e
......@@ -52,6 +52,7 @@ public:
SETTING_ROI,
KILL_ACQUISITION,
RUNNING,
RESET_HIGH_VOLTAGE,
ANYCMD
};
......@@ -132,8 +133,13 @@ public:
bool hasRoiCapability() const;
void setRoi(const std::string&);
bool hasHighVoltageReset();
void resetHighVoltage(double sleeptime = -1.);
private:
static const double TIME_OUT = 10.;
enum HIGH_VOLTAGE { NOT_INITIALIZED,
HAS_HIGH_VOLTAGE,DONT_HAVE_HIGH_VOLTAGE };
const std::string& errorMessage() const;
void softReset();
......@@ -187,6 +193,7 @@ private:
int m_major_version;
int m_minor_version;
int m_patch_version;
HIGH_VOLTAGE m_cmd_high_voltage_reset;
};
}
}
......
......@@ -116,7 +116,8 @@ Camera::Camera(const char *host,int port)
m_has_cmd_roi(true),
m_major_version(-1),
m_minor_version(-1),
m_patch_version(-1)
m_patch_version(-1),
m_cmd_high_voltage_reset(NOT_INITIALIZED)
{
DEB_CONSTRUCTOR();
m_server_ip = host;
......@@ -604,6 +605,13 @@ void Camera::_run()
m_has_cmd_roi = false;
_resync();
}
else if(msg.find("Unrecognized command: resetmodulepower") !=
std::string::npos)
{
m_cmd_high_voltage_reset = DONT_HAVE_HIGH_VOLTAGE;
m_state = Camera::STANDBY;
m_cond.broadcast();
}
else
{
DEB_TRACE() << "-- ERROR";
......@@ -1186,5 +1194,58 @@ void Camera::setRoi(const std::string& roi_pattern)
<< DEB_VAR2(roi_pattern,m_error_message);
}
}
/*-----------------------------------------------------
High voltage reset command (Cdte)
------------------------------------------------------*/
bool Camera::hasHighVoltageReset()
{
DEB_MEMBER_FUNCT();
//-----------------------------------------------------
AutoMutex lock(m_cond.mutex());
if(m_pilatus3_threshold_mode)
{
if(m_cmd_high_voltage_reset == NOT_INITIALIZED)
{
try
{
AutoMutexUnlock unlock(lock);
resetHighVoltage();
}
catch(...)
{}
}
return m_cmd_high_voltage_reset == HAS_HIGH_VOLTAGE;
}
else
return false;
}
void Camera::resetHighVoltage(double sleep_time)
{
DEB_MEMBER_FUNCT();
AutoMutex lock(m_cond.mutex());
if(m_cmd_high_voltage_reset == DONT_HAVE_HIGH_VOLTAGE)
THROW_HW_ERROR(Error) << "This detector doesn't have a "
<< "command to reset high voltage";
std::stringstream msg;
msg << "resetmodulepower";
if(sleep_time > 0.) msg << " " << sleep_time;
m_state = Camera::RESET_HIGH_VOLTAGE;
while(m_state == Camera::RESET_HIGH_VOLTAGE)
m_cond.wait(TIME_OUT + sleep_time < 0. ? 0. : sleep_time);
if(m_cmd_high_voltage_reset == DONT_HAVE_HIGH_VOLTAGE)
THROW_HW_ERROR(Error) << "This detector doesn't have a "
<< "command to reset high voltage";
else
{
/** Refresh the energy settings.
Has the chip supply voltage and HV are power cycle,
it lost the energy threshold.
*/
if(m_has_cmd_setenergy)
send("setenergy");
else
send("setthreshold");
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment