Anniversary Sale · up to 80% off all librariesEnds Nov 9Shop now
SOFTTDocs

Disable Firmware OTA

Enable or disable firmware updates at runtime in ElegantOTA Pro, and check whether the firmware update target is enabled.

ElegantOTA Pro feature. This functionality is available only in the commercial edition of ElegantOTA.

ElegantOTA Pro lets you enable or disable each update target at runtime, for security reasons or while a task is running that an update must not interrupt. The update target defines what an update may overwrite: the firmware or the filesystem image. The setting applies to every OTA mode, and the portal hides a disabled target.

Update target selector in the portal

Use this setting carefully. While firmware updates are disabled, the device cannot be updated over the air, and if the setting is left disabled by mistake, the device can no longer be recovered by an OTA update.

Disable firmware updates

ElegantOTA.setFirmwareMode(false);

Enable firmware updates

ElegantOTA.setFirmwareMode(true);

Both update targets are enabled by default after a cold boot.

Check the setting

if (ElegantOTA.checkFirmwareMode() == true) {
  Serial.println("Firmware updates are enabled");
} else {
  Serial.println("Firmware updates are disabled");
}

Behavior

While firmware updates are disabled:

  • The Firmware option disappears from the Write to selector in the portal.
  • /ota/start rejects firmware uploads.
  • pullFrom() with OTA_MODE_FIRMWARE and direct downloads from the portal are rejected.
  • installUpdate() and automatic installation from an update channel are rejected, because an update channel always carries firmware.

If both firmware and filesystem updates are disabled, the portal states that the device does not accept updates.

On this page