This is an automated email from the ASF dual-hosted git repository. ligd pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit bf140bcaae313243c2ea88700721f3f7244e2ea7 Author: liucheng5 <liuche...@xiaomi.com> AuthorDate: Wed Sep 28 11:06:27 2022 +0800 fix: sensor: support ECG event lead info Lead info is added into sensor_ecg event struct. Uorb and sensortest shall be modified. Signed-off-by: liucheng5 <liuche...@xiaomi.com> --- system/uorb/sensor/ecg.c | 5 +++-- testing/sensortest/sensortest.c | 10 +++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/system/uorb/sensor/ecg.c b/system/uorb/sensor/ecg.c index fdc050e83..f267c4c76 100644 --- a/system/uorb/sensor/ecg.c +++ b/system/uorb/sensor/ecg.c @@ -35,9 +35,10 @@ static void print_sensor_ecg_message(FAR const struct orb_metadata *meta, FAR const struct sensor_ecg *message = buffer; const orb_abstime now = orb_absolute_time(); - uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago) ecg: %.4f", + uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago) ecg: %.4f " + "status:0x%" PRIx32 "", meta->o_name, message->timestamp, now - message->timestamp, - message->ecg); + message->ecg, message->status); } #endif diff --git a/testing/sensortest/sensortest.c b/testing/sensortest/sensortest.c index 11c1b400e..35975e9ce 100644 --- a/testing/sensortest/sensortest.c +++ b/testing/sensortest/sensortest.c @@ -63,6 +63,7 @@ static void print_valf2(FAR const char *buffer, FAR const char *name); static void print_valf(FAR const char *buffer, FAR const char *name); static void print_valb(FAR const char *buffer, FAR const char *name); static void print_vali2(FAR const char *buffer, FAR const char *name); +static void print_ecg(FAR const char *buffer, FAR const char *name); static void print_ppgd(FAR const char *buffer, FAR const char *name); static void print_ppgq(FAR const char *buffer, FAR const char *name); static void print_cap(FAR const char *buffer, FAR const char *name); @@ -83,7 +84,7 @@ static const struct sensor_info g_sensor_info[] = {print_cap, sizeof(struct sensor_cap), "cap"}, {print_valf, sizeof(struct sensor_co2), "co2"}, {print_valf, sizeof(struct sensor_dust), "dust"}, - {print_valf, sizeof(struct sensor_ecg), "ecg"}, + {print_ecg, sizeof(struct sensor_ecg), "ecg"}, {print_gps, sizeof(struct sensor_gps), "gps"}, {print_gps_satellite, sizeof(struct sensor_gps_satellite), "gps_satellite"}, @@ -160,6 +161,13 @@ static void print_valf3(const char *buffer, const char *name) name, event->timestamp, event->r, event->g, event->b); } +static void print_ecg(const char *buffer, const char *name) +{ + struct sensor_event_ecg *event = (struct sensor_event_ecg *)buffer; + printf("%s: timestamp:%" PRIu64 " ecg:%.4f status:%lx", name, + event->timestamp, event->ecg, event->status); +} + static void print_ppgd(const char *buffer, const char *name) { FAR struct sensor_ppgd *event = (FAR struct sensor_ppgd *)buffer;