Skip to content

Commit 8cc66dc

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 31c69c2 + 1c56f58 commit 8cc66dc

File tree

13 files changed

+82
-70
lines changed

13 files changed

+82
-70
lines changed

.github/workflows/check-arduino.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
steps:
1818
- name: Checkout repository
19-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
2020

2121
- name: Arduino Lint
2222
uses: arduino/arduino-lint-action@v1

.github/workflows/compile-examples.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- fqbn: arduino:samd:mkrzero
5050
platforms: |
5151
- name: arduino:samd
52-
- fqbn: arduino:mbed_portenta:envie_m4
52+
- fqbn: arduino:mbed_portenta:envie_m7:target_core=cm4
5353
platforms: |
5454
- name: arduino:mbed_portenta
5555
- fqbn: arduino:mbed_portenta:envie_m7
@@ -64,7 +64,7 @@ jobs:
6464
6565
steps:
6666
- name: Checkout repository
67-
uses: actions/checkout@v3
67+
uses: actions/checkout@v4
6868

6969
- name: Compile examples
7070
uses: arduino/compile-sketches@v1

.github/workflows/spell-check.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
steps:
1818
- name: Checkout repository
19-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
2020

2121
- name: Spell check
2222
uses: codespell-project/actions-codespell@master

.github/workflows/sync-labels.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727

2828
steps:
2929
- name: Checkout repository
30-
uses: actions/checkout@v3
30+
uses: actions/checkout@v4
3131

3232
- name: Download JSON schema for labels configuration file
3333
id: download-schema
34-
uses: carlosperate/download-file-action@v1
34+
uses: carlosperate/download-file-action@v2
3535
with:
3636
file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/arduino-tooling-gh-label-configuration-schema.json
3737
location: ${{ runner.temp }}/label-configuration-schema
@@ -65,7 +65,7 @@ jobs:
6565

6666
steps:
6767
- name: Download
68-
uses: carlosperate/download-file-action@v1
68+
uses: carlosperate/download-file-action@v2
6969
with:
7070
file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }}
7171

@@ -105,7 +105,7 @@ jobs:
105105
echo "::set-output name=flag::--dry-run"
106106
107107
- name: Checkout repository
108-
uses: actions/checkout@v3
108+
uses: actions/checkout@v4
109109

110110
- name: Download configuration files artifact
111111
uses: actions/download-artifact@v3
@@ -114,7 +114,7 @@ jobs:
114114
path: ${{ env.CONFIGURATIONS_FOLDER }}
115115

116116
- name: Remove unneeded artifact
117-
uses: geekyeggo/delete-artifact@v1
117+
uses: geekyeggo/delete-artifact@v2
118118
with:
119119
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
120120

docs/api.md

+55-50
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ Print data, followed by a carriage return and newline, to the File, which must h
451451
```
452452
file.println()
453453
file.println(data)
454-
file.print(data, BASE)
454+
file.println(data, BASE)
455455
```
456456

457457
#### Parameters
@@ -669,29 +669,29 @@ void loop() {
669669
}
670670
671671
void printDirectory(File dir, int numTabs) {
672-
while(true) {
673-
674-
File entry = dir.openNextFile();
675-
if (! entry) {
676-
// No more files
677-
// Serial.println("**nomorefiles**");
678-
break;
679-
}
680-
681-
for (uint8_t i=0; i<numTabs; i++) {
682-
Serial.print('\t');
683-
}
684-
685-
Serial.print(entry.name());
686-
if (entry.isDirectory()) {
687-
Serial.println("/");
688-
printDirectory(entry, numTabs+1);
689-
} else {
690-
// Files have sizes, directories do not
691-
Serial.print("\t\t");
692-
Serial.println(entry.size(), DEC);
693-
}
694-
}
672+
while (true) {
673+
674+
File entry = dir.openNextFile();
675+
if (!entry) {
676+
// No more files
677+
// Serial.println("**nomorefiles**");
678+
break;
679+
}
680+
681+
for (uint8_t i = 0; i < numTabs; i++) {
682+
Serial.print('\t');
683+
}
684+
685+
Serial.print(entry.name());
686+
if (entry.isDirectory()) {
687+
Serial.println("/");
688+
printDirectory(entry, numTabs + 1);
689+
} else {
690+
// Files have sizes, directories do not
691+
Serial.print("\t\t");
692+
Serial.println(entry.size(), DEC);
693+
}
694+
}
695695
}
696696
```
697697

@@ -745,7 +745,7 @@ void setup() {
745745
delay(2000);
746746
747747
Serial.println();
748-
Serial.println("Rewinding, and repeating below:" );
748+
Serial.println("Rewinding, and repeating below:");
749749
Serial.println();
750750
delay(2000);
751751
@@ -761,7 +761,7 @@ void loop() {
761761
void printDirectory(File dir, int numTabs) {
762762
while (true) {
763763
File entry = dir.openNextFile();
764-
if (! entry) {
764+
if (!entry) {
765765
if (numTabs == 0)
766766
Serial.println("** Done **");
767767
return;
@@ -833,6 +833,13 @@ void setup() {
833833
SD.begin(10);
834834
root = SD.open("/");
835835
printDirectory(root, 0);
836+
Serial.println();
837+
838+
Serial.println("PRINT AGAIN");
839+
Serial.println("-----------");
840+
root.rewindDirectory(); // Return to the first file in the directory
841+
printDirectory(root, 0);
842+
836843
Serial.println("Done!");
837844
}
838845
@@ -841,29 +848,27 @@ void loop() {
841848
}
842849
843850
void printDirectory(File dir, int numTabs) {
844-
while(true) {
845-
File entry = dir.openNextFile();
846-
if (! entry) {
847-
// No more files
848-
// Return to the first file in the directory
849-
dir.rewindDirectory();
850-
break;
851-
}
852-
853-
for (uint8_t i=0; i<numTabs; i++) {
854-
Serial.print('\t');
855-
}
856-
857-
Serial.print(entry.name());
858-
if (entry.isDirectory()) {
859-
Serial.println("/");
860-
printDirectory(entry, numTabs+1);
861-
} else {
862-
// Files have sizes, directories do not
863-
Serial.print("\t\t");
864-
Serial.println(entry.size(), DEC);
865-
}
866-
}
851+
while (true) {
852+
File entry = dir.openNextFile();
853+
if (!entry) {
854+
// No more files
855+
break;
856+
}
857+
858+
for (uint8_t i = 0; i < numTabs; i++) {
859+
Serial.print('\t');
860+
}
861+
862+
Serial.print(entry.name());
863+
if (entry.isDirectory()) {
864+
Serial.println("/");
865+
printDirectory(entry, numTabs + 1);
866+
} else {
867+
// Files have sizes, directories do not
868+
Serial.print("\t\t");
869+
Serial.println(entry.size(), DEC);
870+
}
871+
}
867872
}
868873
```
869874

@@ -882,4 +887,4 @@ void printDirectory(File dir, int numTabs) {
882887
* [read()](#read)
883888
* [write()](#write)
884889
* [isDirectory()](#isdirectory)
885-
* [openNextFile()](#opennextfile)
890+
* [openNextFile()](#opennextfile)

examples/CardInfo/CardInfo.ino

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void setup() {
5252
Serial.println("* is a card inserted?");
5353
Serial.println("* is your wiring correct?");
5454
Serial.println("* did you change the chipSelect pin to match your shield or module?");
55+
Serial.println("Note: press reset button on the board and reopen this Serial Monitor after fixing your issue!");
5556
while (1);
5657
} else {
5758
Serial.println("Wiring is correct and a card is present.");

examples/Datalogger/Datalogger.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void setup() {
4141
Serial.println("1. is a card inserted?");
4242
Serial.println("2. is your wiring correct?");
4343
Serial.println("3. did you change the chipSelect pin to match your shield or module?");
44-
Serial.println("Note: press reset or reopen this Serial Monitor after fixing your issue!");
44+
Serial.println("Note: press reset button on the board and reopen this Serial Monitor after fixing your issue!");
4545
while (true);
4646
}
4747

examples/DumpFile/DumpFile.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void setup() {
3838
Serial.println("1. is a card inserted?");
3939
Serial.println("2. is your wiring correct?");
4040
Serial.println("3. did you change the chipSelect pin to match your shield or module?");
41-
Serial.println("Note: press reset or reopen this Serial Monitor after fixing your issue!");
41+
Serial.println("Note: press reset button on the board and reopen this Serial Monitor after fixing your issue!");
4242
while (true);
4343
}
4444

examples/Files/Files.ino

+6-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ while (!Serial);
3232

3333
Serial.print("Initializing SD card...");
3434

35-
if (!SD.begin(10)) {
36-
Serial.println("initialization failed!");
35+
if (!SD.begin(chipSelect)) {
36+
Serial.println("initialization failed. Things to check:");
37+
Serial.println("1. is a card inserted?");
38+
Serial.println("2. is your wiring correct?");
39+
Serial.println("3. did you change the chipSelect pin to match your shield or module?");
40+
Serial.println("Note: press reset button on the board and reopen this serial monitor after fixing your issue!");
3741
while (1);
3842
}
3943
Serial.println("initialization done.");

examples/NonBlockingWrite/NonBlockingWrite.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void setup() {
6464
Serial.println("1. is a card inserted?");
6565
Serial.println("2. is your wiring correct?");
6666
Serial.println("3. did you change the chipSelect pin to match your shield or module?");
67-
Serial.println("Note: press reset or reopen this Serial Monitor after fixing your issue!");
67+
Serial.println("Note: press reset button on the board and reopen this Serial Monitor after fixing your issue!");
6868
while (true);
6969
}
7070

examples/ReadWrite/ReadWrite.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void setup() {
3636
Serial.println("1. is a card inserted?");
3737
Serial.println("2. is your wiring correct?");
3838
Serial.println("3. did you change the chipSelect pin to match your shield or module?");
39-
Serial.println("Note: press reset or reopen this Serial Monitor after fixing your issue!");
39+
Serial.println("Note: press reset button on the board and reopen this Serial Monitor after fixing your issue!");
4040
while (true);
4141
}
4242

examples/listfiles/listfiles.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void setup() {
4444
Serial.println("1. is a card inserted?");
4545
Serial.println("2. is your wiring correct?");
4646
Serial.println("3. did you change the chipSelect pin to match your shield or module?");
47-
Serial.println("Note: press reset or reopen this Serial Monitor after fixing your issue!");
47+
Serial.println("Note: press reset button on the board and reopen this Serial Monitor after fixing your issue!");
4848
while (true);
4949
}
5050

src/SD.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@
5454

5555
namespace SDLib {
5656

57-
// Used by `getNextPathComponent`
58-
#define MAX_COMPONENT_LEN 12 // What is max length?
59-
#define PATH_COMPONENT_BUFFER_LEN MAX_COMPONENT_LEN+1
57+
// Used by `getNextPathComponent`
58+
#define MAX_COMPONENT_LEN 12
59+
#define PATH_COMPONENT_BUFFER_LEN (MAX_COMPONENT_LEN + 1)
60+
// BASENAME:char(8) + '.':char(1) + EXT:char(3) = 12 (a.k.a short 8.3 name)
61+
// And an extra space for '\0' for path buffer
6062

6163
bool getNextPathComponent(const char *path, unsigned int *p_offset,
6264
char *buffer) {
@@ -453,7 +455,7 @@ namespace SDLib {
453455
454456
*/
455457

456-
int pathidx;
458+
int pathidx = 0;
457459

458460
// do the interactive search
459461
SdFile parentdir = getParentDir(filepath, &pathidx);

0 commit comments

Comments
 (0)