forked from zapmaker/GrblHoming
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgcodecontroller.cpp
48 lines (38 loc) · 1.13 KB
/
gcodecontroller.cpp
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
#include "gcodecontroller.h"
#include <QObject>
GCodeController::GCodeController()
{
}
void GCodeController::closePort(bool reopen)
{
port.CloseComport();
emit portIsClosed(reopen);
}
bool GCodeController::isPortOpen()
{
return port.isPortOpen();
}
// Abort means stop file send after the end of this line
void GCodeController::setAbort()
{
// cross-thread operation, only set one atomic variable in this method (bool in this case) or add critsec
abortState.set(true);
}
// Reset means immediately stop waiting for a response
void GCodeController::setReset()
{
// cross-thread operation, only set one atomic variable in this method (bool in this case) or add critsec
resetState.set(true);
}
// Shutdown means app is shutting down - we give thread about .3 sec to exit what it is doing
void GCodeController::setShutdown()
{
// cross-thread operation, only set one atomic variable in this method (bool in this case) or add critsec
shutdownState.set(true);
}
void GCodeController::trimToEnd(QString& strline, QChar ch)
{
int pos = strline.indexOf(ch);
if (pos != -1)
strline = strline.left(pos);
}