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.

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/startrejects firmware uploads.pullFrom()withOTA_MODE_FIRMWAREand 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.