Skip to content

Commit 09c5b8b

Browse files
committed
dont erase bootlog unnecessarily, skip erase Circuitpython stuff
1 parent e6bafe8 commit 09c5b8b

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ lib_deps =
9191
; Common build environment for ESP32 platform
9292
[common:esp32]
9393
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.07/platform-espressif32.zip
94-
; This is needed for occasional new features and bug fixes
94+
; develop branch is needed for occasional new features and bug fixes, main may be preferred
9595
; platform = https://github.com/pioarduino/platform-espressif32#develop
9696
lib_ignore = WiFiNINA, WiFi101, OneWire
9797
monitor_filters = esp32_exception_decoder, time

src/provisioning/tinyusb/Wippersnapper_FS.cpp

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

162+
if (false) { //TODO: reinstate after discussion over utility. Restest a full fs.
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+
// using setVolumeLabel(), but note the FS must be unmounted first
169+
}
165170

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

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

314315
// Compare existing content with new content
315316
if (existingContent == newContent) {
317+
WS_DEBUG_PRINTLN("INFO: wipper_boot_out.txt already exists with the "
318+
"same content.");
316319
return true; // No need to overwrite
320+
} else {
321+
WS_DEBUG_PRINTLN("INFO: wipper_boot_out.txt exists but with different "
322+
"content. Overwriting...");
317323
}
324+
} else {
325+
WS_DEBUG_PRINTLN("INFO: could not open wipper_boot_out.txt for reading. "
326+
"Creating new file...");
318327
}
319328

329+
// We probably don't need to erase first!
330+
eraseBootFile();
331+
320332
// Overwrite the file with new content
321333
bootFile = wipperFatFs.open("/wipper_boot_out.txt", FILE_WRITE);
322334
if (bootFile) {
323335
bootFile.print(newContent);
324336
bootFile.flush();
325337
bootFile.close();
326338
is_success = true;
339+
} else {
340+
WS_DEBUG_PRINTLN("ERROR: Unable to open wipper_boot_out.txt for writing!");
327341
}
328342

329343
return is_success;

testplan.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
copy and analyse the hex difference for a corrupted file system versus freshly saved secrets + hunky dorey
2+
-- nulls for file entry - like we've erased the file and then rebooted (before writing the replacement)
3+
-- we do a lot of unnecessary file writing each boot, I'm optimising that to only if needed so normally there will be no file writes
24

35
retest first secrets.json acces on a new device on tinyUF2 0.18.2 and WS 88, versus tinyUF2 0.20.1 and WS88, then with no-ds-format-nor-file-recreation instead of WS88
6+
-- no-fs-format-nor-file-recreation branch has eliminated the issue
7+
8+
Cleanup eraseCPFS and retest with full file system and no secrets + different bootlog contents. also move write bootlog after secrets processing if not already
9+
10+
Add boot reason detection for brownouts, if so and corrupt secrets/FS then fsHalt with appropriate message for 30s then reboot.
11+
Bad USB cables on first boot should be accounted for - brownout serial message / fsHalt
12+
13+
As part of boot protection add message when write or erase attempt and suggest user manually perform action.
14+
Secondly consider moving all serial debug output to after usb reattach so user sees it, or at least repeat?
15+
416

517
then add the metro-s3
618
Update step images in ws_boards for metro-s3
@@ -10,4 +22,13 @@ then add FT usb-to-gpio to ws_python
1022

1123
Test ws_boards c6-aVref branch (esp32 aref=1.1 instead of 3.3, and C6 from 1.1 to 2.5v)
1224

13-
Fix pin numbers + names for Metro S2 (all digital etc, tx/rx and D1 [etc] seem wrong, analog5 is wrong etc)
25+
Fix pin numbers + names for Metro S2 (all digital etc, tx/rx and D1 [etc] seem wrong, analog5 is wrong etc)
26+
Add guide pages for wippersnapper on metro s2
27+
Add guide pages for WS on C6
28+
29+
Check in on Marty's code / local mqtt issue.
30+
Look at exception handling in mqtt library which seems biggest user hurdle
31+
- consider capturing OSError etc and return mqtt exception?
32+
- look at how IO fails too
33+
- catch gai dns errors
34+
- see what happens when no response / waiting message during loop call (people report exception but actually valid to have empty response)

0 commit comments

Comments
 (0)