feat(color): use dynamic memory allocation for screen & widget data (#6782)
This commit is contained in:
@@ -34,6 +34,10 @@
|
||||
#include "debug.h"
|
||||
#include "bitfield.h"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#include "datastructs_screen.h"
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define N_TARANIS_FIELD(x)
|
||||
#define TARANIS_FIELD(x) x;
|
||||
@@ -614,28 +618,6 @@ static_assert(sizeof(potconfig_t) * 8 >= ((MAX_POTS - 1) / 4) + 1,
|
||||
static_assert(sizeof(potwarnen_t) * 8 >= MAX_POTS,
|
||||
"MAX_POTS must fit potwarnen_t");
|
||||
|
||||
#if defined(COLORLCD) && defined(BACKUP)
|
||||
#define CUSTOM_SCREENS_DATA
|
||||
#elif defined(COLORLCD)
|
||||
#include "layout.h"
|
||||
#include "topbar.h"
|
||||
#define LAYOUT_ID_LEN 12
|
||||
PACK(struct CustomScreenData {
|
||||
char LayoutId[LAYOUT_ID_LEN];
|
||||
LayoutPersistentData layoutData;
|
||||
});
|
||||
#define CUSTOM_SCREENS_DATA \
|
||||
NOBACKUP(CustomScreenData screenData[MAX_CUSTOM_SCREENS]); \
|
||||
NOBACKUP(TopBarPersistentData topbarData); \
|
||||
NOBACKUP(uint8_t topbarWidgetWidth[MAX_TOPBAR_ZONES]); \
|
||||
NOBACKUP(uint8_t view);
|
||||
#else
|
||||
#define CUSTOM_SCREENS_DATA \
|
||||
uint8_t screensType SKIP; /* 2bits per screen (None/Gauges/Numbers/Script) */ \
|
||||
TelemetryScreenData screens[MAX_TELEMETRY_SCREENS]; \
|
||||
uint8_t view;
|
||||
#endif
|
||||
|
||||
#if defined(PCBX9D) || defined(PCBX9DP) || defined(PCBX9E)
|
||||
// telemetry sensor idx + 1
|
||||
#define TOPBAR_DATA \
|
||||
@@ -669,6 +651,11 @@ struct RGBLedColor {
|
||||
};
|
||||
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
enum booleanEnum {
|
||||
BOOL_OFF,
|
||||
BOOL_ON
|
||||
};
|
||||
|
||||
PACK(struct customSwitch {
|
||||
CUST_IDX(sw, cfs_idx_read, cfs_idx_write);
|
||||
NOBACKUP(char name[LEN_SWITCH_NAME]);
|
||||
@@ -835,7 +822,27 @@ PACK(struct ModelData {
|
||||
|
||||
TARANIS_PCBX9E_FIELD(uint8_t toplcdTimer)
|
||||
|
||||
CUSTOM_SCREENS_DATA
|
||||
#if defined(COLORLCD)
|
||||
#if defined(YAML_GENERATOR)
|
||||
NOBACKUP(CustomScreenData screenData[MAX_CUSTOM_SCREENS]) FUNC(screen_is_active);
|
||||
NOBACKUP(TopBarPersistentData topbarData) FUNC(isAlwaysActive);
|
||||
#endif
|
||||
NOBACKUP(uint8_t topbarWidgetWidth[MAX_TOPBAR_ZONES]);
|
||||
NOBACKUP(uint8_t view);
|
||||
|
||||
void initScreenData();
|
||||
const char* getScreenLayoutId(int screenNum);
|
||||
void setScreenLayoutId(int screenNum, const char* s);
|
||||
TopBarPersistentData* getTopbarData();
|
||||
CustomScreenData* getScreenData(int screenNum);
|
||||
LayoutPersistentData* getScreenLayoutData(int screenNum);
|
||||
WidgetPersistentData* getWidgetData(int screenNum, int zoneNum);
|
||||
void removeScreenLayout(int idx);
|
||||
#else
|
||||
uint8_t screensType SKIP; /* 2bits per screen (None/Gauges/Numbers/Script) */
|
||||
TelemetryScreenData screens[MAX_TELEMETRY_SCREENS];
|
||||
uint8_t view;
|
||||
#endif
|
||||
|
||||
char modelRegistrationID[PXX2_LEN_REGISTRATION_ID];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user