Read ACCELEROMETER_QUERY response in macro

Interesting. Since it errors, you can catch it with a try except clause like this:

try:
  adxl = printer.lookup_object('adxl345')
  aclient = adxl.start_internal_client()
  printer.lookup_object('toolhead').dwell(.1)
  aclient.finish_measurements()
  values = aclient.get_samples()
  _, x, y, z = values[-1]
  output({
    "x": x,
    "y": y,
    "z": z,
  })
except:
  output("No ADXL345")

Also updated the DynamicMacros docs. Thank you!

1 Like

Thanx for the suggestion - that got it.

When the ADXL345 is attached:

When it is not attached:

So I can check the response and determine whether or not the hardware is working as I expect it to - which was the point of this exercise.

A lot of work to determine whether or not an OR gate is operational (and the STM32 SPI pins, but the issues is the 74AUP1632 OR gate which prevents other transfers on the SPI bus from being interpreted as I2C commands).

Thank you again for your patience with me.

1 Like