forked from xiaozhi/xiaozhi-esp32
连接wifi时按下boot重置wifi
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user