sforkowany z mirror/meshtastic-firmware
#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
rodzic
bdeba54c50
commit
02ce12607c
22
src/main.cpp
22
src/main.cpp
|
@ -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();
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue