mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
Replay: added in_list() method
neaten up code
This commit is contained in:
parent
34fe39f17d
commit
dc1ff9a757
@ -87,6 +87,19 @@ static const char *passthrough_types[] = { "MODE", "EV", "POWR", "RCIN", "RCOU",
|
||||
"CMD", "CAM", "CURR", "SIM", "TERR", "STRT", "PM",
|
||||
"STAT", NULL };
|
||||
|
||||
/*
|
||||
see if a type is in a list of types
|
||||
*/
|
||||
bool LogReader::in_list(const char *type, const char *list[])
|
||||
{
|
||||
for (uint8_t i=0; list[i] != NULL; i++) {
|
||||
if (strcmp(type, list[i]) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LogReader::update(char type[5])
|
||||
{
|
||||
uint8_t hdr[3];
|
||||
@ -214,11 +227,8 @@ bool LogReader::update(char type[5])
|
||||
|
||||
MsgHandler *p = msgparser[f.type];
|
||||
if (p == NULL) {
|
||||
for (uint8_t i=0; passthrough_types[i]; i++) {
|
||||
if (strcmp(passthrough_types[i], type) == 0) {
|
||||
if (in_list(type, passthrough_types)) {
|
||||
dataflash.WriteBlock(msg, f.length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -87,4 +87,6 @@ private:
|
||||
|
||||
bool installed_vehicle_specific_parsers;
|
||||
void maybe_install_vehicle_specific_parsers();
|
||||
|
||||
bool in_list(const char *type, const char *list[]);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user