-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update DisplayInfoOnLCD.py #18774
base: main
Are you sure you want to change the base?
Update DisplayInfoOnLCD.py #18774
Conversation
2e5cd5f
to
3cd4efb
Compare
3cd4efb
to
2061fba
Compare
Most of these changes were requested by #18766 while other are because I'm unable to keep my fingers out of it. |
Bug fix for "remaining_time". Affected M118 and M73_time Update DisplayInfoOnLCD.py Add options for Time-to-pause to include Filament Change. Update DisplayInfoOnLCD.py Make M117 optional. Combine M73 R and M73 P lines into a single line. Add A and P parameters for M118 lines. Update DisplayInfoOnLCD A TouchUp. Update DisplayInfoOnLCD.py TouchUp Update DisplayInfoOnLCD.py TuneUp
2061fba
to
da0fe19
Compare
Should not have been included.
I see no reason why Remco and Casper have to be the only ones horrified by my coding style. |
if add_m118_line: | ||
if add_m118_a1 and not add_m118_p0: | ||
m118_str = "M118 A1 " | ||
if add_m118_p0 and not add_m118_a1: | ||
m118_str = "M118 P0 " | ||
if add_m118_p0 and add_m118_a1: | ||
m118_str = "M118 A1 P0 " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be a bit simplified either like below
if add_m118_line: | |
if add_m118_a1 and not add_m118_p0: | |
m118_str = "M118 A1 " | |
if add_m118_p0 and not add_m118_a1: | |
m118_str = "M118 P0 " | |
if add_m118_p0 and add_m118_a1: | |
m118_str = "M118 A1 P0 " | |
if add_m118_line: | |
if add_m118_a1: | |
m118_str += "A1 " | |
if add_m118_p0: | |
m118_str += "P0 " |
Or, you can check for both conditions being true at the same time in the first if, then use elif for individual conditions.
if add_m118_a1 and not add_m118_p0: | ||
m118_str = m118_text.replace("M118 ","M118 A1 ") | ||
if add_m118_p0 and not add_m118_a1: | ||
m118_str = m118_text.replace("M118 ","M118 P0 ") | ||
if add_m118_p0 and add_m118_a1: | ||
m118_str = m118_text.replace("M118 ","M118 A1 P0 ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elif variation, first checks for both being true, otherwise goes for the other conditions.
if add_m118_a1 and not add_m118_p0: | |
m118_str = m118_text.replace("M118 ","M118 A1 ") | |
if add_m118_p0 and not add_m118_a1: | |
m118_str = m118_text.replace("M118 ","M118 P0 ") | |
if add_m118_p0 and add_m118_a1: | |
m118_str = m118_text.replace("M118 ","M118 A1 P0 ") | |
if add_m118_p0 and add_m118_a1: | |
m118_str = m118_text.replace("M118 ","M118 A1 P0 ") | |
elif add_m118_p0: | |
m118_str = m118_text.replace("M118 ","M118 P0 ") | |
elif add_m118_a1: | |
m118_str = m118_text.replace("M118 ","M118 A1 ") |
Did a quick check to share the horror :P But I'm not familiar enough with the code to make a full review on it. |
Thanks for looking anyway. |
Revised the M118 lines and insertion point in the gcode. Revised M117 same. Added nozzle size and filament type to data[0]
Added "global_stack" variable.
Bug fix.
Bug fix for "remaining_time".
Affected M118 and M73_time
Bug was pointed out in #18766
Description
This repairs a problem with M118 lines being added if "remaining_time" was not selected. The bug affected M118 and M73_time insertions.
There was a request to add the "A" and "P" parameters to the M118 lines as they might be required by Octoprint.
Adding M117 is now an option.
This fixes... OR This improves... -->
Type of change
How Has This Been Tested?
Cura 5.7beta and 4.13.1
Test Configuration:
Checklist: