Files
MeshCore-Solo/variants/wio-tracker-l1-eink/platformio.ini
MarekZegare4 64a48f2aea fix(eink): capture button edges via GPIO interrupt to survive display refresh
E-ink panel refreshes block the main loop for 500ms-3.6s (GxEPD2's
display.display() waits on the BUSY pin), and MomentaryButton::check()
only ever samples the live pin level once per loop iteration. A full
press+release that lands entirely inside a refresh is never sampled,
not just delayed - users on WioTracker L1 Eink were losing taps.

Add an opt-in ISR path (BUTTON_USE_INTERRUPTS) that latches each edge
with its own timestamp into a small ring buffer from attachInterrupt(),
independent of what the main loop is doing. check() replays buffered
edges through the existing transition/multi-click logic afterwards, so
click-duration and multi-click-window math still uses the edge's actual
capture time rather than "now".

Scoped to wio-tracker-l1-eink only for now: it's the one board this was
reported against and the only GxEPDDisplay-class variant that currently
builds clean on main. OLED boards refresh in ~20-30ms so polling already
catches every press; analog-button boards (rak4631/rak3401) can't use
attachInterrupt(CHANGE) at all.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 23:56:08 +02:00

98 lines
2.9 KiB
INI

[WioTrackerL1Eink]
extends = nrf52_base
board = seeed-wio-tracker-l1
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
board_upload.maximum_size = 708608
build_flags = ${nrf52_base.build_flags}
${sensor_base.build_flags}
-I lib/nrf52/s140_nrf52_7.3.0_API/include
-I lib/nrf52/s140_nrf52_7.3.0_API/include/nrf52
-I variants/wio-tracker-l1
-I examples/companion_radio/ui-new
-I lib/GxEPD2-patch/src
-D WIO_TRACKER_L1
-D WIO_TRACKER_L1_EINK
-D USE_SX1262
-D RADIO_CLASS=CustomSX1262
-D WRAPPER_CLASS=CustomSX1262Wrapper
-D LORA_TX_POWER=22
-D SX126X_CURRENT_LIMIT=140
-D SX126X_RX_BOOSTED_GAIN=1
-D EINK_DISPLAY_MODEL=GxEPD2_213_B74
-D DISPLAY_ROTATION=1
-D GPS_BAUD_RATE=9600
-D ENV_PIN_SDA=PIN_WIRE1_SDA
-D ENV_PIN_SCL=PIN_WIRE1_SCL
-D DISABLE_DIAGNOSTIC_OUTPUT
-D AUTO_OFF_MILLIS=0
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D DISPLAY_CLASS=GxEPDDisplay
-D BUTTON_USE_INTERRUPTS=1
-D UI_HAS_JOYSTICK=1
-D UI_HAS_JOYSTICK_UPDOWN=1
-D PIN_BUZZER=12
-D QSPIFLASH=1
-D FIRMWARE_SOLO_BUILD=1
-D MESHCORE_VERSION='"1.16"'
-D UI_SENSORS_PAGE=1
-D BLE_PIN_CODE=123456
build_src_filter = ${nrf52_base.build_src_filter}
+<WioTrackerL1Board.cpp>
+<../variants/wio-tracker-l1>
+<helpers/ui/GxEPDDisplay.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<helpers/ui/buzzer.cpp>
+<helpers/nrf52/SerialBLEInterface.cpp>
+<helpers/sensors>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps = ${nrf52_base.lib_deps}
${sensor_base.lib_deps}
adafruit/Adafruit GFX Library @ ^1.12.1
adafruit/RTClib @ ^2.1.3
zinggjm/GxEPD2 @ 1.6.2
bakercp/CRC32 @ ^2.0.0
densaugeo/base64 @ ~1.4.0
end2endzone/NonBlockingRTTTL@^1.3.0
; BLE only
[env:WioTrackerL1Eink_companion_radio_ble]
extends = WioTrackerL1Eink
extra_scripts = post:create-uf2.py
debug_tool=stlink
; Dual BLE+USB
[env:WioTrackerL1Eink_companion_dual]
extends = WioTrackerL1Eink
build_flags = ${WioTrackerL1Eink.build_flags}
-D DUAL_SERIAL=1
extra_scripts = post:create-uf2.py
; Dual BLE+USB with added Solo
[env:WioTrackerL1Eink_companion_solo_dual]
extends = WioTrackerL1Eink
; Optimise for size, not speed: the nRF52 Arduino core defaults to -Ofast
; (≈ -O3 + -ffast-math), which bloats flash by ~200 KB on this feature-rich
; solo build. -Os keeps every feature, fits comfortably, and is actually safer
; for float (no fast-math reassociation). Speed is irrelevant for the UI/mesh.
build_unflags = -Ofast
build_flags = ${WioTrackerL1Eink.build_flags}
-D DUAL_SERIAL=1
-D ENABLE_SCREENSHOT
-Os
extra_scripts = post:create-uf2.py
; Dual BLE+USB with screenshot support (development/debug)
[env:WioTrackerL1Eink_companion_dual_dev]
extends = WioTrackerL1Eink
build_flags = ${WioTrackerL1Eink.build_flags}
-D DUAL_SERIAL=1
-D ENABLE_SCREENSHOT
[env:WioTrackerL1Eink_kiss_modem]
extends = WioTrackerL1Eink
build_src_filter = ${WioTrackerL1Eink.build_src_filter}
+<../examples/kiss_modem/>