Create default r0ket.cfg if missing
This commit is contained in:
parent
5f0995f1fe
commit
5574ca2cdc
|
@ -28,10 +28,37 @@ int lcdInitConfig(){
|
|||
lcdPrint("open:");
|
||||
lcdPrintln(f_get_rc_string(res));
|
||||
if(res){
|
||||
lcdPrintln("r0ket.cfg missing!");
|
||||
lcdPrintln("new r0ket.cfg...");
|
||||
|
||||
res=f_open(&file[0], "r0ket.cfg", FA_OPEN_ALWAYS|FA_WRITE);
|
||||
lcdPrint("create:");
|
||||
lcdPrintln(f_get_rc_string(res));
|
||||
if(res){
|
||||
return 1;
|
||||
};
|
||||
|
||||
buf[0]='0';
|
||||
buf[1]='0';
|
||||
res = f_write(&file[0], buf, 2, &readbytes);
|
||||
lcdPrint("write:");
|
||||
lcdPrintln(f_get_rc_string(res));
|
||||
if(res){
|
||||
return 1;
|
||||
};
|
||||
|
||||
lcdPrint("wrote:");
|
||||
lcdPrintInt(readbytes);
|
||||
lcdPrintln("b");
|
||||
|
||||
res=f_close(&file[0]);
|
||||
lcdPrint("close:");
|
||||
lcdPrintln(f_get_rc_string(res));
|
||||
if(res){
|
||||
return 1;
|
||||
};
|
||||
return 2; // created. Still show screen
|
||||
};
|
||||
|
||||
for(int i=0;i<CONFIGLEN;i++)
|
||||
buf[i]=0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue