File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
examples/PortentaH7Logger Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ void performUpdate() {
8181 UFile lastUpdateFile = usbRoot.createFile (" diff.txt" , FileMode::READ); // Create or open the last update file
8282
8383 backingUP = true ;
84- int lastUpdateBytes = lastUpdateFile.readAsString ().toInt (); // Read the last update size from the file
84+ unsigned lastUpdateBytes = lastUpdateFile.readAsString ().toInt (); // Read the last update size from the file
8585
8686 Serial.print (" Last update bytes: " ); Serial.println (lastUpdateBytes);
8787
@@ -97,7 +97,8 @@ void performUpdate() {
9797 unsigned long totalBytesToMove = bytesWritten - lastUpdateBytes;
9898 Serial.print (" New update bytes: " ); Serial.println (totalBytesToMove);
9999
100- uint8_t buffer[totalBytesToMove];
100+ uint8_t * buffer = new uint8_t [totalBytesToMove];
101+
101102 size_t bytesRead = logFile.read (buffer, totalBytesToMove);
102103 size_t bytesMoved = backupFile.write (buffer, bytesRead); // Only write the bytes that haven't been backed up yet
103104
@@ -115,6 +116,7 @@ void performUpdate() {
115116
116117 digitalWrite (USB_MOUNTED_LED, HIGH);
117118 backingUP = false ;
119+ delete[] buffer;
118120}
119121
120122
You can’t perform that action at this time.
0 commit comments