I had waited long enough, and a complete code rewrite from procedural flat C to OO C++ model.
Advantages of OO redesign:
- Adding more functions becomes easer.
- Legibilidy and intent becomes clearer
- Memory management* issues easer to solve.
- Moving to PlatformIO makes C++ easer to navigate than the Arduino IDE.
*Memory Management: Due to the constraints of up to 64x64 RGB pixels on an arduino Mega, memory management had been key in the original implementation of the code. Moving the code to OO C++ would normally mean leaving even more of the memory in the hands of the compiler, but inorder to force reuse of the pool of available RAM, I wrote my own memory management routines, and each Mode or Module that runs on the device can clear out and use as required this same buffer of ram, that only has to be allocated once. Previous versions of the code had approached maximum allocation, forcing reuse of global variables such that adding one more 8Bit int could cause the code to no longer execute.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.