From c26b999360ddbc6392f36ac8f7abed0f7cb457cc Mon Sep 17 00:00:00 2001 From: bernard Date: Mon, 1 Dec 2014 12:22:17 +0800 Subject: [PATCH] Fix the sensor list issue. --- components/drivers/sensors/sensor.cpp | 19 ++++++++++++++++--- components/drivers/sensors/sensor.h | 3 --- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/components/drivers/sensors/sensor.cpp b/components/drivers/sensors/sensor.cpp index 52718183f..8751efd36 100644 --- a/components/drivers/sensors/sensor.cpp +++ b/components/drivers/sensors/sensor.cpp @@ -1,3 +1,17 @@ +/* + * File : sensors.cpp + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2014, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2014-08-03 Bernard the first version + */ + #include #include "sensor.h" @@ -60,7 +74,7 @@ int SensorManager::RegisterSensor(Sensor *sensor) RT_ASSERT(sensor != RT_NULL); /* add sensor into the list */ - if (self->sensorList = NULL) + if (self->sensorList == NULL) { sensor->prev = sensor->next = sensor; } @@ -113,8 +127,7 @@ Sensor *SensorManager::GetDefaultSensor(int type) if (sensor->GetType() == type) return sensor; sensor = sensor->next; - } - while (sensor != self->sensorList); + }while (sensor != self->sensorList); return NULL; } diff --git a/components/drivers/sensors/sensor.h b/components/drivers/sensors/sensor.h index 09929d1b5..065422944 100644 --- a/components/drivers/sensors/sensor.h +++ b/components/drivers/sensors/sensor.h @@ -34,10 +34,7 @@ #define SENSORS_H__ #include - #include -#include -#include /** * Handles must be higher than SENSORS_HANDLE_BASE and must be unique. -- GitLab