View Single Post
  #9   Spotlight this post!  
Unread 07-02-2004, 07:16
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: User_Autonomous_Code() questions

Instead of risking frying stuff , for testing you could use preprossesor directives to make the tests for autonomous mode always true when a certain macro is/isn't defined. Something like this:

main.c (in main())
Code:
 while (1)   /* This loop will repeat indefinitely. */
 {
 
    ...
 
 	if (statusflag.NEW_SPI_DATA)	  /* 26.2ms loop area */
 	{
 	  Process_Data_From_Master_uP();
 
 #ifndef AUTO_TESTING
 	  if (autonomous_mode)
 	  {
 		User_Autonomous_Code();
 	  }
 #else
 		User_Autonomous_Code();
 #endif
 	}
 	
 	...
 
 }
user_routines_fast.c (in User_Autonomous_Code())
Code:
 #ifndef AUTO_TESTING
 while (autonomous_mode)   /* DO NOT CHANGE! */
 #else
 while(1)
 #endif
 { 
   if (statusflag.NEW_SPI_DATA)	  /* 26.2ms loop area */
   {
 	  Getdata(&rxdata);
 
 	  autonomousRun(autonomousModeSelection);
 	  Putdata(&txdata);
   }
 }
auto_testing_setting.h
Code:
 #define AUTO_TESTING
Just #include auto_testing_setting.h in main and user_routines fast and your autonomous stuff will run. This doesn't stop after 15 sec, but it can be useful for testing your IR homing works or something like that.

Don't forget to comment the #define out when you're in competition.
__________________