From 2cb6e7bd37f0ff705fc73ba042832237ed143f62 Mon Sep 17 00:00:00 2001 From: geeksville Date: Thu, 27 Jun 2024 11:14:16 -0700 Subject: [PATCH 1/2] tell vscode, if formatting, use whatever our trunk formatter wants (#4186) without this flag if the user has set some other formatter (clang) in their user level settings, it will be looking in the wrong directory for the clang options (we want the options in .trunk/clang) Note: formatOnSave is true in master, which means a bunch of our older files are non compliant and if you edit them it will generate lots of formatting related diffs. I guess I'll start letting that happen with my future commits ;-). --- .vscode/settings.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 07e198f0a..bf9b82111 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,5 +4,8 @@ "trunk.enableWindows": true, "files.insertFinalNewline": false, "files.trimFinalNewlines": false, - "cmake.configureOnOpen": false + "cmake.configureOnOpen": false, + "[cpp]": { + "editor.defaultFormatter": "trunk.io" + } } From 41d633bfd84aec023922a7f34611a3715a6dd1cd Mon Sep 17 00:00:00 2001 From: geeksville Date: Thu, 27 Jun 2024 18:43:08 -0700 Subject: [PATCH 2/2] fix the build - would loop forever if there were no files to send (#4188) --- src/mesh/PhoneAPI.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 57a42651a..399715f61 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -354,15 +354,14 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) case STATE_SEND_FILEMANIFEST: { LOG_INFO("getFromRadio=STATE_SEND_FILEMANIFEST\n"); - fromRadioScratch.which_payload_variant = meshtastic_FromRadio_fileInfo_tag; - if (config_state < filesManifest.size()) { + // last element + if (config_state == filesManifest.size()) { // also handles an empty filesManifest + state = STATE_SEND_COMPLETE_ID; + config_state = 0; + } else { + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_fileInfo_tag; fromRadioScratch.fileInfo = filesManifest.at(config_state); config_state++; - // last element - if (config_state == filesManifest.size()) { - state = STATE_SEND_COMPLETE_ID; - config_state = 0; - } } break; }