| 140 | } |
| 141 | |
| 142 | async function testRelative(): Promise<void> { |
| 143 | console.log("\n=== B. RELATIVE move (06 03) at low speed bytes ==="); |
| 144 | for (const b of [1, 2]) { |
| 145 | await position(-60, 0); |
| 146 | gotoRel(40, 0, b, b); // far target: still in flight during the window |
| 147 | await sleep(1000); |
| 148 | const frames = await capture(2.5); |
| 149 | stop(); |
| 150 | await sleep(600); |
| 151 | const dps = cruiseDps(frames); |
| 152 | if (dps > 0.2 && dps < 7) { |
| 153 | console.log(` rel pan @${b}: cruise ${dps.toFixed(2)} °/s *** SLOWER THAN FLOOR — new lever! ***`); |
| 154 | } else if (dps >= 7) { |
| 155 | console.log(` rel pan @${b}: cruise ${dps.toFixed(2)} °/s (no slow lever)`); |
| 156 | } else { |
| 157 | // Saw nothing — either the move finished at high speed before the |
| 158 | // capture window, or 06 03 is unsupported. Disambiguate by displacement. |
| 159 | await position(-60, 0); |
| 160 | const a = (await capture(0.4)).pop()!; |
| 161 | gotoRel(5, 0, b, b); |
| 162 | await sleep(3000); |
| 163 | stop(); |
| 164 | const z = (await capture(0.4)).pop()!; |
| 165 | const moved = totalDeg(a, z); |
| 166 | console.log(` rel pan @${b}: cruise ~0 in window; 5° probe moved ${moved.toFixed(1)}° ${moved > 3 ? "(supported but FAST — ignores speed byte, dead end)" : "(06 03 unsupported on this firmware)"}`); |
| 167 | } |
| 168 | } |
| 169 | // Chained small relatives — the "creep by inches" variant. |
| 170 | console.log(" chained 0.5° relatives @byte1, 300ms period:"); |
| 171 | await position(-60, 0); |
| 172 | const cap = capture(4.5); |
| 173 | await sleep(800); |
| 174 | for (let i = 0; i < 10; i++) { gotoRel(0.5, 0, 1, 1); await sleep(300); } |
| 175 | const frames = await cap; |
| 176 | stop(); |
| 177 | const s = shiftSeries(frames); |
| 178 | const { peak, mean } = stats(s); |
| 179 | console.log(` profile |${profile(s)}|`); |
| 180 | console.log(` mean ${mean.toFixed(2)} °/s, peak ${peak.toFixed(2)} °/s ${peak < 4 ? "(gentle — usable!)" : "(lunges — same stutter)"}`); |
| 181 | } |
| 182 | |
| 183 | async function testPulseQuantum(): Promise<void> { |
| 184 | console.log("\n=== C. Pulsed DRIVE @byte1 — displacement quantum + ramp ==="); |