Update cnc.py

writelock and path
This commit is contained in:
Thomas Herrmann 2021-09-08 11:45:49 +02:00
parent a503c3b778
commit 387384d992

8
cnc.py
View File

@ -139,7 +139,7 @@ def openGCODE():
global GCODE global GCODE
filetypes = (('GCODE', '*.nc'),('All files', '*.*')) filetypes = (('GCODE', '*.nc'),('All files', '*.*'))
GCODE = fd.askopenfile(title='Open a file', initialdir='/home/thomas/NEXTCLOUD/CAM/', filetypes=filetypes) GCODE = fd.askopenfile(title='Open a file', initialdir='/home/thomas/Nextcloud/CAM/', filetypes=filetypes)
if GCODE != 0: if GCODE != 0:
fopen.config(bg= loaded) fopen.config(bg= loaded)
@ -221,10 +221,10 @@ def sendGRBL(grbl_command):
#infoScreen("finished") #infoScreen("finished")
def displayPosition(): def displayPosition():
if grbl != 0 : if grbl != 0 and freetosend == 1:
grbl_command = '?' grbl_command = '?'
position = str(sendGRBL(grbl_command)) position = str(sendGRBL(grbl_command))
print(position) #print(position)
position = position.replace('Idle|', ',') position = position.replace('Idle|', ',')
position = position.replace('Run|', ',') position = position.replace('Run|', ',')
position = position.replace('WPos:', '') position = position.replace('WPos:', '')
@ -233,7 +233,7 @@ def displayPosition():
position = position.replace('|', ',') position = position.replace('|', ',')
position.strip() position.strip()
coordinates_list = position.split(',') coordinates_list = position.split(',')
print(coordinates_list) #print(coordinates_list)
try: try:
show_ctrl_x.config(text = coordinates_list[1]) show_ctrl_x.config(text = coordinates_list[1])
show_ctrl_y.config(text = coordinates_list[2]) show_ctrl_y.config(text = coordinates_list[2])