Lopy4 FFT (spectrum analysis) micropython, adding C code?
I tried a micropython FFT algorithm of 2048 points and it took 4m53s to complete (yes almost 5 minutes), hence the need for the C version.
Should this be incorporated in the lopy4.bin or is this a .bin beside it?
How to keep that working with firmware updates?
Does pycom provide info for this?
The post processing after the FFT only took 0.02 seconds in Python so I don't think it that needs to be put in C, so the pure FFT functions are the problem.
keep in mind that the float implementation works like similar like the string implementation. Each expression will create at least one new object. even
x += 1.0
will generate a new object. So you have to deal with a heavy fragmented memory. If you can do most of your float stuff around the fft code, move them as well to C. So it will be easier to allocate mem.
robert-hh last edited by
@KenM You might get some inspiration here: https://micropython-dev-docs.readthedocs.io/en/latest/adding-module.html
The code structure for both Micropyhton variants is pretty similar.