Thanks for the help on this one.
I've gone the route of adding some commands to SDM uBasic. One will write a variable to the card, the other will recall that variable. If anyone's interested, I've posted the functions below.
static void set_config_statement()
{
int fd;
char config[1];
accept(TOKENIZER_SET_CONFIG);
config[0] = (char)expr();
// write config to file
fd = open("A/CHDK/OBC.CFG", O_WRONLY|O_CREAT, 0777);
if (fd>0)
{
write(fd, config, 1);
close(fd);
}
accept_cr();
}
static void get_config_statement()
{
int fd, var, rd;
char config[1];
accept(TOKENIZER_GET_CONFIG);
var = tokenizer_variable_num();
accept(TOKENIZER_VARIABLE);
// read config from file
fd = open("A/CHDK/OBC.CFG", O_RDONLY, 0777);
if (fd>0)
{
rd = read(fd, config, 1);
if (rd>0)
{
// put config into variable
ubasic_set_variable(var, (int)config[0]);
}
close(fd);
}
accept_cr();
}
Cheers,
Peter