mirror of
https://github.com/pelgraine/Meck.git
synced 2026-08-06 16:52:46 +02:00
T-Watch: Leaving tilt debug back in on S3 builds
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user