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