This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 78590a55ea035f31c951aab87ec90647147d8f69
Author: dongjiuzhu1 <[email protected]>
AuthorDate: Sun May 28 16:35:45 2023 +0800

    system/uorb: Support frequency less than 1hz
    
    Signed-off-by: dongjiuzhu1 <[email protected]>
---
 system/uorb/listener.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/system/uorb/listener.c b/system/uorb/listener.c
index b98f78e04..139e9a59f 100644
--- a/system/uorb/listener.c
+++ b/system/uorb/listener.c
@@ -70,8 +70,8 @@ static int listener_generate_object_list(FAR struct list_node 
*objlist,
                                          FAR const char *filter);
 static int listener_print(FAR const struct orb_metadata *meta, int fd);
 static void listener_monitor(FAR struct list_node *objlist, int nb_objects,
-                             int topic_rate, int topic_latency, int nb_msgs,
-                             int timeout);
+                             float topic_rate, int topic_latency,
+                             int nb_msgs, int timeout);
 static int listener_update(FAR struct list_node *objlist,
                            FAR struct orb_object *object);
 static void listener_top(FAR struct list_node *objlist,
@@ -492,12 +492,12 @@ static int listener_print(FAR const struct orb_metadata 
*meta, int fd)
  ****************************************************************************/
 
 static void listener_monitor(FAR struct list_node *objlist, int nb_objects,
-                             int topic_rate, int topic_latency, int nb_msgs,
-                             int timeout)
+                             float topic_rate, int topic_latency,
+                             int nb_msgs, int timeout)
 {
   FAR struct pollfd *fds;
   FAR int *recv_msgs;
-  int interval = topic_rate ? 1000000 / topic_rate : 0;
+  int interval = topic_rate ? (int)(1000000 / topic_rate) : 0;
   int nb_recv_msgs = 0;
   int i = 0;
 
@@ -706,7 +706,7 @@ int main(int argc, FAR char *argv[])
 {
   struct list_node objlist;
   FAR struct listen_object_s *tmp;
-  int topic_rate    = 0;
+  float topic_rate = 0;
   int topic_latency = 0;
   int nb_msgs       = 0;
   int timeout       = 5;
@@ -729,7 +729,7 @@ int main(int argc, FAR char *argv[])
       switch (ch)
       {
         case 'r':
-          topic_rate = strtol(optarg, NULL, 0);
+          topic_rate = atof(optarg);
           if (topic_rate < 0)
             {
               goto error;

Reply via email to