fix(cpn): add default top bar widgets to new models for colour radios (#7254)

This commit is contained in:
Neil Horne
2026-04-21 13:10:37 +10:00
committed by GitHub
parent 122afc4aa5
commit 6e30c244b6
4 changed files with 36 additions and 3 deletions
+29 -2
View File
@@ -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";
}
}