Mcu 'mcu': Unknown command with newly defined DECL_COMMAND()

I’m developing some additional MCU software to add timed SPI commands, basically adding incoming SPI requests to the queue and executing them when the toolhead actually is at the correct position.

I wrote some code that takes some queue’ing-code from gpiocmds.c, and the SPI communication from the sensor_adxl345.c code, and mix it to achieve what I want. The code can be seen in my fork on Github, most importantly timed_spi.c and spi_valves.py.

The code compiles, however, it seems that Klippy doesn’t receive my newly added command from the MCU. I have debugged it, and when msgproto.py > process_identify() is called, i do not see my command in the data. I have declared my new command in timed_spi.c using DECL_COMMAND().

What am I missing? I have added timed_spi.c to the Makefile, do I need to add it somewhere else for the make to ‘see’ my newly added command? The error I’m getting is mcu 'mcu': Unknown command: queue_timed_spi, and like I said, I don’t see my command show up in the initial handshake between Klippy and the MCU.

Ok, with some shame on my face: I solved the issue. Somehow I was under the assumption that make would also flash the device (which I admit is far from logical). So after running make flash FLASH_DEVICE=xxxxxxxxx all was good, my command was received, and Klippy is happy.

2 Likes