Skip to content

Commit e6bafe8

Browse files
committed
Only create "don't index" files if not there
1 parent 9b52d98 commit e6bafe8

File tree

2 files changed

+40
-16
lines changed

2 files changed

+40
-16
lines changed

src/provisioning/tinyusb/Wippersnapper_FS.cpp

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Wippersnapper_FS::Wippersnapper_FS() {
105105

106106
// If a filesystem does not already exist - attempt to initialize a new
107107
// filesystem
108-
if (!initFilesystem() && !initFilesystem(true)) {
108+
if (!initFilesystem()){ //} && !initFilesystem(true)) {
109109
setStatusLEDColor(RED);
110110
fsHalt("ERROR Initializing Filesystem");
111111
}
@@ -115,7 +115,7 @@ Wippersnapper_FS::Wippersnapper_FS() {
115115

116116
// If we created a new filesystem, halt until user RESETs device.
117117
if (_freshFS)
118-
fsHalt("New filesystem created! Press the reset button on your board.");
118+
fsHalt("New filesystem created! Press the reset button on your board."); // TODO: just reset here after printing message then a delay/countdown.
119119
}
120120

121121
/************************************************************/
@@ -159,29 +159,40 @@ bool Wippersnapper_FS::initFilesystem(bool force_format) {
159159
if (!wipperFatFs.begin(&flash))
160160
return false;
161161

162+
//TODO: Don't do this unless we need the space and createSecrets fails
162163
// If CircuitPython was previously installed - erase CPY FS
163164
eraseCPFS();
164165

166+
//TODO: don't do this every time, only if content differs?
165167
// If WipperSnapper was previously installed - remove the
166168
// wippersnapper_boot_out.txt file
167169
eraseBootFile();
168170

171+
//TODO: don't do this every time, only if missing (less power usage? less block wear)
169172
// No file indexing on macOS
170-
wipperFatFs.mkdir("/.fseventsd/");
171-
File32 writeFile = wipperFatFs.open("/.fseventsd/no_log", FILE_WRITE);
172-
if (!writeFile)
173-
return false;
174-
writeFile.close();
175-
176-
writeFile = wipperFatFs.open("/.metadata_never_index", FILE_WRITE);
177-
if (!writeFile)
178-
return false;
179-
writeFile.close();
173+
if (!wipperFatFs.exists("/.fseventsd/no_log"))
174+
{
175+
wipperFatFs.mkdir("/.fseventsd/");
176+
File32 writeFile = wipperFatFs.open("/.fseventsd/no_log", FILE_WRITE);
177+
if (!writeFile)
178+
return false;
179+
writeFile.close();
180+
}
180181

181-
writeFile = wipperFatFs.open("/.Trashes", FILE_WRITE);
182-
if (!writeFile)
183-
return false;
184-
writeFile.close();
182+
if (!wipperFatFs.exists("/.metadata_never_index"))
183+
{
184+
File32 writeFile = wipperFatFs.open("/.metadata_never_index", FILE_WRITE);
185+
if (!writeFile)
186+
return false;
187+
writeFile.close();
188+
}
189+
if (!wipperFatFs.exists("/.Trashes"))
190+
{
191+
File32 writeFile = wipperFatFs.open("/.Trashes", FILE_WRITE);
192+
if (!writeFile)
193+
return false;
194+
writeFile.close();
195+
}
185196

186197
// Create wippersnapper_boot_out.txt file
187198
if (!createBootFile())

testplan.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
copy and analyse the hex difference for a corrupted file system versus freshly saved secrets + hunky dorey
2+
3+
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
4+
5+
then add the metro-s3
6+
Update step images in ws_boards for metro-s3
7+
8+
then add FT usb-to-gpio to ws_python
9+
10+
11+
Test ws_boards c6-aVref branch (esp32 aref=1.1 instead of 3.3, and C6 from 1.1 to 2.5v)
12+
13+
Fix pin numbers + names for Metro S2 (all digital etc, tx/rx and D1 [etc] seem wrong, analog5 is wrong etc)

0 commit comments

Comments
 (0)