bench+docs: IG threshold LSB is FS/256; factory HA* seed values recovered

The captured pulse headers carry the factory's IG programming: hunts
off, travels abort-only (HAar=133 at +/-4 g), the cut alert-only
(HAxr=132, HAyr=112), Z and idle never armed. The factory abort value
itself rules out an FS/128 LSB (4.16 g would sit over the measurable
range), and two Z-only bench windows bracket gravity between
thresholds 100 and 150, which only FS/256 explains. The drill script's
printed g conversion is corrected, and the stale motion-profile
reading of HAxr/HAyr/HAar as accel limits is corrected in the facts
bank.

No catalog consequence: a bench script's printed conversion and the
docs record; no shipped behavior changes.
This commit is contained in:
ScottW514
2026-08-31 18:26:58 -04:00
parent 61b2913e3a
commit 4a0338a03f
3 changed files with 49 additions and 10 deletions
+4 -3
View File
@@ -41,8 +41,9 @@ Usage:
but liveness is down meanwhile, so stop the controller and
forgectrl first)
--ths N per-axis threshold register value 0..255 (default 40); the
LSB is full-scale dependent, so the printed CTRL4 FS fixes
the g conversion (+/-2 g default: ~15.6 mg/LSB, 1 g ~= 64)
LSB is full scale / 256 (bench-confirmed against gravity:
+/-2 g gives ~7.8 mg/LSB, 1 g ~= 128), so the printed CTRL4
FS fixes the g conversion
--dur N IG_DUR1 duration counter, samples at the running ODR
(default 0 = fire on the first over-threshold sample)
--axes which axes arm high events (default xyz)
@@ -172,7 +173,7 @@ def main():
if (ctrl1 & 0x70) == 0: # ODR bits 6:4 zero = power-down; IG needs
wr(fd, CTRL1, 0x6F) # a running ODR: 800 Hz, BDU, XYZ on
ctrl1 = rd(fd, CTRL1)
lsb_mg = (fs * 1000.0 / 128.0) if isinstance(fs, int) else 0
lsb_mg = (fs * 1000.0 / 256.0) if isinstance(fs, int) else 0
print('WHO_AM_I=0x%02x CTRL1=0x%02x CTRL4=0x%02x FS=+/-%sg '
'ths=%d (~%.0f mg, ~%.2f g) dur=%d axes=%s mode=%s'
% (who, ctrl1, ctrl4, fs, ths, ths * lsb_mg, ths * lsb_mg / 1000.0,