TMO Project Log – Like fashion, never finished (but close!)
I’m not so good at this whole “consistent project log” thing, am I? In any case, I’ve made lots of progress since my last check in (the introduction, hah)!
The display board is complete, controls are hooked up and working, and TMOOS is quite functional. It’s able to run standalone from a battery and is even semi-portable (though easily breakable, since it’s mounted on cardboard for the moment). I’ve got my own Pong clone running on it and the beginnings of a Galaga-style arcade shooter. This all sounds gravy, but it hasn’t been without its share of bumps in the road. I’ll share some issues I’ve run in to recently.
Heap corruption. This one isn’t any picnic to debug, and even less so if you don’t know what you’re looking for. In my case it manifested itself as rows of pixels randomly flickering across the screen, but _only_ after I had started the Pong game. Weird right? I spent a lot of time attempting other fixes (read: denying the obvious problem) before I realized I had simply exhausted the 2.5KB of RAM on my ATMega32u4. I fixed this by converting all of my functions that took static strings from RAM and stored their strings in flash memory. I put off doing this for so long because I thought it might be a lot of work, but it really wasn’t. Just had to write a second version of functions that dealt with strings to read from flash memory, which in the end meant a lot of copy-pasting and editing of a few lines. These changes alone more than halved the RAM usage of the system as a whole.
An issue I’m still currently facing is one dealing with the input wheel. I think it’s because the potentiometer I’m using is old and has a dead spot, but the way it manifests itself is quite strange. When browsing the menu, there’s a very small spot I can turn the wheel to that changes the display to a menu entry I certainly didn’t add myself. Usually it’s just blank at this spot, but sometimes after playing games there will be a few test glyphs rendered there. If I hit the button to start a game, sometimes it will completely crash TMOOS and I need to power cycle the MCU! Though usually it just doesn’t do anything. Weird, huh? Maybe it’s a bug in my GetWheelRegion function, because even if there was a dead spot on the pot it should just go to either end of the wheels range, not somewhere completely unknown.
There’s still quite a bit to be done to TMO as a whole before it’s _finished_ and that’s probably going to remain the case well after it’s “finished”, if you know what I mean. There’s still no sound, though that’s arguably a very easy feature to build and code in (probably why I’ve neglected to do it yet). The back end console is still barely more than a way to get debug output. The battery meter still isn’t calibrated, and as such is totally useless. But all these things will come in time.
On the software side of things, I want to come up with some way to easily compile different games in to the system without (any, if possible) many changes to the code. It would be nice to have a large collection of games for TMO even if they can’t all be loaded at once. I’d like to make the menu a little fancier as well, perhaps with sliding animations as you move from one entry to another. Well, there’s plenty I’d like to add and maybe I’ll get around to it all some time. Check out my todo.txt and notes.txt in the GitHub repo if you want some more specific information. I’ve even written a few basic Wiki pages in the GitHub repo to help others get started developing or find their way around if interested. I’m realizing more and more these days the value of software documentation beyond the code alone.
I think that’s all I’ve got for now, so stay tuned until next time and I hope you enjoy seeing this project progress.