Made everything needed to update firmware. Added the bundle to upload both front and backendin a bundle. Added magic number for more safety

This commit is contained in:
2026-03-03 22:45:41 -05:00
parent fdb13d62d4
commit 85dc698a8d
17 changed files with 467 additions and 44 deletions

View File

@@ -72,6 +72,21 @@ internal esp_err_t api_ota_firmware_handler(httpd_req_t *req)
return ESP_FAIL;
}
if (binary_file_len == 0 && recv_len > 0)
{
if ((uint8_t)buf[0] != 0xE9)
{
ESP_LOGE("OTA_FW", "Invalid magic: %02X. Expected 0xE9 for Firmware.",
(uint8_t)buf[0]);
esp_ota_abort(update_handle);
free(buf);
httpd_resp_send_err(
req, HTTPD_400_BAD_REQUEST,
"Invalid file: This does not look like an ESP32 firmware binary.");
return ESP_FAIL;
}
}
err = esp_ota_write(update_handle, (const void *)buf, recv_len);
if (err != ESP_OK)
{