So the CubeBlack uses an F4 processor so it doesn’t have enough memory unless some features are turned off. We’ve been planning to add a wiki page with suggestions on what features are most effective at reducing memory but here are some ideas:
EK3_IMU_MASK = 1 (this disables the 2nd IMU)
TERRAIN_ENABLE = 0 (disables the terrain database which will stop missions from using AltFrame=Terrain using the inbuilt terrain database, rangefinders will still work)
LOG_FILE_BUFSIZE = 8 (this reduces the memory used for logging which could lead to mission log messages but shouldn’t have any impact beyond this)
If you double click on an item in the Action tab and select “freemem” from the huge black window you can see how much memory is free on the board. For example I have 25,000 free on this random autopilot. You’d always want to leave at least 5000 but you could increase the SCR_HEAP_SIZE parameter by whatever extra you’ve got. I’d guess that 70,000 is enough for most scripts.
Well, I’m out of ideas I’m afraid. Maybe check that there are no other scripts in the scripts directory… Maybe disable any other features that you don’t immediately need (rangefinders, optical flow, anything else)…
The CubeBlack just doesn’t have the memory required to run scripting very well I think.
There is no other script installed on the cube.similarly no other functions enabled like range finder,optical flow etc…
You can refer 1st section of this thread to see only quicktune lua script only installed.
In the screen shots above it looks like SCR_HEAP_SIZE is 202400 which is more than the available memory of 145800. I think if you reduced SCR_HEAP_SIZE to 130,000 the error would go away.
The complexity comes though because at startup many different features try to take memory. There may be other features that also couldn’t get memory so it’s possible the above change to SCR_HEAP_SIZE won’t resolve the problem.
I am including a change in 4.2.2 that allows for the CAN memory pool to be reduced, which will help if you use CAN.
Scripting is hard though on F4 based boards, and it can be very tricky to get memory usage low enough to allow complex lua scripts to work.
We have discussed moving quicktune to being in C++ to avoid that issue, but that is unlikely to happen soon, sorry.