mirror of
https://github.com/pelgraine/Meck.git
synced 2026-07-29 04:42:41 +02:00
755f883d66
Both watches undercount steps. Two divergences from LilyGo's own configuration for this hardware, applied to both boards: 1. Watermark. LilyGoLib calls setStepCounterWatermark(1) and SensorLib's BMA423_StepDetector example passes step_counter_wm = 1. Meck's raw-I2C enable never touched those bits, leaving whatever the config-file blob defaults to. The watermark is BMA423_STEP_CNTR_WM_MSK (0x03FF), spanning feature_config [0x36] as LSB and the low two bits of [0x37] as MSB; it does not collide with the enable bit, which is bit 4 of [0x37]. Both are now written in one read-modify-write. The bit arithmetic was checked exhaustively against bma423_step_counter_set_watermark() + feature_enable() over all 65536 starting states of cfg[0x36]/cfg[0x37]: identical. 2. ODR. SensorLib's step detector example runs the accelerometer at 100 Hz. Meck used 50 Hz. Everything else already matched: NORMAL, FS_2G, OSR2_AVG2, CIC_AVG_MODE. Reverting the single 100.0f literal to 50.0f A/Bs this against the watermark change. Ruled out: the axis remap is BOTTOM_LAYER_TOP_RIGHT_CORNER on both, identical to LilyGoLib, and the enable bit itself was already register-for-register what bma423_feature_enable(BMA423_STEP_CNTR, TRUE) writes. Not attempted: the 25-value pedometer parameter block at feature_config[0x04..0x35], reachable via bma423_stepcounter_set_parameter() but with no reference values.