-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathautomator.h
80 lines (66 loc) · 2.13 KB
/
automator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef AUTOMATOR_H
#define AUTOMATOR_H
#include <QObject>
#include "rayreceiver.h"
#include <QTimer>
class Automator : public QObject
{
Q_OBJECT
Q_PROPERTY(bool working READ working NOTIFY workingChanged)
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
Q_PROPERTY(QString message READ message NOTIFY messageChanged)
Q_PROPERTY(bool autosendB READ autosendB WRITE setAutosendB)
Q_PROPERTY(bool autosendPower READ autosendPower WRITE setAutosendPower)
Q_PROPERTY(float minPower READ minPower WRITE setMinPower)
Q_PROPERTY(float maxPower READ maxPower WRITE setMaxPower)
Q_PROPERTY(float lastSentPower READ lastSentPower NOTIFY changePower)
public:
explicit Automator(QObject *parent = nullptr);
bool working() const;
bool enabled() const;
void setEnabled(bool enabled);
QString message() const;
Q_INVOKABLE float compensate(float dz) const;
bool autosendB() const;
void setAutosendB(bool autosendB);
bool autosendPower() const;
void setAutosendPower(bool autosendPower);
float maxPower() const;
void setMaxPower(float maxPower);
float minPower() const;
void setMinPower(float minPower);
float lastSentPower() const;
signals:
void workingChanged();
void enabledChanged();
void messageChanged();
void sendToMC(const QString &command);
void changePower(float power);
public slots:
void ondzChanged(float dz);
void ondzValidChanged(bool valid);
void onMcConnectionStateChanged(bool connected);
void onRayConnectionStateChanged(bool connected);
void onCoordsChanged(float x, float y, float z, float b);
void onMcStateChanged(RayReceiver::State s);
private:
void checkWorkingState();
bool m_working;
float m_lastdz;
bool m_lastdzValid;
bool m_lastCoordsValid;
bool m_enabled;
bool m_mcConnected;
float m_mcs_x;
float m_mcs_y;
float m_mcs_b;
float m_mcs_b_initial;
QString m_message;
bool m_autosendB;
bool m_autosendPower;
float m_maxPower;
float m_minPower;
float m_lastSentPower;
QTimer m_powerTimer;
};
#endif // AUTOMATOR_H