Thread: main.c
View Single Post
  #1   Spotlight this post!  
Unread 28-08-2006, 17:11
6600gt's Avatar
6600gt 6600gt is offline
Registered User
AKA: Lohit
FRC #0226 (Hammerhead)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Troy, MI
Posts: 221
6600gt is a jewel in the rough6600gt is a jewel in the rough6600gt is a jewel in the rough
main.c

in the main.c

Quote:
while (1) /* This loop will repeat indefinitely. */
{
#ifdef _SIMULATOR
statusflag.NEW_SPI_DATA = 1;
#endif

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 */
}


}
Process_Data_From_Local_IO(); /* You edit this in user_routines_fast.c */
/* I'm fast! I execute during every loop.*/
} /* while (1) */
shouldn't it be

if(autonomous_mode)
{
User_Autonomous_Code();
}
else
{
Process_Data_From_Master_uP();
}

otherwise it will be executing Process_Data_From_Master_uP() and then User_Autonomous_Code() in auton, every loop, thus eating up a lot of processor time.

Last edited by 6600gt : 28-08-2006 at 17:17.