Go to Post Side effect include: Hearing loss, splinters, blisters, extreme sprit, uncontrollable urges to scream "GO MOE", and bright green fashion sense - The Lucas [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #13   Spotlight this post!  
Unread 21-02-2007, 01:54
shtylman shtylman is offline
some sort of programmer
FRC #2420
 
Join Date: Feb 2004
Rookie Year: 2003
Location: Marietta, GA
Posts: 37
shtylman has a spectacular aura aboutshtylman has a spectacular aura about
Re: changing main.c

Quote:
Originally Posted by Alan Anderson View Post
Consider yourself corrected. Take a look at the main() function in main.c and you'll see that it calls Process_Data_From_Master_uP() just before checking autonomous_mode. So it calls the "slow loop" code continuously before going autonomous, and then calls it one more time after autonomous is enabled and before calling User_Autonomous_Code().
In the default Code, Process_Data_From_Master_uP is only called once before autonomous if the OI is set to run autonomous mode. After the RC goes into autonomous mode, the while loop in the autonomous code blocks and Process_Data_From_Master_uP is not called again until autonomous code ends.

The reason for calling it first is most likely that teams usually run the regular code and not autonomous. Whatever the case, a Getdata must be called with the rx_data struct so the data can be retrieved from the master processor about which mode to go into. I have not done it myself, but I am confident that you can simply change

Quote:
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{ /* I'm slow! I only execute every 26.2ms because */
/* that's how fast the Master uP gives me data. */
Process_Data_From_Master_uP(); /* You edit this in user_routines.c */

if (autonomous_mode) /* DO NOT CHANGE! */
{
User_Autonomous_Code(); /* You edit this in user_routines_fast.c */
}
}
to ->

Quote:
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{ /* I'm slow! I only execute every 26.2ms because */
/* that's how fast the Master uP gives me data. */
Getdata(&rxdata);

if (autonomous_mode) /* DO NOT CHANGE! */
{
User_Autonomous_Code(); /* You edit this in user_routines_fast.c */
}
else
{
Process_Data_From_Master_uP(); /* You edit this in user_routines.c */
}
}
In main.c

And you will not run user code and yet still be ok. Someone should try this if they have a spare RC around (ours got shipped today and I don't have access to old robots). Just my $0.02
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
main.c 6600gt Programming 3 29-08-2006 02:19
Main Battery Cables maclaren Electrical 14 26-07-2006 12:37
Editing Main.c Astronouth7303 Programming 22 20-02-2004 16:45
Main Stage archiver 2001 3 24-06-2002 03:06
main driver Kaitlin Palmer Off-Season Events 0 09-04-2002 21:26


All times are GMT -5. The time now is 04:12.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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