summaryrefslogtreecommitdiff
path: root/src/camera/veyeimx287m.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/camera/veyeimx287m.cpp')
-rw-r--r--src/camera/veyeimx287m.cpp48
1 files changed, 46 insertions, 2 deletions
diff --git a/src/camera/veyeimx287m.cpp b/src/camera/veyeimx287m.cpp
index 4556112..83ad32f 100644
--- a/src/camera/veyeimx287m.cpp
+++ b/src/camera/veyeimx287m.cpp
@@ -426,6 +426,7 @@ std::optional<float> VeyeIMX287m::get_gain()
bool VeyeIMX287m::set_triggerExposureDelay(const std::chrono::microseconds us)
{
using namespace veye::imx287m;
+ std::cout << __func__ << ": " << us << std::endl;
return m_i2c->write(static_cast<uint16_t>(Register::Trigger_Exp_Delay), us.count());
}
@@ -442,6 +443,49 @@ std::optional<const std::chrono::microseconds> VeyeIMX287m::get_triggerExposureD
return std::chrono::microseconds{*value};
}
+bool VeyeIMX287m::set_isBlackLevelManual(const bool manual)
+{
+ using namespace veye::imx287m;
+ std::cout << __func__ << ": " << manual << std::endl;
+ return m_i2c->write(static_cast<uint16_t>(Register::BLC_Mode),
+ static_cast<uint32_t>(manual
+ ? BlackLevelCalibrationMode::ManuallySpecified
+ : BlackLevelCalibrationMode::AutomaticOrDefault));
+}
+
+std::optional<bool> VeyeIMX287m::get_isBlackLevelManual()
+{
+ using namespace veye::imx287m;
+
+ const auto value = m_i2c->read(static_cast<uint32_t>(Register::BLC_Mode));
+
+ if (!value) {
+ return {};
+ }
+
+ return *value == static_cast<uint32_t>(BlackLevelCalibrationMode::ManuallySpecified);
+}
+
+bool VeyeIMX287m::set_blackLevel(const uint32_t level)
+{
+ using namespace veye::imx287m;
+ std::cout << __func__ << ": " << level << std::endl;
+ return m_i2c->write(static_cast<uint16_t>(Register::Black_Level), level);
+}
+
+std::optional<uint32_t> VeyeIMX287m::get_blackLevel()
+{
+ using namespace veye::imx287m;
+
+ const auto value = m_i2c->read(static_cast<uint32_t>(Register::Black_Level));
+
+ if (!value) {
+ return {};
+ }
+
+ return value;
+}
+
bool VeyeIMX287m::openCam()
{
m_cam_fd = open(videoDevice, O_RDWR);
@@ -739,7 +783,7 @@ void VeyeIMX287m::calcPixelsLoop(std::stop_token stopToken)
tmp.insert(tmp.begin(), p.cbegin(), p.cend());
}
// dumpCalibrationPixels(m_calibrationPixels);
- dumpCalibrationPixels(tmp, DumpFormat::Binary);
+ op::dumpCalibrationPixels(tmp, op::DumpFormat::Binary);
m_calibrationPixels.clear();
}
}
@@ -760,7 +804,7 @@ bool VeyeIMX287m::dequeueImageBuffer(size_t &imageIndex)
// TODO: move this shit to some beautiful place
if (elapsedTime > 1000. && processedCounter != 0) {
- if (false) {
+ if (true) {
fprintf(stderr,
"fps: %d\tdropped: %lu sec: %ld "
"dq: %lu get: %lu rot: %lu pix: %lu sum: %lu corr: "