@@ -52,13 +52,13 @@ bool backingUP = false;
5252void connectionCallback (){
5353 usbAvailable = true ;
5454 usbStorage.removeOnConnectCallback ();
55- Arduino_UnifiedStorage::debugPrint (" USB drive connected." );
55+ Arduino_UnifiedStorage::testPrint (" USB drive connected." );
5656}
5757
5858void disconnectionCallback (){
5959 usbAvailable = false ;
6060 usbStorage.onConnect (connectionCallback);
61- Arduino_UnifiedStorage::debugPrint (" USB drive disconnected." );
61+ Arduino_UnifiedStorage::testPrint (" USB drive disconnected." );
6262}
6363// Function to run a given method periodically
6464void runPeriodically (void (*method)(), unsigned long interval, unsigned long* variable) {
@@ -97,10 +97,10 @@ void performUpdate() {
9797 backingUP = true ;
9898 unsigned lastUpdateBytes = lastUpdateFile.readAsString ().toInt (); // Read the last update size from the file
9999
100- Arduino_UnifiedStorage::debugPrint (" Last update bytes: " + String (lastUpdateBytes));
100+ Arduino_UnifiedStorage::testPrint (" Last update bytes: " + String (lastUpdateBytes));
101101
102102 if (lastUpdateBytes >= bytesWritten) {
103- Arduino_UnifiedStorage::debugPrint (" No new data to copy. " );
103+ Arduino_UnifiedStorage::testPrint (" No new data to copy. " );
104104 backupFile.close ();
105105 lastUpdateFile.close ();
106106 backingUP = false ;
@@ -109,14 +109,14 @@ void performUpdate() {
109109
110110 logFile.seek (lastUpdateBytes); // Move the file pointer to the last update position
111111 unsigned long totalBytesToMove = bytesWritten - lastUpdateBytes;
112- Arduino_UnifiedStorage::debugPrint (" New update bytes: " + String (totalBytesToMove));
112+ Arduino_UnifiedStorage::testPrint (" New update bytes: " + String (totalBytesToMove));
113113
114114 uint8_t * buffer = new uint8_t [totalBytesToMove];
115115
116116 size_t bytesRead = logFile.read (buffer, totalBytesToMove);
117117 size_t bytesMoved = backupFile.write (buffer, bytesRead); // Only write the bytes that haven't been backed up yet
118118
119- Arduino_UnifiedStorage::debugPrint (" Successfully copied " + String (bytesMoved) + " new bytes. " );
119+ Arduino_UnifiedStorage::testPrint (" Successfully copied " + String (bytesMoved) + " new bytes. " );
120120
121121 lastUpdateFile.changeMode (FileMode::WRITE); // Open the last update file in write mode
122122 lastUpdateFile.write (String (lastUpdateBytes + bytesMoved)); // Update the last update size
@@ -137,32 +137,32 @@ void performUpdate() {
137137void backupToUSB () {
138138 if (usbAvailable && !usbIntialized){
139139 usbStorage.begin ();
140- Arduino_UnifiedStorage::debugPrint (" First drive insertion, creating folders... " );
140+ Arduino_UnifiedStorage::testPrint (" First drive insertion, creating folders... " );
141141 Folder usbRoot = usbStorage.getRootFolder ();
142142 String folderName = " LoggerBackup" + String (random (9999 ));
143143 backupFolder = usbRoot.createSubfolder (folderName);
144- Arduino_UnifiedStorage::debugPrint (" Successfully created backup folder: " + backupFolder.getPathAsString ());
144+ Arduino_UnifiedStorage::testPrint (" Successfully created backup folder: " + backupFolder.getPathAsString ());
145145 usbStorage.unmount ();
146146 usbIntialized = true ;
147147 }
148148 else if (usbAvailable && usbIntialized) {
149- Arduino_UnifiedStorage::debugPrint (" USB Mass storage is available " );
149+ Arduino_UnifiedStorage::testPrint (" USB Mass storage is available " );
150150 delay (100 );
151151 if (!usbStorage.isMounted ()) {
152152
153- Arduino_UnifiedStorage::debugPrint (" Mounting USB Mass Storage " );
153+ Arduino_UnifiedStorage::testPrint (" Mounting USB Mass Storage " );
154154 digitalWrite (USB_MOUNTED_LED, LOW);
155155 if (usbStorage.begin ()){
156156 performUpdate ();
157157 }
158158
159159 } 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 " );
161161 performUpdate ();
162162
163163 }
164164 } else {
165- Arduino_UnifiedStorage::debugPrint (" USB Mass storage is not available " );
165+ Arduino_UnifiedStorage::testPrint (" USB Mass storage is not available " );
166166 }
167167}
168168
@@ -178,21 +178,21 @@ void setup() {
178178#endif
179179
180180 // toggle this to enable debugging output
181- Arduino_UnifiedStorage::debuggingModeEnabled = true ;
181+ Arduino_UnifiedStorage::debuggingModeEnabled = false ;
182182
183183 usbStorage.onConnect (connectionCallback);
184184 usbStorage.onDisconnect (disconnectionCallback);
185185
186186 pinMode (USB_MOUNTED_LED, OUTPUT);
187- Arduino_UnifiedStorage::debugPrint (" Formatting internal storage... " );
187+ Arduino_UnifiedStorage::testPrint (" Formatting internal storage... " );
188188 int formatted = internalStorage.format (FS_LITTLEFS);
189- Arduino_UnifiedStorage::debugPrint (" QSPI Format status: " + String (formatted));
189+ Arduino_UnifiedStorage::testPrint (" QSPI Format status: " + String (formatted));
190190
191191 if (!internalStorage.begin ()) {
192- Arduino_UnifiedStorage::debugPrint (" Failed to initialize internal storage " );
192+ Arduino_UnifiedStorage::testPrint (" Failed to initialize internal storage " );
193193 return ;
194194 } else {
195- Arduino_UnifiedStorage::debugPrint (" Initialized storage " );
195+ Arduino_UnifiedStorage::testPrint (" Initialized storage " );
196196 }
197197}
198198
0 commit comments