Too many (If, Else If) statements?

Hey all!

I’ve been trying to make a better autonomous before our next regional. Since it’s a day away, i’ve started to panic even more!

I’ve been using Kevin Watson’s IR code, with a few additions to take commands and store them into the EEPROM. Once the commands are stored in the EEPROM, I have about 10 If/Else If statements to give our autonomous routine its desired waypoints.

Once I loaded my code via IFI Loader, the program light was STILL blinking! My code never entered the user teleoperated routine.

Later, I tried removing a few of the If/Else If statements, and I was left to TWO If/Else If statements. I compiled and loaded the code, the robot entered the user teleoperated routine with no problem.

Could I be edging on the side of overloading our IFI RC? Is there a way to get around this issue?

Thank you in advance! :smiley:

This somewhat depends on where you put the if-else statements and if you had them all properly scoped. If you’re putting these in an interrupt service routine, then it might just be taking up too much time and you’d get a red light of death. If you’re doing this elsewhere then timing shouldn’t be an issue. You might instead have some misplaced braces that are causing you to skip past the PutData() command or something. C18 doesn’t seem to do anything too stupid when compiling nested if-elses, so I’m unsure what else this might be unless your code is so long that it needs to be using the large code model and you’re not using it at the moment. Perhaps if you just tried re-compiling your original code. I can’t think of anything other than a corrupted file that would keep the controller in a program state after a download.

Is it using the large code model (see here: http://www.ifirobotics.com/docs/memory_problem_8722.pdf)?

I went ahead and looked at my project files, the compiler was set to work with the small code model that was less than 64k bytes. I hope this works!! I’ll be heading over to the field very shortly to find out.

Thank you!

Thanks all!!! The code works great!!!