From 6d40ee41124cec57a9d9e6e02c51526d99ddbd28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Mon, 14 Oct 2024 13:04:34 +0200 Subject: [PATCH] applications: nrf_desktop: Add missing sample_fetch for qdec in wheel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added sensor_sample-fetch before sensor_channel_get which is now required by updated qdec driver properly implementing zephyr sensor API. Signed-off-by: MichaƂ Stasiak --- applications/nrf_desktop/src/hw_interface/wheel.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/applications/nrf_desktop/src/hw_interface/wheel.c b/applications/nrf_desktop/src/hw_interface/wheel.c index bb12cecac51f..e124fa5a0772 100644 --- a/applications/nrf_desktop/src/hw_interface/wheel.c +++ b/applications/nrf_desktop/src/hw_interface/wheel.c @@ -114,9 +114,16 @@ static void data_ready_handler(const struct device *dev, const struct sensor_tri k_spin_unlock(&lock, key); } + int err = sensor_sample_fetch_chan(qdec_dev, SENSOR_CHAN_ROTATION); + + if (err) { + LOG_ERR("Cannot fetch sensor sample (err %d)", err); + return; + } + struct sensor_value value; - int err = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &value); + err = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &value); if (err) { LOG_ERR("Cannot get sensor value"); return;