diff --git a/src/main.cpp b/src/main.cpp index 416a0db0..b3d48896 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -323,6 +323,12 @@ void init_display(const char *Productname, const char *Version) { void setup() { + // disable brownout detection +#ifdef DISABLE_BROWNOUT + // Register with brownout is at address DR_REG_RTCCNTL_BASE + 0xd4 + (*((volatile uint32_t *)ETS_UNCACHED_ADDR((DR_REG_RTCCNTL_BASE+0xd4)))) = 0; +#endif + // setup debug output or silence device #ifdef VERBOSE Serial.begin(115200); @@ -362,9 +368,15 @@ void setup() { #endif #ifdef HAS_BUTTON - // install button interrupt +#ifdef BUTTON_PULLUP + // install button interrupt (pullup mode) + pinMode(HAS_BUTTON, INPUT_PULLUP); + attachInterrupt(digitalPinToInterrupt(HAS_BUTTON), isr_button_pressed, RISING); +#else + // install button interrupt (pulldown mode) pinMode(HAS_BUTTON, INPUT_PULLDOWN); attachInterrupt(digitalPinToInterrupt(HAS_BUTTON), isr_button_pressed, FALLING); +#endif #endif // initialize wifi antenna