T-Watch: Leaving tilt debug back in on S3 builds

This commit is contained in:
pelgraine
2026-07-18 14:57:03 +10:00
parent b9e59953e6
commit 627039cd36
2 changed files with 11 additions and 1 deletions
+10 -1
View File
@@ -4,11 +4,12 @@
#include <esp_bt.h> // 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;
}
@@ -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();