Commit 93fce27e authored by ahoms's avatar ahoms

* Workaround over TACO Python bug not properly dealing with

  Server.error exceptions (resulting in segment fault);
  use TacoCcd.TacoError exception instead
* Implemented automatic sleeping on slow Frelon serial commands
  once their acknowlegde was received (ConfigHD, BinHorz)
* Always go to Chan1234 when changing the FrameTransferMode
* Activated Set/GetKinWinSize in FrelonTacoCcd



git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@343 45c4679d-1946-429d-baad-37912b19538b
parent e3d88ba1
......@@ -35,6 +35,9 @@ extern RegStrMapType RegStrMap;
typedef std::vector<Reg> RegListType;
extern RegListType CacheableRegList;
typedef std::map<Reg, double> RegDoubleMapType;
extern RegDoubleMapType RegSleepMap;
extern const int MaxRegVal;
enum Cmd {
......
......@@ -111,6 +111,8 @@ class SerialLine : public HwSerialLine
bool isRegCacheable(Reg reg);
bool getRegCacheVal(Reg reg, int& val);
double getRegSleepTime(Reg reg);
Espia::SerialLine& m_espia_ser_line;
Cond m_cond;
int m_last_warn;
......
......@@ -80,6 +80,13 @@ static Reg CacheableRegCList[] = {
RegListType
lima::Frelon::CacheableRegList(C_LIST_ITERS(CacheableRegCList));
typedef pair<Reg, double> RegSleepPair;
static const RegSleepPair RegSleepCList[] = {
RegSleepPair(ConfigHD, 2.0),
RegSleepPair(BinHorz, 2.0),
};
RegDoubleMapType lima::Frelon::RegSleepMap(C_LIST_ITERS(RegSleepCList));
const int lima::Frelon::MaxRegVal = (1 << 16) - 1;
typedef pair<Cmd, string> CmdPair;
......
......@@ -6,7 +6,6 @@ using namespace lima;
using namespace lima::Frelon;
using namespace std;
const double Camera::BinChangeTime = 2.0;
const double Camera::MaxIdleWaitTime = 1.5;
......@@ -165,7 +164,7 @@ string Camera::getInputChanModeName(FrameTransferMode ftm,
int chan_bit = 1 << (chan - 1);
if ((input_chan & chan_bit) != 0) {
os << sep << chan;
sep = "+";
sep = "&";
}
}
string mode_name = os.str();
......@@ -287,8 +286,7 @@ void Camera::setFrameTransferMode(FrameTransferMode ftm)
return;
}
InputChan input_chan;
getInputChan(input_chan);
InputChan input_chan = Chan1234;
int chan_mode;
calcChanMode(ftm, input_chan, chan_mode);
setChanMode(chan_mode);
......@@ -410,9 +408,6 @@ void Camera::setBin(const Bin& bin)
writeRegister(BinHorz, bin.getX());
writeRegister(BinVert, bin.getY());
DEB_TRACE() << "Sleeping " << DEB_VAR1(BinChangeTime);
Sleep(BinChangeTime);
}
void Camera::getBin(Bin& bin)
......
......@@ -193,7 +193,16 @@ void SerialLine::readSingleLine(string& buffer, int max_len, double timeout)
m_espia_ser_line.readLine(buffer, max_len, timeout);
decodeFmtResp(buffer, m_curr_fmt_resp);
if (m_curr_op == WriteReg) {
double sleep_time = getRegSleepTime(m_curr_reg);
if (sleep_time > 0) {
DEB_TRACE() << "Sleeping " << sleep_time << " s after "
<< "changing " << RegStrMap[m_curr_reg];
Sleep(sleep_time);
}
}
bool reg_op = ((m_curr_op == WriteReg) || (m_curr_op == ReadReg));
if (!reg_op || !isRegCacheable(m_curr_reg))
return;
......@@ -257,6 +266,16 @@ bool SerialLine::getRegCacheVal(Reg reg, int& val)
return in_cache;
}
double SerialLine::getRegSleepTime(Reg reg)
{
DEB_MEMBER_FUNCT();
RegDoubleMapType::const_iterator it = RegSleepMap.find(reg);
bool in_map = (it != RegSleepMap.end());
double sleep_time = in_map ? it->second : 0;
DEB_RETURN() << DEB_VAR1(sleep_time);
return sleep_time;
}
void SerialLine::flush()
{
DEB_MEMBER_FUNCT();
......
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