-
Notifications
You must be signed in to change notification settings - Fork 89
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
Reporting status during the update process #87
Comments
Currently used for a couple of basic purposes: 1) to send count of connection attempts on connection (somewhat useful for determining if a connection is a reboot/physical issue or network). 2) Log start of OTA updates. Neither are super-important, mostly just to demo/test the functionality - more concretely, I plan to follow this up for more completed OTA status reporting (e.g. error cases), but that requires chrisjoyce911/esp32FOTA#87 to be addressed first. Outside of OTA status, I have a few other features planned that would also benefit from being able to report this type of status back.
Hi, Not exactly what you're looking for but you might be interested by the new Based on your input, here are some ideas for callbacks which could send MQTT messages without disturbing the update process: // when Update.begin() returned false
onUpdateBeginFail( int partition );
// after Update.end() and before validate_sig()
onUpdateEnd( int partition );
// validate_sig() error handling, mixed situations
onUpdateCheckFail( int partition, int error_code );
// update successful
onUpdateFinished( int partition, bool restart_after );
// Note: int partition; can be U_SPIFFS or U_FLASH
Please let me know if you're still looking for such features and I'll prioritize this. |
Hello, Thanks for the reply! The new callback will definitely be a great improvement to give some feedback about how the update is going. Going to upgrade and see how it works. Still interested in getting any info we can get on the progress. The device I'm working on has to run off very crappy internet in rural areas, so downloading the full update can take quite a while, the user has to keep faith that it's still doing something :) |
There's an untested implementation (I'm still writing the CI scripts) on this fork if you're willing to test. Here's the code block that was added in the headers: // this is passed to Update.onProgress()
typedef std::function<void(size_t, size_t)> ProgressCallback_cb; // size_t progress, size_t size
void setProgressCb(ProgressCallback_cb fn) { _ota_progress_callback = fn; }
// when Update.begin() returned false
typedef std::function<void(int)> UpdateBeginFail_cb; // int partition
void setUpdateBeginFailCb(UpdateBeginFail_cb fn) { onUpdateBeginFail = fn; }
UpdateBeginFail_cb onUpdateBeginFail;
// after Update.end() and before validate_sig()
typedef std::function<void(int)> UpdateEnd_cb; // int partition
void setUpdateEndCb(UpdateEnd_cb fn) { onUpdateEnd = fn; }
UpdateEnd_cb onUpdateEnd;
// validate_sig() error handling, mixed situations
typedef std::function<void(int,int)> UpdateCheckFail_cb; // int partition, int error_code
void setUpdateCheckFailCb(UpdateCheckFail_cb fn) { onUpdateCheckFail = fn; }
UpdateCheckFail_cb onUpdateCheckFail;
// update successful
typedef std::function<void(int,bool)> UpdateFinished_cb; // int partition, bool restart_after
void setUpdateFinishedCb(UpdateFinished_cb fn) { onUpdateFinished = fn; }
UpdateFinished_cb onUpdateFinished;
|
It would be very useful to have a way of getting info about what's going on during the update process outside of the library. This would let you, for example, publish some messages or errors to MQTT or BLE while the update is going on.
Think a simple way to do this would be to have a callback function that gets passed on initialization that then gets called whenever something happens during the update process.
Things that could be useful to track in my opinion: errors, download status for firmware file, start of the actual update process once the file is downloaded, result (success/fail).
The text was updated successfully, but these errors were encountered: