feat(color): Convert top bar display in main view into widgets (#3700)

* Convert radio info (USB, volume, signal strength), date/time and internal GPS display from top bar into widgets.

* Fix B&W build.
This commit is contained in:
philmoz
2023-08-04 12:14:31 +10:00
committed by GitHub
parent 69338ab0ab
commit 4272a03025
14 changed files with 347 additions and 240 deletions
+22
View File
@@ -139,6 +139,28 @@ static void sortMixerLines()
void postModelLoad(bool alarms)
{
#if defined(COLORLCD)
// Load 'date time' widget if slot is empty
if (g_model.topbarData.zones[MAX_TOPBAR_ZONES-1].widgetName[0] == 0) {
strcpy(g_model.topbarData.zones[MAX_TOPBAR_ZONES-1].widgetName, "Date Time");
g_model.topbarData.zones[MAX_TOPBAR_ZONES-1].widgetData.options[0].type = ZOV_Color;
g_model.topbarData.zones[MAX_TOPBAR_ZONES-1].widgetData.options[0].value.unsignedValue = 0xFFFFFF;
storageDirty(EE_MODEL);
}
// Load 'radio info' widget if slot is empty
if (g_model.topbarData.zones[MAX_TOPBAR_ZONES-2].widgetName[0] == 0) {
strcpy(g_model.topbarData.zones[MAX_TOPBAR_ZONES-2].widgetName, "Radio Info");
storageDirty(EE_MODEL);
}
#if defined(INTERNAL_GPS)
// Load 'internal gps' widget if slot is empty
if (g_model.topbarData.zones[MAX_TOPBAR_ZONES-3].widgetName[0] == 0) {
strcpy(g_model.topbarData.zones[MAX_TOPBAR_ZONES-3].widgetName, "Internal GPS");
storageDirty(EE_MODEL);
}
#endif
#endif
// Convert 'noGlobalFunctions' to 'radioGFDisabled'
// TODO: Remove sometime in the future (and remove 'noGlobalFunctions' property)
if (g_model.noGlobalFunctions) {
@@ -287,7 +287,7 @@ static const struct YamlNode struct_ZoneOptionValueTyped[] = {
YAML_UNION("value", 64, union_ZoneOptionValue_elmts, select_zov),
YAML_END
};
static const struct YamlNode struct_OpenTxTheme__PersistentData[] = {
static const struct YamlNode struct_EdgeTxTheme__PersistentData[] = {
YAML_ARRAY("options", 96, 5, struct_ZoneOptionValueTyped, NULL),
YAML_END
};
@@ -373,7 +373,7 @@ static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "blOffBright", 7 ),
YAML_STRING("bluetoothName", 10),
YAML_STRING("themeName", 8),
YAML_STRUCT("themeData", 480, struct_OpenTxTheme__PersistentData, NULL),
YAML_STRUCT("themeData", 480, struct_EdgeTxTheme__PersistentData, NULL),
YAML_STRING("ownerRegistrationID", 8),
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
YAML_UNSIGNED( "rotEncMode", 2 ),
@@ -785,7 +785,7 @@ static const struct YamlNode struct_CustomScreenData[] = {
YAML_END
};
static const struct YamlNode struct_TopBarPersistentData[] = {
YAML_ARRAY("zones", 576, 2, struct_ZonePersistentData, NULL),
YAML_ARRAY("zones", 576, 4, struct_ZonePersistentData, NULL),
YAML_ARRAY("options", 96, 1, struct_ZoneOptionValueTyped, NULL),
YAML_END
};
@@ -849,7 +849,7 @@ static const struct YamlNode struct_ModelData[] = {
YAML_ARRAY("potsWarnPosition", 8, 16, struct_signed_8, NULL),
YAML_ARRAY("telemetrySensors", 112, 60, struct_TelemetrySensor, NULL),
YAML_ARRAY("screenData", 6816, 10, struct_CustomScreenData, NULL),
YAML_STRUCT("topbarData", 1248, struct_TopBarPersistentData, NULL),
YAML_STRUCT("topbarData", 2400, struct_TopBarPersistentData, NULL),
YAML_UNSIGNED( "view", 8 ),
YAML_STRING("modelRegistrationID", 8),
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
@@ -295,7 +295,7 @@ static const struct YamlNode struct_ZoneOptionValueTyped[] = {
YAML_UNION("value", 64, union_ZoneOptionValue_elmts, select_zov),
YAML_END
};
static const struct YamlNode struct_OpenTxTheme__PersistentData[] = {
static const struct YamlNode struct_EdgeTxTheme__PersistentData[] = {
YAML_ARRAY("options", 96, 5, struct_ZoneOptionValueTyped, NULL),
YAML_END
};
@@ -379,7 +379,7 @@ static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "blOffBright", 7 ),
YAML_STRING("bluetoothName", 10),
YAML_STRING("themeName", 8),
YAML_STRUCT("themeData", 480, struct_OpenTxTheme__PersistentData, NULL),
YAML_STRUCT("themeData", 480, struct_EdgeTxTheme__PersistentData, NULL),
YAML_STRING("ownerRegistrationID", 8),
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
YAML_UNSIGNED( "rotEncMode", 2 ),
@@ -793,7 +793,7 @@ static const struct YamlNode struct_CustomScreenData[] = {
YAML_END
};
static const struct YamlNode struct_TopBarPersistentData[] = {
YAML_ARRAY("zones", 576, 4, struct_ZonePersistentData, NULL),
YAML_ARRAY("zones", 576, 6, struct_ZonePersistentData, NULL),
YAML_ARRAY("options", 96, 1, struct_ZoneOptionValueTyped, NULL),
YAML_END
};
@@ -857,7 +857,7 @@ static const struct YamlNode struct_ModelData[] = {
YAML_ARRAY("potsWarnPosition", 8, 16, struct_signed_8, NULL),
YAML_ARRAY("telemetrySensors", 112, 60, struct_TelemetrySensor, NULL),
YAML_ARRAY("screenData", 6816, 10, struct_CustomScreenData, NULL),
YAML_STRUCT("topbarData", 2400, struct_TopBarPersistentData, NULL),
YAML_STRUCT("topbarData", 3552, struct_TopBarPersistentData, NULL),
YAML_UNSIGNED( "view", 8 ),
YAML_STRING("modelRegistrationID", 8),
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
@@ -295,7 +295,7 @@ static const struct YamlNode struct_ZoneOptionValueTyped[] = {
YAML_UNION("value", 64, union_ZoneOptionValue_elmts, select_zov),
YAML_END
};
static const struct YamlNode struct_OpenTxTheme__PersistentData[] = {
static const struct YamlNode struct_EdgeTxTheme__PersistentData[] = {
YAML_ARRAY("options", 96, 5, struct_ZoneOptionValueTyped, NULL),
YAML_END
};
@@ -379,7 +379,7 @@ static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "blOffBright", 7 ),
YAML_STRING("bluetoothName", 10),
YAML_STRING("themeName", 8),
YAML_STRUCT("themeData", 480, struct_OpenTxTheme__PersistentData, NULL),
YAML_STRUCT("themeData", 480, struct_EdgeTxTheme__PersistentData, NULL),
YAML_STRING("ownerRegistrationID", 8),
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
YAML_UNSIGNED( "rotEncMode", 2 ),
@@ -793,7 +793,7 @@ static const struct YamlNode struct_CustomScreenData[] = {
YAML_END
};
static const struct YamlNode struct_TopBarPersistentData[] = {
YAML_ARRAY("zones", 576, 4, struct_ZonePersistentData, NULL),
YAML_ARRAY("zones", 576, 6, struct_ZonePersistentData, NULL),
YAML_ARRAY("options", 96, 1, struct_ZoneOptionValueTyped, NULL),
YAML_END
};
@@ -857,7 +857,7 @@ static const struct YamlNode struct_ModelData[] = {
YAML_ARRAY("potsWarnPosition", 8, 16, struct_signed_8, NULL),
YAML_ARRAY("telemetrySensors", 112, 60, struct_TelemetrySensor, NULL),
YAML_ARRAY("screenData", 6816, 10, struct_CustomScreenData, NULL),
YAML_STRUCT("topbarData", 2400, struct_TopBarPersistentData, NULL),
YAML_STRUCT("topbarData", 3552, struct_TopBarPersistentData, NULL),
YAML_UNSIGNED( "view", 8 ),
YAML_STRING("modelRegistrationID", 8),
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),