From 4603fdf17aff8bdbac19296fe1a1d2d3edd05f69 Mon Sep 17 00:00:00 2001 From: Florian <1technophile@users.noreply.github.com> Date: Sun, 14 Jun 2020 07:03:57 -0500 Subject: [PATCH] Per default don't use TRIGGER_GPIO and move SLEEP_BUTTON definition to config_M5 as it is only used for the moment with M5 stack and stickc boards --- main/User_config.h | 13 ++++--------- main/config_M5.h | 4 ++++ main/main.ino | 7 ++++++- test/Test_config.h | 4 ++-- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/main/User_config.h b/main/User_config.h index fd5c033da1..7b897fbd93 100644 --- a/main/User_config.h +++ b/main/User_config.h @@ -120,9 +120,6 @@ char gateway_name[parameters_size * 2] = Gateway_Name; //DEFAULT_LOW_POWER_MODE 1 to activate deep sleep with LCD ON when a function is processing, //DEFAULT_LOW_POWER_MODE 2 to activate deep sleep with LED ON when a function is processing (LCD is turned OFF) #ifdef ESP32 -# ifndef SLEEP_BUTTON -# define SLEEP_BUTTON 33 -# endif # ifndef DEFAULT_LOW_POWER_MODE # define DEFAULT_LOW_POWER_MODE 0 # endif @@ -240,12 +237,10 @@ uint8_t wifiProtocol = 0; // default mode, automatic selection # endif #endif -#ifndef TRIGGER_GPIO -# ifdef ESP8266 -# define TRIGGER_GPIO 14 // pin D5 as full reset button (long press >10s) -# elif ESP32 -# define TRIGGER_GPIO 0 // boot button as full reset button (long press >10s) -# endif +#ifdef ESP8266 +//# define TRIGGER_GPIO 14 // pin D5 as full reset button (long press >10s) +#elif ESP32 +//# define TRIGGER_GPIO 0 // boot button as full reset button (long press >10s) #endif // VCC ------------D|-----------/\/\/\/\ ----------------- Arduino PIN diff --git a/main/config_M5.h b/main/config_M5.h index 52424709be..0340eebcf0 100644 --- a/main/config_M5.h +++ b/main/config_M5.h @@ -43,6 +43,10 @@ extern void loopM5(); #ifndef NORMAL_LCD_BRIGHTNESS # define NORMAL_LCD_BRIGHTNESS 100 // 0 to 100 #endif +/*---------------DEFINE SLEEP BUTTON------------------*/ +#ifndef SLEEP_BUTTON +# define SLEEP_BUTTON 33 +#endif /*-------------------DEFINE LOG LEVEL----------------------*/ #define LOG_LEVEL_LCD LOG_LEVEL_WARNING // if we go down below warning the size of the text to display can make the M5 restarting #define LOG_TO_LCD true //set to false if you want to use serial monitor for the log per default instead of the M5 screen diff --git a/main/main.ino b/main/main.ino index cf8ff496d5..61129719bc 100644 --- a/main/main.ino +++ b/main/main.ino @@ -774,6 +774,7 @@ void saveConfigCallback() { shouldSaveConfig = true; } +# if TRIGGER_GPIO void checkButton() { // code from tzapu/wifimanager examples // check for button press if (digitalRead(TRIGGER_GPIO) == LOW) { @@ -791,6 +792,9 @@ void checkButton() { // code from tzapu/wifimanager examples } } } +# else +void checkButton() {} +# endif void eraseAndRestart() { # if defined(ESP8266) @@ -811,8 +815,9 @@ void eraseAndRestart() { } void setup_wifimanager(bool reset_settings) { +# if TRIGGER_GPIO pinMode(TRIGGER_GPIO, INPUT_PULLUP); - +# endif delay(10); WiFi.mode(WIFI_STA); if (!wifiProtocol) forceWifiProtocol(); diff --git a/test/Test_config.h b/test/Test_config.h index 0422e3961d..bd90b0f004 100644 --- a/test/Test_config.h +++ b/test/Test_config.h @@ -136,9 +136,9 @@ char gateway_name[parameters_size * 2] = Gateway_Name; // LED Resistor 270-510R #ifndef TRIGGER_GPIO # ifdef ESP8266 -# define TRIGGER_GPIO 14 // pin D5 as full reset button (long press >10s) +//# define TRIGGER_GPIO 14 // pin D5 as full reset button (long press >10s) # elif ESP32 -# define TRIGGER_GPIO 0 // boot button as full reset button (long press >10s) +//# define TRIGGER_GPIO 0 // boot button as full reset button (long press >10s) # endif #endif