feat(color): allow changing the size of topbar widgets (#5235)

This commit is contained in:
philmoz
2024-07-27 16:06:48 +10:00
committed by GitHub
parent 3d8854abdf
commit faf0027818
40 changed files with 185 additions and 65 deletions
@@ -1179,6 +1179,9 @@ Node convert<ModelData>::encode(const ModelData& rhs)
if (topbarData && topbarData.IsMap()) {
node["topbarData"] = topbarData;
}
for (int i = 0; i < MAX_TOPBAR_ZONES; i += 1)
if (rhs.topbarWidgetWidth[i] > 0)
node["topbarWidgetWidth"][std::to_string(i)]["val"] = (int)rhs.topbarWidgetWidth[i];
node["view"] = rhs.view;
}
@@ -1447,8 +1450,15 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
node["screenData"] >> rhs.customScreens.customScreenData;
node["topbarData"] >> rhs.topBarData;
if (node["topbarWidgetWidth"]) {
for (int i = 0; i < MAX_TOPBAR_ZONES; i += 1) {
if (node["topbarWidgetWidth"][std::to_string(i)]) {
node["topbarWidgetWidth"][std::to_string(i)]["val"] >> rhs.topbarWidgetWidth[i];
}
}
}
node["view"] >> rhs.view;
node["modelRegistrationID"] >> rhs.registrationId;
node["hatsMode"] >> hatsModeLut >> rhs.hatsMode;
+1
View File
@@ -188,6 +188,7 @@ class ModelData {
RadioLayout::CustomScreens customScreens;
TopBarPersistentData topBarData;
uint8_t topbarWidgetWidth[MAX_TOPBAR_ZONES];
unsigned int view;
char registrationId[8+1];