using limit_switch_max/min in autonomus

when the entire project is compilied will functions in user_routines.c be accessable in user_routines_fast.c. mainly the limit_switch_max defintion, and the limit_switch_min definition.

Yes.

somewhat related… why does the limit max funxtion require that you add 2000, only to disregard it in the function itself?

That’s carried over from the PBASIC controller which didn’t deal with negative numbers correctly (or at all, I can’t remember). I scrapped the Limit_Mix function and wrote my own MIN & MAX macros. Here’s what our code looks like:


int right_drive_speed, left_drive_speed

right_drive_speed = (int)Oi_drive_y + (int)Oi_drive_x - 127;
MIN(right_drive_speed, 0);
MAX(right_drive_speed, 254);

left_drive_speed = (int)Oi_drive_y - (int)Oi_drive_x + 127;
MIN(left_drive_speed, 0);
MAX(left_drive_speed, 254);

In my opinion it’s much more readable than the code IFI gave us, and it doesn’t have the unnecessary 2000 addition / subtraction.

Leav,

This question was asked on the FIRST Greater Toronto Regional forum a while ago, and I’ve attached a link below to the response there.

http://www.firstcanadianregional.org/BB/viewtopic.php?t=500

-SlimBoJones…