8000 Synced the example code snippet with the updated Sensor interface. · w3c/motion-sensors@9473473 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9473473

Browse files
author
Mikhail Pozdnyakov
committed
Synced the example code snippet with the updated Sensor interface.
1 parent 0c02017 commit 9473473

File tree

2 files changed

+100
-100
lines changed

2 files changed

+100
-100
lines changed

index.bs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ solution introduces a delay in registering the actual events.
376376
// Isolate gravity with low-pass filter.
377377
const filter = new LowPassFilterData(accl, 0.8);
378378

379-
accl.onchange = () => {
379+
accl.onreading = () => {
380380
filter.update(accl); // Pass latest values through filter.
381381
console.log(`Isolated gravity (${filter.x}, ${filter.y}, ${filter.z})`);
382382
}
@@ -418,7 +418,7 @@ with [=gyroscope=] readings.
418418
// Remove drift with a high pass filter.
419419
const filter = new HighPassFilterData(gyro, 0.8);
420420

421-
gyro.onchange = () => {
421+
gyro.onreading = () => {
422422
filter.update(gyro); // Pass latest values through filter.
423423
console.log(`Steady gyroscope (${filter.x}, ${filter.y}, ${filter.z})`);
424424
}
@@ -549,7 +549,7 @@ measurements.
549549
let alpha = beta = gamma = 0;
550550
const bias = 0.98;
551551

552-
gyro.onchange = () => {
552+
gyro.onreading = () => {
553553
let dt = timestamp ? (gyro.timestamp - timestamp) / 1000 : 0;
554554
timestamp = gyro.timestamp;
555555

0 commit comments

Comments
 (0)
0