From 710d2d38a1bd616f59fd1a5dcd812819b64a9272 Mon Sep 17 00:00:00 2001 From: DivingDuck Date: Thu, 12 Sep 2024 23:30:07 +0200 Subject: [PATCH 1/4] Add test file for repeated prints --- testfiles/quicktest.dxf | 418 ++++++++++++++++++++++++++++++++++++++ testfiles/quicktest.gcode | 38 ++++ 2 files changed, 456 insertions(+) create mode 100644 testfiles/quicktest.dxf create mode 100644 testfiles/quicktest.gcode diff --git a/testfiles/quicktest.dxf b/testfiles/quicktest.dxf new file mode 100644 index 000000000..b6110fccd --- /dev/null +++ b/testfiles/quicktest.dxf @@ -0,0 +1,418 @@ +0 +SECTION +2 +HEADER +9 +$INSUNITS +70 +4 +9 +$ACADVER +1 +AC1014 +9 +$HANDSEED +5 +FFFF +0 +ENDSEC +0 +SECTION +2 +TABLES +0 +TABLE +2 +VPORT +5 +8 +100 +AcDbSymbolTable +0 +ENDTAB +0 +TABLE +2 +LTYPE +5 +5 +100 +AcDbSymbolTable +0 +LTYPE +5 +14 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +2 +BYBLOCK +70 +0 +0 +LTYPE +5 +15 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +2 +BYLAYER +70 +0 +0 +ENDTAB +0 +TABLE +2 +LAYER +5 +2 +100 +AcDbSymbolTable +70 +2 +0 +LAYER +5 +50 +100 +AcDbSymbolTableRecord +100 +AcDbLayerTableRecord +2 +0 +70 +0 +6 +CONTINUOUS +0 +ENDTAB +0 +TABLE +2 +STYLE +5 +3 +100 +AcDbSymbolTable +70 +1 +0 +STYLE +5 +11 +100 +AcDbSymbolTableRecord +100 +AcDbTextStyleTableRecord +2 +STANDARD +70 +0 +0 +ENDTAB +0 +TABLE +2 +VIEW +5 +6 +100 +AcDbSymbolTable +70 +0 +0 +ENDTAB +0 +TABLE +2 +UCS +5 +7 +100 +AcDbSymbolTable +70 +0 +0 +ENDTAB +0 +TABLE +2 +APPID +5 +9 +100 +AcDbSymbolTable +70 +2 +0 +APPID +5 +12 +100 +AcDbSymbolTableRecord +100 +AcDbRegAppTableRecord +2 +ACAD +70 +0 +0 +ENDTAB +0 +TABLE +2 +DIMSTYLE +5 +A +100 +AcDbSymbolTable +70 +1 +0 +ENDTAB +0 +TABLE +2 +BLOCK_RECORD +5 +1 +100 +AcDbSymbolTable +70 +1 +0 +BLOCK_RECORD +5 +1F +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord +2 +*MODEL_SPACE +0 +BLOCK_RECORD +5 +1B +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord +2 +*PAPER_SPACE +0 +ENDTAB +0 +ENDSEC +0 +SECTION +2 +BLOCKS +0 +BLOCK +5 +20 +100 +AcDbEntity +100 +AcDbBlockBegin +2 +*MODEL_SPACE +0 +ENDBLK +5 +21 +100 +AcDbEntity +100 +AcDbBlockEnd +0 +BLOCK +5 +1C +100 +AcDbEntity +100 +AcDbBlockBegin +2 +*PAPER_SPACE +0 +ENDBLK +5 +1D +100 +AcDbEntity +100 +AcDbBlockEnd +0 +ENDSEC +0 +SECTION +2 +ENTITIES +0 +LWPOLYLINE +5 +100 +100 +AcDbEntity +8 +0 +100 +AcDbPolyline +90 +12 +70 +1 +43 +0.0 +10 +-20.000000000000007 +20 +50.000000000000007 +10 +19.999999999999989 +20 +50.000000000000007 +10 +20 +20 +5.5511151231257827e-15 +10 +16.999999999999989 +20 +9.8280962319814762e-15 +10 +16.999999999999986 +20 +3.0000000000000098 +10 +14.999999999999984 +20 +3.000000000000008 +10 +14.99999999999998 +20 +-4.9107620221003759e-15 +10 +-14.99999999999998 +20 +4.9107620221003735e-15 +10 +-15.000000000000002 +20 +2.9999999999999893 +10 +-17 +20 +2.9999999999999916 +10 +-17.000000000000004 +20 +-3.655686818890702e-15 +10 +-20.000000000000021 +20 +1.2212453270876722e-14 +0 +LWPOLYLINE +5 +101 +100 +AcDbEntity +8 +0 +100 +AcDbPolyline +90 +4 +70 +1 +43 +0.0 +10 +-38.000000000000028 +20 +40.000000000000007 +10 +-30.000000000000018 +20 +40.000000000000007 +10 +-30 +20 +32.000000000000014 +10 +-38.000000000000028 +20 +32.000000000000014 +0 +LINE +5 +102 +100 +AcDbEntity +8 +0 +100 +AcDbLine +10 +0 +20 +0 +30 +0 +11 +-9.9920072216264089e-15 +21 +50.000000000000007 +31 +0 +0 +ENDSEC +0 +SECTION +2 +OBJECTS +0 +DICTIONARY +5 +C +100 +AcDbDictionary +3 +ACAD_GROUP +350 +D +3 +ACAD_MLINESTYLE +350 +17 +0 +DICTIONARY +5 +D +100 +AcDbDictionary +0 +DICTIONARY +5 +1A +330 +C +100 +AcDbDictionary +0 +DICTIONARY +5 +17 +100 +AcDbDictionary +0 +ENDSEC +0 +EOF diff --git a/testfiles/quicktest.gcode b/testfiles/quicktest.gcode new file mode 100644 index 000000000..ce50d9f45 --- /dev/null +++ b/testfiles/quicktest.gcode @@ -0,0 +1,38 @@ +G28 +G0 Z10.0000 S0 +G90 +G21 +G0 F2000 +G0 Z 7.0000 +G0 X 38.0000 Y 70.0000 +G4 P0 +G1 Z5.0000 S0 +G4 P0 +G1 F1000.0000 +G1 X 78.0000 Y 70.0000 +G1 X 78.0000 Y 20.0000 +G1 X 75.0000 Y 20.0000 +G1 X 75.0000 Y 23.0000 +G1 X 73.0000 Y 23.0000 +G1 X 73.0000 Y 20.0000 +G1 X 43.0000 Y 20.0000 +G1 X 43.0000 Y 23.0000 +G1 X 41.0000 Y 23.0000 +G1 X 41.0000 Y 20.0000 +G1 X 38.0000 Y 20.0000 +G1 X 38.0000 Y 70.0000 +G4 P0 +G0 Z10.0000 S0 +G0 Z 7.0000 +G0 X 20.0000 Y 60.0000 +G1 Z 5.0000 +G1 X 28.0000 Y 60.0000 +G1 X 28.0000 Y 52.0000 +G1 X 20.0000 Y 52.0000 +G1 X 20.0000 Y 60.0000 + +G0 Z10.0000 +G0 X5.0000 +G0 Y5.0000 +M84; motors off + From e04d6ea149b7dd01def1248db5150c7149f07404 Mon Sep 17 00:00:00 2001 From: DivingDuck Date: Thu, 12 Sep 2024 23:40:04 +0200 Subject: [PATCH 2/4] Add old behavior of M110 back and combine it with the actual behavior of Prusa firmware >3.12.x --- printrun/printcore.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/printrun/printcore.py b/printrun/printcore.py index f0f3da8f5..0845052a6 100644 --- a/printrun/printcore.py +++ b/printrun/printcore.py @@ -416,7 +416,17 @@ def startprint(self, gcode, startindex = 0): return True self.clear = False - self._send("M110 N-1") + + '''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 + ''' + #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, @@ -675,7 +685,17 @@ def _sendnext(self): if not self.paused: self.queueindex = 0 self.lineno = 0 - self._send("M110 N-1") + + '''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 + ''' + #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) From 6f41202f7eaeea6833ea5d67a3fc4c830011cac4 Mon Sep 17 00:00:00 2001 From: DivingDuck Date: Sat, 12 Oct 2024 11:01:04 +0200 Subject: [PATCH 3/4] Code cleaning, update comment, updated gcode test files --- printrun/printcore.py | 24 +++++++++++------------- testfiles/arc_test.gcode | 21 +++++++++++++++++++++ testfiles/quicktest.gcode | 17 ++++++++++++----- 3 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 testfiles/arc_test.gcode diff --git a/printrun/printcore.py b/printrun/printcore.py index 0845052a6..52672be31 100644 --- a/printrun/printcore.py +++ b/printrun/printcore.py @@ -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, @@ -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) diff --git a/testfiles/arc_test.gcode b/testfiles/arc_test.gcode new file mode 100644 index 000000000..46364e419 --- /dev/null +++ b/testfiles/arc_test.gcode @@ -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 \ No newline at end of file diff --git a/testfiles/quicktest.gcode b/testfiles/quicktest.gcode index ce50d9f45..643d83bfc 100644 --- a/testfiles/quicktest.gcode +++ b/testfiles/quicktest.gcode @@ -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 @@ -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 From fdc25e52995db9c17ce032cdecef86abf2b6fab5 Mon Sep 17 00:00:00 2001 From: DivingDuck Date: Sat, 12 Oct 2024 21:12:34 +0200 Subject: [PATCH 4/4] Remove comments --- printrun/printcore.py | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/printrun/printcore.py b/printrun/printcore.py index 52672be31..042c94efa 100644 --- a/printrun/printcore.py +++ b/printrun/printcore.py @@ -416,16 +416,7 @@ def startprint(self, gcode, startindex = 0): return True self.clear = False - - '''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", -1, True) #all in one if Prusa works with "N-1 M110 N-1 + checksum" + self._send("M110 N-1", -1, True) resuming = (startindex != 0) self.print_thread = threading.Thread(target = self._print, @@ -684,16 +675,7 @@ def _sendnext(self): if not self.paused: self.queueindex = 0 self.lineno = 0 - - '''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", -1, True) #all in one if Prusa works with "N-1 M110 N-1 + checksum" + self._send("M110 N-1", -1, True) def _send(self, command, lineno = 0, calcchecksum = False): # Only add checksums if over serial (tcp does the flow control itself)