Skip to content
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

Add ArduinoOTA Support for ESP32-Based Boards #395

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

SenMorgan
Copy link

This pull request introduces support for ArduinoOTA updates on ESP32-based boards. This feature allows for wireless updating of the firmware over the network, which significantly simplifies the update process for devices that are not easily accessible.

Changes include:

  • Added necessary ArduinoOTA library includes and setup calls in the appropriate conditional compilation sections.
  • Integrated ArduinoOTA handlers into the main loop to listen for incoming update requests.
  • Configured OTA settings such as hostname and password for secure firmware updates.
  • Updated platformio.ini configuration to support OTA updates.

This enhancement provides a robust and user-friendly method for firmware updates, reducing the need for physical access to the device and streamlining the update process.

Please review and provide any feedback.

@habazut
Copy link
Contributor

habazut commented Jan 28, 2024

Thanks for the contribution. Have you tested also with arduino-cli? I ask because the ex-installer uses arduino-cli.
What do you think about a command like <C OTA> to start it instead of having OTA available all the time?
Regards,
Harald.

@SenMorgan
Copy link
Author

I haven't had the chance to test it with arduino-cli yet, and I'm not quite sure how to go about it. Could you possibly guide me through the process?

As for the suggestion to manually enable OTA with a command, I see the merit in it. However, during development and debugging of automation processes, it might become cumbersome to send this command before every update. It would be ideal if the ESP32 could remember to enable OTA even after a reboot, but as far as I can tell from the code, there doesn't seem to be EEPROM support for the ESP32 device yet. Could you confirm this, please?

@habazut
Copy link
Contributor

habazut commented Jan 28, 2024

  1. OTA: One could have the "enable OTA" in the mySetup.h if devel person

  2. EEPROM: There is emulated EEPROM which can be allocated in FLASH on the ESP32 but to use it you must add "commit" statements which copy the RAM cache to EEPROM. I think we talked about it on Discord and I looked at that and then got sidetracked.

Regards.

@habazut
Copy link
Contributor

habazut commented Jan 28, 2024

Could you possibly guide me through the process?

Install arduino-cli (or use the install you get with the ex-installer)
Start the OTA on the ESP32
Check if you see it with arduino-cli board list
Check if you can upload by using what it shows as "port" (IP addr or mDNS name)

Regards.
Now I have timeout for today.

@SenMorgan
Copy link
Author

Hello again,

I believe there might be a misunderstanding: I don't use Discord, so perhaps you've confused me with someone else.

I've tested the OTA upload using arduino-cli and can confirm that it works flawlessly.

Your suggestion to temporarily enable OTA via a command and permanently enable it through a config file seems very good. I'll attempt to implement this. Thank you for the advice.

@SenMorgan
Copy link
Author

You suggested using the command , but I couldn't find any information about the opcode. I only found the one, which is used for requesting track current information. However, I did find that the opcode could potentially be used to control OTA. Am I mistaken, or did you intend for me to implement a new opcode?

@SenMorgan
Copy link
Author

So, I've chosen to implement this feature using the opcode. Please review my changes.

@habazut
Copy link
Contributor

habazut commented Feb 1, 2024

As you have based your changes on master does not exist yet. But C is like D but I want to divide the commands into C for config and D for diag. So that we on system with little RAM can disable all D if we need to.

I will not have time to review this before start of next week but you are not forgotten.

Harald.

@SenMorgan
Copy link
Author

Ah, okay, I found this in another branch. Ok, will wait for your verification.

@SenMorgan
Copy link
Author

Hello. Any updates/reviews?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants