Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 236ea5c

Browse filesBrowse files
andreagilardonipennam
authored andcommitted
QSPIFormat: Added confirmation request before reformatting fs
1 parent 12ed482 commit 236ea5c
Copy full SHA for 236ea5c

File tree

1 file changed

+29
-6
lines changed
Filter options

1 file changed

+29
-6
lines changed

‎libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino

Copy file name to clipboardExpand all lines: libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino
+29-6Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,29 @@ void setup() {
6767
MBRBlockDevice::partition(root, 4, 0x0B, 7 * 1024 * 1024, 14 * 1024 * 1024);
6868
// use space from 15.5MB to 16 MB for another fw, memory mapped
6969

70-
int err = wifi_data_fs.reformat(&wifi_data);
71-
if (err) {
70+
bool reformat = true;
71+
72+
if(!wifi_data_fs.mount(&wifi_data)) {
73+
Serial.println("\nPartition 1 already contains a filesystem, do you want to reformat it? Y/[n]");
74+
wifi_data_fs.unmount();
75+
76+
reformat = waitResponse();
77+
}
78+
79+
if (reformat && wifi_data_fs.reformat(&wifi_data)) {
7280
Serial.println("Error formatting WiFi partition");
7381
return;
7482
}
7583

76-
err = ota_data_fs.reformat(&ota_data);
77-
if (err) {
84+
reformat = true;
85+
if(!ota_data_fs.mount(&ota_data)) {
86+
Serial.println("\nPartition 2 already contains a filesystem, do you want to reformat it? Y/[n]");
87+
ota_data_fs.unmount();
88+
89+
reformat = waitResponse();
90+
}
91+
92+
if (reformat && ota_data_fs.reformat(&ota_data)) {
7893
Serial.println("Error formatting OTA partition");
7994
return;
8095
}
@@ -90,11 +105,19 @@ void setup() {
90105
user_data_fs = new mbed::FATFileSystem("user");
91106
}
92107

93-
err = user_data_fs->reformat(&user_data);
94-
if (err) {
108+
reformat = true;
109+
if(!user_data_fs->mount(&user_data)) {
110+
Serial.println("\nPartition 4 already contains a filesystem, do you want to reformat it? Y/[n]");
111+
user_data_fs->unmount();
112+
113+
reformat = waitResponse();
114+
}
115+
116+
if (reformat && user_data_fs->reformat(&user_data)) {
95117
Serial.println("Error formatting user partition");
96118
return;
97119
}
120+
98121
Serial.println("\nQSPI Flash formatted!");
99122
}
100123

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.