-
Notifications
You must be signed in to change notification settings - Fork 0
/
controldock.h
73 lines (50 loc) · 1.36 KB
/
controldock.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
#ifndef CONTROLDOCK_H
#define CONTROLDOCK_H
#include <QDockWidget>
#include <QTimer>
#include "packet.h"
#include "ui_controldock.h"
#define MAX_TARGET_POSITION 20000
#define MM_PER_STEP 0.005
#define COARSE_STEP 5
#define MAX_THRESHOLD 1023
#define THRESHOLD_PER_STEP 0.00477028347
#define MAX_VOLTAGE 1007
#define VOLTAGE_PER_STEP 1.19165839126
#define TIMEOUT_MS 200
class ControlDock : public QDockWidget, private Ui::ControlDock
{
Q_OBJECT
private:
int targetPosition;
bool amplifierState = false;
bool laserState = false;
QTimer positionTimer;
QTimer voltageTimer;
QTimer thresholdTimer;
void connectObjects();
void setupSlider();
void updateTargetPosition();
private slots:
void onFineLeftClicked();
void onCoarseLeftClicked();
void onFineRightClicked();
void onCoarseRightClicked();
void onHomeClicked();
void onPositionSliderMoved();
void onValueEntered();
void onVoltageSliderMoved();
void onThresholdSliderMoved();
void onAmplifierButtonClicked();
void onLaserButtonClicked();
void sendTargetPosition();
void sendVoltage();
void sendThreshold();
public slots:
void onPacketReceived(std::shared_ptr<Packet>);
signals:
void sendPacket(std::shared_ptr<SendablePacket>);
public:
explicit ControlDock(QWidget *parent = nullptr);
};
#endif // ControlDock_H