View Single Post
  #1   Spotlight this post!  
Unread 03-02-2004, 12:24
sscanf sscanf is offline
Registered User
#0061
 
Join Date: Jan 2004
Location: Blackstone Valley Regional, Upton, MA
Posts: 4
sscanf is an unknown quantity at this point
Question User_Autonomous_Code() questions

OK. I'm new to FIRST but not new to C. I'm trying to understand the default FRC code. I see that main is calling User_Autonomous_Code() when the autonomous_mode flag is set and after calling Process_Data_From_Master_uP(). like so:

Code:
while (1)   /* This loop will repeat indefinitely. */
{
   if (statusflag.NEW_SPI_DATA)          
   {                                 
      Process_Data_From_Master_uP();  
      if (autonomous_mode)            
      {
        User_Autonomous_Code();       
      }
    }
    Process_Data_From_Local_IO();     
} /* while (1) */
What I don't understand is Process_Data_From_Master_uP() will in-turn call Default_Routine() which handles the operator interface. This doesn't seem correct but maybe I'm mis-understanding something.

It seems to me that the if check in main should be something more like this:

Code:
while (1)   /* This loop will repeat indefinitely. */
{
   if (statusflag.NEW_SPI_DATA)          
   {             
      GetData(&rxdata);  
      if (autonomous_mode)            
      {
        User_Autonomous_Code();        
      }
      else
      {  
         Process_Data_From_Master_uP(); //Modify to remove Get/PutData()
      }
      PutData(&txdata);
    }
    Process_Data_From_Local_IO();     
} /* while (1) */
I'm operating remotely from my team and finally got a hold of the edu robot kit and have managed to program and download it. I got started on this because there is no autonomous mode in the edu default code and want to add it, somehow simulating the autonomous_mode.

I want to be sure I'm not misunderstanding anything before I procede.

Thanks.

Dan Rasmussen