Quote:
|
Originally Posted by RedBarons
2. I am essentially trying to jumper out into autonomatic mode right off the bat in main.c:
Code:
if (statusflag.NEW_SPI_DATA)
{
Process_Data_From_Master_uP();
// ####################
// Kick start autonomous mode
// ####################
autonomous_mode = 1;
if (autonomous_mode)
{
User_Autonomous_Code();
}
}
3. In user_routines_fast, I initiate the timer (Autonom_Code_Init()) and then call a state machine (Autonom_Code_Handler())
Code:
...
while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */
/* Add your own autonomous code here. */
Autonom_Code_Handler();
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
}
}
}
|
The call to
Getdata() will change the value of
autonomous_mode to reflect the state of the pin on the competition port. Without a dongle connected, the
while loop in
User_Autonomous_Code() will execute once and exit. Your
main loop will end up calling
Process_Data_From_Master_uP(), then
User_Autonomous_Code(), repeatedly.