From 09b8fa72a72750385b800f86b01b66b79fd5f90e Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Sat, 15 May 2021 13:33:49 +0200 Subject: [PATCH] Fix esp8266 compile errors --- platformio.ini | 2 +- src/sys/gpio/hasp_gpio.cpp | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/platformio.ini b/platformio.ini index d7889b52..a15bf3f5 100644 --- a/platformio.ini +++ b/platformio.ini @@ -196,7 +196,7 @@ build_flags= ; -- lvgl build options ----------------------------- -D LV_MEM_SIZE=12288U ; 12kB lvgl memory -D LV_ATTRIBUTE_FAST_MEM= - -D LV_ATTRIBUTE_TASK_HANDLER=IRAM_ATTR + -D LV_ATTRIBUTE_TASK_HANDLER= ; -- ArduinoJson build options ---------------------------- -D ARDUINOJSON_ENABLE_PROGMEM=1 ; for PROGMEM arguments -D ARDUINOJSON_ENABLE_STD_STRING=1 ; for std::string diff --git a/src/sys/gpio/hasp_gpio.cpp b/src/sys/gpio/hasp_gpio.cpp index 89493d84..e5dd739a 100644 --- a/src/sys/gpio/hasp_gpio.cpp +++ b/src/sys/gpio/hasp_gpio.cpp @@ -48,8 +48,8 @@ static inline void gpio_update_group(uint8_t group, lv_obj_t* obj, bool power, i #include "driver/uart.h" #include -volatile bool touchdetected = false; -RTC_DATA_ATTR int recordCounter = 0; +volatile bool touchdetected = false; +RTC_DATA_ATTR int rtcRecordCounter = 0; void gotTouch() { @@ -96,8 +96,8 @@ static void gpio_event_handler(AceButton* button, uint8_t eventType, uint8_t but } else { eventid = HASP_EVENT_DOWN; } - state = true; - touchdetected = false; + state = true; + // touchdetected = false; break; case 2: // AceButton::kEventClicked: eventid = HASP_EVENT_UP; @@ -224,12 +224,14 @@ static void gpio_setup_pin(uint8_t index) pinMode(gpio->pin, INPUT_PULLUP); gpio->max = 0; break; +#if defined(ARDUINO_ARCH_ESP32) case hasp_gpio_type_t::TOUCH: if(gpio->btn) delete gpio->btn; gpio->btn = new AceButton(&touchConfig, gpio->pin, HIGH, index); gpio->max = 0; // touchAttachInterrupt(gpio->pin, gotTouch, 33); break; +#endif case hasp_gpio_type_t::POWER_RELAY: case hasp_gpio_type_t::LIGHT_RELAY: @@ -294,7 +296,9 @@ static void gpio_setup_pin(uint8_t index) void gpioSetup() { LOG_INFO(TAG_GPIO, F(D_SERVICE_STARTING)); - LOG_WARNING(TAG_GPIO, F("Reboot counter %d"), recordCounter++); +#if defined(ARDUINO_ARCH_ESP32) + LOG_WARNING(TAG_GPIO, F("Reboot counter %d"), rtcRecordCounter++); +#endif aceButtonSetup();