Bypass errors encountered in a macro

I have been doing a lot of resonance testing. I have also been doing a lot of changing things in my cfg, restarting Klipper, and then running more resonance tests.

Every time I have to restart Klipper the first time I perform accelerometer_query or test_resonances, I get an error message:

Invalid adxl345 id (got 0 vs e5). This is generally indicative of connection problems (e.g. faulty wiring) or a faulty adxl345 chip.

What I want to do is create a macro for resonance testing that will:

  • call an existing conditional homing macro
  • accelerometer_query
  • if there is an error and it matches the one shown above, swallow the error message and repeat the accelerometer query
  • if the error appears again, stop and actually bother the user
  • run the actual test_resonances command
  • run another macro I wrote that creates the chart and moves the csv and the chart to a directory where I can easily access them

I can do all of this except for the part about swallowing the error. My current macro just stops immediately whenever Klipper throws an error.

I have tried some searches, but I can’t seem to come up with the right combination of search terms.

Anyway, thanks for reading and double-thanks if you are able to provide some help.

The macro handler isn’t able to read the human-readable output that shows up on the console, and I don’t think the accelerometer modules have a get_status() method that would expose data in the printer object that macros could see. You might take a look at this and see if you could use it to implement a resonance testing script instead of a macro.

Note that this error only pops up when using hardware SPI. You could switch to software SPI without any adverse effects and be done with the error.

You are using a Pi Pico, right?

I am using a Pi Pico (a KUSBA v2 to be precise). I also have a Fysetc Portable Input Shaper. The cfg file from the KUSBA people says that software SPI might provide results somehow inferior to using hardware SPI. I don’t know. My Klipper host is a dual-core Intel 2955U in an old Chromebox fwiw.

I also have a BTT S2DW (LIS2DW sensor instead of ADXL345, but still an rp2040 MCU).

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.