连接wifi时按下boot重置wifi

This commit is contained in:
Terrence
2024-11-25 02:27:21 +08:00
parent 472219d5bf
commit b07ec1a148
10 changed files with 49 additions and 6 deletions

View File

@@ -2,6 +2,7 @@
#include "application.h"
#include "system_info.h"
#include "font_awesome_symbols.h"
#include "settings.h"
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
@@ -149,3 +150,15 @@ void WifiBoard::SetPowerSaveMode(bool enabled) {
auto& wifi_station = WifiStation::GetInstance();
wifi_station.SetPowerSaveMode(enabled);
}
void WifiBoard::ResetWifiConfiguration() {
// Reset the wifi station
{
Settings settings("wifi", true);
settings.EraseAll();
}
GetDisplay()->ShowNotification("已重置 WiFi...");
vTaskDelay(pdMS_TO_TICKS(1000));
// Reboot the device
esp_restart();
}

View File

@@ -19,6 +19,7 @@ public:
virtual bool GetNetworkState(std::string& network_name, int& signal_quality, std::string& signal_quality_text) override;
virtual const char* GetNetworkStateIcon() override;
virtual void SetPowerSaveMode(bool enabled) override;
virtual void ResetWifiConfiguration();
};
#endif // WIFI_BOARD_H