Gear S3 加速度计非常慢

Gear S3 accelerometer very slow

我正在使用 Gear S3,更新后它的加速度计变得非常慢。在更新之前,我在 30 秒内注册了 20-25 个样本。现在,我注册了 10-12 个样本。有人知道为什么麻烦吗?

var t0 = 0;
var cont = 0;

function onDeviceMotion(event){
    var x = event.acceleration.x.toFixed(2);
    var y = event.acceleration.y.toFixed(2);
    var z = event.acceleration.z.toFixed(2);
    var t = ((new Date().getSeconds() + 60) - t0)%60;

    var components = {
    x: x,
    y: y,
    z: z,
    t : t
    }

    counter.innerHTML = cont++;
    start.innerHTML = components.t;

    console.log(components.x + " " + components.y + " " + components.z + " " + components.t+ " " + new Date().getSeconds() );

}


window.addEventListener('devicemotion', onDeviceMotion);

根据您可能要使用的设备 ACCELERATIONLINEAR_ ACCELERATION。您可以通过调用 tizen.sensorservice.getAvailableSensors(); 检查可用的传感器 在我的例子中它是 LINEAR_ACCELERATION (Samsung Gear Sport)。您还可以修改您希望从传感器回调的频率(1000 是每秒一次)。

function startAccelerometerSensor() {
 var accelerationSensor = tizen.sensorservice
   .getDefaultSensor("LINEAR_ACCELERATION");
 accelerationSensor.setChangeListener(onChangedCBAccelerometer, 1000);
 accelerationSensor.start(onSuccessCBAccelerometer);
}

function onSuccessCBAccelerometer() {
 console.log('Accelerometer service has started successfully.');
}

function onChangedCBAccelerometer(sensorData) {
 console.log("######## Get ACCELEROMETER sensor data ########");
 console.log("X : " + sensorData.x);
 console.log("Y : " + sensorData.y);
 console.log("Z : " + sensorData.z);
}

这里是 documentation