From 0016e747e912e2583a36ac7be6a6b9ed23073b3b Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 28 Jun 2024 09:50:22 -0500 Subject: [PATCH] Clear vector after complete config state (#4194) * Clear after complete config * Don't collect . entries * Log file name and size --- src/FSCommon.cpp | 4 +++- src/mesh/PhoneAPI.cpp | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/FSCommon.cpp b/src/FSCommon.cpp index f9e9f1a82..7d3788c4d 100644 --- a/src/FSCommon.cpp +++ b/src/FSCommon.cpp @@ -124,7 +124,9 @@ std::vector getFiles(const char *dirname, uint8_t levels) #else strcpy(fileInfo.file_name, file.name()); #endif - filenames.push_back(fileInfo); + if (!String(fileInfo.file_name).endsWith(".")) { + filenames.push_back(fileInfo); + } file.close(); } file = root.openNextFile(); diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 399715f61..d6721b018 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -330,7 +330,6 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) // Clients sending special nonce don't want to see other nodeinfos state = config_nonce == SPECIAL_NONCE ? STATE_SEND_FILEMANIFEST : STATE_SEND_OTHER_NODEINFOS; config_state = 0; - filesManifest.clear(); } break; @@ -358,9 +357,11 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) if (config_state == filesManifest.size()) { // also handles an empty filesManifest state = STATE_SEND_COMPLETE_ID; config_state = 0; + filesManifest.clear(); } else { fromRadioScratch.which_payload_variant = meshtastic_FromRadio_fileInfo_tag; fromRadioScratch.fileInfo = filesManifest.at(config_state); + LOG_DEBUG("File: %s (%d) bytes\n", fromRadioScratch.fileInfo.file_name, fromRadioScratch.fileInfo.size_bytes); config_state++; } break;