Cannot run the C Language Interface example on my ESP32

I’m trying to write a library in order to make a driver for the HC-SR04 suitable with the ESP32 hardware limitations (no way to sleep for microseconds or ICU), so I’m using the processor ticks counter to emulate that behavior. The driver works very well, and I’m trying to generalize it to make the code suitable for everyone. The problem is that it seems to be no way to pass arguments to the C function from Python, the parse_py_args function seems not to work at all, even in the C Language Interface example from the documentation: it just returns 0 without changing any of the memory passed as arguments.
I’m using the 2.5.1 version of the toolchain and the standard Virtual Machine on my ESP32-WROOM-32D device. Any idea of what can be the issue?
Thanks in advice for the answers!

Ok, while I was writing these lines I thought that it could be a problem with my configuration. It turns out that downgrading to 2.4 fixes the issue, so I suppose that this is definitely a toolchain bug.
Please fix that as soon as possible!

So just to be sure I understand, The same project folder with the same exact code works on r2.4 on Zerynth studio but doesn’t work on r2.5.1?
Do you use Zerynth studio for your development or ZTC commandline?
If yes, Could you post the project folder here to debug this?

Thank you.

Hi, thanks for your quick response!
I’m using the Zerynth Studio automated toolchain to uplink the software to the board. I’ve just redone the switch between 2.4.3 and 2.5.1 and it still doesn’t work. If I try to run the “pure” C Language Interface example, the serial returns me a TypeError caused by the parse_py_args function returning 0 for failing the execution or, more probably, a linking error. In fact, I’ve noticed that even the printf function does not work when I use the 2.5.1 environment on my machine. I’ve added the driver on my github, feel free to pull it on your local machine and give it a try.

I replicated the problem, Thanks for reporting this bug.
The development team will be working on this and will be fixed in the coming updates as soon as possible.

1 Like

We are currently working on this bug, In the meantime for everyone using the C language example on the latest update.
You can access the arguments without parse_by_args.
This should work :

    a = PSMALLINT_VALUE(args[0]);
    b = PSMALLINT_VALUE(args[1]);