提交 c26b9993 编写于 作者: B bernard

Fix the sensor list issue.

上级 43e46150
/*
* 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 <stddef.h>
#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;
}
......
......@@ -34,10 +34,7 @@
#define SENSORS_H__
#include <rtdevice.h>
#include <stdint.h>
#include <sys/cdefs.h>
#include <sys/types.h>
/**
* Handles must be higher than SENSORS_HANDLE_BASE and must be unique.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册