parent
11068c9352
commit
74aba4f4fa
@ -0,0 +1,6 @@
|
||||
#include "command.h"
|
||||
|
||||
Command::Command()
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
#ifndef COMMAND_H
|
||||
#define COMMAND_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class Command
|
||||
{
|
||||
public:
|
||||
Command();
|
||||
virtual void exec() = 0;
|
||||
};
|
||||
|
||||
#endif // COMMAND_H
|
@ -0,0 +1,18 @@
|
||||
#ifndef DATAPOLLCOMMAND_H
|
||||
#define DATAPOLLCOMMAND_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "command.h"
|
||||
#include "src/MLX90640_API.h"
|
||||
|
||||
class DataPollCommand : public QObject, public Command
|
||||
{
|
||||
protected:
|
||||
MLX90640* _thermal;
|
||||
public:
|
||||
DataPollCommand(MLX90640* thermal) : _thermal(thermal){}
|
||||
void exec() override {_thermal->getData();}
|
||||
};
|
||||
|
||||
#endif // DATAPOLLCOMMAND_H
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,24 @@
|
||||
#include "pollingtimer.h"
|
||||
#include <chrono>
|
||||
|
||||
void PollingTimer::start(){
|
||||
shouldRun = true;
|
||||
}
|
||||
|
||||
void PollingTimer::stop(){
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
void PollingTimer::doLoop(){
|
||||
std::chrono::steady_clock::time_point begin;
|
||||
std::chrono::steady_clock::time_point end;
|
||||
|
||||
while(shouldRun){
|
||||
begin = std::chrono::steady_clock::now();
|
||||
_c->exec();
|
||||
end = std::chrono::steady_clock::now();
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::microseconds((this->timeout)
|
||||
- std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count()));
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
#ifndef POLLINGTIMER_H
|
||||
#define POLLINGTIMER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
#include "command.h"
|
||||
|
||||
class PollingTimer
|
||||
{
|
||||
protected:
|
||||
std::atomic<bool> shouldRun;
|
||||
std::thread* myThread;
|
||||
|
||||
Command* _c;
|
||||
|
||||
unsigned int timeout;
|
||||
void doLoop();
|
||||
public:
|
||||
PollingTimer(Command* c) : shouldRun(false), _c(c){}
|
||||
void start();
|
||||
void stop();
|
||||
};
|
||||
|
||||
#endif // POLLINGTIMER_H
|
@ -0,0 +1,6 @@
|
||||
#include "thermaldatarenderer.h"
|
||||
|
||||
ThermalDataRenderer::ThermalDataRenderer()
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
#ifndef THERMALDATARENDERER_H
|
||||
#define THERMALDATARENDERER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QColor>
|
||||
|
||||
class ThermalDataRenderer
|
||||
{
|
||||
bool direct = false;
|
||||
QVector<QColor> renderBuffer;
|
||||
float minValue = 0.0f;
|
||||
float maxValue = 0.0f;
|
||||
public:
|
||||
ThermalDataRenderer();
|
||||
};
|
||||
|
||||
#endif // THERMALDATARENDERER_H
|
Loading…
Reference in new issue