Update DisplayInfoOnLCD.py

Add pause count notification

Update DisplayInfoOnLCD.py

Moved some line insertions to accommodate newer Creality firmware.

Change DisplayFIlename and DIsplayProgress

Add messages to use DIsplay Info and add exit code.

Update DisplayInfoOnLCD.py

Some changes
This commit is contained in:
GregValiant 2023-10-16 14:22:10 -04:00
parent c40dad5119
commit cd6e583f43
3 changed files with 101 additions and 8 deletions

View file

@ -0,0 +1,37 @@
# Cura PostProcessingPlugin
# Author: Amanda de Castilho
# Date: August 28, 2018
# Modified: November 16, 2018 by Joshua Pope-Lewis
# Description: This plugin is now an option in 'Display Info on LCD'
from ..Script import Script
from UM.Application import Application
from UM.Message import Message
class DisplayFilenameAndLayerOnLCD(Script):
def initialize(self) -> None:
Message(title = "[Display Filename and Layer on LCD]", text = "This script is now an option in 'Display Info on LCD'. This post processor no longer works.").show()
def getSettingDataString(self):
return """{
"name": "Display Filename And Layer On LCD",
"key": "DisplayFilenameAndLayerOnLCD",
"metadata": {},
"version": 2,
"settings":
{
"enable_script":
{
"label": "Deprecated/Obsolete",
"description": "This script is now included in 'Display Info on LCD'.",
"type": "bool",
"default_value": true
}
}
}"""
def execute(self, data):
Message(title = "[Display Filename and Layer on LCD]", text = "This post is now included in 'Display Info on LCD'. This script will exit.").show()
data[0] += "; [Display Filename and Layer on LCD] Did not run. It is now included in 'Display Info on LCD'.\n"
return data

View file

@ -134,7 +134,7 @@ class DisplayInfoOnLCD(Script):
"countdown_to_pause":
{
"label": "Countdown to Pauses",
"description": "Instead of layer number and remaining print time the LCD will show 'layers remaining before pause' and 'Est Time to Pause' (ETP).",
"description": "When enabled - DisplayInfoOnLCD must run AFTER all PauseAtHeight and Filament Change scripts. Instead of layer number and remaining print time the LCD will show 'layers remaining before pause/filament change and the time to pause/filament change' (TP).",
"type": "bool",
"default_value": false,
"enabled": "display_option == 'display_progress'"
@ -229,17 +229,33 @@ class DisplayInfoOnLCD(Script):
if line.startswith(";TIME:"):
tindex = lines.index(line)
cura_time = int(line.split(":")[1])
print_time = cura_time*speed_factor
print_time = cura_time * speed_factor
hhh = print_time/3600
hr = round(hhh // 1)
mmm = round((hhh % 1) * 60)
orig_hhh = cura_time/3600
orig_hr = round(orig_hhh // 1)
orig_mmm = round((orig_hhh % 1) * 60)
if add_m118_line: lines.insert(tindex+1,"M118 Adjusted Print Time " + str(hr) + "hr " + str(mmm) + "min")
lines.insert(tindex+1,"M117 ET " + str(hr) + "hr " + str(mmm) + "min")
orig_min = int((cura_time - (orig_hr * 3600))/60) # Not rounded up
orig_mmm = round((orig_hhh % 1) * 60) # Rounded up
orig_sec = round(cura_time - orig_hr * 3600 - orig_min * 60)
if add_m118_line: lines.insert(tindex + 3,"M118 Adjusted Print Time " + str(hr) + "hr " + str(mmm) + "min")
lines.insert(tindex + 3,"M117 ET " + str(hr) + "hr " + str(mmm) + "min")
# If Countdown to pause is enabled then count the pauses and/or filament changes
pause_str = ""
if bool(self.getSettingValueByKey("countdown_to_pause")):
pause_count = 0
filament_change_count = 0
for num in range(2,len(data) - 1, 1):
if "PauseAtHeight.py" in data[num]:
pause_count += 1
if "M600" in data[num]:
filament_change_count += 1
if pause_count > 0:
pause_str = f" with {pause_count} pause(s)"
if filament_change_count > 0:
pause_str += f" and {filament_change_count} filament change(s)"
# This line goes in to convert seconds to hours and minutes
lines.insert(tindex+1, f";Cura Time: {orig_hr}hr {orig_mmm}min")
lines.insert(tindex + 3, f";Cura Time Estimate: {cura_time}sec = {orig_hr}hr {orig_min}min {orig_sec}sec {pause_str}")
data[0] = "\n".join(lines)
data[len(data)-1] += "M117 Orig Cura Est " + str(orig_hr) + "hr " + str(orig_mmm) + "min\n"
if add_m118_line: data[len(data)-1] += "M118 Est w/FudgeFactor " + str(speed_factor * 100) + "% was " + str(hr) + "hr " + str(mmm) + "min\n"
@ -328,7 +344,7 @@ class DisplayInfoOnLCD(Script):
if line.startswith(";TIME_ELAPSED:"):
this_time = (float(line.split(":")[1]))*speed_factor
time_list.append(str(this_time))
if "PauseAtHeight.py" in layer:
if "PauseAtHeight.py" in layer or "M600" in layer:
for qnum in range(num - 1, pause_index, -1):
time_list[qnum] = str(float(this_time) - float(time_list[qnum])) + "P"
pause_index = num-1

View file

@ -0,0 +1,40 @@
# Cura PostProcessingPlugin
# Author: Mathias Lyngklip Kjeldgaard, Alexander Gee, Kimmo Toivanen, Inigo Martinez
# Date: July 31, 2019
# Modified: Nov 30, 2021
# Description: This plugin displays progress on the LCD. It can output the estimated time remaining and the completion percentage.
from ..Script import Script
import re
import datetime
from UM.Message import Message
class DisplayProgressOnLCD(Script):
def initialize(self) -> None:
Message(title = "[Display Progress on LCD]", text = "This script is now an option in 'Display Info on LCD'. This post processor no longer works.").show()
def getSettingDataString(self):
return """{
"name": "Display Progress On LCD",
"key": "DisplayProgressOnLCD",
"metadata": {},
"version": 2,
"settings":
{
"enable_script":
{
"label": "Deprecated/Obsolete",
"description": "This script is now included in 'Display Info on LCD'.",
"type": "bool",
"default_value": true
}
}
}"""
def execute(self, data):
Message(title = "[Display Progress on LCD]", text = "This post is now included in 'Display Info on LCD'. This script will exit.").show()
data[0] += "; [Display Progress on LCD] Did not run. It is now included in 'Display Info on LCD'.\n"
return data