From 5df63c0bc7e3d6f1850d04f5bafbae2dd6fa619e Mon Sep 17 00:00:00 2001 From: Nikita Kostovsky Date: Fri, 14 Nov 2025 21:05:12 +0100 Subject: organize things a bit, populate ICamera --- src/main.cpp | 61 ++++++------------------------------------------------------ 1 file changed, 6 insertions(+), 55 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 60e4668..5a7d701 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,17 +13,15 @@ #include "LibCamera.h" #include "calibration.h" -#include "camera/innomakerov9281.h" -#include "camera/ov9281.h" #include "camera/veye_i2c.h" #include "camera/veyeimx287m.h" #include "dumps.h" #include "fuck_intel.h" #include "genetic_algos.h" -#include "httpservice.h" #include "imagealgos.h" #include "laser.h" #include "macro.h" +#include "protocols/httpserver.h" // #include "pigpio.h" #include "printerclient.h" #include "profile.h" @@ -179,34 +177,6 @@ int main(int argc, char* argv[]) QList> initializers; -#ifdef INNO_MAKER - if (false) - { - std::cout << std::boolalpha; - InnoMakerOV9281 innoMakerCam; - qDebug() << "init:" << innoMakerCam.init(); - // qDebug() << "set exposure:" << innoMakerCam.setExposureTimeUs(3000000); - qDebug() << "set exposure:" << innoMakerCam.setExposureTimeUs(10000); - qDebug() << "set gain:" << innoMakerCam.setGain(2); - - innoMakerCam.startStream(); - QThread::sleep(3); - qDebug() << "should be stopped"; - // Image buf; - - // for (size_t i = 0; i < 1000; ++i) { - // if (!innoMakerCam.getImage(buf)) { - // break; - // } - - // buf.rotate(); - // auto pixels = buf.pixels(); - // } - } - // qDebug() << "ok"; - // exit(EXIT_SUCCESS); -#endif - // if (false) qDebug() << "size of raw profile" << sizeof(Pixels); if (false) { @@ -400,11 +370,6 @@ int main(int argc, char* argv[]) qDebug() << "msecs before camera:" << t.elapsed(); // FIXME: don't use one var for everything int ret; -#ifndef INNO_MAKER - std::unique_ptr cm = - std::make_unique(); - cm->start(); -#endif // const auto cameras = cm->cameras(); // const auto cameras = OV9281::search(cm); // const auto cameras = InnoMakerOV9281::search(); @@ -414,21 +379,14 @@ int main(int argc, char* argv[]) if (cameras.empty()) { std::cerr << "No cameras were identified on the system." << std::endl; -#ifndef INNO_MAKER - cm->stop(); -#endif return EXIT_FAILURE; } auto camera = cameras.at(0); -#ifndef INNO_MAKER - camera->printControls(); -#endif - std::cout << "connect everything" << std::endl; - camera->newPixels.connect(&onNewPixels); + // camera->newPixels.connect(&onNewPixels); // camera->newImage.connect(&onNewImage); // camera->newImageCallback = &onNewImage; camera->newPixelsCallback = &onNewPixels; @@ -439,10 +397,6 @@ int main(int argc, char* argv[]) if (!camera->startStream()) { -#ifndef INNO_MAKER - cm->stop(); -#endif - return EXIT_FAILURE; } @@ -634,7 +588,8 @@ int main(int argc, char* argv[]) // qDebug() << "set new exposure time:" << value; // requested_params.exposureTime = value; - if (!camera->setExposureTimeUs(value)) { + if (!camera->set_exposureTime( + std::chrono::microseconds(value))) { qDebug() << "cannot set exp"; return QHttpServerResponse::StatusCode:: RequestRangeNotSatisfiable; @@ -643,13 +598,13 @@ int main(int argc, char* argv[]) if (json.contains(gainKey)) { - const int32_t value{json[gainKey].toInt()}; + const auto value = json[gainKey].toDouble(); if (value == 0) return QHttpServerResponse::StatusCode:: RequestRangeNotSatisfiable; - if (!camera->setGain(value)) + if (!camera->set_gain(value)) return QHttpServerResponse::StatusCode:: RequestRangeNotSatisfiable; } @@ -683,10 +638,6 @@ int main(int argc, char* argv[]) auto result = app.exec(); -#ifndef INNO_MAKER - cm->stop(); -#endif - return result; } -- cgit v1.2.3-70-g09d2