fix: OTA update on x3 and progress bar on x4 and x3 (#1805)
Co-authored-by: Justin Mitchell <1875695+itsthisjustin@users.noreply.github.com>
This commit is contained in:
co-authored by
Justin Mitchell
parent
15ea7027df
commit
ba4a361d64
@@ -200,15 +200,13 @@ bool OtaUpdater::isUpdateNewer() const {
|
||||
|
||||
const std::string& OtaUpdater::getLatestVersion() const { return latestVersion; }
|
||||
|
||||
OtaUpdater::OtaUpdaterError OtaUpdater::installUpdate() {
|
||||
OtaUpdater::OtaUpdaterError OtaUpdater::installUpdate(ProgressCallback onProgress, void* ctx) {
|
||||
if (!isUpdateNewer()) {
|
||||
return UPDATE_OLDER_ERROR;
|
||||
}
|
||||
|
||||
esp_https_ota_handle_t ota_handle = NULL;
|
||||
esp_err_t esp_err;
|
||||
/* Signal for OtaUpdateActivity */
|
||||
render = false;
|
||||
|
||||
esp_http_client_config_t client_config = {
|
||||
.url = otaUrl.c_str(),
|
||||
@@ -241,8 +239,7 @@ OtaUpdater::OtaUpdaterError OtaUpdater::installUpdate() {
|
||||
do {
|
||||
esp_err = esp_https_ota_perform(ota_handle);
|
||||
processedSize = esp_https_ota_get_image_len_read(ota_handle);
|
||||
/* Sent signal to OtaUpdateActivity */
|
||||
render = true;
|
||||
if (onProgress) onProgress(ctx);
|
||||
delay(100); // TODO: should we replace this with something better?
|
||||
} while (esp_err == ESP_ERR_HTTPS_OTA_IN_PROGRESS);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user