-
Notifications
You must be signed in to change notification settings - Fork 7.8k
feat(hosted): Implement OTA for esp-hosted co-processors #12065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+326
−12
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
61f0329
feat(hosted): Implement OTA for esp-hosted co-processors
me-no-dev c084de9
feat(hosted): Add library to CMakeLists.txt
me-no-dev 0a950cc
feat(hosted): Limit CI to run the example only on P4
me-no-dev 5ebe76d
feat(hosted): Document inline the source code
me-no-dev a37aebb
feat(hosted): Add library to code owners
me-no-dev 011b4ed
ci(pre-commit): Apply automatic fixes
pre-commit-ci-lite[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
libraries/ESP_HostedOTA/examples/ESP_HostedOTA/ESP_HostedOTA.ino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| /* | ||
| * ESP-Hosted OTA Update Example | ||
| * | ||
| * This example demonstrates how to update the ESP-Hosted co-processor firmware | ||
| * over-the-air (OTA). The ESP-Hosted solution allows an ESP32 to act as a WiFi | ||
| * co-processor for other microcontrollers. | ||
| * | ||
| * Prerequisites: | ||
| * - ESP32 with ESP-Hosted firmware configured as WiFi co-processor | ||
| * - Network connectivity to download firmware updates | ||
| * - Valid WiFi credentials | ||
| */ | ||
|
|
||
| #include "WiFi.h" // WiFi library for network connectivity | ||
| #include "ESP_HostedOTA.h" // ESP-Hosted OTA update functionality | ||
|
|
||
| // WiFi network credentials - CHANGE THESE TO YOUR NETWORK SETTINGS | ||
| const char *ssid = "your-ssid"; // Replace with your WiFi network name | ||
| const char *password = "your-password"; // Replace with your WiFi password | ||
|
|
||
| void setup() { | ||
| // Step 1: Initialize serial communication for debugging output | ||
| Serial.begin(115200); | ||
|
|
||
| // Step 2: Initialize the ESP-Hosted WiFi station mode | ||
| // This prepares the ESP-Hosted co-processor for WiFi operations | ||
| WiFi.STA.begin(); | ||
|
|
||
| // Step 3: Display connection attempt information | ||
| Serial.println(); | ||
| Serial.println("******************************************************"); | ||
| Serial.print("Connecting to "); | ||
| Serial.println(ssid); | ||
|
|
||
| // Step 4: Attempt to connect to the specified WiFi network | ||
| WiFi.STA.connect(ssid, password); | ||
|
|
||
| // Step 5: Wait for WiFi connection to be established | ||
| // Display progress dots while connecting | ||
| while (WiFi.STA.status() != WL_CONNECTED) { | ||
| delay(500); // Wait 500ms between connection attempts | ||
| Serial.print("."); // Show connection progress | ||
| } | ||
| Serial.println(); | ||
|
|
||
| // Step 6: Display successful connection information | ||
| Serial.println("WiFi connected"); | ||
| Serial.print("IP address: "); | ||
| Serial.println(WiFi.STA.localIP()); | ||
|
|
||
| // Step 7: Attempt to update the ESP-Hosted co-processor firmware | ||
| // This function will: | ||
| // - Check if ESP-Hosted is initialized | ||
| // - Verify if an update is available | ||
| // - Download and install the firmware update if needed | ||
| if (updateEspHostedSlave()) { | ||
| // Step 8: Restart the host ESP32 after successful update | ||
| // This is currently required to properly activate the new firmware | ||
| // on the ESP-Hosted co-processor | ||
| ESP.restart(); | ||
| } | ||
| } | ||
|
|
||
| void loop() { | ||
| delay(1000); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| requires: | ||
| - CONFIG_ESP_WIFI_REMOTE_ENABLED=y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| ####################################### | ||
| # Syntax Coloring Map For ESP_HostedOTA | ||
| ####################################### | ||
|
|
||
| ####################################### | ||
| # Datatypes (KEYWORD1) | ||
| ####################################### | ||
|
|
||
| ####################################### | ||
| # Methods and Functions (KEYWORD2) | ||
| ####################################### | ||
|
|
||
| updateEspHostedSlave KEYWORD2 | ||
|
|
||
| ####################################### | ||
| # Constants (LITERAL1) | ||
| ####################################### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| name=ESP_HostedOTA | ||
| version=3.3.4 | ||
| author=me-no-dev | ||
| maintainer=me-no-dev | ||
| sentence=Library for updating the ESP-Hosted co-processor | ||
| paragraph=Supports ESP32 Arduino platforms. | ||
| category=Communication | ||
| url=https://github.com/espressif/arduino-esp32/ | ||
| architectures=esp32 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.