Quote:
Originally Posted by gwt8641
Can anyone confirm that this code works when interfaced to the competition control?
I ran this code, compiled with the 3.0 compiler, with no issues prior to competition. During our first practice match at the Finger Lakes competition, the "code error" light came on and we have encountered a number of very strange issues with our team's RC since. These malfunctions disappear for a short while after reloading the "master code", but keep coming back.
Any ideas? It very well might not even be related to Kevin's libraries... but the default .hex file from IFI seems to work, so I'm stumped. I can't even find a 2.4 version of the compiler, so I hope to make this work.
Thanks!
|
Looking at your code... You've got a lot of calls to printf() that could very well be causing problems. While my serial port driver is fully buffered and non-blocking, if the buffer fills up, the code will have to resort to a blocking scheme to prevent data corruption. In blocking mode, your code won't execute until there is enough room in the Rx buffer for the string you're trying to send. A few things to consider doing:
1) Use the DEBUG() macro (see ifi_frc.h) so that it's easy to remove the printf() statements from your competition code.
2) You can also redirect the output to go nowhere by placing this line in teleop.c/Initialization:
stdout_serial_port = NUL;
This will prevent the stalling, but isn't optimal because the code associated with printf() will still execute.
3) Increase the RX1 buffer size in serial_ports.h to 64 or even 128 bytes.
I've also seen a few inconsistances in your code. Can you describe the 'bot a bit? I'm mostly interested in the sensors you're using and how they're attached to the robot controller.
-Kevin