mirror of
https://github.com/workinghard/mmuGcodeParser.git
synced 2025-12-13 22:32:08 +00:00
lower ramming temperature when all filaments have same temp
This commit is contained in:
@@ -35,6 +35,7 @@ from io import open
|
|||||||
VERSION = "v0.1"
|
VERSION = "v0.1"
|
||||||
MYGCODEMARK = " ; MMUGCODEPARSER " + VERSION
|
MYGCODEMARK = " ; MMUGCODEPARSER " + VERSION
|
||||||
UNLOAD_START_LINE = "unloadStartLine"
|
UNLOAD_START_LINE = "unloadStartLine"
|
||||||
|
LOAD_START_LINE = "loadStartLine"
|
||||||
DEST_TEMP_LINE = "destTempLine"
|
DEST_TEMP_LINE = "destTempLine"
|
||||||
DEST_TEMP = "destTemp"
|
DEST_TEMP = "destTemp"
|
||||||
UNLOAD_LINE = "unloadLine"
|
UNLOAD_LINE = "unloadLine"
|
||||||
@@ -52,6 +53,7 @@ debug_set = False
|
|||||||
|
|
||||||
# Drop the temperature by 10C during the ramming process. Checking if it might help
|
# Drop the temperature by 10C during the ramming process. Checking if it might help
|
||||||
ram_temp_diff = 10
|
ram_temp_diff = 10
|
||||||
|
ram_temp_diff_wait_for_stabilize = False
|
||||||
|
|
||||||
# get the input file specified, and turn it into a path variable for the current OS
|
# get the input file specified, and turn it into a path variable for the current OS
|
||||||
inpath = sys.argv[1]
|
inpath = sys.argv[1]
|
||||||
@@ -72,8 +74,9 @@ unloading = r"^T[0-9]?"
|
|||||||
purge = r"^; CP TOOLCHANGE WIPE"
|
purge = r"^; CP TOOLCHANGE WIPE"
|
||||||
# 3. Print
|
# 3. Print
|
||||||
printLine = r"^; CP TOOLCHANGE END"
|
printLine = r"^; CP TOOLCHANGE END"
|
||||||
# 4. Before unload
|
# 4. Before unload/load
|
||||||
beforeUnload = r"^; CP TOOLCHANGE UNLOAD"
|
beforeUnload = r"^; CP TOOLCHANGE UNLOAD"
|
||||||
|
beforeLoad = r"^; CP TOOLCHANGE LOAD"
|
||||||
# 5. Target temperature
|
# 5. Target temperature
|
||||||
targetTemp = r"^M104 S([0-9]*)"
|
targetTemp = r"^M104 S([0-9]*)"
|
||||||
|
|
||||||
@@ -86,6 +89,7 @@ purge_detect = re.compile(purge)
|
|||||||
print_detect = re.compile(printLine)
|
print_detect = re.compile(printLine)
|
||||||
unloading_detect = re.compile(unloading)
|
unloading_detect = re.compile(unloading)
|
||||||
before_unload_detect = re.compile(beforeUnload)
|
before_unload_detect = re.compile(beforeUnload)
|
||||||
|
before_load_detect = re.compile(beforeLoad)
|
||||||
target_temp_detect = re.compile(targetTemp)
|
target_temp_detect = re.compile(targetTemp)
|
||||||
|
|
||||||
|
|
||||||
@@ -208,9 +212,22 @@ def none_handler(p_tool_change, p_line_number):
|
|||||||
if ram_temp_diff > 0: # Only if set
|
if ram_temp_diff > 0: # Only if set
|
||||||
# Add temp drop for better tip
|
# Add temp drop for better tip
|
||||||
lv_lower_temp = int(p_tool_change[CURR_TEMP]) - ram_temp_diff
|
lv_lower_temp = int(p_tool_change[CURR_TEMP]) - ram_temp_diff
|
||||||
|
if ram_temp_diff_wait_for_stabilize:
|
||||||
|
# wait for stable nozzle temp
|
||||||
|
lv_output = "M109 S" + str(lv_lower_temp)
|
||||||
|
else:
|
||||||
|
# set nozzle temp without wait
|
||||||
lv_output = "M104 S" + str(lv_lower_temp)
|
lv_output = "M104 S" + str(lv_lower_temp)
|
||||||
lv_insert = 1 # after the line
|
lv_insert = 1 # after the line
|
||||||
|
|
||||||
|
if p_tool_change[p_line_number] == LOAD_START_LINE:
|
||||||
|
if ram_temp_diff > 0: # Only if set
|
||||||
|
lv_restore_temp = int(p_tool_change[CURR_TEMP])
|
||||||
|
# don't wait for stable nozzle temperature
|
||||||
|
# (enough time for nozzle to reach correct temp)
|
||||||
|
lv_output = "M104 S" + str(lv_restore_temp)
|
||||||
|
lv_insert = 1
|
||||||
|
|
||||||
if p_tool_change[p_line_number] == DEST_TEMP_LINE:
|
if p_tool_change[p_line_number] == DEST_TEMP_LINE:
|
||||||
# nothing to do
|
# nothing to do
|
||||||
pass
|
pass
|
||||||
@@ -261,13 +278,20 @@ for line in infile:
|
|||||||
# create dictionary entry
|
# create dictionary entry
|
||||||
myToolChanges[toolChangeID] = myToolChange
|
myToolChanges[toolChangeID] = myToolChange
|
||||||
|
|
||||||
# Search for the 'before loading' position
|
# Search for the 'before unloading' position
|
||||||
before_unload_match = before_unload_detect.search(line)
|
before_unload_match = before_unload_detect.search(line)
|
||||||
if before_unload_match is not None:
|
if before_unload_match is not None:
|
||||||
if len(myToolChanges) > 0: # we found at least the start tool change
|
if len(myToolChanges) > 0: # we found at least the start tool change
|
||||||
# remember the line number
|
# remember the line number
|
||||||
myToolChanges[toolChangeID][line_number] = UNLOAD_START_LINE
|
myToolChanges[toolChangeID][line_number] = UNLOAD_START_LINE
|
||||||
|
|
||||||
|
# Search for the 'before loading' position
|
||||||
|
before_load_match = before_load_detect.search(line)
|
||||||
|
if before_load_match is not None:
|
||||||
|
if len(myToolChanges) > 0: # we found at least the start tool change
|
||||||
|
# remember the line number
|
||||||
|
myToolChanges[toolChangeID][line_number] = LOAD_START_LINE
|
||||||
|
|
||||||
# Search for the target temperature
|
# Search for the target temperature
|
||||||
targetTemp_match = target_temp_detect.search(line)
|
targetTemp_match = target_temp_detect.search(line)
|
||||||
if targetTemp_match is not None:
|
if targetTemp_match is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user