mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-18 17:53:31 +08:00
1.Add sensor vendor MAXIM.
2.Fix: When printing sub-zero temperature, "-" is displayed after ".". Signed-off-by: SimpleInit <63694297@qq.com>
This commit is contained in:
parent
e6743e8c47
commit
c495d5a247
@ -65,6 +65,7 @@ extern "C" {
|
||||
#define RT_SENSOR_VENDOR_TI (11) /* Texas Instruments */
|
||||
#define RT_SENSOR_VENDOR_PLANTOWER (12) /* Plantower */
|
||||
#define RT_SENSOR_VENDOR_AMS (13) /* ams AG */
|
||||
#define RT_SENSOR_VENDOR_MAXIM (14) /* Maxim Integrated */
|
||||
|
||||
|
||||
/* Sensor unit types */
|
||||
|
@ -38,7 +38,7 @@ static void sensor_show_data(rt_size_t num, rt_sensor_t sensor, struct rt_sensor
|
||||
LOG_I("num:%3d, lon:%5d, lat:%5d, timestamp:%5d", num, sensor_data->data.coord.longitude, sensor_data->data.coord.latitude, sensor_data->timestamp);
|
||||
break;
|
||||
case RT_SENSOR_CLASS_TEMP:
|
||||
LOG_I("num:%3d, temp:%3d.%d C, timestamp:%5d", num, sensor_data->data.temp / 10, sensor_data->data.temp % 10, sensor_data->timestamp);
|
||||
LOG_I("num:%3d, temp:%3d.%d C, timestamp:%5d", num, sensor_data->data.temp / 10, (rt_uint32_t)sensor_data->data.temp % 10, sensor_data->timestamp);
|
||||
break;
|
||||
case RT_SENSOR_CLASS_HUMI:
|
||||
LOG_I("num:%3d, humi:%3d.%d%%, timestamp:%5d", num, sensor_data->data.humi / 10, sensor_data->data.humi % 10, sensor_data->timestamp);
|
||||
@ -345,6 +345,9 @@ static void sensor(int argc, char **argv)
|
||||
case RT_SENSOR_VENDOR_AMS:
|
||||
rt_kprintf("vendor :AMS\n");
|
||||
break;
|
||||
case RT_SENSOR_VENDOR_MAXIM:
|
||||
rt_kprintf("vendor :Maxim Integrated\n");
|
||||
break;
|
||||
}
|
||||
rt_kprintf("model :%s\n", info.model);
|
||||
switch (info.unit)
|
||||
|
Loading…
x
Reference in New Issue
Block a user