From f3ae02c425835602c9b01fdfb2c70c514a2edfb7 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Tue, 12 May 2026 16:32:00 -0500 Subject: [PATCH] Cleanup comments --- src/xmodem.cpp | 6 +----- src/xmodem.h | 5 +---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/xmodem.cpp b/src/xmodem.cpp index b885e47e5..735d933fc 100644 --- a/src/xmodem.cpp +++ b/src/xmodem.cpp @@ -123,11 +123,7 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket) filename[sizeof(filename) - 1] = '\0'; if (xmodemPacket.control == meshtastic_XModem_Control_SOH) { // Receive this file and put to Flash - // Truncate the destination before opening. On Adafruit_LittleFS, - // `open(path, FILE_O_WRITE)` is *append* semantics (O_RDWR|O_CREAT + - // seek-to-EOF), so without a prior remove, our XModem-streamed - // payload would be concatenated onto whatever was there, producing - // a corrupt mixed file. + // FILE_O_WRITE on Adafruit_LittleFS is append, not truncate — remove first. spiLock->lock(); if (FSCom.exists(filename)) FSCom.remove(filename); diff --git a/src/xmodem.h b/src/xmodem.h index 3a1183df1..974187820 100644 --- a/src/xmodem.h +++ b/src/xmodem.h @@ -52,10 +52,7 @@ class XModemAdapter meshtastic_XModem getForPhone(); void resetForPhone(); - // True while a file is being received from or transmitted to the phone. - // Callers (e.g. NodeDB::saveNodeDatabaseToDisk) consult this to avoid - // opening the same on-disk file for write in parallel, which races our - // long-lived xmodem `file` handle and ends up producing a 0-byte file. + // True while a file transfer is in flight; lets callers avoid racing our `file` handle. bool isBusy() const { return isReceiving || isTransmitting; } private: