From adac5cfd26e86b792574eb7751e19f072de3e400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kari=20Hautam=C3=A4ki?= Date: Fri, 10 Feb 2017 09:54:09 +0200 Subject: iot-sensortag: Fix RotationPage 'no rotation' bug - Conditional binding to sensor values only when sensor is available - Set and recalibrate sensor for RotationPage when the sensor becomes available Change-Id: I3729faa482abdd17bf0d0a850a3eef528cd5a6b6 Reviewed-by: Titta Heikkala --- tradeshow/iot-sensortag/resources/small/MainSmall.qml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'tradeshow/iot-sensortag/resources/small') diff --git a/tradeshow/iot-sensortag/resources/small/MainSmall.qml b/tradeshow/iot-sensortag/resources/small/MainSmall.qml index 377acd1..df4a868 100644 --- a/tradeshow/iot-sensortag/resources/small/MainSmall.qml +++ b/tradeshow/iot-sensortag/resources/small/MainSmall.qml @@ -71,6 +71,7 @@ Item { magnetometer.sensor = dataProviderPool.getProvider(SensorTagData.Magnetometer); rotation.sensor = dataProviderPool.getProvider(SensorTagData.Rotation); accelometer.sensor = dataProviderPool.getProvider(SensorTagData.Accelometer); + rotationMain.sensor = dataProviderPool.getProvider(SensorTagData.Rotation); } } @@ -155,7 +156,7 @@ Item { } RotationPage { - id: mainContainer + id: rotationMain anchors.top: topToolbar.bottom anchors.left: leftPane.right @@ -163,11 +164,7 @@ Item { anchors.right: rightPane.left anchors.rightMargin: 32 anchors.bottom: parent.bottom - - Component.onCompleted: { - sensor = rotation.sensor; - sensor.recalibrate(); - } + onSensorChanged: if (sensor) sensor.recalibrate() } -- cgit v1.2.3