listener: use PX4_INFO_RAW instead of printf

Ensures that clients will get the output of the listener.
This commit is contained in:
Beat Küng
2018-08-06 08:11:58 +02:00
committed by Lorenz Meier
parent e6d71680ab
commit f1dc8f8f48
4 changed files with 15 additions and 13 deletions
+6 -6
View File
@@ -65,7 +65,7 @@ topic_fields = ["uint64_t timestamp"]+["%s %s" % (convert_type(field.type), fiel
}@
#include <cinttypes>
#include <cstdio>
#include <px4_log.h>
#include <px4_defines.h>
#include <uORB/topics/@(topic_name).h>
#include <drivers/drv_hrt.h>
@@ -80,14 +80,14 @@ ORB_DEFINE(@multi_topic, struct @uorb_struct, @(struct_size-padding_end_size), _
void print_message(const @uorb_struct& message)
{
printf(" @(uorb_struct)\n");
printf("\ttimestamp: %" PRIu64, message.timestamp);
PX4_INFO_RAW(" @(uorb_struct)\n");
PX4_INFO_RAW("\ttimestamp: %" PRIu64, message.timestamp);
if (message.timestamp != 0) {
printf(" (%.6f seconds ago)\n", hrt_elapsed_time(&message.timestamp) / 1e6);
PX4_INFO_RAW(" (%.6f seconds ago)\n", hrt_elapsed_time(&message.timestamp) / 1e6);
} else {
printf("\n");
PX4_INFO_RAW("\n");
}
@[for field in sorted_fields]@
@( print_field(field) )@
@[end for]@
}
}