Give priority to names sent by multi (#8069)
* Give priority to names sent by multi
This commit is contained in:
@@ -452,30 +452,31 @@ void lcdDrawBlackOverlay()
|
|||||||
#if defined(MULTIMODULE)
|
#if defined(MULTIMODULE)
|
||||||
void lcdDrawMultiProtocolString(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t protocol, LcdFlags flags)
|
void lcdDrawMultiProtocolString(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t protocol, LcdFlags flags)
|
||||||
{
|
{
|
||||||
if (protocol <= MODULE_SUBTYPE_MULTI_LAST) {
|
MultiModuleStatus & status = getMultiModuleStatus(moduleIdx);
|
||||||
|
if (status.protocolName[0] && status.isValid()) {
|
||||||
|
lcdDrawText(x, y, status.protocolName, flags);
|
||||||
|
}
|
||||||
|
else if (protocol <= MODULE_SUBTYPE_MULTI_LAST) {
|
||||||
lcdDrawTextAtIndex(x, y, STR_MULTI_PROTOCOLS, protocol, flags);
|
lcdDrawTextAtIndex(x, y, STR_MULTI_PROTOCOLS, protocol, flags);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MultiModuleStatus &status = getMultiModuleStatus(moduleIdx);
|
lcdDrawNumber(x, y, protocol + 3, flags); // Convert because of OpenTX FrSky fidling (OpenTX protocol tables and Multiprotocol tables don't match)
|
||||||
if (status.protocolName[0] && status.isValid())
|
|
||||||
lcdDrawText(x, y, status.protocolName, flags);
|
|
||||||
else
|
|
||||||
lcdDrawNumber(x, y, protocol + 3, flags); // Convert because of OpenTX FrSky fidling (OpenTX protocol tables and Multiprotocol tables don't match)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcdDrawMultiSubProtocolString(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t subType, LcdFlags flags)
|
void lcdDrawMultiSubProtocolString(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t subType, LcdFlags flags)
|
||||||
{
|
{
|
||||||
const mm_protocol_definition *pdef = getMultiProtocolDefinition(g_model.moduleData[moduleIdx].getMultiProtocol());
|
MultiModuleStatus & status = getMultiModuleStatus(moduleIdx);
|
||||||
if (subType <= pdef->maxSubtype && pdef->subTypeString != nullptr) {
|
const mm_protocol_definition * pdef = getMultiProtocolDefinition(g_model.moduleData[moduleIdx].getMultiProtocol());
|
||||||
|
|
||||||
|
if (status.protocolName[0] && status.isValid()) {
|
||||||
|
lcdDrawText(x, y, status.protocolSubName, flags);
|
||||||
|
}
|
||||||
|
else if (subType <= pdef->maxSubtype && pdef->subTypeString != nullptr) {
|
||||||
lcdDrawTextAtIndex(x, y, pdef->subTypeString, subType, flags);
|
lcdDrawTextAtIndex(x, y, pdef->subTypeString, subType, flags);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MultiModuleStatus &status = getMultiModuleStatus(moduleIdx);
|
lcdDrawNumber(x, y, subType, flags);
|
||||||
if (status.protocolName[0] && status.isValid())
|
|
||||||
lcdDrawText(x, y, status.protocolSubName, flags);
|
|
||||||
else
|
|
||||||
lcdDrawNumber(x, y, subType, flags);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,32 +24,31 @@
|
|||||||
#if defined(MULTIMODULE)
|
#if defined(MULTIMODULE)
|
||||||
void lcdDrawMultiProtocolString(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t protocol, LcdFlags flags)
|
void lcdDrawMultiProtocolString(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t protocol, LcdFlags flags)
|
||||||
{
|
{
|
||||||
if (protocol <= MODULE_SUBTYPE_MULTI_LAST) {
|
MultiModuleStatus & status = getMultiModuleStatus(moduleIdx);
|
||||||
|
if (status.protocolName[0] && status.isValid()) {
|
||||||
|
lcdDrawText(x, y, status.protocolName, flags);
|
||||||
|
}
|
||||||
|
else if (protocol <= MODULE_SUBTYPE_MULTI_LAST) {
|
||||||
lcdDrawTextAtIndex(x, y, STR_MULTI_PROTOCOLS, protocol, flags);
|
lcdDrawTextAtIndex(x, y, STR_MULTI_PROTOCOLS, protocol, flags);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MultiModuleStatus &status = getMultiModuleStatus(moduleIdx);
|
lcdDrawNumber(x, y, protocol + 3, flags); // Convert because of OpenTX FrSky fidling (OpenTX protocol tables and Multiprotocol tables don't match)
|
||||||
if (status.protocolName[0] && status.isValid())
|
|
||||||
lcdDrawText(x, y, status.protocolName, flags);
|
|
||||||
else
|
|
||||||
lcdDrawNumber(x, y, protocol + 3, flags); // Convert because of OpenTX FrSky fidling (OpenTX protocol tables and Multiprotocol tables don't match)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcdDrawMultiSubProtocolString(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t subType, LcdFlags flags)
|
void lcdDrawMultiSubProtocolString(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t subType, LcdFlags flags)
|
||||||
{
|
{
|
||||||
const mm_protocol_definition *pdef = getMultiProtocolDefinition(g_model.moduleData[moduleIdx].getMultiProtocol());
|
MultiModuleStatus & status = getMultiModuleStatus(moduleIdx);
|
||||||
if (subType <= pdef->maxSubtype && pdef->subTypeString != nullptr) {
|
const mm_protocol_definition * pdef = getMultiProtocolDefinition(g_model.moduleData[moduleIdx].getMultiProtocol());
|
||||||
|
|
||||||
|
if (status.protocolName[0] && status.isValid()) {
|
||||||
|
lcdDrawText(x, y, status.protocolSubName, flags);
|
||||||
|
}
|
||||||
|
else if (subType <= pdef->maxSubtype && pdef->subTypeString != nullptr) {
|
||||||
lcdDrawTextAtIndex(x, y, pdef->subTypeString, subType, flags);
|
lcdDrawTextAtIndex(x, y, pdef->subTypeString, subType, flags);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MultiModuleStatus &status = getMultiModuleStatus(moduleIdx);
|
lcdDrawNumber(x, y, subType, flags);
|
||||||
if (status.protocolName[0] && status.isValid())
|
|
||||||
lcdDrawText(x, y, status.protocolSubName, flags);
|
|
||||||
else
|
|
||||||
lcdDrawNumber(x, y, subType, flags);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user