Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Setting Autonomous Settings from OI (http://www.chiefdelphi.com/forums/showthread.php?t=36177)

dm0ney 27-03-2005 11:45

Re: Setting Autonomous Settings from OI
 
We use a selector switch on the OI to choose from 8 different modes (2^3).

Because the OI button states arent gotten until AFTER the initialization, we could not populate our autonomous queueing system with different modes.

I solved that problem by going into main.c (the file you should never have to touch) and after the Process_Data_From_Master_uP(); call, inserting this code below:

Code:

...
Process_Data_From_Master_uP(); /* You edit this in user_routines.c */

if(flag)
{
//printf("AUTO FLAG");
tcr_autonomous_fill_queue();
flag = 0;
}

if(autonomous_mode)
{
...

The variable flag is an int that is declared and initialized to 1 at the start.
The flag = 0; means it will only run once.

I believe the same code could be inserted into Process_Data_From_Master_uP however, I did not try it and cannot verify that it works.

The best implementation of that in my mind would be to have a function called in that if statement that reads which mode it is from OI buttons and stores it into memory. Extern that variable over to user_routines_fast and use it with your current code. A switch statement or if statements?

Our autonomous code is a scripting / queue style so the only thing that ever changes is the list of commands in the queue as governed by tcr_autonomous_fill_queue(), enabling us to never have to touch our user_routines_fast.


All times are GMT -5. The time now is 00:17.

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