Skip to content

Commit 34d3bcc

Browse files
Merge pull request #10 from arduino-libraries/sketch-fixes
Address compiler warning in Sketch file
2 parents 400b91d + ccaa7b8 commit 34d3bcc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/PortentaH7Logger/PortentaH7Logger.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)