Commit 3993044b authored by Laurent Claustre's avatar Laurent Claustre

Added helper functions to get list of values as string for PGain, VsSpeed and AdcSpeed.

parent c708567e
......@@ -75,6 +75,7 @@
#include "lima/HwBufferMgr.h"
#include <ostream>
#include <string>
using namespace std;
......@@ -214,15 +215,21 @@ namespace lima
// -- andor specific
void initialiseController();
void initAdcSpeed();
void setAdcSpeed(int adc);
void getAdcSpeed(int& adc);
void getAdcSpeedInMhz(float& adc);
void setAdcSpeed(int index);
void getAdcSpeed(int& index);
void getAdcSpeedInMhz(float& speed);
void getAdcSpeedMaxIndex(int &max_index);
void getAdcSpeedPaireString(int index, string& paire);
void initVsSpeed();
void setVsSpeed(int vss);
void getVsSpeed(int& vss);
void getVsSpeedMaxIndex(int& max_index);
void getVsSpeedString(int index, string& speed);
void initPGain();
void setPGain(int gain);
void getPGain(int& gain);
void getPGainMaxIndex(int& max_index);
void getPGainString(int index, string& pgain);
void setFastExtTrigger(bool flag);
void getFastExtTrigger(bool& flag);
void setShutterLevel(int level);
......@@ -242,7 +249,6 @@ namespace lima
//void setReadMode(ReadMode mode);
void setBaselineClamp(bool enable);
void getBaselineClamp(bool& enable);
private:
class _AcqThread;
......@@ -321,7 +327,9 @@ namespace lima
#else
int m_ring_buffer_size;
#endif
map<int, string> m_andor_type_maps;
map<int, string> m_andor_type_maps;
map<int, string> m_adcspeed_maps;
map<int, string> m_vsspeed_maps;
};
} // namespace Andor
} // namespace lima
......
......@@ -61,12 +61,18 @@ namespace lima
virtual int getNbHwAcquiredFrames();
// - From AndorCamera
void setAdcSpeed(int adc);
void getAdcSpeed(int& adc);
void setVsSpeed(int vss);
void getVsSpeed(int& vss);
void setPGain(int gain);
void getPGain(int& gain);
void setAdcSpeed(int index);
void getAdcSpeed(int& index);
void getAdcSpeedMaxIndex(int& max_index){m_cam.getAdcSpeedMaxIndex(max_index);};
void getAdcSpeedPaireString(int index, string& pgain){m_cam.getAdcSpeedPaireString(index, pgain);};
void setVsSpeed(int index);
void getVsSpeed(int& index);
void getVsSpeedMaxIndex(int& max_index){m_cam.getVsSpeedMaxIndex(max_index);};
void getVsSpeedString(int index, string& speed){m_cam.getVsSpeedString(index, speed);};
void setPGain(int index);
void getPGain(int& index);
void getPGainMaxIndex(int& max_index) {m_cam.getPGainMaxIndex(max_index);};
void getPGainString(int index, string& pgain){m_cam.getPGainString(index, pgain);};
void setFastExtTrigger(bool flag);
void getFastExtTrigger(bool& flag);
void setShutterLevel(int level);
......
......@@ -121,14 +121,21 @@ namespace Andor
void initialiseController();
void initAdcSpeed();
void setAdcSpeed(int adc);
void getAdcSpeed(int& adc /Out/);
void setAdcSpeed(int index);
void getAdcSpeed(int& index /Out/);
void getAdcSpeedInMhz(float& adc /Out/);
void getAdcSpeedMaxIndex(int &max_index /Out/);
void getAdcSpeedPaireString(int index, std::string& paire /Out/);
void initVsSpeed();
void setVsSpeed(int vss);
void getVsSpeed(int& vss /Out/);
void getVsSpeedMaxIndex(int& max_index /Out/);
void getVsSpeedString(int index, std::string& speed /Out/);
void initPGain();
void setPGain(int gain);
void getPGainMaxIndex(int& max_index /Out/);
void getPGainString(int index, std::string& pgain /Out/);
void getPGain(int& gain /Out/);
void setFastExtTrigger(bool flag);
void getFastExtTrigger(bool& flag /Out/);
......
......@@ -21,12 +21,18 @@ namespace Andor
virtual void getStatus(StatusType& status /Out/);
virtual int getNbHwAcquiredFrames();
void setAdcSpeed(int adc);
void getAdcSpeed(int& adc /Out/);
void setVsSpeed(int vss);
void getVsSpeed(int& vss /Out/);
void setPGain(int gain);
void getPGain(int& gain /Out/);
void setAdcSpeed(int index);
void getAdcSpeed(int& index /Out/);
void getAdcSpeedMaxIndex(int &max_index /Out/);
void getAdcSpeedPaireString(int index, std::string& paire /Out/);
void setVsSpeed(int index);
void getVsSpeed(int& index /Out/);
void getVsSpeedMaxIndex(int& max_index /Out/);
void getVsSpeedString(int index, std::string& speed /Out/);
void setPGain(int index);
void getPGain(int&index);
void getPGainMaxIndex(int& max_index /Out/);
void getPGainString(int index, std::string& pgain /Out/);
void setFastExtTrigger(bool flag);
void getFastExtTrigger(bool& flag /Out/);
void setShutterLevel(int level);
......
......@@ -1097,6 +1097,9 @@ void Camera::initAdcSpeed()
if (m_adc_speeds[is].speed > speedMax) {
speedMax= m_adc_speeds[is].speed;
m_adc_speed_max= is;
stringstream ss;
ss << "ADC" << m_adc_speeds[is].adc << "_" << m_adc_speeds[is].speed << "MHZ";
m_adcspeed_maps[is] = ss.str();
}
is++;
}
......@@ -1108,19 +1111,19 @@ void Camera::initAdcSpeed()
// @param adc pair adc/speed index (if =-1, set to max speed)
//
//-----------------------------------------------------
void Camera::setAdcSpeed(int adc)
void Camera::setAdcSpeed(int index)
{
DEB_MEMBER_FUNCT();
int is;
// -- Initialise ad speed
if ((adc == -1) || (adc > m_adc_speed_number))
if ((index == -1) || (index > m_adc_speed_number-1))
{
is = m_adc_speed_max;
}
else
{
is = adc;
is = index;
}
THROW_IF_NOT_SUCCESS(SetADChannel(m_adc_speeds[is].adc), "Failed to set ADC channel");
THROW_IF_NOT_SUCCESS(SetHSSpeed(0, m_adc_speeds[is].hss), "Failed to set HSS");
......@@ -1135,9 +1138,9 @@ void Camera::setAdcSpeed(int adc)
// @param adc index
//
//-----------------------------------------------------
void Camera::getAdcSpeed(int& adc)
void Camera::getAdcSpeed(int& index)
{
adc = m_adc;
index = m_adc;
}
//-----------------------------------------------------
......@@ -1145,11 +1148,42 @@ void Camera::getAdcSpeed(int& adc)
// @param adc frequency
//
//-----------------------------------------------------
void Camera::getAdcSpeedInMhz(float& adc)
void Camera::getAdcSpeedInMhz(float& speed)
{
adc = m_adc_speeds[m_adc].speed;
speed = m_adc_speeds[m_adc].speed;
}
//-----------------------------------------------------
// @brief get max number of adc/speed paire
// @param max_index
//
//-----------------------------------------------------
void Camera::getAdcSpeedMaxIndex(int& max_index)
{
max_index = m_adc_speed_number;
}
//-----------------------------------------------------
// @brief get ADC/Speed paire as a string for a given index
// @param index
//
//-----------------------------------------------------
void Camera::getAdcSpeedPaireString(int index,string& paire)
{
int is;
if ((index == -1) || (index >= m_adc_speed_number))
{
is = m_adc_speed_max;
}
else
{
is = index;
}
stringstream ss;
ss << "ADC" << m_adc_speeds[is].adc << "_" << m_adc_speeds[is].speed << "MHZ";
paire = ss.str();
}
//-----------------------------------------------------
// @brief get possible VSS (vertical shift speed) for controller
//
......@@ -1172,6 +1206,9 @@ void Camera::initVsSpeed()
for (ivss=0; ivss<m_vss_number; ivss++)
{
THROW_IF_NOT_SUCCESS(GetVSSpeed(ivss, &m_vsspeeds[ivss]), "Cannot get VSS value");
stringstream ss;
ss << m_vsspeeds[ivss] << "USEC";
m_vsspeed_maps[ivss] = ss.str();
}
// --- get recommended VSS value
......@@ -1190,18 +1227,18 @@ void Camera::initVsSpeed()
// @param vss index (if =-1, set to recommended)
//
//-----------------------------------------------------
void Camera::setVsSpeed(int vss)
void Camera::setVsSpeed(int index)
{
DEB_MEMBER_FUNCT();
int is;
if ((vss == -1)||(vss > m_vss_number))
if ((index == -1)||(index >= m_vss_number))
{
is = m_vss_best;
}
else
{
is = vss;
is = index;
}
THROW_IF_NOT_SUCCESS(SetVSSpeed(is), "Failed to set VS speed");
m_vss = is;
......@@ -1214,9 +1251,30 @@ void Camera::setVsSpeed(int vss)
// @param vss index
//
//-----------------------------------------------------
void Camera::getVsSpeed(int& vss)
void Camera::getVsSpeed(int& index)
{
vss = m_vss;
index = m_vss;
}
//-----------------------------------------------------
// @brief get Vertical Shift Speed
// @param vss index
//
//-----------------------------------------------------
void Camera::getVsSpeedString(int index, string& speed)
{
DEB_MEMBER_FUNCT();
speed = m_vsspeed_maps[index];
}
//-----------------------------------------------------
// @brief get Vertical Shift Speed max index value
// @param index
//
//-----------------------------------------------------
void Camera::getVsSpeedMaxIndex(int& max_index)
{
max_index = m_vss_number;
}
//-----------------------------------------------------
......@@ -1252,23 +1310,23 @@ void Camera::initPGain()
// @param gain preamp gain index
//
//-----------------------------------------------------
void Camera::setPGain(int gain)
void Camera::setPGain(int index)
{
DEB_MEMBER_FUNCT();
int ig;
if (gain==-1)
if (index==-1)
{
ig= m_gain_max;
}
else
{
if (gain<-1 || gain>=m_gain_number)
if (index<-1 || index>= m_gain_number)
{
DEB_ERROR() << "Invalid gain index range is" << "[0," << m_gain_number-1 << "] or -1 for max gain";
THROW_HW_ERROR(Error) << "Invalid gain index range is" << "[0," << m_gain_number-1 << "] or -1 for max gain";
}
ig= gain;
ig= index;
}
THROW_IF_NOT_SUCCESS(SetPreAmpGain(ig), "Failed to set Preamp Gain");
......@@ -1282,9 +1340,24 @@ void Camera::setPGain(int gain)
// @param gain preamp gain index
//
//-----------------------------------------------------
void Camera::getPGain(int& gain)
void Camera::getPGain(int& index)
{
gain = m_gain;
DEB_MEMBER_FUNCT();
index = m_gain;
}
void Camera::getPGainMaxIndex(int& max_index)
{
DEB_MEMBER_FUNCT();
max_index = m_gain_number;
}
void Camera::getPGainString(int index, string& pgain)
{
DEB_MEMBER_FUNCT();
stringstream ss;
ss << "X" << m_preamp_gains[index];
pgain = ss.str();
}
//-----------------------------------------------------
......
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