Pixy2JavaAPI
Pixy2JavaAPI copied to clipboard
Get "LLVL Error: out of memory" with large number of blocks
Using 1.4 (can't use 1.4.1, not on WPILIB 2021), we get "LLVL Error: out of memory" when we get a result with a large number (>10) of blocks.
We are SPI connected.
Working around it right now (better Pixy tuning!), will dig into it after March with a test case.
That sounds like a crash caused by the underlying C libraries, so it's probably out of the scope of this project. I think it's probably due to the internal data buffer filling up? The Pixy2 can send a lot of data at once, and I vaguely remember having this error in the past with a lot of blocks.
I don't really know a ton about the inner workings of WPILib, but I'd guess it's somewhere around here in SPIJNI.cpp, perhaps with the resizing of the buffers. Pixy2JavaAPI works by receiving a header for the packet that gives a size, which will eventually result in JNI calling this spiReadB method, and resizing the buffers to match the size requested by my API.