mirror of
https://github.com/meshtastic/firmware.git
synced 2026-05-19 06:14:12 -04:00
Cleanup comments
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user