Skip to content

Commit f9e3278

Browse files
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.
1 parent 0d15723 commit f9e3278

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

libraries/ArduinoOTA/src/ArduinoOTA.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,19 @@ void ArduinoOTAClass::_onRx() {
243243
void ArduinoOTAClass::_runUpdate() {
244244
IPAddress ota_ip = _ota_ip;
245245

246+
if (!LittleFS.begin()) {
247+
#ifdef OTA_DEBUG
248+
OTA_DEBUG.println("LittleFS Begin Error");
249+
#endif
250+
_udp_ota->append("ERR: ", 5);
251+
_udp_ota->append("no filesystem", 13);
252+
_udp_ota->send(ota_ip, _ota_udp_port);
253+
delay(100);
254+
_udp_ota->listen(IP_ADDR_ANY, _port);
255+
_state = OTA_IDLE;
256+
return;
257+
}
258+
246259
if (!Update.begin(_size, _cmd)) {
247260
#ifdef OTA_DEBUG
248261
OTA_DEBUG.println("Update Begin Error");
@@ -261,15 +274,6 @@ void ArduinoOTAClass::_runUpdate() {
261274
_state = OTA_IDLE;
262275
return;
263276
}
264-
if (!LittleFS.begin()) {
265-
_udp_ota->append("ERR: ", 5);
266-
_udp_ota->append("nofilesystem", 6);
267-
_udp_ota->send(ota_ip, _ota_udp_port);
268-
delay(100);
269-
_udp_ota->listen(IP_ADDR_ANY, _port);
270-
_state = OTA_IDLE;
271-
return;
272-
}
273277

274278
_udp_ota->append("OK", 2);
275279
_udp_ota->send(ota_ip, _ota_udp_port);

libraries/WiFi/src/BearSSLHelpers.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
#include <string.h>
3030
#include <Arduino.h>
3131
#include "StackThunk.h"
32-
//#include <Updater_Signing.h>
32+
33+
#include <Updater_Signing.h>
3334
#ifndef ARDUINO_SIGNING
3435
#define ARDUINO_SIGNING 0
3536
#endif

0 commit comments

Comments
 (0)