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) ||
|
||||
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:
|
||||
return IS_RADIOMASTER_TX16S(board);
|
||||
|
||||
|
||||
@@ -226,13 +226,14 @@ namespace Board {
|
||||
HasAuxSerialMode,
|
||||
HasAux2SerialMode,
|
||||
HasBacklightColor,
|
||||
HasBlingLEDS,
|
||||
HasBluetooth,
|
||||
HasColorLcd,
|
||||
HasExternalModuleSupport,
|
||||
HasIMU,
|
||||
HasInternalGPS,
|
||||
HasInternalModuleSupport,
|
||||
HasIntModuleHeartbeatGPIO,
|
||||
HasBlingLEDS,
|
||||
HasRTC,
|
||||
HasSDCard,
|
||||
HasSoftwareSerialPower,
|
||||
|
||||
@@ -308,8 +308,14 @@ void ModelData::clear()
|
||||
sensorData[i].clear();
|
||||
|
||||
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++)
|
||||
topbarWidgetWidth[i] = 1;
|
||||
@@ -2307,3 +2313,24 @@ void ModelData::updateSourceNumRef(int & 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 updateSourceNumRef(int & value);
|
||||
void initTopBar();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user