Merge branch 'patch-1' of https://github.com/inigoml/Cura into inigoml-patch-1

This commit is contained in:
Ghostkeeper 2022-02-16 12:46:47 +01:00
commit 5fc89b6053
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -1,7 +1,7 @@
# Cura PostProcessingPlugin
# Author: Mathias Lyngklip Kjeldgaard, Alexander Gee, Kimmo Toivanen
# Author: Mathias Lyngklip Kjeldgaard, Alexander Gee, Kimmo Toivanen, Inigo Martinez
# 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.
@ -37,7 +37,8 @@ class DisplayProgressOnLCD(Script):
"type": "enum",
"options": {
"m117":"M117 - All printers",
"m73":"M73 - Prusa, Marlin 2"
"m73":"M73 - Prusa, Marlin 2",
"m118":"M118 - Octoprint"
},
"enabled": "time_remaining",
"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))
# And now insert that into the GCODE
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:
mins = int(60 * h + m + s / 30)
lines.insert(line_index, "M73 R{}".format(mins))
@ -107,6 +112,9 @@ class DisplayProgressOnLCD(Script):
if output_percentage:
# Emit 0 percent to sure Marlin knows we are overriding the completion percentage
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:"):
@ -178,6 +186,9 @@ class DisplayProgressOnLCD(Script):
output = min(percentage + previous_layer_end_percentage, 100)
# Now insert the sanitized percentage into the GCODE
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