AP_RCProtocol: return protocol name string

This commit is contained in:
Andrew Tridgell 2018-11-03 09:49:56 +11:00
parent dbc05f787b
commit e1385573b1
2 changed files with 28 additions and 0 deletions

View File

@ -153,3 +153,28 @@ void AP_RCProtocol::start_bind(void)
}
}
}
/*
return protocol name
*/
const char *AP_RCProtocol::protocol_name(void) const
{
switch (_detected_protocol) {
case PPM:
return "PPM";
case SBUS:
case SBUS_NI:
return "SBUS";
case DSM:
return "DSM";
case SUMD:
return "SUMD";
case SRXL:
return "SRXL";
case ST24:
return "ST24";
case NONE:
break;
}
return nullptr;
}

View File

@ -64,6 +64,9 @@ public:
bool new_input();
void start_bind(void);
// return protocol name as a string
const char *protocol_name(void) const;
// access to singleton
static AP_RCProtocol *get_instance(void) {
return instance;