mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-22 06:14:14 +08:00
logger: choose logged instances by logger_topics file
new versions of logger does not allow to log multiple instances of a topic when using 'logger_topics.txt' This commit restores the default behavior (log all instances of a topic) and ad the option to specify an instance to log
This commit is contained in:
committed by
Beat Küng
parent
a8c3944485
commit
cfa74b9106
@@ -230,10 +230,11 @@ int LoggedTopics::add_topics_from_file(const char *fname)
|
||||
continue;
|
||||
}
|
||||
|
||||
// read line with format: <topic_name>[, <interval>]
|
||||
// read line with format: <topic_name>[ <interval>[ <instance>]]
|
||||
char topic_name[80];
|
||||
uint32_t interval_ms = 0;
|
||||
int nfields = sscanf(line, "%s %u", topic_name, &interval_ms);
|
||||
uint32_t instance = 0;
|
||||
int nfields = sscanf(line, "%s %u %u", topic_name, &interval_ms, &instance);
|
||||
|
||||
if (nfields > 0) {
|
||||
int name_len = strlen(topic_name);
|
||||
@@ -243,7 +244,8 @@ int LoggedTopics::add_topics_from_file(const char *fname)
|
||||
}
|
||||
|
||||
/* add topic with specified interval_ms */
|
||||
if (add_topic(topic_name, interval_ms)) {
|
||||
if ((nfields > 2 && add_topic(topic_name, interval_ms, instance))
|
||||
|| add_topic_multi(topic_name, interval_ms)) {
|
||||
ntopics++;
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user