Close

Bad News

A project log for KAPCOM

Yet another hardware controller for Kerbal Space Program. Leveraging Telemachus, Python and Arduino to drive joysticks, buttons and displays

lawnmowerlattelawnmowerlatte 02/28/2015 at 05:370 Comments

First the good news, I got past the memory issues I was having and started working on the displays. I also replaced all the LEDs in the buttons I'll be using with nice diffused ones. I also was able to get past some issues with the Adafruit library for the 24 LED bargraph. When all was said and done, I was able to compile my 42KB sketch and load it onto the Arduino.

That's when things started heading South.

It was then that I realized the severe memory limitations of the Arduino. Even the Mega, with 8KB of SRAM is seriously cramped. It never finished the setup() routine, it ran out of RAM before creating all the variables. So I started to work on cutting down. First, I found that using reserve() on the vectors was chewing through RAM and not doing what I expected. By removing that, I was able to immediately save a ton of SRAM, at least enough to have some breathing room.

From there, I learned about enclosing String literals with F() to reduce SRAM utilization. After implementing this across the board, I was able to save 1374 bytes. After that, I was able to compile the whole thing, with all buttons and displays and have 1638 bytes left. Which isn't enough to actually parse anything.

I do have some options:

I'm still investigating, but I'm kind of disheartened.

Discussions