File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,13 @@ bool Wippersnapper_FS::configFileExists() {
238
238
// Does secrets.json file exist?
239
239
if (!wipperFatFs.exists (" /secrets.json" ))
240
240
return false ;
241
+ File32 file = wipperFatFs.open (" /secrets.json" , FILE_READ);
242
+ if (!file)
243
+ return false ;
244
+ int firstChar = file.peek ();
245
+ file.close ();
246
+ if (firstChar <= 0 || firstChar == 255 )
247
+ return false ;
241
248
return true ;
242
249
}
243
250
@@ -324,7 +331,7 @@ bool Wippersnapper_FS::createBootFile() {
324
331
void Wippersnapper_FS::createSecretsFile () {
325
332
// Open file for writing
326
333
File32 secretsFile = wipperFatFs.open (" /secrets.json" , FILE_WRITE);
327
-
334
+ secretsFile. truncate ( 0 );
328
335
// Create a default secretsConfig structure
329
336
secretsConfig secretsConfig;
330
337
strcpy (secretsConfig.aio_user , " YOUR_IO_USERNAME_HERE" );
@@ -339,7 +346,7 @@ void Wippersnapper_FS::createSecretsFile() {
339
346
serializeJsonPretty (doc, secretsFile);
340
347
secretsFile.flush ();
341
348
secretsFile.close ();
342
-
349
+
343
350
writeToBootOut (
344
351
" ERROR: Please edit the secrets.json file. Then, reset your board.\n " );
345
352
#ifdef USE_DISPLAY
You can’t perform that action at this time.
0 commit comments