Skip to content

Commit

Permalink
Code cleaning, update comment, updated gcode test files
Browse files Browse the repository at this point in the history
  • Loading branch information
DivingDuck committed Oct 12, 2024
1 parent 5ac78fe commit 6f41202
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 18 deletions.
24 changes: 11 additions & 13 deletions printrun/printcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,15 @@ def startprint(self, gcode, startindex = 0):

self.clear = False

'''Reset Gcode line number for printer
'''Reset Gcode line number for printer, pls. see issue #1421.
Actual Prusa firmware >3.12.x needs "M110 N-1"
Smoothieware firmware needs "N-1 M110"
Old Marlin firmware 1.0.0 needs in addition line checksum
self._send("M110 N-1", -1, True) work for Smoothieware and old Marlin firmware.
Test for Prusa is needed
self._send("M110 N-1", -1, True) results in sending "N-1 M110 N-1*125"
and do not harm Smoothieware and old Marlin firmware.
Test for Prusa is needed.
'''
#self._send("M110 N-1") #Prusa firmware >3.12.x
self._send("M110 N-1", -1, True) #all in one if Prusa works with "N-1 M110 N-1 + checksum"
#self._send("M110", -1, True) #older or other firmware, like Smoothieware + Marlin 1.0 needs checksum in addition

resuming = (startindex != 0)
self.print_thread = threading.Thread(target = self._print,
Expand Down Expand Up @@ -686,16 +685,15 @@ def _sendnext(self):
self.queueindex = 0
self.lineno = 0

'''Reset Gcode Line number for Printer
Actual Prusa firmware >3.12.x needs "M110 N-1"
Smoothieware firmware needs "N-1 M110"
Old Marlin firmware 1.0.0 needs in addition line checksum
self._send("M110 N-1", -1, True) work for Smoothieware and old Marlin firmware.
Test for Prusa is needed
'''Reset Gcode line number for printer, pls. see issue #1421.
Actual Prusa firmware >3.12.x needs "M110 N-1"
Smoothieware firmware needs "N-1 M110"
Old Marlin firmware 1.0.0 needs in addition line checksum
self._send("M110 N-1", -1, True) results in sending "N-1 M110 N-1*125"
and do not harm Smoothieware and old Marlin firmware.
Test for Prusa is needed.
'''
#self._send("M110 N-1") #Prusa firmware >3.12.x
self._send("M110 N-1", -1, True) #all in one if Prusa works with "N-1 M110 N-1 + checksum"
#self._send("M110", -1, True) #older or other firmware, like Smoothieware + Marlin 1.0 needs checksum in addition

def _send(self, command, lineno = 0, calcchecksum = False):
# Only add checksums if over serial (tcp does the flow control itself)
Expand Down
21 changes: 21 additions & 0 deletions testfiles/arc_test.gcode
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
; Print this file for a quick test of support for arc movements with
; G2 and G3 and z helix movement up and down +- 10 mm, 6 times a full cycle
; It takes only a half minute and prints above the print bed (z=20 mm)
; w/o heating and extrusion

G28 ; home
G0 Z10.0000 S0 ; lift z
G90 ; absolute mode
G21 ; set unit to mm

G2 X15 Y20 I30 J40 Z20 F8000
G3 X15 Y20 I30 J40 Z10 F8000
G2 X15 Y20 I30 J40 Z20 F8000
G3 X15 Y20 I30 J40 Z10 F8000
G2 X15 Y20 I30 J40 Z20 F8000
G3 X15 Y20 I30 J40 Z10 F8000

G0 X5.0000
G0 Y5.0000

M84; motors off
17 changes: 12 additions & 5 deletions testfiles/quicktest.gcode
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
G28
G0 Z10.0000 S0
G90
G21
; Print this little gcode file for a quick test for repeated prints
; Area needed from homing position: x78 y70 z10 mm
; It takes only a half minute and prints above the print bed (z=7 mm)
; w/o heating and extrusion

G28 ; home
G0 Z10.0000 S0 ; lift z
G90 ; absolute mode
G21 ; set unit to mm

G0 F2000
G0 Z 7.0000
G0 X 38.0000 Y 70.0000
Expand Down Expand Up @@ -34,5 +40,6 @@ G1 X 20.0000 Y 60.0000
G0 Z10.0000
G0 X5.0000
G0 Y5.0000
M84; motors off

M84 ; motors off

0 comments on commit 6f41202

Please sign in to comment.