What I did was redid the code so that it accessed a pointer to the array, than made that pointer an argument:
Code:
struct commands *command_list;
//...
void robot_control(struct commands *script)
{
robot_command(script);
robot_timer();
robot_position();
}
void robot_command(struct commands *script)
{
//...
}
Of course, I also macro'ed access to the elements in the array, which makes such changes easy:
Code:
#define GET_COMMAND(index) command_list[(index)]
#define CUR_COMMAND GET_COMMAND(current_command)
#define COMMAND CUR_COMMAND.command
#define PARAM1 CUR_COMMAND.parm_1
#define PARAM2 CUR_COMMAND.parm_2
#define PARAM3 CUR_COMMAND.parm_3
So my autonomous mode is now:
Code:
robot_control(default_script);
After you set all of this up, you can easily add something to select which mode.