Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

system/uorb: Support frequency less than 1hz #1868

Merged
merged 2 commits into from
Jul 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions system/uorb/listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
float interval = topic_rate ? (1000000 / topic_rate) : 0;
int nb_recv_msgs = 0;
int i = 0;

Expand Down Expand Up @@ -542,7 +542,7 @@ static void listener_monitor(FAR struct list_node *objlist, int nb_objects,
}
else if (interval != 0)
{
orb_set_interval(fd, interval);
orb_set_interval(fd, (unsigned)interval);

if (topic_latency != 0)
{
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Loading