diff --git a/system/uorb/listener.c b/system/uorb/listener.c index 4a60b518573..27ae57da52b 100644 --- a/system/uorb/listener.c +++ b/system/uorb/listener.c @@ -84,7 +84,7 @@ static int listener_print(FAR const struct orb_metadata *meta, int fd); static void listener_monitor(FAR struct listen_list_s *objlist, int nb_objects, float topic_rate, int topic_latency, int nb_msgs, - int timeout, bool record, bool nonwakeup); + int timeout, bool record, bool wakeup); static int listener_update(FAR struct listen_list_s *objlist, FAR struct orb_object *object); static void listener_top(FAR struct listen_list_s *objlist, @@ -140,7 +140,7 @@ listener [arguments...]\n\ \t[-l ] Top only execute once.\n\ \t[-i ] Get sensor device information based on topic.\n\ \t[-f ] Flush sensor drive data.\n\ -\t[-u ] Subscribe in non-wakeup mode to save power.\n\ +\t[-w ] Subscribe in wakeup mode.\n\ "); } @@ -187,28 +187,26 @@ static int listener_create_dir(FAR char *dir, size_t size) * Name: listener_subscribe * * Description: - * Subscribe topic according to non wakeup mode. + * Subscribe topic according to wakeup mode. * * Input Parameters: * tmp Given object - * nonwakeup State of nonwakeup. + * wakeup State of wakeup. * * Returned Value: * fd on success, otherwise -1. ****************************************************************************/ static int listener_subscribe(FAR struct listen_object_s *tmp, - bool nonwakeup) + bool wakeup) { - if (nonwakeup) + if (wakeup) { - return orb_subscribe_multi_nonwakeup(tmp->object.meta, - tmp->object.instance); - } - else - { - return orb_subscribe_multi(tmp->object.meta, tmp->object.instance); + return orb_subscribe_multi_wakeup(tmp->object.meta, + tmp->object.instance); } + + return orb_subscribe_multi(tmp->object.meta, tmp->object.instance); } /**************************************************************************** @@ -571,14 +569,14 @@ static int listener_print(FAR const struct orb_metadata *meta, int fd) * objlist Topic object list. * nb_objects Length of objects list. * timeout Maximum poll waiting time(microsecond). - * nonwakeup The state of non wakeup + * wakeup The state of wakeup * * Returned Value: * void ****************************************************************************/ static void listener_flush_topic(FAR const struct listen_list_s *objlist, - int nb_objects, int timeout, bool nonwakeup) + int nb_objects, int timeout, bool wakeup) { FAR struct listen_object_s *tmp; FAR struct pollfd *fds; @@ -607,7 +605,7 @@ static void listener_flush_topic(FAR const struct listen_list_s *objlist, { int fd; - fd = listener_subscribe(tmp, nonwakeup); + fd = listener_subscribe(tmp, wakeup); if (fd < 0) { fds[i].fd = -1; @@ -703,14 +701,14 @@ static void listener_flush_topic(FAR const struct listen_list_s *objlist, * * Input Parameters: * objlist topic object list. - * nonwakeup The state of non wakeup + * wakeup The state of wakeup * * Returned Value: * void ****************************************************************************/ static void listener_print_info(FAR const struct listen_list_s *objlist, - bool nonwakeup) + bool wakeup) { FAR struct listen_object_s *tmp; orb_info_t info; @@ -719,7 +717,7 @@ static void listener_print_info(FAR const struct listen_list_s *objlist, SLIST_FOREACH(tmp, objlist, node) { - fd = listener_subscribe(tmp, nonwakeup); + fd = listener_subscribe(tmp, wakeup); if (fd < 0) { continue; @@ -807,7 +805,7 @@ static int listener_record(FAR const struct orb_metadata *meta, int fd, static void listener_monitor(FAR struct listen_list_s *objlist, int nb_objects, float topic_rate, int topic_latency, int nb_msgs, - int timeout, bool record, bool nonwakeup) + int timeout, bool record, bool wakeup) { FAR struct pollfd *fds; char path[PATH_MAX]; @@ -838,7 +836,7 @@ static void listener_monitor(FAR struct listen_list_s *objlist, { int fd; - fd = listener_subscribe(tmp, nonwakeup); + fd = listener_subscribe(tmp, wakeup); if (fd < 0) { fds[i].fd = -1; @@ -1079,7 +1077,7 @@ int main(int argc, FAR char *argv[]) bool info = false; bool flush = false; bool record = false; - bool nonwakeup = false; + bool wakeup = false; bool only_once = false; FAR char *filter = NULL; int ret; @@ -1093,7 +1091,7 @@ int main(int argc, FAR char *argv[]) /* Pasrse Argument */ - while ((ch = getopt(argc, argv, "r:b:n:t:Tfslhiu")) != EOF) + while ((ch = getopt(argc, argv, "r:b:n:t:Tfslhiw")) != EOF) { switch (ch) { @@ -1151,8 +1149,8 @@ int main(int argc, FAR char *argv[]) info = true; break; - case 'u': - nonwakeup = true; + case 'w': + wakeup = true; break; case 'h': @@ -1177,13 +1175,13 @@ int main(int argc, FAR char *argv[]) if (flush) { - listener_flush_topic(&objlist, ret, timeout, nonwakeup); + listener_flush_topic(&objlist, ret, timeout, wakeup); goto exit; } if (info) { - listener_print_info(&objlist, nonwakeup); + listener_print_info(&objlist, wakeup); goto exit; } @@ -1202,7 +1200,7 @@ int main(int argc, FAR char *argv[]) } listener_monitor(&objlist, ret, topic_rate, topic_latency, - nb_msgs, timeout, record, nonwakeup); + nb_msgs, timeout, record, wakeup); } exit: diff --git a/system/uorb/sensor/accel.c b/system/uorb/sensor/accel.c index f2c67a34d06..5c569fbd361 100644 --- a/system/uorb/sensor/accel.c +++ b/system/uorb/sensor/accel.c @@ -33,7 +33,9 @@ #ifdef CONFIG_DEBUG_UORB static const char sensor_accel_format[] = "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,temperature:%hf"; - +static const char sensor_accel_uncal_format[] = + "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,x_bias:%hf,y_bias:%hf," + "z_bias:%hf,temperature:%hf"; #endif /**************************************************************************** @@ -41,7 +43,8 @@ static const char sensor_accel_format[] = ****************************************************************************/ ORB_DEFINE(sensor_accel, struct sensor_accel, sensor_accel_format); -ORB_DEFINE(sensor_accel_uncal, struct sensor_accel, sensor_accel_format); +ORB_DEFINE(sensor_accel_uncal, struct sensor_accel_uncal, + sensor_accel_uncal_format); ORB_DEFINE(sensor_linear_accel, struct sensor_accel, sensor_accel_format); -ORB_DEFINE(sensor_linear_accel_uncal, struct sensor_accel, - sensor_accel_format); +ORB_DEFINE(sensor_linear_accel_uncal, struct sensor_accel_uncal, + sensor_accel_uncal_format); diff --git a/system/uorb/sensor/gyro.c b/system/uorb/sensor/gyro.c index d1988f56d16..18aa26a2161 100644 --- a/system/uorb/sensor/gyro.c +++ b/system/uorb/sensor/gyro.c @@ -33,6 +33,9 @@ #ifdef CONFIG_DEBUG_UORB static const char sensor_gyro_format[] = "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,temperature:%hf"; +static const char sensor_gyro_uncal_format[] = + "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,x_bias:%hf,y_bias:%hf," + "z_bias:%hf,temperature:%hf"; #endif /**************************************************************************** @@ -40,4 +43,5 @@ static const char sensor_gyro_format[] = ****************************************************************************/ ORB_DEFINE(sensor_gyro, struct sensor_gyro, sensor_gyro_format); -ORB_DEFINE(sensor_gyro_uncal, struct sensor_gyro, sensor_gyro_format); +ORB_DEFINE(sensor_gyro_uncal, struct sensor_gyro_uncal, + sensor_gyro_uncal_format); diff --git a/system/uorb/sensor/mag.c b/system/uorb/sensor/mag.c index 97077975b55..49b7b2992a2 100644 --- a/system/uorb/sensor/mag.c +++ b/system/uorb/sensor/mag.c @@ -34,6 +34,9 @@ static const char sensor_mag_format[] = "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,temperature:%hf," "status:%" PRId32 ""; +static const char sensor_mag_uncal_format[] = + "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,x_bias:%hf,y_bias:%hf," + "z_bias:%hf,temperature:%hf,status:%" PRId32 ""; #endif /**************************************************************************** @@ -41,4 +44,5 @@ static const char sensor_mag_format[] = ****************************************************************************/ ORB_DEFINE(sensor_mag, struct sensor_mag, sensor_mag_format); -ORB_DEFINE(sensor_mag_uncal, struct sensor_mag, sensor_mag_format); +ORB_DEFINE(sensor_mag_uncal, struct sensor_mag_uncal, + sensor_mag_uncal_format); diff --git a/system/uorb/test/unit_test.c b/system/uorb/test/unit_test.c index 70cd059dfe3..4150cd4d006 100644 --- a/system/uorb/test/unit_test.c +++ b/system/uorb/test/unit_test.c @@ -544,11 +544,6 @@ static int test_multi(int *afds, int *sfds) return test_fail("sub #1 val. mismatch: %d", sub_sample.val); } - if (OK != latency_test(false)) - { - return test_fail("latency test failed"); - } - orb_unsubscribe(sfds[0]); orb_unsubscribe(sfds[1]); @@ -1162,12 +1157,12 @@ int main(int argc, FAR char *argv[]) { if (test() == OK) { - printf("PASS\n"); + printf("TEST PASS\n"); return 0; } else { - printf("FAIL\n"); + printf("TEST FAIL\n"); return -1; } } diff --git a/system/uorb/uORB/uORB.c b/system/uorb/uORB/uORB.c index 6fcc060c20a..a9dfe7b7939 100644 --- a/system/uorb/uORB/uORB.c +++ b/system/uorb/uORB/uORB.c @@ -51,7 +51,7 @@ * flag The open flag. * instance Instance number to open. * queue_size Maximum number of buffered elements. - * non_wakeup The non wakeup flag. + * wakeup The wakeup flag. * * Returned Value: * fd on success, otherwise returns negative value and set errno. @@ -59,7 +59,7 @@ static int orb_advsub_open(FAR const struct orb_metadata *meta, int flags, int instance, unsigned int queue_size, - FAR orb_info_t *info, bool non_wakeup) + FAR orb_info_t *info, bool wakeup) { char path[ORB_PATH_MAX]; int fd; @@ -124,9 +124,9 @@ static int orb_advsub_open(FAR const struct orb_metadata *meta, int flags, ioctl(fd, SNIOC_SET_BUFFER_NUMBER, (unsigned long)queue_size); } - if (non_wakeup) + if (wakeup) { - ioctl(fd, SNIOC_SET_NONWAKEUP, (unsigned long)non_wakeup); + ioctl(fd, SNIOC_SET_WAKEUP, (unsigned long)wakeup); } return fd; @@ -219,7 +219,7 @@ int orb_subscribe_multi(FAR const struct orb_metadata *meta, return orb_advsub_open(meta, O_RDONLY, instance, 0, NULL, false); } -int orb_subscribe_multi_nonwakeup(FAR const struct orb_metadata *meta, +int orb_subscribe_multi_wakeup(FAR const struct orb_metadata *meta, unsigned instance) { return orb_advsub_open(meta, O_RDONLY, instance, 0, NULL, true); diff --git a/system/uorb/uORB/uORB.h b/system/uorb/uORB/uORB.h index e30c52fdd62..67736fd590e 100644 --- a/system/uorb/uORB/uORB.h +++ b/system/uorb/uORB/uORB.h @@ -449,7 +449,7 @@ static inline int orb_publish_auto(FAR const struct orb_metadata *meta, * Name: orb_subscribe_multi * * Description: - * Subscribe to a topic. + * Subscribe to a topic in a non-wakeup ways. * * The data is published to the topic and any waiting subscribers will be * notified. Subscribers that are not waiting can check the topic for @@ -485,20 +485,18 @@ static inline int orb_subscribe(FAR const struct orb_metadata *meta) } /**************************************************************************** - * Name: orb_subscribe_multi_nonwakeup/orb_subscribe_nonwakeup + * Name: orb_subscribe_multi_wakeup/orb_subscribe_wakeup * * Description: - * Subscribe to a topic in a non-wakeup ways. + * Subscribe to a topic in a wakeup ways. * - * The usage of orb_subscribe_multi_nonwakeup is similar to that of + * The usage of orb_subscribe_multi_wakeup is similar to that of * orb_subscribe_multi, with the key difference lying in whether the * system's wakeup status needs to be concerned. This distinction is * particularly beneficial for low-power consumption scenarios. - * If the subscription is in a non-wakeup mode, the subscriber will not - * receive data while the system is in sleep mode. In such cases, new data - * will overwrite old data until the system is awakened, at which point - * the subscriber will be notified. Typically, the subscriber and - * publisher of a topic reside in two separate systems. + * If the subscription is in a wakeup mode, the subscriber will be wokeup + * and it receives data while the system is in sleep mode. Typically, the + * subscriber and publisher of a topic reside in two separate systems. * * Input Parameters: * meta The uORB metadata (usually from the ORB_ID() macro) @@ -513,13 +511,13 @@ static inline int orb_subscribe(FAR const struct orb_metadata *meta) * this function will return -1 and set errno to ENOENT. ****************************************************************************/ -int orb_subscribe_multi_nonwakeup(FAR const struct orb_metadata *meta, - unsigned instance); +int orb_subscribe_multi_wakeup(FAR const struct orb_metadata *meta, + unsigned instance); static inline -int orb_subscribe_nonwakeup(FAR const struct orb_metadata *meta) +int orb_subscribe_wakeup(FAR const struct orb_metadata *meta) { - return orb_subscribe_multi_nonwakeup(meta, 0); + return orb_subscribe_multi_wakeup(meta, 0); } /****************************************************************************