Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   using limit_switch_max/min in autonomus (http://www.chiefdelphi.com/forums/showthread.php?t=34388)

CmptrGk 11-02-2005 06:31

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.

Mark McLeod 11-02-2005 10:37

Re: using limit_switch_max/min in autonomus
 
Quote:

Originally Posted by CmptrGk
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.

Leav 11-02-2005 10:40

Re: using limit_switch_max/min in autonomus
 
somewhat related.... why does the limit max funxtion require that you add 2000, only to disregard it in the function itself?

Mike Soukup 11-02-2005 11:27

Re: using limit_switch_max/min in autonomus
 
Quote:

Originally Posted by Leav
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:

Code:

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.

Mr. Lim 11-02-2005 11:32

Re: using limit_switch_max/min in autonomus
 
Quote:

Originally Posted by Leav
somewhat related.... why does the limit max funxtion require that you add 2000, only to disregard it in the function itself?

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...opic.php?t=500

-SlimBoJones...


All times are GMT -5. The time now is 23:59.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi