Skip to content

Conversation

me-no-dev
Copy link
Member

This pull request adds support for updating multiple file system types via OTA (Over-The-Air) updates, refactors the update logic to generalize file system handling, and introduces new update methods for various file systems. The changes improve flexibility and maintainability by replacing the previous SPIFFS-only logic with support for SPIFFS, FATFS, LittleFS, and a generic file system mode. Additionally, several code cleanups and refactorings are included.

File System OTA Update Support:

  • Added new constants (U_FLASHFS, U_FATFS, U_LITTLEFS) to Update.h to represent different file system OTA update modes, and refactored code to use these instead of only U_SPIFFS.
  • Updated the UpdateClass::begin method and OTA partition selection logic to support SPIFFS, FATFS, LittleFS, and a generic file system mode (U_FLASHFS), including fallback logic for partition selection.
  • Refactored the handleUpdate method in HTTPUpdate.cpp to accept a file system type parameter instead of a boolean, and to set appropriate HTTP headers and select the correct partition for each file system type. [1] [2] [3] [4] [5]

API Additions and Refactoring:

  • Added new update methods for file systems (updateFs, updateFatfs, updateLittlefs) to both HTTPUpdate.h and HTTPUpdate.cpp, for both NetworkClient and HTTPClient usage. [1] [2]
  • Updated function signatures and internal logic to use the new file system type constants, replacing previous boolean flags and simplifying the API. [1] [2]

Code Cleanup and Documentation:

  • Removed the unused _paroffset member from UpdateClass and related logic, simplifying partition offset handling. [1] [2]
  • Updated documentation and comments to clarify that OTA file system updates now support multiple types, not just SPIFFS. [1] [2]
  • Updated example code and server logic to use the new generic file system mode (U_FLASHFS) instead of SPIFFS. [1] [2]

Backward Compatibility and Generalization:

  • Generalized header verification and completion logic in Updater.cpp to work for all file system types, not just SPIFFS. [1] [2]
  • Updated OTA command parsing and handling to support the new file system modes, ensuring correct update behavior for all supported types.

These changes collectively make the OTA update process more robust and extensible for different file system types on ESP32 platforms.

Fixes: #9347

@me-no-dev me-no-dev requested a review from a team as a code owner September 18, 2025 10:34
Copy link
Contributor

github-actions bot commented Sep 18, 2025

Messages
📖 🎉 Good Job! All checks are passing!

👋 Hello me-no-dev, we appreciate your contribution to this project!


📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 69c974f

@me-no-dev me-no-dev added the Status: Review needed Issue or PR is awaiting review label Sep 18, 2025
@me-no-dev me-no-dev requested a review from Copilot September 18, 2025 10:38
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds support for updating multiple file system types via OTA (Over-The-Air) updates, expanding beyond the previous SPIFFS-only capability to include FATFS, LittleFS, and a generic file system mode. The changes refactor the update logic to use specific constants for each file system type and introduce new API methods for targeted file system updates.

Key changes include:

  • Added new constants (U_FLASHFS, U_FATFS, U_LITTLEFS) and refactored existing U_SPIFFS constant
  • Introduced new update methods for each file system type in HTTPUpdate API
  • Enhanced partition selection logic with fallback mechanisms for generic file system updates

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
libraries/Update/src/Update.h Adds new file system type constants and removes unused _paroffset member
libraries/Update/src/Updater.cpp Implements multi-file system partition selection logic and removes offset handling
libraries/HTTPUpdate/src/HTTPUpdate.h Declares new file system-specific update methods
libraries/HTTPUpdate/src/HTTPUpdate.cpp Implements file system-specific update methods and refactors internal handling
libraries/HTTPUpdateServer/src/HTTPUpdateServer.h Updates example to use generic file system mode
libraries/Update/examples/HTTP_Server_AES_OTA_Update/HTTP_Server_AES_OTA_Update.ino Updates example and documentation to use generic file system mode
libraries/ArduinoOTA/src/ArduinoOTA.cpp Updates OTA command validation to accept generic file system mode
Comments suppressed due to low confidence (1)

libraries/Update/src/Updater.cpp:313

  • [nitpick] Missing whitespace after the closing brace. There should be a blank line before the next statement for better code readability and consistency with the surrounding code structure.
        }

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

github-actions bot commented Sep 18, 2025

Test Results

 76 files   76 suites   13m 53s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commit 69c974f.

♻️ This comment has been updated with latest results.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32C5💚 -9K⚠️ +330💚 -0.85⚠️ +0.03💚 -320💚 -0.060.00
ESP32P4💚 -9K⚠️ +332💚 -1.02⚠️ +0.04💚 -320💚 -0.100.00
ESP32S3💚 -6K⚠️ +528💚 -0.67⚠️ +0.05💚 -320💚 -0.070.00
ESP32S2💚 -7K⚠️ +540💚 -0.71⚠️ +0.06💚 -320💚 -0.070.00
ESP32C3💚 -9K⚠️ +334💚 -0.90⚠️ +0.03💚 -320💚 -0.080.00
ESP32C6💚 -9K⚠️ +338💚 -0.89⚠️ +0.03💚 -240💚 -0.110.00
ESP32H20⚠️ +240.00⚠️ +0.01000.000.00
ESP32💚 -6K⚠️ +540💚 -0.65⚠️ +0.05💚 -320💚 -0.070.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32C5ESP32P4ESP32S3ESP32S2ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/ArduinoOTA/examples/BasicOTA⚠️ +240⚠️ +24💚 -16⚠️ +320⚠️ +400⚠️ +280⚠️ +240--⚠️ +480
libraries/HTTPUpdate/examples/httpUpdate⚠️ +3280⚠️ +328💚 -16⚠️ +5160⚠️ +5400⚠️ +3280⚠️ +3360--⚠️ +5400
libraries/HTTPUpdate/examples/httpUpdateSPIFFS⚠️ +3300⚠️ +330💚 -16⚠️ +5280⚠️ +5280⚠️ +3340⚠️ +3380--⚠️ +5280
libraries/HTTPUpdate/examples/httpUpdateSecure⚠️ +3280⚠️ +332💚 -16⚠️ +5000⚠️ +5280⚠️ +3280⚠️ +3360--⚠️ +5240
libraries/HTTPUpdateServer/examples/WebUpdater⚠️ +280⚠️ +28💚 -16⚠️ +320⚠️ +360⚠️ +240⚠️ +280--⚠️ +440
libraries/Update/examples/AWS_S3_OTA_Update⚠️ +18💚 -16⚠️ +180⚠️ +240⚠️ +280⚠️ +22💚 -16⚠️ +180--⚠️ +400
libraries/Update/examples/HTTP_Client_AES_OTA_Update⚠️ +220⚠️ +220⚠️ +240⚠️ +280⚠️ +220⚠️ +220--⚠️ +360
libraries/Update/examples/HTTP_Server_AES_OTA_Update💚 -9K💚 -32💚 -9K💚 -32💚 -6K💚 -32💚 -7K💚 -32💚 -9K💚 -32💚 -9K💚 -24--💚 -6K💚 -32
libraries/Update/examples/OTAWebUpdater⚠️ +28💚 -16⚠️ +280⚠️ +240⚠️ +360⚠️ +28💚 -16⚠️ +280--⚠️ +440
libraries/Update/examples/SD_Update⚠️ +240⚠️ +240⚠️ +280⚠️ +280⚠️ +240⚠️ +24💚 -16⚠️ +240⚠️ +400
libraries/WebServer/examples/HttpAdvancedAuth⚠️ +280⚠️ +280⚠️ +320⚠️ +360⚠️ +280⚠️ +28💚 -16--⚠️ +440
libraries/WebServer/examples/HttpAuthCallback⚠️ +280⚠️ +280⚠️ +320⚠️ +360⚠️ +280⚠️ +28💚 -16--⚠️ +440
libraries/WebServer/examples/HttpAuthCallbackInline⚠️ +280⚠️ +280⚠️ +320⚠️ +400⚠️ +280⚠️ +28💚 -16--⚠️ +440
libraries/WebServer/examples/HttpBasicAuth⚠️ +280⚠️ +280⚠️ +320⚠️ +400⚠️ +280⚠️ +28💚 -16--⚠️ +440
libraries/WebServer/examples/HttpBasicAuthSHA1⚠️ +240⚠️ +240⚠️ +320⚠️ +440⚠️ +280⚠️ +24💚 -16--00
libraries/WebServer/examples/HttpBasicAuthSHA1orBearerToken⚠️ +240⚠️ +24💚 -16⚠️ +320⚠️ +400⚠️ +280⚠️ +240--⚠️ +480
libraries/WebServer/examples/WebUpdate⚠️ +280⚠️ +280⚠️ +320⚠️ +360⚠️ +280⚠️ +280--⚠️ +480

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Review needed Issue or PR is awaiting review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add LittleFS support to HTTPUpdate and HTTPUpdateServer
1 participant