Skip to content

Commit

Permalink
Clear vector after complete config state (#4194)
Browse files Browse the repository at this point in the history
* Clear after complete config

* Don't collect . entries

* Log file name and size
  • Loading branch information
thebentern authored Jun 28, 2024
1 parent ce58a23 commit 0016e74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/FSCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ std::vector<meshtastic_FileInfo> 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();
Expand Down
3 changes: 2 additions & 1 deletion src/mesh/PhoneAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0016e74

Please sign in to comment.