Skip to content

Commit 87a3079

Browse files
committed
dont erase bootlog unnecessarily, skip erase Circuitpython stuff
1 parent 52662ff commit 87a3079

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/provisioning/tinyusb/Wippersnapper_FS.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,14 @@ bool Wippersnapper_FS::initFilesystem(bool force_format) {
159159
if (!wipperFatFs.begin(&flash))
160160
return false;
161161

162+
if (false) {
163+
162164
//TODO: Don't do this unless we need the space and createSecrets fails
163165
// If CircuitPython was previously installed - erase CPY FS
164166
eraseCPFS();
167+
// Also, should probably relabel drive to WIPPER if CIRCUITPY was there
168+
}
165169

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();
170170

171171
//TODO: don't do this every time, only if missing (less power usage? less block wear)
172172
// No file indexing on macOS
@@ -313,17 +313,30 @@ bool Wippersnapper_FS::createBootFile() {
313313

314314
// Compare existing content with new content
315315
if (existingContent == newContent) {
316+
WS_DEBUG_PRINTLN("INFO: wipper_boot_out.txt already exists with the "
317+
"same content.");
316318
return true; // No need to overwrite
319+
} else {
320+
WS_DEBUG_PRINTLN("INFO: wipper_boot_out.txt exists but with different "
321+
"content. Overwriting...");
317322
}
323+
} else {
324+
WS_DEBUG_PRINTLN("INFO: could not open wipper_boot_out.txt for reading. "
325+
"Creating new file...");
318326
}
319327

328+
// We probably don't need to erase first!
329+
eraseBootFile();
330+
320331
// Overwrite the file with new content
321332
bootFile = wipperFatFs.open("/wipper_boot_out.txt", FILE_WRITE);
322333
if (bootFile) {
323334
bootFile.print(newContent);
324335
bootFile.flush();
325336
bootFile.close();
326337
is_success = true;
338+
} else {
339+
WS_DEBUG_PRINTLN("ERROR: Unable to open wipper_boot_out.txt for writing!");
327340
}
328341

329342
return is_success;

0 commit comments

Comments
 (0)