Hi, i tested your macro, works great so far - Thank you for the macro!
May i ask for a feature request:
When i use the print progress, all leds are switched off and i have no light in my case.
Would it be possible to add another type of progess with all leds on ( i.e white ) and only chage the colour of the corresponding led# to the progress percentage is switched to red or green or whatever ( maybe configurable with parameter? )
At the beginning when using progess, all leds are off - i would prefer to switch on the 1st led even if the print starts and is at 0 or 1% - what do you think?
Yes, I could extend the option to colors, âbackgroundâ color, âforegroundâ color and so on. But, after I see led_effects plugin, I promised myself that I keep this as simple as I could
If you want a red âbackgroundâ color for print progress change the line 99 from here to:
1.0, 0.0, 0.0, 0.0
The colors are in order RED, GREEN, BLUE, WHITE (for RGB neopixel, white values is igored)
About the second request with one led on: that means I must lie about the progress. The first led will be turn on only after 1/total_leds from print are done.
I made some code optimization and add the option to clear the current template in order to use SET_LED command. All changes are in a new beta branch. Fell free to test it and share your feedback.
Interesting. Just as an FYI, you can invoke other display_templates from a display_template. Not sure if that would simplify your examples. For example (totally untested):
[display_template get_bed_temp]
text:
{ printer.heater_bed.target }
[display_template led_progress]
param_led_num: 0
param_led_total: 1
param_ratio_tmpl: ""
text:
{% set ratio = render(param_ratio_tmpl)|float %}
{% set led_ratio = param_led_num|float / param_led_total %}
{% if ratio > led_ratio %}
{led_ratio}, 0.0, 0.0, 0.0
{% else %}
0.0, 0.0, 0.0, 0.0
{% endif %}
And (again totally untested): SET_LED_TEMPLATE LED={led} INDEX={i+1} TEMPLATE={'led_' ~ type ~ '_' ~ mode} param_led_num={i+1} param_led_total={my_neopixel.chain_count|int} param_ratio_tmpl="\"get_bed_temp\""
First of all, thank you Kevin for your feedback. Coming from the one who started this wonderful firmware gives me wings.
Based on your example I finally understand how render() works and Iâm already starting to think about how it can be used in my macros.
And one question: I read in a dev comment from a klipper commit that display template has 2 fps refresh rate. Consider increasing the fps in the future or this will load the CPU too much?
Thanks. I havenât run any tests with a higher update rate. You can change the RENDER_TIME value at the top of klippy/extras/led.py if you want to experiment with something else (be sure to run a full sudo service klipper restart after any code change).
Hi george, great job making this progress bar!!
Got it running on 2 machines, the first one is a 8 led strip with the non beta fw klipper, and the second one is with beta fw klipper and this one is a bit buggy(weird with colours stil have to look in to)
But is there a way or a macro to turn the template off while printing, and is there an option to dimm the lights so they are not on 100% power
I already implement a macro in beta version that clear the template and turn off the led. I test it and have no bugs so far. Give it a try. With master version you could use something like this in your end macro
About light intensity, this isnât a good idea for GLOW mode because will limit the ârangeâ. In PROGRESS mode not all leds glow with the same intensity. For example the first led will have 1/chain intensity and this will increase for each led that is turn on until the last one, which is the only one that glow at full power.
I just set up your macro, I can get glow and clear to work, but I can not get progress to. The error is:
Error evaluating âgcode_macro NEOPIXEL_DISPLAY:gcodeâ: UndefinedError: âdict objectâ has no attribute uâneopixel neoneoâ
Not sure why two templates work and not the other? Thanks in advance!
The only difference I see so far is at you neopixel configuration. The new leds donât have white values. Remove the initial_WHITE from [neopixel] section and try again.
I donât find the lines where you call the NEOPIXEL_DISAPLY with MODE=progress.
Removed the white and still the same thing, the error does seem different now.
Error evaluating âgcode_macro NEOPIXEL_DISPLAY:gcodeâ: UndefinedError: âdict objectâ has no attribute uâneopixel neoneoâ
The only way I can get back the same error is when I misspell the led name. And again, I didnât find any call in your log with mode=progress. How did you call the macro?