File tree Expand file tree Collapse file tree 2 files changed +100
-100
lines changed Expand file tree Collapse file tree 2 files changed +100
-100
lines changed Original file line number Diff line number Diff line change @@ -376,7 +376,7 @@ solution introduces a delay in registering the actual events.
376
376
// Isolate gravity with low-pass filter.
377
377
const filter = new LowPassFilterData(accl, 0.8);
378
378
379
- accl.onchange = () => {
379
+ accl.onreading = () => {
380
380
filter.update(accl); // Pass latest values through filter.
381
381
console.log(`Isolated gravity (${filter.x}, ${filter.y}, ${filter.z})`);
382
382
}
@@ -418,7 +418,7 @@ with [=gyroscope=] readings.
418
418
// Remove drift with a high pass filter.
419
419
const filter = new HighPassFilterData(gyro, 0.8);
420
420
421
- gyro.onchange = () => {
421
+ gyro.onreading = () => {
422
422
filter.update(gyro); // Pass latest values through filter.
423
423
console.log(`Steady gyroscope (${filter.x}, ${filter.y}, ${filter.z})`);
424
424
}
@@ -549,7 +549,7 @@ measurements.
549
549
let alpha = beta = gamma = 0;
550
550
const bias = 0.98;
551
551
552
- gyro.onchange = () => {
552
+ gyro.onreading = () => {
553
553
let dt = timestamp ? (gyro.timestamp - timestamp) / 1000 : 0;
554
554
timestamp = gyro.timestamp;
555
555
You can’t perform that action at this time.
0 commit comments