Review comments
This commit is contained in:
@@ -280,6 +280,11 @@ bool WifiSelectionActivity::checkCaptivePortal() {
|
||||
String location = http.getLocation();
|
||||
http.end();
|
||||
|
||||
if (code < 0) {
|
||||
LOG_DBG("WIFI", "Captive portal probe failed (connection error %d)", code);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (code == 204) {
|
||||
return false; // Open internet, no captive portal
|
||||
}
|
||||
|
||||
+7
-2
@@ -31,7 +31,6 @@
|
||||
#include "util/ButtonNavigator.h"
|
||||
#include "util/ScreenshotUtil.h"
|
||||
|
||||
|
||||
MappedInputManager mappedInputManager(gpio);
|
||||
GfxRenderer renderer(display);
|
||||
ActivityManager activityManager(renderer, mappedInputManager);
|
||||
@@ -182,7 +181,13 @@ void setupDisplayAndFonts() {
|
||||
}
|
||||
|
||||
void setup() {
|
||||
esp_ota_mark_app_valid_cancel_rollback();
|
||||
{
|
||||
esp_ota_img_states_t otaState;
|
||||
const esp_partition_t* running = esp_ota_get_running_partition();
|
||||
if (esp_ota_get_state_partition(running, &otaState) == ESP_OK && otaState == ESP_OTA_IMG_PENDING_VERIFY) {
|
||||
esp_ota_mark_app_valid_cancel_rollback();
|
||||
}
|
||||
}
|
||||
HalSystem::begin();
|
||||
gpio.begin();
|
||||
powerManager.begin();
|
||||
|
||||
@@ -201,7 +201,10 @@ const std::string& OtaUpdater::getLatestVersion() const { return latestVersion;
|
||||
|
||||
void OtaUpdater::cleanupUpdate() {
|
||||
if (otaHandle) {
|
||||
esp_https_ota_finish(otaHandle);
|
||||
const esp_err_t err = esp_https_ota_finish(otaHandle);
|
||||
if (err != ESP_OK) {
|
||||
LOG_ERR("OTA", "esp_https_ota_finish on cleanup: %s", esp_err_to_name(err));
|
||||
}
|
||||
otaHandle = nullptr;
|
||||
}
|
||||
cancelRequested = false;
|
||||
@@ -365,20 +368,3 @@ OtaUpdater::OtaUpdaterError OtaUpdater::performInstallUpdateStep() {
|
||||
LOG_INF("OTA", "Update completed");
|
||||
return OK;
|
||||
}
|
||||
|
||||
OtaUpdater::OtaUpdaterError OtaUpdater::installUpdate() {
|
||||
const auto beginResult = beginInstallUpdate();
|
||||
if (beginResult != UPDATE_IN_PROGRESS) {
|
||||
return beginResult;
|
||||
}
|
||||
|
||||
OtaUpdaterError result;
|
||||
do {
|
||||
result = performInstallUpdateStep();
|
||||
if (result == UPDATE_IN_PROGRESS) {
|
||||
delay(100);
|
||||
}
|
||||
} while (result == UPDATE_IN_PROGRESS);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ class OtaUpdater {
|
||||
OtaUpdaterError performInstallUpdateStep();
|
||||
void cancelUpdate();
|
||||
void cleanupUpdate();
|
||||
OtaUpdaterError installUpdate();
|
||||
|
||||
private:
|
||||
static int forceSetOtaBootPartition();
|
||||
|
||||
Reference in New Issue
Block a user