mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Update DisplayProgressOnLCD.py
Support for Octoprint via M118 A1 P1 action:notification command when using BTREETECH TFT - ETA - % advance
This commit is contained in:
parent
ab2cbbfecc
commit
e5e774cd33
1 changed files with 16 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
# Cura PostProcessingPlugin
|
# Cura PostProcessingPlugin
|
||||||
# Author: Mathias Lyngklip Kjeldgaard, Alexander Gee, Kimmo Toivanen
|
# Author: Mathias Lyngklip Kjeldgaard, Alexander Gee, Kimmo Toivanen, Inigo Martinez
|
||||||
# Date: July 31, 2019
|
# Date: July 31, 2019
|
||||||
# Modified: Okt 22, 2020
|
# Modified: Nov 30, 2021
|
||||||
|
|
||||||
# Description: This plugin displays progress on the LCD. It can output the estimated time remaining and the completion percentage.
|
# Description: This plugin displays progress on the LCD. It can output the estimated time remaining and the completion percentage.
|
||||||
|
|
||||||
|
@ -37,7 +37,8 @@ class DisplayProgressOnLCD(Script):
|
||||||
"type": "enum",
|
"type": "enum",
|
||||||
"options": {
|
"options": {
|
||||||
"m117":"M117 - All printers",
|
"m117":"M117 - All printers",
|
||||||
"m73":"M73 - Prusa, Marlin 2"
|
"m73":"M73 - Prusa, Marlin 2",
|
||||||
|
"m118":"M118 - Octoprint"
|
||||||
},
|
},
|
||||||
"enabled": "time_remaining",
|
"enabled": "time_remaining",
|
||||||
"default_value": "m117"
|
"default_value": "m117"
|
||||||
|
@ -77,6 +78,10 @@ class DisplayProgressOnLCD(Script):
|
||||||
current_time_string = "{:d}h{:02d}m{:02d}s".format(int(h), int(m), int(s))
|
current_time_string = "{:d}h{:02d}m{:02d}s".format(int(h), int(m), int(s))
|
||||||
# And now insert that into the GCODE
|
# And now insert that into the GCODE
|
||||||
lines.insert(line_index, "M117 Time Left {}".format(current_time_string))
|
lines.insert(line_index, "M117 Time Left {}".format(current_time_string))
|
||||||
|
elif mode == "m118":
|
||||||
|
current_time_string = "{:d}h{:02d}m{:02d}s".format(int(h), int(m), int(s))
|
||||||
|
# And now insert that into the GCODE
|
||||||
|
lines.insert(line_index, "M118 A1 P0 action:notification Time Left {}".format(current_time_string))
|
||||||
else:
|
else:
|
||||||
mins = int(60 * h + m + s / 30)
|
mins = int(60 * h + m + s / 30)
|
||||||
lines.insert(line_index, "M73 R{}".format(mins))
|
lines.insert(line_index, "M73 R{}".format(mins))
|
||||||
|
@ -107,7 +112,10 @@ class DisplayProgressOnLCD(Script):
|
||||||
|
|
||||||
if output_percentage:
|
if output_percentage:
|
||||||
# Emit 0 percent to sure Marlin knows we are overriding the completion percentage
|
# Emit 0 percent to sure Marlin knows we are overriding the completion percentage
|
||||||
lines.insert(line_index, "M73 P0")
|
if output_time_method == "m118":
|
||||||
|
lines.insert(line_index, "M118 A1 P0 action:notification Data Left 0/100")
|
||||||
|
else:
|
||||||
|
lines.insert(line_index, "M73 P0")
|
||||||
|
|
||||||
elif line.startswith(";TIME_ELAPSED:"):
|
elif line.startswith(";TIME_ELAPSED:"):
|
||||||
# We've found one of the time elapsed values which are added at the end of layers
|
# We've found one of the time elapsed values which are added at the end of layers
|
||||||
|
@ -178,7 +186,10 @@ class DisplayProgressOnLCD(Script):
|
||||||
output = min(percentage + previous_layer_end_percentage, 100)
|
output = min(percentage + previous_layer_end_percentage, 100)
|
||||||
|
|
||||||
# Now insert the sanitized percentage into the GCODE
|
# Now insert the sanitized percentage into the GCODE
|
||||||
lines.insert(percentage_line_index, "M73 P{}".format(output))
|
if output_time_method == "m118":
|
||||||
|
lines.insert(percentage_line_index, "M118 A1 P0 action:notification Data Left {}/100".format(output))
|
||||||
|
else:
|
||||||
|
lines.insert(percentage_line_index, "M73 P{}".format(output))
|
||||||
|
|
||||||
previous_layer_end_percentage = layer_end_percentage
|
previous_layer_end_percentage = layer_end_percentage
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue