Commit 67108cfa authored by Alejandro Homs's avatar Alejandro Homs

* Support Frelon Hamamatsu with its unique Frame-Transfer-Mode:

  * Allow cameras to not have a default input channel on FFM,
    try FTM as well in Frelon::Interface::resetDefaults
  * Do not divide FrameDim height by 2 in FTM if isHama()
parent 9289e83d
......@@ -84,6 +84,9 @@ enum FrameTransferMode {
FFM = 0, FTM = 1,
};
typedef std::map<FrameTransferMode, std::string> FTMStrMapType;
extern FTMStrMapType FTMNameMap;
enum InputChan {
Chan1 = (1 << 0),
Chan2 = (1 << 1),
......
......@@ -53,7 +53,7 @@ class Camera : public HwMaxImageSizeCallbackGen
TimingCtrl& getTimingCtrl();
void getDefInputChan(FrameTransferMode ftm, InputChan& input_chan);
bool getDefInputChan(FrameTransferMode ftm, InputChan& input_chan);
void setInputChan(InputChan input_chan);
void getInputChan(InputChan& input_chan);
......
......@@ -125,6 +125,7 @@ class Model
bool isSPB2();
int getAdcBits();
ChipType getChipType();
bool isHama();
bool hasTaper();
bool hasModesAvail();
bool hasTimeCalc();
......@@ -146,6 +147,7 @@ class Model
bool m_valid;
ChipType m_chip_type;
bool m_is_hama;
bool m_modes_avail;
bool m_time_calc;
bool m_htd_cmd;
......
......@@ -76,6 +76,10 @@ extern MultiLineCmdStrMapType MultiLineCmdStrMap;
enum FrameTransferMode {
FFM = 0, FTM = 1,
};
/*
typedef std::map<FrameTransferMode, std::string> FTMStrMapType;
extern FTMStrMapType FTMNameMap;
*/
enum InputChan {
Chan1 = 1 /*(1 << 0)*/,
......
......@@ -47,7 +47,7 @@ class Camera
Frelon::TimingCtrl& getTimingCtrl();
void getDefInputChan(Frelon::FrameTransferMode ftm,
bool getDefInputChan(Frelon::FrameTransferMode ftm,
Frelon::InputChan& input_chan /Out/);
void setInputChan(Frelon::InputChan input_chan);
void getInputChan(Frelon::InputChan& input_chan /Out/);
......
......@@ -76,6 +76,7 @@ class Model
bool isSPB2();
int getAdcBits();
int getChipType();
bool isHama();
bool hasTaper();
bool hasModesAvail();
bool hasTimeCalc();
......
......@@ -145,6 +145,13 @@ MultiLineCmdStrMapType
lima::Frelon::MultiLineCmdStrMap(C_LIST_ITERS(MLCmdStrCList));
typedef pair<FrameTransferMode, string> FTMStrPair;
static const FTMStrPair FTMNameCList[] = {
FTMStrPair(FFM, "FFM"),
FTMStrPair(FTM, "FTM"),
};
FTMStrMapType lima::Frelon::FTMNameMap(C_LIST_ITERS(FTMNameCList));
typedef pair<FrameTransferMode, ChanRange> RangePair;
static const RangePair FTMChanRangeCList[] = {
RangePair(FFM, ChanRange(1, 10)),
......
......@@ -330,7 +330,7 @@ string Camera::getInputChanModeName(FrameTransferMode ftm,
DEB_STATIC_FUNCT();
ostringstream os;
os << ((ftm == FTM) ? "FTM" : "FFM") << "-";
os << FTMNameMap[ftm] << "-";
string sep;
for (int chan = 1; chan <= 4; chan++) {
int chan_bit = 1 << (chan - 1);
......@@ -383,7 +383,7 @@ void Camera::calcChanMode(FrameTransferMode ftm, InputChan input_chan,
int& chan_mode)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR2(ftm, DEB_HEX(input_chan));
DEB_PARAM() << DEB_VAR2(FTMNameMap[ftm], DEB_HEX(input_chan));
calcBaseChanMode(ftm, chan_mode);
const InputChanList& chan_list = FTMInputChanListMap[ftm];
......@@ -419,13 +419,13 @@ void Camera::calcFTMInputChan(int chan_mode, FrameTransferMode& ftm,
int base_chan_mode;
calcBaseChanMode(ftm, base_chan_mode);
input_chan = FTMInputChanListMap[ftm][chan_mode - base_chan_mode];
DEB_RETURN() << DEB_VAR2(ftm, DEB_HEX(input_chan));
DEB_RETURN() << DEB_VAR2(FTMNameMap[ftm], DEB_HEX(input_chan));
}
void Camera::getDefInputChan(FrameTransferMode ftm, InputChan& input_chan)
bool Camera::getDefInputChan(FrameTransferMode ftm, InputChan& input_chan)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(ftm);
DEB_PARAM() << DEB_VAR1(FTMNameMap[ftm]);
int modes_avail = getModesAvail();
......@@ -445,13 +445,18 @@ void Camera::getDefInputChan(FrameTransferMode ftm, InputChan& input_chan)
break;
}
if (!valid_mode)
THROW_HW_ERROR(Error) << "Could not find valid " << ftm
<< "mode: "
<< DEB_VAR1(DEB_HEX(modes_avail));
if (!valid_mode) {
DEB_WARNING() << "Could not find default input_chan for "
<< FTMNameMap[ftm] << ": "
<< DEB_VAR1(DEB_HEX(modes_avail));
DEB_RETURN() << DEB_VAR1(valid_mode);
} else {
DEB_RETURN() << DEB_VAR2(valid_mode, DEB_HEX(input_chan))
<< " [" << getInputChanModeName(ftm, input_chan)
<< "]";
}
DEB_RETURN() << DEB_VAR1(DEB_HEX(input_chan))
<< " [" << getInputChanModeName(ftm, input_chan) << "]";
return valid_mode;
}
void Camera::setInputChan(InputChan input_chan)
......@@ -481,7 +486,7 @@ void Camera::getInputChan(InputChan& input_chan)
void Camera::setFrameTransferMode(FrameTransferMode ftm)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(ftm);
DEB_PARAM() << DEB_VAR1(FTMNameMap[ftm]);
FrameTransferMode prev_ftm;
getFrameTransferMode(prev_ftm);
......@@ -498,9 +503,11 @@ void Camera::setFrameTransferMode(FrameTransferMode ftm)
setChanMode(chan_mode);
} catch (...) {
DEB_TRACE() << DEB_VAR1(DEB_HEX(input_chan))
<< " not available in " << DEB_VAR1(ftm);
<< " not available in " << FTMNameMap[ftm];
DEB_TRACE() << " Trying default input channel";
getDefInputChan(ftm, input_chan);
if (!getDefInputChan(ftm, input_chan))
THROW_HW_ERROR(Error) << "No input channel found for "
<< FTMNameMap[ftm];
calcChanMode(ftm, input_chan, chan_mode);
setChanMode(chan_mode);
}
......@@ -526,7 +533,7 @@ void Camera::getFrameTransferMode(FrameTransferMode& ftm)
ftm = it->first;
const ChanRange& range = it->second;
if ((chan_mode >= range.first) && (chan_mode < range.second)) {
DEB_RETURN() << DEB_VAR1(ftm);
DEB_RETURN() << DEB_VAR1(FTMNameMap[ftm]);
return;
}
}
......@@ -551,7 +558,7 @@ void Camera::getFrameDim(FrameDim& frame_dim)
getMaxFrameDim(frame_dim);
FrameTransferMode ftm;
getFrameTransferMode(ftm);
if (ftm == FTM)
if ((ftm == FTM) && !m_model.isHama())
frame_dim /= Point(1, 2);
DEB_RETURN() << DEB_VAR1(frame_dim);
......
......@@ -851,9 +851,12 @@ void Interface::resetDefaults()
stopAcq();
m_cam.setFrameTransferMode(FFM);
FrameTransferMode ftm;
InputChan input_chan;
m_cam.getDefInputChan(FFM, input_chan);
if (!m_cam.getDefInputChan(ftm=FFM, input_chan) &&
!m_cam.getDefInputChan(ftm=FTM, input_chan))
THROW_HW_ERROR(Error) << "Cannot find default input channel!!";
m_cam.setFrameTransferMode(ftm);
m_cam.setInputChan(input_chan);
m_flip.setFlip(Flip(false));
......
......@@ -201,6 +201,7 @@ void Model::update()
m_chip_type = ChipType(getSerialNbParam(SPB2Type) >> 12);
else
m_chip_type = bool(getSerialNbParam(SPB1Kodak)) ? Kodak : Atmel;
m_is_hama = (m_chip_type == Hama);
bool firm_v2_0c = (is_spb2 && (m_firmware >= Firmware::v2_0c));
m_htd_cmd = firm_v2_0c;
......@@ -214,8 +215,8 @@ void Model::update()
bool firm_v3_1c = (is_spb2 && (m_firmware >= Firmware::v3_1c));
m_images_per_eof = firm_v3_1c;
DEB_TRACE() << DEB_VAR5(m_chip_type, m_modes_avail, m_time_calc,
m_good_htd, m_images_per_eof);
DEB_TRACE() << DEB_VAR6(m_chip_type, m_is_hama, m_modes_avail,
m_time_calc, m_good_htd, m_images_per_eof);
}
bool Model::isValid()
......@@ -296,6 +297,16 @@ ChipType Model::getChipType()
return m_chip_type;
}
bool Model::isHama()
{
DEB_MEMBER_FUNCT();
checkValid();
DEB_RETURN() << DEB_VAR1(m_is_hama);
return m_is_hama;
}
bool Model::hasTaper()
{
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