diff --git a/variants/lilygo_twatch_s3/TWatchS3Board.cpp b/variants/lilygo_twatch_s3/TWatchS3Board.cpp index 0644282f..9dff8bb2 100644 --- a/variants/lilygo_twatch_s3/TWatchS3Board.cpp +++ b/variants/lilygo_twatch_s3/TWatchS3Board.cpp @@ -4,11 +4,12 @@ #include // power-debug: esp_bt_controller_get_status() volatile bool TWatchS3Board::_tilt_flag = false; +volatile uint32_t TWatchS3Board::_tilt_isr_count = 0; // TEMP diagnostic // memw forces the _tilt_flag store to retire to SRAM before this ISR // returns. Without it, tiltFired() in the main loop can read a stale // value and raise-to-wake is missed. Do not remove. -void IRAM_ATTR TWatchS3Board::onTiltISR() { _tilt_flag = true; asm volatile("memw" ::: "memory"); } +void IRAM_ATTR TWatchS3Board::onTiltISR() { _tilt_flag = true; _tilt_isr_count++; asm volatile("memw" ::: "memory"); } // ---- Wrapper-free BMA423 step counter (raw I2C) ---------------------------- // SensorLib's SensorBMA423 step-counter methods do not compile in this build, @@ -223,6 +224,14 @@ bool TWatchS3Board::tiltFired() { _accel->update(); // reading the status clears the sensor INT return true; } + // TEMP diagnostic: periodically report the raw INT pin level and ISR count, + // to distinguish "pin stuck high / never re-arms" from "never asserts". + static unsigned long _tilt_dbg_next = 0; + if (millis() >= _tilt_dbg_next) { + _tilt_dbg_next = millis() + 5000; + Serial.printf("[TILT] pin=%d isr_count=%u\n", + digitalRead(PIN_ACCEL_IRQ), (unsigned)_tilt_isr_count); + } return false; } diff --git a/variants/lilygo_twatch_s3/TWatchS3Board.h b/variants/lilygo_twatch_s3/TWatchS3Board.h index fd654cfd..ec31e72b 100644 --- a/variants/lilygo_twatch_s3/TWatchS3Board.h +++ b/variants/lilygo_twatch_s3/TWatchS3Board.h @@ -26,6 +26,7 @@ class TWatchS3Board : public ESP32Board { XPowersAXP2101* _axp = NULL; // same object as PMU, concrete type SensorBMA423* _accel = nullptr; static volatile bool _tilt_flag; + static volatile uint32_t _tilt_isr_count; // TEMP diagnostic static void IRAM_ATTR onTiltISR(); // defined in the .cpp (IRAM relocation) bool power_init();