Clear vector after complete config state (#4194)

* Clear after complete config

* Don't collect . entries

* Log file name and size
This commit is contained in:
Ben Meadors 2024-06-28 09:50:22 -05:00 committed by GitHub
parent ce58a23f9b
commit 0016e747e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -124,7 +124,9 @@ std::vector<meshtastic_FileInfo> getFiles(const char *dirname, uint8_t levels)
#else #else
strcpy(fileInfo.file_name, file.name()); strcpy(fileInfo.file_name, file.name());
#endif #endif
filenames.push_back(fileInfo); if (!String(fileInfo.file_name).endsWith(".")) {
filenames.push_back(fileInfo);
}
file.close(); file.close();
} }
file = root.openNextFile(); file = root.openNextFile();

View File

@ -330,7 +330,6 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
// Clients sending special nonce don't want to see other nodeinfos // Clients sending special nonce don't want to see other nodeinfos
state = config_nonce == SPECIAL_NONCE ? STATE_SEND_FILEMANIFEST : STATE_SEND_OTHER_NODEINFOS; state = config_nonce == SPECIAL_NONCE ? STATE_SEND_FILEMANIFEST : STATE_SEND_OTHER_NODEINFOS;
config_state = 0; config_state = 0;
filesManifest.clear();
} }
break; break;
@ -358,9 +357,11 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
if (config_state == filesManifest.size()) { // also handles an empty filesManifest if (config_state == filesManifest.size()) { // also handles an empty filesManifest
state = STATE_SEND_COMPLETE_ID; state = STATE_SEND_COMPLETE_ID;
config_state = 0; config_state = 0;
filesManifest.clear();
} else { } else {
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_fileInfo_tag; fromRadioScratch.which_payload_variant = meshtastic_FromRadio_fileInfo_tag;
fromRadioScratch.fileInfo = filesManifest.at(config_state); fromRadioScratch.fileInfo = filesManifest.at(config_state);
LOG_DEBUG("File: %s (%d) bytes\n", fromRadioScratch.fileInfo.file_name, fromRadioScratch.fileInfo.size_bytes);
config_state++; config_state++;
} }
break; break;