Go to Post The most important part anyone can lend is just a hand. - Libby K [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Spotlight this post!  
Unread 20-01-2005, 01:28
Anthony Kesich's Avatar
Anthony Kesich Anthony Kesich is offline
Programmer Turned Engineer
AKA: SonKenshin
#1097 (Site 3 Engineernig)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Sacramento, CA
Posts: 186
Anthony Kesich has a spectacular aura aboutAnthony Kesich has a spectacular aura about
Send a message via AIM to Anthony Kesich
Re: Multiple command_lists

I would suggest making a two dimentional array.

Code:
Example commands.h file:

#define AUTO_MODE 1

struct commands command_list[][] =
     {
          {Set 0 of autonomous commands;}
     },
     {
          {set 1 of autonomous commands;}
     },
     {
          {set 2 of autonomous commands;}
     }
Code:
Example robot.c code:

switch (command_list[AUTO_MODE][current_command].command)
  {
  case NULL:
    {
	rc = 0;    // We don't want to increment to the next command
    break;
    }

  case CMD_SHOW_STATE:
    {
    rc = cmd_show_state();
    break;
    }
...so on and so forth
Anyways, this allows for multiple programs that change with one macro definition. If you're worried about space, just have multiple codes in you commands.h file, and comment them all out except for the one you want.

This array decliration can also be used if you have multiple programs and want to change between them with a switch on the robot without recompiling and downloading. Just replace the macro definition with the input source.

-Tony K
__________________
C is screwing up my English--I'm ending all my sentences in semi-colons;

Horray for most things! -George Carlin

"Sure, I'll play rugby. Besides, I have a lot of experience running from really big guys who want to cream me." -Me, Freshman year
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
White Paper Discuss: Operator Interface - Userbyte Multiple Displays Variables marccenter Extra Discussion 0 02-12-2004 14:56
Multiple version of Inventor on one computer sanddrag Inventor 4 30-11-2004 13:31
Remember that thread? [11-11-04]: Multiple Regionals Ken Leung General Forum 5 11-11-2004 16:53
Multiple teams from one high school? KathieK General Forum 24 28-06-2004 16:30
Multiple Motors phrontist Motors 12 21-06-2004 23:05


All times are GMT -5. The time now is 01:40.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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