Skip to content

Commit 21e28f1

Browse files
added opta fixes, using latest POSIXStorage lib
1 parent cb735bf commit 21e28f1

File tree

8 files changed

+307
-219
lines changed

8 files changed

+307
-219
lines changed

extras/tests/TestExisting/TestExisting.ino

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
#include <Arduino_UnifiedStorage.h>
22

3-
InternalStorage internalStorage = InternalStorage();
43

4+
InternalStorage internalStorage = InternalStorage();
55

66
void setup() {
77
/* UNCOMMENT THIS PART IF YOU WANT TO ENABLE FORMATTING*/
88

99

10+
#if defined(ARDUINO_PORTENTA_C33) || defined(ARDUINO_PORTENTA_H7_M7)
11+
Serial.begin(115200);
12+
while(!Serial);
13+
#elif defined(ARDUINO_OPTA)
14+
beginRS485(115200);
15+
#endif
1016

11-
Serial.begin(9600);
12-
delay(1000); // Give time to open the Serial Monitor
13-
while(!Serial);
1417

1518

1619

@@ -19,36 +22,30 @@ void setup() {
1922

2023

2124
Folder root = internalStorage.getRootFolder();
22-
Serial.println(root.getPathAsString());
25+
2326

2427
// Test copyTo
25-
Serial.println("Testing copyTo...");
28+
printFormatted("Testing copyTo... \n");
2629
Folder sourceFolder2 = root.createSubfolder("source_folder");
27-
Serial.println("Folder 1 created");
30+
printFormatted("Folder 1 created \n");
2831

29-
Serial.println("Trying to create a folder on top of an existing one... without overwrite");
32+
printFormatted("Trying to create a folder on top of an existing one... without overwrite \n");
3033
Folder sourceFolder3 = root.createSubfolder("source_folder");
3134

32-
Serial.println("Trying to create a folder on top of an existing one... with overwrite");
35+
printFormatted("Trying to create a folder on top of an existing one... with overwrite \n");
3336
Folder sourceFolder4 = root.createSubfolder("source_folder", true);
3437

3538
Folder destinationFolder2 = root.createSubfolder("destination_folder");
36-
Serial.println("Folder 2 created");
37-
38-
Serial.println(sourceFolder2.getPathAsString());
39-
Serial.println(destinationFolder2.getPathAsString());
39+
printFormatted("Folder 2 created \n");
4040

41-
Serial.println();
42-
Serial.println();
4341

4442

4543
bool copyResult = sourceFolder2.copyTo(destinationFolder2, true); // Overwrite if exists
4644
if (copyResult) {
47-
Serial.println("Copy successful");
45+
printFormatted("Copy successful \n");
4846
} else {
49-
Serial.println("Copy failed");
47+
printFormatted("Copy failed \n");
5048
}
51-
Serial.println();
5249

5350

5451

@@ -57,15 +54,12 @@ void setup() {
5754
Folder sourceFolder = root.createSubfolder("source");
5855
Folder destinationFolder = root.createSubfolder("destination");
5956

60-
61-
Serial.println();
62-
Serial.println();
63-
Serial.println("Testing moveTo...");
57+
printFormatted("Testing moveTo... \n");
6458
bool moveResult = sourceFolder.moveTo(destinationFolder, true); // Overwrite if exists
6559
if (moveResult) {
66-
Serial.println("Move successful");
60+
printFormatted("Move successful \n");
6761
} else {
68-
Serial.println("Move failed");
62+
printFormatted("Move failed \n");
6963
}
7064

7165

@@ -79,14 +73,10 @@ void setup() {
7973

8074

8175
bool success = someFile.copyTo(someOtherFolder);
82-
Serial.println("trying to copy file without overwrite");
83-
Serial.println(success);
76+
printFormatted("trying to copy file without overwrite: %d\n", success);
8477

8578
success = someFile.copyTo(someOtherFolder,true);
86-
Serial.println("trying to copy file with overwrite");
87-
Serial.println(success);
88-
89-
79+
printFormatted("trying to copy file with overwrite: %d \n", success);
9080

9181
}
9282

0 commit comments

Comments
 (0)