-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathmainwindow.h
138 lines (101 loc) · 2.45 KB
/
mainwindow.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#ifndef __MAINWINDOWH
#define __MAINWINDOWH
#include <QWidget>
#include <fstream>
#include <stdint.h>
#include <QList>
class MyThread;
class QwtPlotCurve;
class QwtPlot;
class QStatusBar;
class QCheckBox;
class QTreeWidget;
class QTreeWidgetItem;
class QTabWidget;
class QComboBox;
class QPushButton;
class QLineEdit;
class TabPID;
class TabRaw;
class TabEEPROM;
class TabVeltest;
//class QextSerialPort;
class SerialDeviceEnumerator;
class AbstractSerial;
class QTimer;
#include <QMap>
//user choices:
//#define USE_QEXTSERIALPORT //if comment QSerialDevice will be used
//#define DONTUSE_QSERIALDEVICEENUMERATE //OSX fix for QSerialDevice
#ifndef USE_QEXTSERIALPORT
#define USE_QSERIALDEVICE
#endif
#ifdef USE_QEXTSERIALPORT
#include "qextserialport.h"
#include <qextserialenumerator.h>
#endif
#ifdef USE_QSERIALDEVICE
#include <abstractserial.h>
#endif
class MainWindow : public QWidget
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
void send(QString text);
void sendGcode(const QString &text); //wait for "ok"
QStringList sendcodes;
QMap<QString, float> variables;
bool wait_reply;
bool endstopfound;
public slots:
void clickedConnect();
void clickedDisconnect();
void clickedRefresh();
void slotRead();
void manualSend();
void measure();
void setHotend1Temp();
void sendPID();
void getPID();
//void quit();
void processReply();
void EEPROM_loadClicked();
void EEPROM_writeClicked();
void EEPROM_storeClicked();
void EEPROM_resetClicked();
void EEPROM_factorResetClicked();
signals:
void newSerialData();
private:
QStatusBar *status;
QTabWidget *tab;
TabPID *tabPID;
TabRaw *tabRaw;
TabEEPROM *tabEEPROM;
TabVeltest *tabVeltest;
QComboBox *portSelector;
QComboBox *baudSelector;
QPushButton *btConnect;
QPushButton *btDisconnect;
QPushButton *btRescan;
#ifdef USE_QEXTSERIALPORT
QextSerialPort *comport;
#endif
#ifdef USE_QSERIALDEVICE
AbstractSerial *comport;
#endif
QString serialBuffer; //so only full lines are handed to the next stuff.
QTimer *timer;
private: //functions
void initSerial();
void openSerial();
void closeSerial();
void getdata(const QString &line,const QString &after, const QString &key,float &target);
void getdata(const QString &line,const QString &after, const QString &key,QLineEdit *target);
QByteArray serialBinBuffer;
QString readSinceLastSend;
bool pidloaded;
};
#endif