mirror of
https://github.com/BKLronin/touchCNC.git
synced 2024-12-22 14:44:01 +01:00
Compare commits
No commits in common. "0308d4796717450ac6f9cfc1b68632840296f1f9" and "9f798791c559347d56eb70c0d39e10295f17386a" have entirely different histories.
0308d47967
...
9f798791c5
34
README.md
34
README.md
@ -31,39 +31,7 @@ Should run on any System wit at least 1024x600 Screen Resolution.
|
||||
`python cnc_gerbil.py`
|
||||
or
|
||||
`cd dist`
|
||||
`./cnc_gerbil` (Bundled pyinstaller executable)
|
||||
|
||||
## Settings
|
||||
`nano settings.py`
|
||||
or any other editor to setup to your specific usecase, the options are:
|
||||
|
||||
- The resolution of your SBC-screen
|
||||
`resolution = '1024x600+0+0'`
|
||||
|
||||
|
||||
- When running on SBC with touch set to: True
|
||||
`set_fullscreen = False`
|
||||
|
||||
|
||||
- Platform dependent com ports
|
||||
`portlist = ['/dev/ttyUSB0', '/dev/ttyACM0', '/dev/ttyUSB1', '/dev/ttyACM1', '/dev/ttyACM2', '/dev/ttyACM3',
|
||||
'/dev/ttyS0', '/dev/ttyS1', '/dev/ttyS2', '/dev/ttyS3']`
|
||||
|
||||
|
||||
- Where the file dialog points to. Ideally some Nextcloud folder or Samba share etc.
|
||||
`basepath = '/home/'`
|
||||
|
||||
|
||||
- Machine commands
|
||||
`spindle_on = 'M3S1000' `
|
||||
`spindle_off = 'M5'`
|
||||
`cooling_on = 'M8' `
|
||||
`cooling_off = 'M9' `
|
||||
`toolchange = 'G10 P0 L20 X0 Y0 Z0' `
|
||||
|
||||
|
||||
- Table Info Text
|
||||
`table_text = 'Fräsbereich 300mm x 300mm'`
|
||||
`./cnc_gerbil`
|
||||
|
||||
### Based on:
|
||||
Python3
|
||||
|
@ -3,8 +3,7 @@ import time
|
||||
from tkinter import Button, Label, Variable, IntVar, Canvas, Frame, Listbox, Entry, Radiobutton, Tk, constants, LEFT
|
||||
from tkinter import filedialog as fd
|
||||
import os
|
||||
from grbl_streamer import GrblStreamer
|
||||
import settings
|
||||
from gerbil.gerbil import Gerbil
|
||||
|
||||
class touchCNC:
|
||||
def __init__(self, root):
|
||||
@ -314,7 +313,8 @@ class touchCNC:
|
||||
|
||||
def grblConnect2(self, baudrate=115200, max_retries=5, retry_interval=3):
|
||||
retry_count = 0
|
||||
locations = settings.portlist
|
||||
locations = ['/dev/ttyUSB0', '/dev/ttyACM0', '/dev/ttyUSB1', '/dev/ttyACM1', '/dev/ttyACM2', '/dev/ttyACM3',
|
||||
'/dev/ttyS0', '/dev/ttyS1', '/dev/ttyS2', '/dev/ttyS3']
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
@ -409,13 +409,13 @@ class touchCNC:
|
||||
|
||||
def get_grbl_command(self, CMD):
|
||||
if CMD == 'M3':
|
||||
return settings.spindle_on if self.states['M3'] == '1' else settings.spindle_off
|
||||
return 'M3 S1000' if self.states['M3'] == '1' else 'M5'
|
||||
|
||||
elif CMD == 'M8':
|
||||
return settings.cooling_on if self.states[CMD] == '1' else settings.cooling_off
|
||||
return CMD if self.states[CMD] == '1' else 'M9'
|
||||
|
||||
elif CMD == 'G10':
|
||||
return settings.toolchange
|
||||
return 'G10 P0 L20 X0 Y0 Z0'
|
||||
|
||||
elif CMD == '32':
|
||||
return '$32=0' if self.states['32'] == '1' else '$32=1'
|
||||
@ -428,7 +428,7 @@ class touchCNC:
|
||||
def openGCODE(self):
|
||||
filetypes = (('GCODE', '*.nc'), ('All files', '*.*'))
|
||||
if not self.file_list:
|
||||
GCODE = fd.askopenfilename(title='Open a file', initialdir=settings.basepath, filetypes=filetypes)
|
||||
GCODE = fd.askopenfilename(title='Open a file', initialdir='/home/', filetypes=filetypes)
|
||||
else:
|
||||
GCODE = self.load_gcode_from_listbox()
|
||||
|
||||
@ -471,7 +471,7 @@ class touchCNC:
|
||||
def openDir(self):
|
||||
self.file_list = []
|
||||
self.path_list = []
|
||||
directory = fd.askdirectory(title='Open a Folder', initialdir=settings.basepath)
|
||||
directory = fd.askdirectory(title='Open a Folder', initialdir='/home/')
|
||||
allowed_extensions = {'nc', 'GCODE'} # Use a set for efficient membership testing
|
||||
|
||||
if directory:
|
||||
@ -602,7 +602,7 @@ class DrawonTable:
|
||||
self.mill_table.delete('all')
|
||||
|
||||
self.mill_table.create_rectangle(50, 50, 350, 350, fill='white')
|
||||
self.mill_table.create_text(200, 25, text=settings.table_text)
|
||||
self.mill_table.create_text(200, 25, text='Fräsbereich 300mm x 300mm')
|
||||
|
||||
for x in range(50, 350, 50):
|
||||
self.mill_table.create_text(x, 400 - x, text=x - 50)
|
||||
@ -616,15 +616,16 @@ class DrawonTable:
|
||||
if __name__ == "__main__":
|
||||
root = Tk()
|
||||
root.title('touchCNC')
|
||||
root.geometry(settings.resolution)
|
||||
root.geometry('1024x600+0+0')
|
||||
root.grid_propagate(True)
|
||||
root.resizable(False, False) # 17203b
|
||||
root.attributes('-fullscreen', settings.set_fullscreen)
|
||||
root.attributes('-fullscreen', False)
|
||||
root.tk_setPalette(background='#4B4A67', foreground='black', activeBackground='#F99417',
|
||||
activeForeground='lightgrey')
|
||||
|
||||
|
||||
app = touchCNC(root)
|
||||
grbl = GrblStreamer(app.gui_callback)
|
||||
grbl = Gerbil(app.gui_callback)
|
||||
grbl.hash_state_requested = True
|
||||
grbl.gcode_parser_state_requested = True
|
||||
|
||||
|
22
dist/settings.py
vendored
22
dist/settings.py
vendored
@ -1,22 +0,0 @@
|
||||
|
||||
# The resolution of your SBC-screen
|
||||
resolution = '1024x600+0+0'
|
||||
|
||||
# When running on SBC with touch set to: True
|
||||
set_fullscreen = False
|
||||
|
||||
# Platform dependent
|
||||
portlist = ['/dev/ttyUSB0', '/dev/ttyACM0', '/dev/ttyUSB1', '/dev/ttyACM1', '/dev/ttyACM2', '/dev/ttyACM3',
|
||||
'/dev/ttyS0', '/dev/ttyS1', '/dev/ttyS2', '/dev/ttyS3']
|
||||
# Where the file dialog points to. Ideally some Nextcloud folder or Samba share etc.
|
||||
basepath = '/home/'
|
||||
|
||||
# Machine commands
|
||||
spindle_on = 'M3S1000'
|
||||
spindle_off = 'M5'
|
||||
cooling_on = 'M8'
|
||||
cooling_off = 'M9'
|
||||
toolchange = 'G10 P0 L20 X0 Y0 Z0'
|
||||
|
||||
# Table Info Text
|
||||
table_text = 'Fräsbereich 300mm x 300mm'
|
1
gcode_machine
Submodule
1
gcode_machine
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 624f71ae1549b13a94aec5c58b9bb0337346225f
|
1
gerbil
Submodule
1
gerbil
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 78aa148f0ae98c7dc686eeeb47e2040f40486dab
|
@ -1,5 +1,3 @@
|
||||
altgraph==0.17.4
|
||||
gcode-machine==1.0.3
|
||||
grbl-streamer==1.0.3
|
||||
numpy==1.26.2
|
||||
pyserial==3.5
|
||||
|
22
settings.py
22
settings.py
@ -1,22 +0,0 @@
|
||||
|
||||
# The resolution of your SBC-screen
|
||||
resolution = '1024x600+0+0'
|
||||
|
||||
# When running on SBC with touch set to: True
|
||||
set_fullscreen = False
|
||||
|
||||
# Platform dependent
|
||||
portlist = ['/dev/ttyUSB0', '/dev/ttyACM0', '/dev/ttyUSB1', '/dev/ttyACM1', '/dev/ttyACM2', '/dev/ttyACM3',
|
||||
'/dev/ttyS0', '/dev/ttyS1', '/dev/ttyS2', '/dev/ttyS3']
|
||||
# Where the file dialog points to. Ideally some Nextcloud folder or Samba share etc.
|
||||
basepath = '/home/'
|
||||
|
||||
# Machine commands
|
||||
spindle_on = 'M3S1000'
|
||||
spindle_off = 'M5'
|
||||
cooling_on = 'M8'
|
||||
cooling_off = 'M9'
|
||||
toolchange = 'G10 P0 L20 X0 Y0 Z0'
|
||||
|
||||
# Table Info Text
|
||||
table_text = 'Fräsbereich 300mm x 300mm'
|
Loading…
Reference in New Issue
Block a user