fix(cpn): add default top bar widgets to new models for colour radios (#7254)
This commit is contained in:
@@ -336,6 +336,10 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
|
|||||||
return (IS_FAMILY_HORUS_OR_T16(board) || IS_TARANIS(board) ||
|
return (IS_FAMILY_HORUS_OR_T16(board) || IS_TARANIS(board) ||
|
||||||
IS_RADIOMASTER_TX15(board));
|
IS_RADIOMASTER_TX15(board));
|
||||||
|
|
||||||
|
case HasInternalGPS:
|
||||||
|
return ((IS_FAMILY_HORUS_OR_T16(board) && getCapability(board, HasAuxSerialMode)) ||
|
||||||
|
IS_RADIOMASTER_TX15(board) || IS_RADIOMASTER_TX16SMK3);
|
||||||
|
|
||||||
case HasSoftwareSerialPower:
|
case HasSoftwareSerialPower:
|
||||||
return IS_RADIOMASTER_TX16S(board);
|
return IS_RADIOMASTER_TX16S(board);
|
||||||
|
|
||||||
|
|||||||
@@ -226,13 +226,14 @@ namespace Board {
|
|||||||
HasAuxSerialMode,
|
HasAuxSerialMode,
|
||||||
HasAux2SerialMode,
|
HasAux2SerialMode,
|
||||||
HasBacklightColor,
|
HasBacklightColor,
|
||||||
|
HasBlingLEDS,
|
||||||
HasBluetooth,
|
HasBluetooth,
|
||||||
HasColorLcd,
|
HasColorLcd,
|
||||||
HasExternalModuleSupport,
|
HasExternalModuleSupport,
|
||||||
HasIMU,
|
HasIMU,
|
||||||
|
HasInternalGPS,
|
||||||
HasInternalModuleSupport,
|
HasInternalModuleSupport,
|
||||||
HasIntModuleHeartbeatGPIO,
|
HasIntModuleHeartbeatGPIO,
|
||||||
HasBlingLEDS,
|
|
||||||
HasRTC,
|
HasRTC,
|
||||||
HasSDCard,
|
HasSDCard,
|
||||||
HasSoftwareSerialPower,
|
HasSoftwareSerialPower,
|
||||||
|
|||||||
@@ -308,8 +308,14 @@ void ModelData::clear()
|
|||||||
sensorData[i].clear();
|
sensorData[i].clear();
|
||||||
|
|
||||||
toplcdTimer = 0;
|
toplcdTimer = 0;
|
||||||
RadioLayout::init("Layout2P1", customScreens);
|
|
||||||
topBarData.clear();
|
if (Boards::getCapability(getCurrentBoard(), Board::HasColorLcd)) {
|
||||||
|
RadioLayout::init("Layout2P1", customScreens);
|
||||||
|
initTopBar();
|
||||||
|
} else {
|
||||||
|
customScreens.clear();
|
||||||
|
topBarData.clear();
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MAX_TOPBAR_ZONES; i++)
|
for (int i = 0; i < MAX_TOPBAR_ZONES; i++)
|
||||||
topbarWidgetWidth[i] = 1;
|
topbarWidgetWidth[i] = 1;
|
||||||
@@ -2307,3 +2313,24 @@ void ModelData::updateSourceNumRef(int & value)
|
|||||||
updateSourceIntRef(value);
|
updateSourceIntRef(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModelData::initTopBar()
|
||||||
|
{
|
||||||
|
topBarData.clear();
|
||||||
|
int zones = RadioLayout::topBarZones();
|
||||||
|
|
||||||
|
if (zones - 1 >= 0) {
|
||||||
|
ZonePersistentData & zone = topBarData.zones[zones - 1];
|
||||||
|
zone.widgetName = "Date Time";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zones - 2 >= 0) {
|
||||||
|
ZonePersistentData & zone = topBarData.zones[zones - 2];
|
||||||
|
zone.widgetName = "Radio Info";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zones - 3 >= 0 && Boards::getCapability(getCurrentBoard(), Board::HasInternalGPS)) {
|
||||||
|
ZonePersistentData & zone = topBarData.zones[zones - 3];
|
||||||
|
zone.widgetName = "Internal GPS";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -435,4 +435,5 @@ class ModelData {
|
|||||||
}
|
}
|
||||||
void updateResetParam(CustomFunctionData * cfd);
|
void updateResetParam(CustomFunctionData * cfd);
|
||||||
void updateSourceNumRef(int & value);
|
void updateSourceNumRef(int & value);
|
||||||
|
void initTopBar();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user