-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix: fix temperature with a floating point.
The start gcode macros in recent versions of Cura format the print temperature as a floating point. Other temperature commands in the gcode don't have such behavior. On Finder (version 1?) with the more recent firmware, this causes the temperature to be the fixed to start at 185C, which appears to be the "default start temperature" or some rounding error when reading the floating point temperature. This commit fixes that by parsing the 'M104 SXXX' commands, and changing the temperature by converting it to integer. This also allows the temperature to be embedded to the .gx file header. I took the opportunity to move the parsing commands into the gx.py script, as a way to potentially easy the proccess to make this a standalone script that can potentially be used by other slicers/software. Fixes #21 Related to #2 and #16
- Loading branch information
Showing
4 changed files
with
101 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import unittest | ||
from gx import GX | ||
|
||
test_gcode = """;FLAVOR:Marlin | ||
;TIME:1066 | ||
;Filament used: 0.681442m | ||
;Layer height: 0.12 | ||
;MINX:-14 | ||
;MINY:-14 | ||
;MINZ:0.2 | ||
;MAXX:14 | ||
;MAXY:14 | ||
;MAXZ:10.04 | ||
;TARGET_MACHINE.NAME:Flashforge Finder | ||
;Generated with Cura_SteamEngine 5.6.0 | ||
M82 ;absolute extrusion mode | ||
M140 S0 | ||
M104 S195.0 T0 | ||
M104 S0 T1 | ||
M107 | ||
G90 | ||
G28 | ||
M132 X Y Z A B | ||
G1 Z50.00 F400 | ||
G161 X Y F3300 | ||
M6 T0 | ||
M907 X100 Y100 Z40 A80 B20 | ||
M108 T0 | ||
G1 Z.20 F400 | ||
G92 E0 | ||
G92 E0 | ||
G1 F1800 E-1.3 | ||
;LAYER_COUNT:83 | ||
;LAYER:0 | ||
M106 S255 | ||
G0 F3000 X14 Y9.314 Z0.2""" | ||
|
||
class TestGX(unittest.TestCase): | ||
|
||
def test_from_gcode(self): | ||
gx = GX.from_gcode(test_gcode) | ||
result = gx.encode().decode('latin1') | ||
print("Resulting gcode: ", result) | ||
self.assertFalse(' S195.0 ' in result) | ||
self.assertTrue(' S195 ' in result) | ||
self.assertTrue('xgcode' in result) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |