|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
changing main.c
Hi,
am I allowed to change main.c so that when autonomous mode is on, Process_Data_From_Master_uP won't execute? I have things in my default_routine that shouldn't work during autonomous, and I'm not sure whether the DISABLE function will disable them or not. thanks, Ran. |
|
#2
|
|||
|
|||
|
Re: changing main.c
If you are in autonomous mode, Process_Data_From_Master_uP will never be called. User_Autonomous_Code() has its own fast/slow loops separate from Process_Data_xxx. If you don't want it to be called BEFORE it goes into autonomous code, you can move it after the if(autonomous_mode) check, or check for it at the beginning of Process_Data_xxx and return otherwise.
|
|
#3
|
||||
|
||||
|
Re: changing main.c
Quote:
|
|
#4
|
|||||
|
|||||
|
Re: changing main.c
IMHO, if they don't want us to change it, they wouldn't give us the source. All the exciting stuff is on the master processor anyway.
|
|
#5
|
|||
|
|||
|
Re: changing main.c
I'm not sure if you can change it. It's been a couple of years since I've even tried, but several of the files (those that say "Do Not Change" or something like that) used to be locked so you couldn't change them.
|
|
#6
|
|||
|
|||
|
Re: changing main.c
Go ahead and change them. There is nothing wrong/illegal about that.
Just make sure you know what you are doing! Quote:
![]() And if they are locked, just take out the write protection (right click in explorer) |
|
#7
|
||||
|
||||
|
Re: changing main.c
OK, but is it right to add
if(!autonomous_mode) just before Process_Data_From_Master_uP()? |
|
#8
|
|||
|
|||
|
Re: changing main.c
If you do not want Process_Data_From_Master_uP() running while in auton, then, yes, the following would do it.
Code:
if (!autonomous_mode)
{
Process_Data_From_Master_uP();
}
|
|
#9
|
||||
|
||||
|
Re: changing main.c
thanks,
BTW, you don't have to add the "{","}"s when you have only one function. |
|
#10
|
||||
|
||||
|
Re: changing main.c
Correct me if I am wrong, but I think Process_Data_From_Master_uP() will never be called while in autonomous code since User_Autonomous_Code() has its own while loop:
Code:
void User_Autonomous_Code(void)
{
/**autonomous initialization....*/
while (autonomous_mode)
{
/**autonomous routine..*/
}
}
|
|
#11
|
|||||
|
|||||
|
Re: changing main.c
Quote:
Rather than modifying main() as 3dude_2231 is asking, it might be less traumatic to check for autonomous_mode inside Process_Data_From_Master_uP(). |
|
#12
|
||||
|
||||
|
Re: changing main.c
Quote:
That makes sense as an option; but I am not sure why it would be a problem to add an if(!autonomous_mode) in main(). With what might this cause trouble? |
|
#13
|
|||||
|
|||||
|
Re: changing main.c
There is nothing illegal or wrong with modifying any of the code to suit your needs. The only requirement is that you call IFI's functions as appropriate. You may modify main.c, ifi_utils.c, ifi_startup.c
, or any other source file.Now, your skill level is more likely a hinderence. I would imagine that 99% of the people here wouldn't dare touch ifi_startup.c. (The other 1% is Kevin Watson. ) Why? It involves initializing clib, clearing memory, and a few other low-level things. Half of it is written in inline assembly. I've only perused it a few times, nevermind modifying it.As for the original question: modify main.c until you turn blue! Just be ready to post a lot of code when it doesn't work. |
|
#14
|
|||
|
|||
|
Re: changing main.c
Quote:
The reason for calling it first is most likely that teams usually run the regular code and not autonomous. Whatever the case, a Getdata must be called with the rx_data struct so the data can be retrieved from the master processor about which mode to go into. I have not done it myself, but I am confident that you can simply change Quote:
Quote:
And you will not run user code and yet still be ok. Someone should try this if they have a spare RC around (ours got shipped today and I don't have access to old robots). Just my $0.02 |
|
#15
|
|||
|
|||
|
Re: changing main.c
Quote:
Jason |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| main.c | 6600gt | Programming | 3 | 29-08-2006 02:19 |
| Main Battery Cables | maclaren | Electrical | 14 | 26-07-2006 12:37 |
| Editing Main.c | Astronouth7303 | Programming | 22 | 20-02-2004 16:45 |
| Main Stage | archiver | 2001 | 3 | 24-06-2002 03:06 |
| main driver | Kaitlin Palmer | Off-Season Events | 0 | 09-04-2002 21:26 |