From fb8e9ea93a7e455a09439d33222bd1da74822633 Mon Sep 17 00:00:00 2001 From: Zxy <78582677+ZosCat1@users.noreply.github.com> Date: Fri, 3 Feb 2023 09:56:10 +0800 Subject: [PATCH] =?UTF-8?q?[sensor]=20=E4=BF=AE=E5=A4=8D=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E4=BD=BF=E7=94=A8=E6=97=A5=E5=BF=97=E8=BE=93?= =?UTF-8?q?=E5=87=BAAPI=E7=9A=84=E9=97=AE=E9=A2=98=20(#6895)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 命令交互应使用rt_kprintf,而非LOG_x --- components/drivers/sensor/sensor_cmd.c | 48 +++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/components/drivers/sensor/sensor_cmd.c b/components/drivers/sensor/sensor_cmd.c index db6061b675..ff1bb0f7d0 100644 --- a/components/drivers/sensor/sensor_cmd.c +++ b/components/drivers/sensor/sensor_cmd.c @@ -205,7 +205,7 @@ static const char* sensor_get_accuracy_mode_name(rt_sensor_info_t info) case RT_SENSOR_MODE_ACCURACY_NOTRUST: return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_MODE_ACCURACY_NOTRUST); default: - LOG_E("accuracy mode illegal!"); + rt_kprintf("accuracy mode illegal!\n"); return ""; } } @@ -227,7 +227,7 @@ static const char* sensor_get_power_mode_name(rt_sensor_info_t info) case RT_SENSOR_MODE_POWER_DOWN: return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_MODE_POWER_DOWN); default: - LOG_E("power mode illegal!"); + rt_kprintf("power mode illegal!\n"); return ""; } } @@ -243,7 +243,7 @@ static const char* sensor_get_fetch_mode_name(rt_sensor_info_t info) case RT_SENSOR_MODE_FETCH_FIFO: return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_MODE_FETCH_FIFO); default: - LOG_E("fetch data mode illegal!"); + rt_kprintf("fetch data mode illegal!\n"); return ""; } } @@ -254,66 +254,66 @@ static void sensor_show_data(rt_size_t num, rt_sensor_t sensor, struct rt_sensor switch (sensor->info.type) { case RT_SENSOR_TYPE_ACCE: - LOG_I("num:%d, x:%f, y:%f, z:%f %s, timestamp:%u", num, sensor_data->data.acce.x, sensor_data->data.acce.y, sensor_data->data.acce.z, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, x:%f, y:%f, z:%f %s, timestamp:%u\n", num, sensor_data->data.acce.x, sensor_data->data.acce.y, sensor_data->data.acce.z, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_GYRO: - LOG_I("num:%d, x:%f, y:%f, z:%f %s, timestamp:%u", num, sensor_data->data.gyro.x, sensor_data->data.gyro.y, sensor_data->data.gyro.z, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, x:%f, y:%f, z:%f %s, timestamp:%u\n", num, sensor_data->data.gyro.x, sensor_data->data.gyro.y, sensor_data->data.gyro.z, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_MAG: - LOG_I("num:%d, x:%f, y:%f, z:%f %s, timestamp:%u", num, sensor_data->data.mag.x, sensor_data->data.mag.y, sensor_data->data.mag.z, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, x:%f, y:%f, z:%f %s, timestamp:%u\n", num, sensor_data->data.mag.x, sensor_data->data.mag.y, sensor_data->data.mag.z, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_GNSS: - LOG_I("num:%d, lon:%f, lat:%f %s, timestamp:%u", num, sensor_data->data.coord.longitude, sensor_data->data.coord.latitude, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, lon:%f, lat:%f %s, timestamp:%u\n", num, sensor_data->data.coord.longitude, sensor_data->data.coord.latitude, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_TEMP: - LOG_I("num:%d, temp:%f%s, timestamp:%u", num, sensor_data->data.temp, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, temp:%f%s, timestamp:%u\n", num, sensor_data->data.temp, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_HUMI: - LOG_I("num:%d, humi:%f%s, timestamp:%u", num, sensor_data->data.humi, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, humi:%f%s, timestamp:%u\n", num, sensor_data->data.humi, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_BARO: - LOG_I("num:%d, press:%f%s, timestamp:%u", num, sensor_data->data.baro, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, press:%f%s, timestamp:%u\n", num, sensor_data->data.baro, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_LIGHT: - LOG_I("num:%d, light:%f%s, timestamp:%u", num, sensor_data->data.light, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, light:%f%s, timestamp:%u\n", num, sensor_data->data.light, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_PROXIMITY: case RT_SENSOR_TYPE_TOF: - LOG_I("num:%d, distance:%f%s, timestamp:%u", num, sensor_data->data.proximity, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, distance:%f%s, timestamp:%u\n", num, sensor_data->data.proximity, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_HR: - LOG_I("num:%d, heart rate:%f%s, timestamp:%u", num, sensor_data->data.hr, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, heart rate:%f%s, timestamp:%u\n", num, sensor_data->data.hr, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_TVOC: - LOG_I("num:%d, tvoc:%f%s, timestamp:%u", num, sensor_data->data.tvoc, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, tvoc:%f%s, timestamp:%u\n", num, sensor_data->data.tvoc, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_NOISE: - LOG_I("num:%d, noise:%f%s, timestamp:%u", num, sensor_data->data.noise, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, noise:%f%s, timestamp:%u\n", num, sensor_data->data.noise, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_STEP: - LOG_I("num:%d, step:%f%s, timestamp:%u", num, sensor_data->data.step, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, step:%f%s, timestamp:%u\n", num, sensor_data->data.step, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_FORCE: - LOG_I("num:%d, force:%f%s, timestamp:%u", num, sensor_data->data.force, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, force:%f%s, timestamp:%u\n", num, sensor_data->data.force, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_DUST: - LOG_I("num:%d, dust:%f%s, timestamp:%u", num, sensor_data->data.dust, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, dust:%f%s, timestamp:%u\n", num, sensor_data->data.dust, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_ECO2: - LOG_I("num:%d, eco2:%f%s, timestamp:%u", num, sensor_data->data.eco2, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, eco2:%f%s, timestamp:%u\n", num, sensor_data->data.eco2, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_IAQ: - LOG_I("num:%d, IAQ:%f%s, timestamp:%u", num, sensor_data->data.iaq, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, IAQ:%f%s, timestamp:%u\n", num, sensor_data->data.iaq, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_ETOH: - LOG_I("num:%d, EtOH:%f%s, timestamp:%u", num, sensor_data->data.etoh, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, EtOH:%f%s, timestamp:%u\n", num, sensor_data->data.etoh, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_BP: - LOG_I("num:%d, bp.sbp:%f, bp.dbp:%f %s, timestamp:%u", num, sensor_data->data.bp.sbp, sensor_data->data.bp.dbp, unit_name, sensor_data->timestamp); + rt_kprintf("num:%d, bp.sbp:%f, bp.dbp:%f %s, timestamp:%u\n", num, sensor_data->data.bp.sbp, sensor_data->data.bp.dbp, unit_name, sensor_data->timestamp); break; case RT_SENSOR_TYPE_NONE: default: - LOG_E("Unknown type of sensor!"); + rt_kprintf("Unknown type of sensor!\n"); break; } } @@ -687,7 +687,7 @@ static void sensor(int argc, char **argv) } if (rt_device_control(new_dev, RT_SENSOR_CTRL_GET_ID, ®) == RT_EOK) { - LOG_I("Sensor Chip ID: %#x", reg); + rt_kprintf("Sensor Chip ID: %#x\n", reg); } if (dev) {