@@ -97,10 +97,10 @@ void performUpdate() {
97
97
backingUP = true ;
98
98
unsigned lastUpdateBytes = lastUpdateFile.readAsString ().toInt (); // Read the last update size from the file
99
99
100
- debugPrint (" Last update bytes: " + String (lastUpdateBytes));
100
+ Arduino_UnifiedStorage:: debugPrint (" Last update bytes: " + String (lastUpdateBytes));
101
101
102
102
if (lastUpdateBytes >= bytesWritten) {
103
- debugPrint (" No new data to copy. " );
103
+ Arduino_UnifiedStorage:: debugPrint (" No new data to copy. " );
104
104
backupFile.close ();
105
105
lastUpdateFile.close ();
106
106
backingUP = false ;
@@ -109,14 +109,14 @@ void performUpdate() {
109
109
110
110
logFile.seek (lastUpdateBytes); // Move the file pointer to the last update position
111
111
unsigned long totalBytesToMove = bytesWritten - lastUpdateBytes;
112
- debugPrint (" New update bytes: " + String (totalBytesToMove));
112
+ Arduino_UnifiedStorage:: debugPrint (" New update bytes: " + String (totalBytesToMove));
113
113
114
114
uint8_t * buffer = new uint8_t [totalBytesToMove];
115
115
116
116
size_t bytesRead = logFile.read (buffer, totalBytesToMove);
117
117
size_t bytesMoved = backupFile.write (buffer, bytesRead); // Only write the bytes that haven't been backed up yet
118
118
119
- debugPrint (" Successfully copied " + String (bytesMoved) + " new bytes. " );
119
+ Arduino_UnifiedStorage:: debugPrint (" Successfully copied " + String (bytesMoved) + " new bytes. " );
120
120
121
121
lastUpdateFile.changeMode (FileMode::WRITE); // Open the last update file in write mode
122
122
lastUpdateFile.write (String (lastUpdateBytes + bytesMoved)); // Update the last update size
@@ -138,32 +138,32 @@ void performUpdate() {
138
138
void backupToUSB () {
139
139
if (usbAvailable && !usbIntialized){
140
140
usbStorage.begin ();
141
- debugPrint (" First drive insertion, creating folders... " );
141
+ Arduino_UnifiedStorage:: debugPrint (" First drive insertion, creating folders... " );
142
142
Folder usbRoot = usbStorage.getRootFolder ();
143
143
String folderName = " LoggerBackup" + String (random (9999 ));
144
144
backupFolder = usbRoot.createSubfolder (folderName);
145
- debugPrint (" Successfully created backup folder: " + backupFolder.getPathAsString ());
145
+ Arduino_UnifiedStorage:: debugPrint (" Successfully created backup folder: " + backupFolder.getPathAsString ());
146
146
usbStorage.unmount ();
147
147
usbIntialized = true ;
148
148
}
149
149
else if (usbAvailable && usbIntialized) {
150
- debugPrint (" USB Mass storage is available " );
150
+ Arduino_UnifiedStorage:: debugPrint (" USB Mass storage is available " );
151
151
delay (100 );
152
152
if (!usbStorage.isMounted ()) {
153
153
154
- debugPrint (" Mounting USB Mass Storage " );
154
+ Arduino_UnifiedStorage:: debugPrint (" Mounting USB Mass Storage " );
155
155
digitalWrite (USB_MOUNTED_LED, LOW);
156
156
if (usbStorage.begin ()){
157
157
performUpdate ();
158
158
}
159
159
160
160
} else if (usbStorage.isMounted ()) {
161
- debugPrint (" USB Mass storage is connected, performing update " );
161
+ Arduino_UnifiedStorage:: debugPrint (" USB Mass storage is connected, performing update " );
162
162
performUpdate ();
163
163
164
164
}
165
165
} else {
166
- debugPrint (" USB Mass storage is not available " );
166
+ Arduino_UnifiedStorage:: debugPrint (" USB Mass storage is not available " );
167
167
}
168
168
169
169
@@ -185,17 +185,17 @@ void setup() {
185
185
usbStorage.onDisconnect (disconnectionCallback);
186
186
187
187
pinMode (USB_MOUNTED_LED, OUTPUT);
188
- debugPrint (" Formatting internal storage... " );
188
+ Arduino_UnifiedStorage:: debugPrint (" Formatting internal storage... " );
189
189
int formatted = internalStorage.format (FS_LITTLEFS);
190
- debugPrint (" QSPI Format status: " + String (formatted));
190
+ Arduino_UnifiedStorage:: debugPrint (" QSPI Format status: " + String (formatted));
191
191
192
192
193
193
194
194
if (!internalStorage.begin ()) {
195
- debugPrint (" Failed to initialize internal storage " );
195
+ Arduino_UnifiedStorage:: debugPrint (" Failed to initialize internal storage " );
196
196
return ;
197
197
} else {
198
- debugPrint (" Initialized storage " );
198
+ Arduino_UnifiedStorage:: debugPrint (" Initialized storage " );
199
199
}
200
200
201
201
}
0 commit comments