Jump to content

Klipper 2024


Recommended Posts

Having been following this discussion : https://klipper.discourse.group/t/possible-klipper-plugins-instead-of-macros/9819 , happy to hear ther will be some new features.

Asynchrounous processes, documented API, maybe the ability to react to some sort of event (it's unlikely there will be a messaging system - would break the near-to-real-time software, but polling variables from another process could be a thing ?), use of real variables, getting rid of stupid macros inceptions written using even more stupid jinja and its brackets...

Had to write my own auto Z offset macros. As a noob, both with Klipper and jinja, it was a real pain. (but got help on Klipper forum)

Dreaming of a Voron logo blinking everytime the probe triggers or a endstop is hit.

Can't wait !

Edited by YaaJ
  • Like 3
Link to comment
Share on other sites

53 minutes ago, YaaJ said:

Dreaming of a Voron logo blinking everytime the probe triggers or a endstop is hit.

I assume you mean in the web interface. I have the NeoPixels doing that now. 😉 But yes, those outlined aspirational goals for 2024 are nice.

Link to comment
Share on other sites

Just using the Julian Schill libraries. They are brilliant.

https://github.com/julianschill/klipper-led_effect

Just to whet your appetite, I have the V0 blink the logo in the Kirigami for Z homing and the Rainbow on a Matchstick strips blink on X & Y homing. The Trident blinks SB logo & the caselights on all homings and on each Tap trigger during bed mesh. 😁

  • Like 1
Link to comment
Share on other sites

Thanks !
I installed this plugin on the 2.4 (still not printing, unfinished), but didn't see the BARF blinking or whatever...
On the two other printers, it's another plugin. Printed the BARF mod parts for the 0.2, still not installed.
Browsed the sources and the macros, don't see where it happens. Can see the plugin polling states (begin, end). Will see later...

A couple months back, I've been searching among various plugins sources and in Klipper itself how to handle events. And found nothing else than some polling loops here and there. Searched callbacks ; no luck : no comprehensive documentation. Came to the conclusion Klipper is not events/messages based, but most likely a finite state machine (and no serious knowledge about FSMs).  Wanted to make a LED blink on endstop triggering, as a beginer's plugin project. Both Klipper and Python noob (C/C++ head). Gave up !

Link to comment
Share on other sites

It doesn't do anything by default. You have to set up the effects definitions, then call them in macros. Here's my Trident config backup and my V0.2 config backup. Look at the leds.cfg files in each (I basically reworked the Trident one for the differences in the V0 on that printer). Then if you look for example in my macros.cfg file for my print_start and print_end you will see where I'm calling the  LED effects macros.

So, to get things working with the led_effects for me was a 4 step process: 1) get the LED hardware defined, 2) create an effect definition per the library syntax, 3) create a function-based macro calling those effects, and 4) call my function-based macro within the appropriate macro.

Now that he has that simulator program, getting your effects definitions is lots easier than it used to be.

Link to comment
Share on other sites

Yes !

When doing for example HOME X, we can overload the macro, and add a blink when the endstop is hit (end of macro).

But I don't see how to catch a bed leveling probe hitting the bed. It's a whole procedure, starting and ending, with nothing in between for the end user. Or I missed something important. This is where I got interested in the new features, with processes running in parallel separate threads, not interfering with the Klipper one, and able to do things on their own.

Please, if you know how to blink at each probe touch while leveling the bed, show me how to do this magic. Could do this with Marlin, no problems. A matter of hours, days at worst. Klipper, no idea. A part from learning Python, and hacking some Klipper in the klippy/extras folder.

Link to comment
Share on other sites

It's all in my config files! It took a little while to get the homing trigger right (I had to get some assistance from Julian).

In my leds.cfg:

 

[led_effect logo_meshing]
leds:
    neopixel:sb_leds (1-8)
autostart: false
frame_rate: 24
endstops: z, probe
layers:
    static 0 0 subtract (0.5,0.5,0.5)
    chase -0.30 0.40 add (0.2,1.0,0.0),(0.75,0.79,0.00)
    homing 2.5 0 top (0.75,0.75,1.0)
 
[led_effect case_meshing]
leds:
    neopixel:caselight
autostart: false
frame_rate: 24
layers:
    chase 0.25 0.50 add (0.2,1.0,0.0),(0.75,0.79,0.00)
    chase -0.2 0.50 add (0.2,1.0,0.0),(0.75,0.79,0.00)
   
[gcode_macro led_meshing]
gcode:
    STOP_LED_EFFECTS ;cancel all others
    SET_LED_EFFECT EFFECT=logo_meshing
    SET_LED_EFFECT EFFECT=nozzle_on
    SET_LED_EFFECT EFFECT=case_meshing

 

Then in print_start (macros.cfg):

 

    LED_MESHING
    BED_MESH_CALIBRATE

 

That's the magic. Set the LEDs to the meshing definition and start the mesh process. LED_effects takes over from there. THen I switch to a different LED definition after it's done (my heating one since that's the next step).

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...