Preventing Wi-Fi from disconnecting

This commit is contained in:
2021-03-21 13:14:19 +01:00
parent 2eac93dd03
commit 4ac795dfe7
3 changed files with 23 additions and 19 deletions

View File

@@ -153,7 +153,7 @@ void Frame_FactoryTest::drawPassCount(m5epd_update_mode_t mode) {
void Frame_FactoryTest::scan(String *ssid, int32_t *rssi) { void Frame_FactoryTest::scan(String *ssid, int32_t *rssi) {
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
WiFi.disconnect(); // WiFi.disconnect();
WiFi.scanNetworks(true); WiFi.scanNetworks(true);
int wifi_num; int wifi_num;

View File

@@ -210,23 +210,27 @@ void Frame_Main::StatusBar(m5epd_update_mode_t mode) {
_bar->drawString("M5Paper", 10, 27); _bar->drawString("M5Paper", 10, 27);
// Wi-Fi // Wi-Fi
const uint8_t *kIMGWifiLevel[4] = { if (isWiFiConfiged()) {
NULL, const uint8_t *kIMGWifiLevel[4] = {
ImageResource_item_icon_wifi_1_32x32, NULL,
ImageResource_item_icon_wifi_2_32x32, ImageResource_item_icon_wifi_1_32x32,
ImageResource_item_icon_wifi_3_32x32 ImageResource_item_icon_wifi_2_32x32,
}; ImageResource_item_icon_wifi_3_32x32
if (WiFi.status() == WL_CONNECTED) { };
int rssi = WiFi.RSSI(); if (WiFi.status() == WL_CONNECTED) {
int level = 0; int rssi = WiFi.RSSI();
if (rssi > -55) { int level = 0;
level = 3; if (rssi > -55) {
} else if (rssi > -88) { level = 3;
level = 2; } else if (rssi > -88) {
} else { level = 2;
level = 1; } else {
} level = 1;
_bar->pushImage(134, 8, 32, 32, kIMGWifiLevel[level]); }
_bar->pushImage(134, 8, 32, 32, kIMGWifiLevel[level]);
} /* else {
WiFi.begin(GetWifiSSID(), GetWifiPassword())
} */
} }
// Battery // Battery

View File

@@ -127,7 +127,7 @@ int Frame_Settings_Wifi::scan() {
} }
} }
if (connect_wifi_idx == -1) { if (connect_wifi_idx == -1) {
WiFi.disconnect(); // WiFi.disconnect();
_key_wifi[0]->SetEnable(true); _key_wifi[0]->SetEnable(true);
_connected = 0; _connected = 0;
for (int i = 1; i < MAX_BTN_NUM; i++) { for (int i = 1; i < MAX_BTN_NUM; i++) {