Report "no filesystem" on OTA uploads w/o a FS (#785)

Give a meaningful error when OTA is attempted against a chip which does
not have a filesystem configured.
This commit was merged in pull request #785.
This commit is contained in:
Earle F. Philhower, III
2022-08-21 13:19:26 -07:00
committed by GitHub
parent 0d15723444
commit f9e3278863
2 changed files with 15 additions and 10 deletions
+13 -9
View File
@@ -243,6 +243,19 @@ void ArduinoOTAClass::_onRx() {
void ArduinoOTAClass::_runUpdate() {
IPAddress ota_ip = _ota_ip;
if (!LittleFS.begin()) {
#ifdef OTA_DEBUG
OTA_DEBUG.println("LittleFS Begin Error");
#endif
_udp_ota->append("ERR: ", 5);
_udp_ota->append("no filesystem", 13);
_udp_ota->send(ota_ip, _ota_udp_port);
delay(100);
_udp_ota->listen(IP_ADDR_ANY, _port);
_state = OTA_IDLE;
return;
}
if (!Update.begin(_size, _cmd)) {
#ifdef OTA_DEBUG
OTA_DEBUG.println("Update Begin Error");
@@ -261,15 +274,6 @@ void ArduinoOTAClass::_runUpdate() {
_state = OTA_IDLE;
return;
}
if (!LittleFS.begin()) {
_udp_ota->append("ERR: ", 5);
_udp_ota->append("nofilesystem", 6);
_udp_ota->send(ota_ip, _ota_udp_port);
delay(100);
_udp_ota->listen(IP_ADDR_ANY, _port);
_state = OTA_IDLE;
return;
}
_udp_ota->append("OK", 2);
_udp_ota->send(ota_ip, _ota_udp_port);