@@ -159,14 +159,14 @@ bool Wippersnapper_FS::initFilesystem(bool force_format) {
159
159
if (!wipperFatFs.begin (&flash))
160
160
return false ;
161
161
162
+ if (false ) {
163
+
162
164
// TODO: Don't do this unless we need the space and createSecrets fails
163
165
// If CircuitPython was previously installed - erase CPY FS
164
166
eraseCPFS ();
167
+ // Also, should probably relabel drive to WIPPER if CIRCUITPY was there
168
+ }
165
169
166
- // TODO: don't do this every time, only if content differs?
167
- // If WipperSnapper was previously installed - remove the
168
- // wippersnapper_boot_out.txt file
169
- eraseBootFile ();
170
170
171
171
// TODO: don't do this every time, only if missing (less power usage? less block wear)
172
172
// No file indexing on macOS
@@ -313,17 +313,30 @@ bool Wippersnapper_FS::createBootFile() {
313
313
314
314
// Compare existing content with new content
315
315
if (existingContent == newContent) {
316
+ WS_DEBUG_PRINTLN (" INFO: wipper_boot_out.txt already exists with the "
317
+ " same content." );
316
318
return true ; // No need to overwrite
319
+ } else {
320
+ WS_DEBUG_PRINTLN (" INFO: wipper_boot_out.txt exists but with different "
321
+ " content. Overwriting..." );
317
322
}
323
+ } else {
324
+ WS_DEBUG_PRINTLN (" INFO: could not open wipper_boot_out.txt for reading. "
325
+ " Creating new file..." );
318
326
}
319
327
328
+ // We probably don't need to erase first!
329
+ eraseBootFile ();
330
+
320
331
// Overwrite the file with new content
321
332
bootFile = wipperFatFs.open (" /wipper_boot_out.txt" , FILE_WRITE);
322
333
if (bootFile) {
323
334
bootFile.print (newContent);
324
335
bootFile.flush ();
325
336
bootFile.close ();
326
337
is_success = true ;
338
+ } else {
339
+ WS_DEBUG_PRINTLN (" ERROR: Unable to open wipper_boot_out.txt for writing!" );
327
340
}
328
341
329
342
return is_success;
0 commit comments