#560 - Force SoftAP if the user button is held down during startup.

#560 - Force SoftAP if the user button is held down during startup.
1.2-legacy
Jm Casler 2020-12-12 13:54:14 -08:00
rodzic bdeba54c50
commit 02ce12607c
1 zmienionych plików z 23 dodań i 1 usunięć

Wyświetl plik

@ -298,6 +298,21 @@ void setup()
digitalWrite(RESET_OLED, 1);
#endif
// If BUTTON_PIN is held down during the startup process,
// force the device to go into a SoftAP mode.
bool forceSoftAP = 0;
#ifdef BUTTON_PIN
#ifndef NO_ESP32
pinMode(BUTTON_PIN, INPUT);
// BUTTON_PIN is pulled high by a 12k resistor.
if (!digitalRead(BUTTON_PIN)) {
forceSoftAP = 1;
}
#endif
#endif
OSThread::setup();
ledPeriodic = new Periodic("Blink", ledBlinker);
@ -466,6 +481,13 @@ void setup()
}
#endif
if (forceSoftAP == false) {
strcpy(radioConfig.preferences.wifi_ssid, "meshtasticAdmin");
strcpy(radioConfig.preferences.wifi_password, "12345678");
radioConfig.preferences.wifi_ap_mode = true;
DEBUG_MSG("Forcing SoftAP\n");
}
// Initialize Wifi
initWifi();