Update DisplayProgressOnLCD.py

Support for Octoprint via M118 A1 P1 action:notification command when using BTREETECH TFT
- ETA
- % advance
This commit is contained in:
Iñigo Martinez Lasala 2021-11-30 19:07:35 +01:00 committed by GitHub
parent ab2cbbfecc
commit e5e774cd33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,6 +112,9 @@ 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
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") lines.insert(line_index, "M73 P0")
elif line.startswith(";TIME_ELAPSED:"): elif line.startswith(";TIME_ELAPSED:"):
@ -178,6 +186,9 @@ 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
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)) lines.insert(percentage_line_index, "M73 P{}".format(output))
previous_layer_end_percentage = layer_end_percentage previous_layer_end_percentage = layer_end_percentage