mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-30 19:29:17 +00:00
#560 - Force SoftAP if the user button is held down during startup.
#560 - Force SoftAP if the user button is held down during startup.
This commit is contained in:
parent
bdeba54c50
commit
02ce12607c
24
src/main.cpp
24
src/main.cpp
@ -241,7 +241,7 @@ class ButtonThread : public OSThread
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
//DEBUG_MSG("Long press %u\n", (millis() - longPressTime));
|
// DEBUG_MSG("Long press %u\n", (millis() - longPressTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,6 +298,21 @@ void setup()
|
|||||||
digitalWrite(RESET_OLED, 1);
|
digitalWrite(RESET_OLED, 1);
|
||||||
#endif
|
#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();
|
OSThread::setup();
|
||||||
|
|
||||||
ledPeriodic = new Periodic("Blink", ledBlinker);
|
ledPeriodic = new Periodic("Blink", ledBlinker);
|
||||||
@ -466,6 +481,13 @@ void setup()
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
// Initialize Wifi
|
||||||
initWifi();
|
initWifi();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user