@@ -52,13 +52,13 @@ bool backingUP = false;
52
52
void connectionCallback (){
53
53
usbAvailable = true ;
54
54
usbStorage.removeOnConnectCallback ();
55
- Arduino_UnifiedStorage::debugPrint (" USB drive connected." );
55
+ Arduino_UnifiedStorage::testPrint (" USB drive connected." );
56
56
}
57
57
58
58
void disconnectionCallback (){
59
59
usbAvailable = false ;
60
60
usbStorage.onConnect (connectionCallback);
61
- Arduino_UnifiedStorage::debugPrint (" USB drive disconnected." );
61
+ Arduino_UnifiedStorage::testPrint (" USB drive disconnected." );
62
62
}
63
63
// Function to run a given method periodically
64
64
void runPeriodically (void (*method)(), unsigned long interval, unsigned long* variable) {
@@ -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
- Arduino_UnifiedStorage::debugPrint (" Last update bytes: " + String (lastUpdateBytes));
100
+ Arduino_UnifiedStorage::testPrint (" Last update bytes: " + String (lastUpdateBytes));
101
101
102
102
if (lastUpdateBytes >= bytesWritten) {
103
- Arduino_UnifiedStorage::debugPrint (" No new data to copy. " );
103
+ Arduino_UnifiedStorage::testPrint (" 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
- Arduino_UnifiedStorage::debugPrint (" New update bytes: " + String (totalBytesToMove));
112
+ Arduino_UnifiedStorage::testPrint (" 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
- Arduino_UnifiedStorage::debugPrint (" Successfully copied " + String (bytesMoved) + " new bytes. " );
119
+ Arduino_UnifiedStorage::testPrint (" 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
@@ -137,32 +137,32 @@ void performUpdate() {
137
137
void backupToUSB () {
138
138
if (usbAvailable && !usbIntialized){
139
139
usbStorage.begin ();
140
- Arduino_UnifiedStorage::debugPrint (" First drive insertion, creating folders... " );
140
+ Arduino_UnifiedStorage::testPrint (" First drive insertion, creating folders... " );
141
141
Folder usbRoot = usbStorage.getRootFolder ();
142
142
String folderName = " LoggerBackup" + String (random (9999 ));
143
143
backupFolder = usbRoot.createSubfolder (folderName);
144
- Arduino_UnifiedStorage::debugPrint (" Successfully created backup folder: " + backupFolder.getPathAsString ());
144
+ Arduino_UnifiedStorage::testPrint (" Successfully created backup folder: " + backupFolder.getPathAsString ());
145
145
usbStorage.unmount ();
146
146
usbIntialized = true ;
147
147
}
148
148
else if (usbAvailable && usbIntialized) {
149
- Arduino_UnifiedStorage::debugPrint (" USB Mass storage is available " );
149
+ Arduino_UnifiedStorage::testPrint (" USB Mass storage is available " );
150
150
delay (100 );
151
151
if (!usbStorage.isMounted ()) {
152
152
153
- Arduino_UnifiedStorage::debugPrint (" Mounting USB Mass Storage " );
153
+ Arduino_UnifiedStorage::testPrint (" Mounting USB Mass Storage " );
154
154
digitalWrite (USB_MOUNTED_LED, LOW);
155
155
if (usbStorage.begin ()){
156
156
performUpdate ();
157
157
}
158
158
159
159
} else if (usbStorage.isMounted ()) {
160
- Arduino_UnifiedStorage::debugPrint (" USB Mass storage is connected, performing update " );
160
+ Arduino_UnifiedStorage::testPrint (" USB Mass storage is connected, performing update " );
161
161
performUpdate ();
162
162
163
163
}
164
164
} else {
165
- Arduino_UnifiedStorage::debugPrint (" USB Mass storage is not available " );
165
+ Arduino_UnifiedStorage::testPrint (" USB Mass storage is not available " );
166
166
}
167
167
}
168
168
@@ -178,21 +178,21 @@ void setup() {
178
178
#endif
179
179
180
180
// toggle this to enable debugging output
181
- Arduino_UnifiedStorage::debuggingModeEnabled = true ;
181
+ Arduino_UnifiedStorage::debuggingModeEnabled = false ;
182
182
183
183
usbStorage.onConnect (connectionCallback);
184
184
usbStorage.onDisconnect (disconnectionCallback);
185
185
186
186
pinMode (USB_MOUNTED_LED, OUTPUT);
187
- Arduino_UnifiedStorage::debugPrint (" Formatting internal storage... " );
187
+ Arduino_UnifiedStorage::testPrint (" Formatting internal storage... " );
188
188
int formatted = internalStorage.format (FS_LITTLEFS);
189
- Arduino_UnifiedStorage::debugPrint (" QSPI Format status: " + String (formatted));
189
+ Arduino_UnifiedStorage::testPrint (" QSPI Format status: " + String (formatted));
190
190
191
191
if (!internalStorage.begin ()) {
192
- Arduino_UnifiedStorage::debugPrint (" Failed to initialize internal storage " );
192
+ Arduino_UnifiedStorage::testPrint (" Failed to initialize internal storage " );
193
193
return ;
194
194
} else {
195
- Arduino_UnifiedStorage::debugPrint (" Initialized storage " );
195
+ Arduino_UnifiedStorage::testPrint (" Initialized storage " );
196
196
}
197
197
}
198
198
0 commit comments