-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathencoder.h
More file actions
48 lines (35 loc) · 872 Bytes
/
encoder.h
File metadata and controls
48 lines (35 loc) · 872 Bytes
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
#ifndef ENCODER_H
#define ENCODER_H
#include <stdint.h>
#include <QObject>
#include <QString>
#include <QByteArray>
#include <QDebug>
#define pBINARY 2
class Encoder : public QObject
{
Q_OBJECT
private:
int id;
QByteArray rawData;
uint16_t position; // in 0.488um
uint8_t steps2mm;
bool OffsetCompensationFinished;
uint16_t origin;
uint16_t steps_to_mm(uint16_t dataInStepsUnits);
public:
explicit Encoder(int motorID, QObject *parent = 0);
~Encoder();
int GetID();
void Update(QByteArray dataFromMaster);
void UpdateCoordinate(uint16_t coord);
void UpdateOrigin(uint16_t coord);
uint16_t GetPosition();
uint8_t GetSteps2mm();
uint16_t GetOrigin();
void ResetSteps2mm();
signals:
void MotorCoordinateUpdated(int motorID, uint16_t newCoordinate);
public slots:
};
#endif // ENCODER_H