From 345ca55d32ac6f01f52989dafde7845b71614633 Mon Sep 17 00:00:00 2001 From: Brandon Bunce <67491262+brandonbunce@users.noreply.github.com> Date: Sun, 24 Sep 2023 15:48:51 -0700 Subject: [PATCH] Update MAKERphone.cpp Fixed writeFile() and appendFile() by setting SD.open()'s mode parameter. Otherwise, calling either function will fail because SD.open() defaults to read-only mode. --- src/MAKERphone.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MAKERphone.cpp b/src/MAKERphone.cpp index 5aed6a1..9013a0f 100644 --- a/src/MAKERphone.cpp +++ b/src/MAKERphone.cpp @@ -4757,7 +4757,7 @@ void MAKERphone::writeFile(const char *path, const char *message) ; Serial.printf("Writing file: %s\n", path); - File file = SD.open(path); + File file = SD.open(path, FILE_WRITE); if (!file) { Serial.println("Failed to open file for writing"); @@ -4777,7 +4777,7 @@ void MAKERphone::appendFile(const char *path, const char *message) { Serial.printf("Appending to file: %s\n", path); - File file = SD.open(path); + File file = SD.open(path, FILE_APPEND); if (!file) { Serial.println("Failed to open file for appending"); @@ -4801,7 +4801,7 @@ String MAKERphone::readFile(const char *path) ; Serial.printf("Reading file: %s\n", path); String helper = ""; - File file = SD.open(path); + File file = SD.open(path, FILE_READ); if (!file) { Serial.println("Failed to open file for reading");