Cleanup comments
This commit is contained in:
+1
-5
@@ -123,11 +123,7 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket)
|
|||||||
filename[sizeof(filename) - 1] = '\0';
|
filename[sizeof(filename) - 1] = '\0';
|
||||||
|
|
||||||
if (xmodemPacket.control == meshtastic_XModem_Control_SOH) { // Receive this file and put to Flash
|
if (xmodemPacket.control == meshtastic_XModem_Control_SOH) { // Receive this file and put to Flash
|
||||||
// Truncate the destination before opening. On Adafruit_LittleFS,
|
// FILE_O_WRITE on Adafruit_LittleFS is append, not truncate — remove first.
|
||||||
// `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.
|
|
||||||
spiLock->lock();
|
spiLock->lock();
|
||||||
if (FSCom.exists(filename))
|
if (FSCom.exists(filename))
|
||||||
FSCom.remove(filename);
|
FSCom.remove(filename);
|
||||||
|
|||||||
+1
-4
@@ -52,10 +52,7 @@ class XModemAdapter
|
|||||||
meshtastic_XModem getForPhone();
|
meshtastic_XModem getForPhone();
|
||||||
void resetForPhone();
|
void resetForPhone();
|
||||||
|
|
||||||
// True while a file is being received from or transmitted to the phone.
|
// True while a file transfer is in flight; lets callers avoid racing our `file` handle.
|
||||||
// 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.
|
|
||||||
bool isBusy() const { return isReceiving || isTransmitting; }
|
bool isBusy() const { return isReceiving || isTransmitting; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user