that idea was meant for day time pointed at like a far away building for feature extraction
forget about that, bad idea
I’m actually 99% implementing the Python code. My HTTP server is fully working as well and I’m minimizing the amount of work that the Python has to do. Anything that can be done via Javascript on the smartphone will be done by Javascript instead. A lot of data is being sent out as JSON using ujson, and it makes it super easy for me to debug via just my computer.
BUT!!!
find_blobs is throwing MemoryErrors! Only sometimes! “Out of normal MicroPython Heap Memory!”
I have added gc.collect() to many places
I have added micropython.opt_level(2) to every file
I am using micropython.const(expr) where I can
I have commented out most useless functions
I can print out the memory data using micropython.mem_info(True)
I might have the skills to dig into the firmware C code, maybe there are options in the makefile I can simply disable?
Can I simply find the malloc() that’s failing and giving it a static buffer instead? Or is there a dynamic buffer that’s failing?
Should I try cross-compiling py files into mpy?
What can I do that doesn’t involve reducing the image resolution?
I have a lot of
if self.debug: print("xxxxxxx")
, do those add up significantly on the heap?
Help me out here! Sooooo close!!! After this I just need to do HTML and JS, no more Python!
ERROR[681153]: <class 'MemoryError'>
Traceback (most recent call last): >> File "<stdin>", line 441, in main >> File "<stdin>", line 435, in task >> File "<stdin>", line 369, in solve >> File "star_finder.py", line 37, in find_stars
MemoryError: Out of normal MicroPython Heap Memory! Please reduce the resolution of the image you are running this algorithm on to bypass this issue!
stack: 1444 out of 64512
GC: total: 246080, used: 68848, free: 177232
No. of 1-blocks: 1020, 2-blocks: 100, max blk sz: 1188, max free sz: 10123
GC memory layout; from 30003c90:
a whole bunch of stuff here
if you are curious, the latest code is up on OpenMV-Astrophotography-Gear/openmv_filesys at master · frank26080115/OpenMV-Astrophotography-Gear · GitHub
EDIT: WOOOOOOT I compiled my own firmware that removed many struct members of the linked list node “find_blobs_list_lnk_data”, and reduced “FIND_BLOBS_CORNERS_RESOLUTION” to 12, and also I’m not tracking 3 lists of stars any more, just 1 list, so the gc can collect older lists, I am now very watchful of what can be gc’ed
I also reduced the USB CDC buffer sizes from 512 to 128
The error seems to have stopped but I haven’t stress tested it outdoors yet, but the report says 147 stars at one point (I’m pointing it at crap around my apartment, with some weird thresholds), which should work fine later on
Fingers crossed!
Also, it seems like burning a new firmware heats it up so much that the PLL freaks out
Oh and if you wanna see my firmware changes, GitHub - frank26080115/openmv at find-blobs-lightweight