From b5f50efdcdd84f36583019b45269b0e24d21868b Mon Sep 17 00:00:00 2001 From: Jm Date: Mon, 18 Jan 2021 10:43:15 -0800 Subject: [PATCH] #647 - Fix for admin mode being forced on boards without hardware pullup --- src/main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b63c193a..aa7b191d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -303,17 +303,20 @@ void setup() digitalWrite(RESET_OLED, 1); #endif +#ifdef BUTTON_PIN +#ifndef NO_ESP32 // 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); +#ifdef BUTTON_NEED_PULLUP + gpio_pullup_en((gpio_num_t)BUTTON_PIN); +#endif // BUTTON_PIN is pulled high by a 12k resistor. if (!digitalRead(BUTTON_PIN)) { forceSoftAP = 1; - DEBUG_MSG("-------------------- Setting forceSoftAP = 1\n"); + DEBUG_MSG("Setting forceSoftAP = 1\n"); } #endif @@ -513,7 +516,6 @@ void setup() } #endif - #ifndef NO_ESP32 // Initialize Wifi initWifi(forceSoftAP);