diff --git a/boards/t-echo.json b/boards/t-echo.json index 957ba01e3c..c53132fdab 100644 --- a/boards/t-echo.json +++ b/boards/t-echo.json @@ -9,6 +9,7 @@ "f_cpu": "64000000L", "hwids": [ ["0x239A", "0x4405"], + ["0x239A", "0x0029"], ["0x239A", "0x002A"] ], "usb_product": "TTGO_eink", diff --git a/src/ButtonThread.h b/src/ButtonThread.h index 66efd60046..20dc14cc47 100644 --- a/src/ButtonThread.h +++ b/src/ButtonThread.h @@ -54,15 +54,18 @@ class ButtonThread : public concurrency::OSThread if (settingsMap.count(user) != 0 && settingsMap[user] != RADIOLIB_NC) userButton = OneButton(settingsMap[user], true, true); #elif defined(BUTTON_PIN) - - userButton = OneButton(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, true, true); + int pin = config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN; + userButton = OneButton(pin, true, true); #endif + #ifdef INPUT_PULLUP_SENSE // Some platforms (nrf52) have a SENSE variant which allows wake from sleep - override what OneButton did - pinMode(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, INPUT_PULLUP_SENSE); + pinMode(pin, INPUT_PULLUP_SENSE); #endif userButton.attachClick(userButtonPressed); - userButton.setClickMs(300); + userButton.setClickMs(400); + userButton.setPressMs(1000); + userButton.setDebounceMs(10); userButton.attachDuringLongPress(userButtonPressedLong); userButton.attachDoubleClick(userButtonDoublePressed); userButton.attachMultiClick(userButtonMultiPressed); @@ -72,7 +75,15 @@ class ButtonThread : public concurrency::OSThread if (settingsMap.count(user) != 0 && settingsMap[user] != RADIOLIB_NC) wakeOnIrq(settingsMap[user], FALLING); #else - wakeOnIrq(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, FALLING); + static OneButton *pBtn = &userButton; // only one instance of ButtonThread is created, so static is safe + attachInterrupt( + pin, + []() { + BaseType_t higherWake = 0; + mainDelay.interruptFromISR(&higherWake); + pBtn->tick(); + }, + CHANGE); #endif #endif #ifdef BUTTON_PIN_ALT @@ -194,6 +205,7 @@ class ButtonThread : public concurrency::OSThread { if (!config.device.disable_triple_click && (gps != nullptr)) { gps->toggleGpsMode(); + screen->forceDisplay(); } } diff --git a/variants/t-echo/platformio.ini b/variants/t-echo/platformio.ini index 2555032dfc..843bd88ff0 100644 --- a/variants/t-echo/platformio.ini +++ b/variants/t-echo/platformio.ini @@ -6,6 +6,7 @@ debug_tool = jlink # add -DCFG_SYSVIEW if you want to use the Segger systemview tool for OS profiling. build_flags = ${nrf52840_base.build_flags} -Ivariants/t-echo + -DGPS_POWER_TOGGLE -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/t-echo> lib_deps =