kopia lustrzana https://github.com/meshtastic/firmware
Merge branch 'master' into 2264-feature-check-for-low-heap-before-adding-to-nodedb-was-reboot-loop-heap-too-low
commit
a30c07e6b4
|
@ -34,6 +34,7 @@ bool copyFile(const char *from, const char *to)
|
|||
f2.write(cbuffer, i);
|
||||
}
|
||||
|
||||
f2.flush();
|
||||
f2.close();
|
||||
f1.close();
|
||||
return true;
|
||||
|
|
|
@ -490,6 +490,7 @@ bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_
|
|||
} else {
|
||||
okay = true;
|
||||
}
|
||||
f.flush();
|
||||
f.close();
|
||||
|
||||
// brief window of risk here ;-)
|
||||
|
|
|
@ -234,15 +234,18 @@ void htmlDeleteDir(const char *dirname)
|
|||
while (file) {
|
||||
if (file.isDirectory() && !String(file.name()).endsWith(".")) {
|
||||
htmlDeleteDir(file.name());
|
||||
file.flush();
|
||||
file.close();
|
||||
} else {
|
||||
String fileName = String(file.name());
|
||||
file.flush();
|
||||
file.close();
|
||||
LOG_DEBUG(" %s\n", fileName.c_str());
|
||||
FSCom.remove(fileName);
|
||||
}
|
||||
file = root.openNextFile();
|
||||
}
|
||||
root.flush();
|
||||
root.close();
|
||||
}
|
||||
|
||||
|
@ -521,7 +524,7 @@ void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
|
|||
std::string pathname = "/static/" + filename;
|
||||
|
||||
// Create a new file to stream the data into
|
||||
File file = FSCom.open(pathname.c_str(), "w");
|
||||
File file = FSCom.open(pathname.c_str(), FILE_O_WRITE);
|
||||
size_t fileLength = 0;
|
||||
didwrite = true;
|
||||
|
||||
|
@ -536,6 +539,7 @@ void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
|
|||
|
||||
// Abort the transfer if there is less than 50k space left on the filesystem.
|
||||
if (FSCom.totalBytes() - FSCom.usedBytes() < 51200) {
|
||||
file.flush();
|
||||
file.close();
|
||||
res->println("<p>Write aborted! Reserving 50k on filesystem.</p>");
|
||||
|
||||
|
@ -553,6 +557,7 @@ void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
|
|||
}
|
||||
// enableLoopWDT();
|
||||
|
||||
file.flush();
|
||||
file.close();
|
||||
res->printf("<p>Saved %d bytes to %s</p>", (int)fileLength, pathname.c_str());
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp)
|
|||
} else {
|
||||
LOG_ERROR("File write failed\n");
|
||||
}
|
||||
|
||||
fileToWrite.flush();
|
||||
fileToWrite.close();
|
||||
}
|
||||
|
||||
|
@ -275,6 +275,7 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp)
|
|||
|
||||
// TODO: If quotes are found in the payload, it has to be escaped.
|
||||
fileToAppend.printf("\"%s\"\n", p.payload.bytes);
|
||||
fileToAppend.flush();
|
||||
fileToAppend.close();
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -142,12 +142,14 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket)
|
|||
case meshtastic_XModem_Control_EOT:
|
||||
// End of transmission
|
||||
sendControl(meshtastic_XModem_Control_ACK);
|
||||
file.flush();
|
||||
file.close();
|
||||
isReceiving = false;
|
||||
break;
|
||||
case meshtastic_XModem_Control_CAN:
|
||||
// Cancel transmission and remove file
|
||||
sendControl(meshtastic_XModem_Control_ACK);
|
||||
file.flush();
|
||||
file.close();
|
||||
FSCom.remove(filename);
|
||||
isReceiving = false;
|
||||
|
|
Ładowanie…
Reference in New Issue