@@ -14,7 +14,7 @@ using namespace RPiController;
class CamHelperImx290 : public CamHelper
{
public:
- CamHelperImx290();
+ CamHelperImx290(unsigned int frameIntegrationDiff = kFrameIntegrationDiff);
uint32_t gainCode(double gain) const override;
double gain(uint32_t gainCode) const override;
unsigned int hideFramesStartup() const override;
@@ -25,10 +25,10 @@ private:
* Smallest difference between the frame length and integration time,
* in units of lines.
*/
- static constexpr int frameIntegrationDiff = 2;
+ static constexpr unsigned int kFrameIntegrationDiff = 2;
};
-CamHelperImx290::CamHelperImx290()
+CamHelperImx290::CamHelperImx290(unsigned int frameIntegrationDiff)
: CamHelper({}, frameIntegrationDiff)
{
}
@@ -61,7 +61,18 @@ static CamHelper *create()
return new CamHelperImx290();
}
+static CamHelper *createImx662()
+{
+ /*
+ * The imx662 requires a frame integration diff of at least 4,
+ * according to the datasheet, but in practice this didn't prevent
+ * bad black level values in HCG (high conversion gain) mode.
+ * So instead, we go with 6 for "safety".
+ */
+ return new CamHelperImx290(6);
+}
+
static RegisterCamHelper reg("imx290", &create);
static RegisterCamHelper reg327("imx327", &create);
static RegisterCamHelper reg462("imx462", &create);
-static RegisterCamHelper reg662("imx662", &create);
+static RegisterCamHelper reg662("imx662", &createImx662);