mirror of
https://github.com/BKLronin/touchCNC.git
synced 2024-11-27 02:54:02 +01:00
Fixed missing gcode commands queue
added txt logging
This commit is contained in:
parent
b4b743a9d0
commit
0c771a96e5
13
cnc.py
13
cnc.py
@ -236,7 +236,7 @@ def grblWrite():
|
|||||||
switchButtonState(button)
|
switchButtonState(button)
|
||||||
fopen.config(bg = 'grey')
|
fopen.config(bg = 'grey')
|
||||||
|
|
||||||
def timedPositionRequest():# >Im Falle das kein GCODE gestremed wird< Abfragen der Momentanen Position nach 1000ms sendet über den "byPass" channel der den GCode Stream nicht beeinflusst
|
def timedPositionRequest():# >Im Falle das kein GCODE gestreamed wird abfragen der momentanen Position nach 1000ms sendet über den "byPass" channel der den GCode Stream nicht beeinflusst
|
||||||
if grbl != 0 and freetosend == 1:
|
if grbl != 0 and freetosend == 1:
|
||||||
grbl_command = '?'
|
grbl_command = '?'
|
||||||
byPass(grbl_command)
|
byPass(grbl_command)
|
||||||
@ -254,7 +254,7 @@ def now_bufferGRBL(grbl_command):
|
|||||||
|
|
||||||
def byPass(grbl_command):
|
def byPass(grbl_command):
|
||||||
global writebuffer_byPass
|
global writebuffer_byPass
|
||||||
#print (grbl_command)
|
#print (grbl_command)
|
||||||
if grbl_command == '?':
|
if grbl_command == '?':
|
||||||
grbl.write(str.encode(grbl_command)) # Send g-code block to grbl
|
grbl.write(str.encode(grbl_command)) # Send g-code block to grbl
|
||||||
grbl_out = grbl.readline().strip()
|
grbl_out = grbl.readline().strip()
|
||||||
@ -277,7 +277,7 @@ def debugWrite(grbl_command):
|
|||||||
infoScreen(grbl_out)
|
infoScreen(grbl_out)
|
||||||
print(grbl_out)
|
print(grbl_out)
|
||||||
|
|
||||||
def sendGRBL():
|
def sendGRBL(): #Komplette Gcodes streamen senden
|
||||||
global writebuffer
|
global writebuffer
|
||||||
global freetosend
|
global freetosend
|
||||||
|
|
||||||
@ -286,17 +286,22 @@ def sendGRBL():
|
|||||||
#print ("current",writebuffer[0])
|
#print ("current",writebuffer[0])
|
||||||
#print (writebuffer)
|
#print (writebuffer)
|
||||||
grbl.write(str.encode(writebuffer[0])) # Send g-code block to grbl
|
grbl.write(str.encode(writebuffer[0])) # Send g-code block to grbl
|
||||||
|
#writeToFileLog(writebuffer[0])
|
||||||
#grbl.timeout = None
|
#grbl.timeout = None
|
||||||
readbuffer.append(grbl.readline().strip()) # Wait for grbl response with carriage return
|
readbuffer.append(grbl.readline().strip()) # Wait for grbl response with carriage return
|
||||||
del writebuffer[0]
|
del writebuffer[0]
|
||||||
|
|
||||||
if len(readbuffer) == 5:
|
if len(readbuffer) == 5:
|
||||||
writebuffer.insert(2,'?')
|
writebuffer.insert(2,'?' + '\n') #newline need?
|
||||||
displayPosition()
|
displayPosition()
|
||||||
infoScreen(readbuffer[0])
|
infoScreen(readbuffer[0])
|
||||||
readbuffer.clear()
|
readbuffer.clear()
|
||||||
freetosend = 1
|
freetosend = 1
|
||||||
|
|
||||||
|
def writeToFileLog(log): #Log für Debugzwecke
|
||||||
|
with open("log.txt", 'a') as out:
|
||||||
|
out.write(log)
|
||||||
|
|
||||||
def displayPosition_request(grbl_pos):
|
def displayPosition_request(grbl_pos):
|
||||||
if grbl != 0 :
|
if grbl != 0 :
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user