diff --git a/CMakeLists.txt b/CMakeLists.txt index e915cc3..ccd29a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,5 +53,5 @@ set(PROJECT_SOURCES add_executable(MAClient ${PROJECT_SOURCES}) target_compile_options(MAClient PRIVATE "-std=gnu++17" "-Wall" "-O2" "-fno-strict-aliasing") -target_link_libraries(MAClient PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Concurrent ${OpenCV_LIBS} -luvoscam -luvosled -luvosunwrap -pthread) +target_link_libraries(MAClient PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Concurrent ${OpenCV_LIBS} -luvoscam -luvosled -luvosunwrap) target_include_directories(${PROJECT_NAME} PRIVATE ${OpenCV_INCLUDE_DIRS} src src/ui) diff --git a/src/cameras.cpp b/src/cameras.cpp index 15e7e85..cba009c 100644 --- a/src/cameras.cpp +++ b/src/cameras.cpp @@ -3,8 +3,7 @@ #include #include #include -#include -#include +#include #include Cameras::Cameras(uvosled* led): led_(led) @@ -81,7 +80,8 @@ bool Cameras::addCamera(const cam::Camera::Description& desc) camera->cam()->setAcquisitionMode(cam::Camera::MODE_FREE); camera->cam()->setFrameRate(10); camera->cam()->startAcquisition(); - std::this_thread::sleep_for (std::chrono::milliseconds(200)); + struct timespec tv = {0, 200000000}; + nanosleep(&tv, nullptr); camera->cam()->stopAcquisition(); cameras_.pop_back(); camera = nullptr; @@ -97,7 +97,7 @@ bool Cameras::addCamera(const cam::Camera::Description& desc) camera->cam()->setAcquisitionMode(cam::Camera::MODE_FREE); camera->cam()->setFrameRate(10); camera->cam()->startAcquisition(); - QTimer::singleShot(5000, [this, camera](){finishAddCamera(camera);}); + QTimer::singleShot(5000, [camera, this](){finishAddCamera(camera);}); } else { diff --git a/src/main.cpp b/src/main.cpp index 7b9f00a..075774e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,8 +6,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -24,8 +23,6 @@ const char* organziation = "UVOS"; const char* application = "UVOS"; const char* version = "UVOS"; -std::atomic closeSplash = false; - std::vector showCameraSelectionDialog(bool* accepted = nullptr) { std::vector ret; @@ -57,34 +54,24 @@ void showProfileDialog(Cameras* cameras) cameras->disable(false); } -void showSplash() -{ - QSplashScreen splash(QPixmap(":/images/splash.png")); - splash.show(); - while(!closeSplash) - { - splash.repaint(); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } -} - int main(int argc, char *argv[]) { Log::level = Log::WARN; - QApplication a(argc, argv); - QCoreApplication::setOrganizationName("UVOS"); - QCoreApplication::setOrganizationDomain("uvos.xyz"); - QCoreApplication::setApplicationName("LubircantThiknessMapperUi"); - QCoreApplication::setApplicationVersion("0.1"); - - std::thread splashThred(&showSplash); - uvosled led; int uvosledRet = uvosled_connect(&led); int ret; { + QApplication a(argc, argv); + QCoreApplication::setOrganizationName("UVOS"); + QCoreApplication::setOrganizationDomain("uvos.xyz"); + QCoreApplication::setApplicationName("LubircantThiknessMapperUi"); + QCoreApplication::setApplicationVersion("0.1"); + + QSplashScreen splash(QPixmap(":/images/splash.png")); + splash.show(); + QDir().mkpath(Profile::profileLocation()); qRegisterMetaType("cv::Mat"); @@ -101,7 +88,7 @@ int main(int argc, char *argv[]) uvosled_poweron(&led); // Give cameras some time to power on // TODO: figure out how to do this better - std::this_thread::sleep_for(std::chrono::seconds(10)); + sleep(10); } Cameras cameras(uvosledRet < 0 ? nullptr : &led); @@ -140,7 +127,7 @@ int main(int argc, char *argv[]) cameras.load(settings); - closeSplash = true; + splash.hide(); w.show(); if(uvosledRet < 0)