-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add a start callback for HTTP updater #1817
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
Conversation
The callback is called when the upgrade actually starts rather than just the initial query so that the user can know that it will not take longer and can also prepare for the upgrade by shutting down other works.
e20554c
to
ee87ac0
Compare
This almost looks good to me, but I would propose to replace plain C function pointer with an |
If you had time to add progress and end callbacks like in ArduinoOTA, that'd be great. Cheers!, |
The problem with progress and end is that at that time there is no TCP/UDP active as they are cancelled by the upgrade process. As for the method calls, I can change to that, they are not that common in Arduino code though and all other callbacks throughout the system is normal function calls too. |
@baruch , but you don't need any other open TCP/UDP connection to show progress, the use case is device itself showing on a display/leds. I use it in all my projects so the end user can have some indication of the upgrade progress. I'd be glad to see an standard interface for those callbacks for consistency within esp8266-arduino at least. |
Can one of the admins verify this patch? |
@esp8266-arduino-bot, |
Sorry for the noise. My regression testing setup is misbehaving. |
@baruch just to clarify regarding callback functions: if an argument is an |
After just running into this lack in the http update server, I've started work on this based on the ArduinoOTA style. |
The core and libraries have changed enough that this PR now has a merge conflict. Could you merge it manually with the latest core, so we can consider it for future releases? |
Closing as abandoned for #6796 |
Replaces abandoned esp8266#1817 and esp8266#2694 Add optional std::function callback (so it supports lambdas and normal functions) via ::onStart, ::onEnd, ::onProgress, and ::onError methods. Update example with their use. From @baruch's original pull request: The callback is called when the upgrade actually starts rather than just the initial query so that the user can know that it will not take longer and can also prepare for the upgrade by shutting down other works. From @karlp's original pull request: Incomplete: I've not updated any documentation yet. If this style looks good, I'll happily go and update the documentation (likewise for the examples)
Replaces abandoned #1817 and #2694 Add optional std::function callback (so it supports lambdas and normal functions) via ::onStart, ::onEnd, ::onProgress, and ::onError methods. Update example with their use. From @baruch's original pull request: The callback is called when the upgrade actually starts rather than just the initial query so that the user can know that it will not take longer and can also prepare for the upgrade by shutting down other works. From @karlp's original pull request: Incomplete: I've not updated any documentation yet. If this style looks good, I'll happily go and update the documentation (likewise for the examples)
The callback is called when the upgrade actually starts rather than just
the initial query so that the user can know that it will not take longer
and can also prepare for the upgrade by shutting down other works.