Commit 90ca5e67 authored by Leander Schulten's avatar Leander Schulten
Browse files

Add DriverDummy, fix Bugs with the HardwareInterface and the gui

parent 3a2cf94c
......@@ -40,6 +40,7 @@ ControlItem{
anchors.horizontalCenter: parent.horizontalCenter
}
onValueChanged: controlData.value = value
}
}
......
......@@ -52,20 +52,23 @@ private:
time += sleepTime.count()/1000.;
}
time = 0;
wait.wait(lock);
if(stopThread.load()==false){
wait.wait(lock);
}
}
}
protected:
virtual void setValuesDeviceDriver() = 0;
double time = 0;
public:
AbstractHardwareInterface():thread([this]{loop();}){}
AbstractHardwareInterface():thread([this]{loop();}),run(false),stopThread(false),sleepTime(33){}
virtual ~AbstractHardwareInterface(){
run = false;
stopThread = true;
wait.notify_all();
stopThread = false;
thread.join();
}
virtual void start()final override{wait.notify_all();}
virtual void start()final override{run=true;wait.notify_all();}
virtual void stop()final override{run = false;}
virtual void setWaitTime(std::chrono::milliseconds m) override{sleepTime = m;}
virtual std::chrono::milliseconds getWaitTime()const override{return sleepTime;}
......
......@@ -39,7 +39,8 @@ SOURCES += main.cpp \
dmxinterface.cpp \
errornotifier.cpp \
settings.cpp \
driver.cpp
driver.cpp \
test/DriverDummy.cpp
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
......@@ -78,7 +79,8 @@ HEADERS += \
HardwareInterface.h \
errornotifier.h \
settings.h \
driver.h
driver.h \
test/DriverDummy.h
# Default rules for deployment.
......
......@@ -129,9 +129,24 @@ int main(int argc, char *argv[])
// Treiber laden
#define USE_DUMMY_DRIVER
#ifndef USE_DUMMY_DRIVER
if(!Driver::loadAndStartDriver(settings.getDriverFilePath())){
ErrorNotifier::showError("Cant start driver.");
}
#else
#include "test/DriverDummy.h"
DriverDummy driver;
driver.setSetValuesCallback([](unsigned char* values, int size, double time){
DMXChannelFilter::initValues(values,size);
Programm::fill(values,size,time);
DMXChannelFilter::filterValues(values,size);
});
driver.setWaitTime(std::chrono::seconds(5));
driver.init();
driver.start();
#endif
//ControlPanel::getLastCreated()->addDimmerGroupControl();
......
Supports Markdown
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