If you've been following along in the forums, we've been hacking on an epic firmware bug for the Arduino based electronics (available from the RRRF). Well, I'm proud to announce that not only have we defeated it, but in the process I audited nearly every piece of code and removed anything that I though could have slightly caused a problem. The end result is that the Arduino code is now damn near rock solid. There still might be some slight bugs, and I dare you to find them ;)
For those who are curious, the bug was actually rather stupid on my part. It was related to the interrupt. I created some interrupt code that was set to go off at regular intervals. As this was my first time dealing with interrupts in my code, I had copied some code without fully understanding it. Not only was the code enabling the timer interrupt, but it was also enabling another interrupt... one I had no interrupt handler declared for. The end result: an interrupt handler with address 0 was called (which was the address of the first function) As you can see, this was exactly our bug. A certain set of conditions triggered the undesired interrupt which sent us back to the beginning of the program.
A huge thanks to Marius Kintel for his great catch. If you are ever in Austria, give him a high five and/or buy him a beer. I'm serious!
There are only a couple major things remaining with the Arduino code:
1. forward/reverse commands are not implemented. the single arduino code does not have enough room to hold them (that i can manage to write) the good news is that it may be possible to squeeze them in. also, they are not required to print, nor do i think they are used anywhere. darwinian evolution also means abandoning obsolete things (like tails!) ;)
2. the speed commands are not yet 100% emulated as on the PIC's. currently they are interpreted as RPM. as soon as i figure out how the PIC stuff is translated into time, i should be able to implement it. this is not a big deal, but just though i'd let you know incase someone wants to help.
Download it from SourceForge!!
No comments:
Post a Comment