Skip to content

Commit fd0dd1f

Browse files
committed
OTA: add setOTAChunkMode()
1 parent 89dddf7 commit fd0dd1f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/ArduinoIoTCloudTCP.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,6 @@ int ArduinoIoTCloudTCP::begin(bool const enable_watchdog, String brokerAddress,
168168

169169
#if OTA_ENABLED && !defined(OFFLOADED_DOWNLOAD)
170170
_ota.setClient(&_otaClient);
171-
if (_connection->getInterface() == NetworkAdapter::ETHERNET) {
172-
_ota.setFetchMode(OTADefaultCloudProcessInterface::OtaFetchChunk);
173-
}
174171
#endif // OTA_ENABLED && !defined(OFFLOADED_DOWNLOAD)
175172

176173
#if OTA_ENABLED && defined(OTA_BASIC_AUTH)

src/ArduinoIoTCloudTCP.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
101101
_ota.setOtaPolicies(OTACloudProcessInterface::None);
102102
}
103103
}
104+
105+
/* Slower but more reliable in some corner cases */
106+
void setOTAChunkMode(bool enable = true) {
107+
if(enable) {
108+
_ota.setFetchMode(OTADefaultCloudProcessInterface::OtaFetchChunk);
109+
} else {
110+
_ota.setFetchMode(OTADefaultCloudProcessInterface::OtaFetchTime);
111+
}
112+
}
104113
#endif
105114

106115
private:

0 commit comments

Comments
 (0)