-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathencoder1.h
More file actions
43 lines (32 loc) · 779 Bytes
/
encoder1.h
File metadata and controls
43 lines (32 loc) · 779 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
#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:
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(QObject *parent = 0);
~Encoder();
void Update(QByteArray);
void UpdateCoordinate(QByteArray coordData);
void UpdateOrigin(QByteArray coordData);
int GetPosition();
uint8_t GetSteps2mm();
uint16_t GetOrigin();
void ResetSteps2mm();
signals:
void MotorCoordinateUpdated(uint16_t);
};
#endif // ENCODER_H