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() {
81
81
UFile lastUpdateFile = usbRoot.createFile (" diff.txt" , FileMode::READ); // Create or open the last update file
82
82
83
83
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
85
85
86
86
Serial.print (" Last update bytes: " ); Serial.println (lastUpdateBytes);
87
87
@@ -97,7 +97,8 @@ void performUpdate() {
97
97
unsigned long totalBytesToMove = bytesWritten - lastUpdateBytes;
98
98
Serial.print (" New update bytes: " ); Serial.println (totalBytesToMove);
99
99
100
- uint8_t buffer[totalBytesToMove];
100
+ uint8_t * buffer = new uint8_t [totalBytesToMove];
101
+
101
102
size_t bytesRead = logFile.read (buffer, totalBytesToMove);
102
103
size_t bytesMoved = backupFile.write (buffer, bytesRead); // Only write the bytes that haven't been backed up yet
103
104
@@ -115,6 +116,7 @@ void performUpdate() {
115
116
116
117
digitalWrite (USB_MOUNTED_LED, HIGH);
117
118
backingUP = false ;
119
+ delete[] buffer;
118
120
}
119
121
120
122
You can’t perform that action at this time.
0 commit comments