unify common layout settings
This commit is contained in:
@@ -97,14 +97,14 @@ void loadCustomScreens()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Layout::decorate(bool topbar, bool sliders, bool trims, bool flightMode)
|
void Layout::decorate()
|
||||||
{
|
{
|
||||||
// check if deco setting are still up-to-date
|
// check if deco setting are still up-to-date
|
||||||
uint8_t checkSettings =
|
uint8_t checkSettings =
|
||||||
(topbar ? 1 << 0 : 0) |
|
(hasTopbar() ? 1 << 0 : 0) |
|
||||||
(sliders ? 1 << 1 : 0) |
|
(hasSliders() ? 1 << 1 : 0) |
|
||||||
(trims ? 1 << 2 : 0) |
|
(hasTrims() ? 1 << 2 : 0) |
|
||||||
(flightMode ? 1 << 3 : 0);
|
(hasFlightMode() ? 1 << 3 : 0);
|
||||||
|
|
||||||
if (checkSettings == decorationSettings) {
|
if (checkSettings == decorationSettings) {
|
||||||
// everything ok, exit!
|
// everything ok, exit!
|
||||||
@@ -124,15 +124,15 @@ void Layout::decorate(bool topbar, bool sliders, bool trims, bool flightMode)
|
|||||||
// save settings
|
// save settings
|
||||||
decorationSettings = checkSettings;
|
decorationSettings = checkSettings;
|
||||||
|
|
||||||
if (topbar) {
|
if (hasTopbar()) {
|
||||||
topBar = new TopBar(this);
|
topBar = new TopBar(this);
|
||||||
topBar->load();
|
topBar->load();
|
||||||
decorations.push_back(topBar);
|
decorations.push_back(topBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sliders) {
|
if (hasSliders()) {
|
||||||
#if defined(HARDWARE_EXT1) || defined(HARDWARE_EXT2)
|
#if defined(HARDWARE_EXT1) || defined(HARDWARE_EXT2)
|
||||||
coord_t yOffset = (trims ? - TRIM_SQUARE_SIZE : 0) + (topbar ? TOPBAR_HEIGHT / 2 : 0);
|
coord_t yOffset = (hasTrims() ? - TRIM_SQUARE_SIZE : 0) + (hasTopbar() ? TOPBAR_HEIGHT / 2 : 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
decorations.push_back(
|
decorations.push_back(
|
||||||
@@ -163,17 +163,17 @@ void Layout::decorate(bool topbar, bool sliders, bool trims, bool flightMode)
|
|||||||
#if defined(HARDWARE_EXT1)
|
#if defined(HARDWARE_EXT1)
|
||||||
if (IS_POT_SLIDER_AVAILABLE(EXT1)) {
|
if (IS_POT_SLIDER_AVAILABLE(EXT1)) {
|
||||||
decorations.push_back(
|
decorations.push_back(
|
||||||
new MainViewVerticalSlider(this, {HMARGIN, LCD_H / 2 - VERTICAL_SLIDERS_HEIGHT(topbar) / 2 + yOffset, TRIM_SQUARE_SIZE, VERTICAL_SLIDERS_HEIGHT(topbar) / 2},
|
new MainViewVerticalSlider(this, {HMARGIN, LCD_H / 2 - VERTICAL_SLIDERS_HEIGHT(hasTopbar()) / 2 + yOffset, TRIM_SQUARE_SIZE, VERTICAL_SLIDERS_HEIGHT(hasTopbar()) / 2},
|
||||||
[=] { return calibratedAnalogs[CALIBRATED_SLIDER_REAR_LEFT]; })
|
[=] { return calibratedAnalogs[CALIBRATED_SLIDER_REAR_LEFT]; })
|
||||||
);
|
);
|
||||||
decorations.push_back(
|
decorations.push_back(
|
||||||
new MainViewVerticalSlider(this, {HMARGIN, LCD_H / 2 + yOffset, TRIM_SQUARE_SIZE, VERTICAL_SLIDERS_HEIGHT(topbar) / 2},
|
new MainViewVerticalSlider(this, {HMARGIN, LCD_H / 2 + yOffset, TRIM_SQUARE_SIZE, VERTICAL_SLIDERS_HEIGHT(hasTopbar()) / 2},
|
||||||
[=] { return calibratedAnalogs[CALIBRATED_POT_EXT1]; })
|
[=] { return calibratedAnalogs[CALIBRATED_POT_EXT1]; })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
decorations.push_back(
|
decorations.push_back(
|
||||||
new MainViewVerticalSlider(this, {HMARGIN, LCD_H / 2 - VERTICAL_SLIDERS_HEIGHT(topbar) / 2 + yOffset, TRIM_SQUARE_SIZE, VERTICAL_SLIDERS_HEIGHT(topbar)},
|
new MainViewVerticalSlider(this, {HMARGIN, LCD_H / 2 - VERTICAL_SLIDERS_HEIGHT(hasTopbar()) / 2 + yOffset, TRIM_SQUARE_SIZE, VERTICAL_SLIDERS_HEIGHT(hasTopbar())},
|
||||||
[=] { return calibratedAnalogs[CALIBRATED_SLIDER_REAR_LEFT]; })
|
[=] { return calibratedAnalogs[CALIBRATED_SLIDER_REAR_LEFT]; })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -182,33 +182,33 @@ void Layout::decorate(bool topbar, bool sliders, bool trims, bool flightMode)
|
|||||||
#if defined(HARDWARE_EXT2)
|
#if defined(HARDWARE_EXT2)
|
||||||
if (IS_POT_SLIDER_AVAILABLE(EXT2)) {
|
if (IS_POT_SLIDER_AVAILABLE(EXT2)) {
|
||||||
decorations.push_back(
|
decorations.push_back(
|
||||||
new MainViewVerticalSlider(this, {LCD_W - HMARGIN - TRIM_SQUARE_SIZE, LCD_H / 2 - VERTICAL_SLIDERS_HEIGHT(topbar) / 2 + yOffset, TRIM_SQUARE_SIZE,
|
new MainViewVerticalSlider(this, {LCD_W - HMARGIN - TRIM_SQUARE_SIZE, LCD_H / 2 - VERTICAL_SLIDERS_HEIGHT(hasTopbar()) / 2 + yOffset, TRIM_SQUARE_SIZE,
|
||||||
VERTICAL_SLIDERS_HEIGHT(topbar) / 2},
|
VERTICAL_SLIDERS_HEIGHT(hasTopbar()) / 2},
|
||||||
[=] { return calibratedAnalogs[CALIBRATED_SLIDER_REAR_RIGHT]; })
|
[=] { return calibratedAnalogs[CALIBRATED_SLIDER_REAR_RIGHT]; })
|
||||||
);
|
);
|
||||||
decorations.push_back(
|
decorations.push_back(
|
||||||
new MainViewVerticalSlider(this, {LCD_W - HMARGIN - TRIM_SQUARE_SIZE, LCD_H / 2 + yOffset, TRIM_SQUARE_SIZE,
|
new MainViewVerticalSlider(this, {LCD_W - HMARGIN - TRIM_SQUARE_SIZE, LCD_H / 2 + yOffset, TRIM_SQUARE_SIZE,
|
||||||
VERTICAL_SLIDERS_HEIGHT(topbar) / 2},
|
VERTICAL_SLIDERS_HEIGHT(hasTopbar()) / 2},
|
||||||
[=] { return calibratedAnalogs[CALIBRATED_POT_EXT2]; })
|
[=] { return calibratedAnalogs[CALIBRATED_POT_EXT2]; })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
decorations.push_back(
|
decorations.push_back(
|
||||||
new MainViewVerticalSlider(this, {LCD_W - HMARGIN - TRIM_SQUARE_SIZE, LCD_H / 2 - VERTICAL_SLIDERS_HEIGHT(topbar) / 2 + yOffset, TRIM_SQUARE_SIZE,
|
new MainViewVerticalSlider(this, {LCD_W - HMARGIN - TRIM_SQUARE_SIZE, LCD_H / 2 - VERTICAL_SLIDERS_HEIGHT(hasTopbar()) / 2 + yOffset, TRIM_SQUARE_SIZE,
|
||||||
VERTICAL_SLIDERS_HEIGHT(topbar)},
|
VERTICAL_SLIDERS_HEIGHT(hasTopbar())},
|
||||||
[=] { return calibratedAnalogs[CALIBRATED_SLIDER_REAR_RIGHT]; })
|
[=] { return calibratedAnalogs[CALIBRATED_SLIDER_REAR_RIGHT]; })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trims) {
|
if (hasTrims()) {
|
||||||
#if defined(HARDWARE_POT3) || defined(HARDWARE_EXT1)
|
#if defined(HARDWARE_POT3) || defined(HARDWARE_EXT1)
|
||||||
coord_t xOffset = sliders? TRIM_SQUARE_SIZE : 0;
|
coord_t xOffset = hasSliders() ? TRIM_SQUARE_SIZE : 0;
|
||||||
#else
|
#else
|
||||||
coord_t xOffset = 0;
|
coord_t xOffset = 0;
|
||||||
#endif
|
#endif
|
||||||
coord_t yOffset = (trims ? - TRIM_SQUARE_SIZE : 0);
|
coord_t yOffset = (hasTrims() ? - TRIM_SQUARE_SIZE : 0);
|
||||||
|
|
||||||
// Trim order TRIM_LH, TRIM_LV, TRIM_RV, TRIM_RH
|
// Trim order TRIM_LH, TRIM_LV, TRIM_RV, TRIM_RH
|
||||||
|
|
||||||
@@ -226,20 +226,20 @@ void Layout::decorate(bool topbar, bool sliders, bool trims, bool flightMode)
|
|||||||
|
|
||||||
// Left
|
// Left
|
||||||
decorations.push_back(
|
decorations.push_back(
|
||||||
new MainViewVerticalTrim(this, {HMARGIN + xOffset, LCD_H /2 - VERTICAL_SLIDERS_HEIGHT(topbar) / 2 + yOffset + (topbar ? TOPBAR_HEIGHT / 2 : 0), TRIM_SQUARE_SIZE, VERTICAL_SLIDERS_HEIGHT(topbar)},
|
new MainViewVerticalTrim(this, {HMARGIN + xOffset, LCD_H /2 - VERTICAL_SLIDERS_HEIGHT(hasTopbar()) / 2 + yOffset + (hasTopbar() ? TOPBAR_HEIGHT / 2 : 0), TRIM_SQUARE_SIZE, VERTICAL_SLIDERS_HEIGHT(hasTopbar())},
|
||||||
[=] { return getTrimValue(mixerCurrentFlightMode, 1); })
|
[=] { return getTrimValue(mixerCurrentFlightMode, 1); })
|
||||||
);
|
);
|
||||||
|
|
||||||
// Right
|
// Right
|
||||||
decorations.push_back(
|
decorations.push_back(
|
||||||
new MainViewVerticalTrim(this, {LCD_W - HMARGIN - TRIM_SQUARE_SIZE - xOffset, LCD_H /2 - VERTICAL_SLIDERS_HEIGHT(topbar) / 2 + yOffset + (topbar ? TOPBAR_HEIGHT / 2 : 0), TRIM_SQUARE_SIZE, VERTICAL_SLIDERS_HEIGHT(topbar)},
|
new MainViewVerticalTrim(this, {LCD_W - HMARGIN - TRIM_SQUARE_SIZE - xOffset, LCD_H /2 - VERTICAL_SLIDERS_HEIGHT(hasTopbar()) / 2 + yOffset + (hasTopbar() ? TOPBAR_HEIGHT / 2 : 0), TRIM_SQUARE_SIZE, VERTICAL_SLIDERS_HEIGHT(hasTopbar())},
|
||||||
[=] { return getTrimValue(mixerCurrentFlightMode, 2); })
|
[=] { return getTrimValue(mixerCurrentFlightMode, 2); })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flightMode) {
|
if (hasFlightMode()) {
|
||||||
decorations.push_back(
|
decorations.push_back(
|
||||||
new DynamicText(this, {50, LCD_H - 4 - (sliders? 2 * TRIM_SQUARE_SIZE: TRIM_SQUARE_SIZE), LCD_W - 100, 20}, [=] {
|
new DynamicText(this, {50, LCD_H - 4 - (hasSliders() ? 2 * TRIM_SQUARE_SIZE: TRIM_SQUARE_SIZE), LCD_W - 100, 20}, [=] {
|
||||||
return g_model.flightModeData[mixerCurrentFlightMode].name;
|
return g_model.flightModeData[mixerCurrentFlightMode].name;
|
||||||
}, CENTERED)
|
}, CENTERED)
|
||||||
);
|
);
|
||||||
@@ -248,21 +248,16 @@ void Layout::decorate(bool topbar, bool sliders, bool trims, bool flightMode)
|
|||||||
|
|
||||||
rect_t Layout::getMainZone(rect_t zone) const
|
rect_t Layout::getMainZone(rect_t zone) const
|
||||||
{
|
{
|
||||||
bool hasTopbar = getOptionValue(OPTION_TOPBAR)->boolValue;
|
if (hasTopbar()) {
|
||||||
bool hasFM = getOptionValue(OPTION_FM)->boolValue;
|
|
||||||
bool hasSliders = getOptionValue(OPTION_SLIDERS)->boolValue;
|
|
||||||
bool hasTrims = getOptionValue(OPTION_TRIMS)->boolValue;
|
|
||||||
|
|
||||||
if (hasTopbar) {
|
|
||||||
zone.y += MENU_HEADER_HEIGHT;
|
zone.y += MENU_HEADER_HEIGHT;
|
||||||
zone.h -= MENU_HEADER_HEIGHT;
|
zone.h -= MENU_HEADER_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasFM || hasTrims) {
|
if (hasFlightMode() || hasTrims()) {
|
||||||
zone.h -= TRIM_SQUARE_SIZE;
|
zone.h -= TRIM_SQUARE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasSliders) {
|
if (hasSliders()) {
|
||||||
#if NUM_SLIDERS + NUM_POTS > 2
|
#if NUM_SLIDERS + NUM_POTS > 2
|
||||||
zone.h -= TRIM_SQUARE_SIZE;
|
zone.h -= TRIM_SQUARE_SIZE;
|
||||||
#endif
|
#endif
|
||||||
@@ -270,7 +265,7 @@ rect_t Layout::getMainZone(rect_t zone) const
|
|||||||
zone.x += TRIM_SQUARE_SIZE;
|
zone.x += TRIM_SQUARE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasTrims) {
|
if (hasTrims()) {
|
||||||
zone.w -= 2 * TRIM_SQUARE_SIZE;
|
zone.w -= 2 * TRIM_SQUARE_SIZE;
|
||||||
zone.x += TRIM_SQUARE_SIZE;
|
zone.x += TRIM_SQUARE_SIZE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,19 @@ constexpr coord_t TRIM_SQUARE_SIZE = 17;
|
|||||||
|
|
||||||
class LayoutFactory;
|
class LayoutFactory;
|
||||||
|
|
||||||
class Layout: public WidgetsContainer<MAX_LAYOUT_ZONES, MAX_LAYOUT_OPTIONS>
|
#define LAYOUT_COMMON_OPTIONS \
|
||||||
|
{ STR_TOP_BAR, ZoneOption::Bool }, \
|
||||||
|
{ STR_FLIGHT_MODE, ZoneOption::Bool }, \
|
||||||
|
{ STR_SLIDERS, ZoneOption::Bool }, \
|
||||||
|
{ STR_TRIMS, ZoneOption::Bool }, \
|
||||||
|
{ STR_MIRROR, ZoneOption::Bool }
|
||||||
|
|
||||||
|
#define LAYOUT_OPTIONS_END \
|
||||||
|
{ nullptr, ZoneOption::Bool }
|
||||||
|
|
||||||
|
typedef WidgetsContainer<MAX_LAYOUT_ZONES, MAX_LAYOUT_OPTIONS> LayoutBase;
|
||||||
|
|
||||||
|
class Layout: public LayoutBase
|
||||||
{
|
{
|
||||||
friend class LayoutFactory;
|
friend class LayoutFactory;
|
||||||
|
|
||||||
@@ -48,9 +60,10 @@ class Layout: public WidgetsContainer<MAX_LAYOUT_ZONES, MAX_LAYOUT_OPTIONS>
|
|||||||
};
|
};
|
||||||
|
|
||||||
Layout(const LayoutFactory * factory, PersistentData * persistentData):
|
Layout(const LayoutFactory * factory, PersistentData * persistentData):
|
||||||
WidgetsContainer<MAX_LAYOUT_ZONES, MAX_LAYOUT_OPTIONS>({0, 0, LCD_W, LCD_H}, persistentData),
|
LayoutBase({0, 0, LCD_W, LCD_H}, persistentData),
|
||||||
factory(factory)
|
factory(factory)
|
||||||
{
|
{
|
||||||
|
decorate();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const LayoutFactory * getFactory() const
|
inline const LayoutFactory * getFactory() const
|
||||||
@@ -58,7 +71,31 @@ class Layout: public WidgetsContainer<MAX_LAYOUT_ZONES, MAX_LAYOUT_OPTIONS>
|
|||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
void decorate(bool topbar, bool sliders, bool trims, bool flightMode);
|
void checkEvents() override
|
||||||
|
{
|
||||||
|
LayoutBase::checkEvents();
|
||||||
|
decorate();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasTopbar() const {
|
||||||
|
return getOptionValue(OPTION_TOPBAR)->boolValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasFlightMode() const {
|
||||||
|
return getOptionValue(OPTION_FM)->boolValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasSliders() const {
|
||||||
|
return getOptionValue(OPTION_SLIDERS)->boolValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasTrims() const {
|
||||||
|
return getOptionValue(OPTION_TRIMS)->boolValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isMirrored() const {
|
||||||
|
return getOptionValue(OPTION_MIRRORED)->boolValue;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const LayoutFactory * factory;
|
const LayoutFactory * factory;
|
||||||
@@ -66,6 +103,9 @@ class Layout: public WidgetsContainer<MAX_LAYOUT_ZONES, MAX_LAYOUT_OPTIONS>
|
|||||||
uint8_t decorationSettings = 0;
|
uint8_t decorationSettings = 0;
|
||||||
std::list<Window*> decorations;
|
std::list<Window*> decorations;
|
||||||
|
|
||||||
|
// adds trims, sliders, pots, etc...
|
||||||
|
void decorate();
|
||||||
|
|
||||||
// get the Zone rect without decoration
|
// get the Zone rect without decoration
|
||||||
rect_t getMainZone(rect_t zone) const;
|
rect_t getMainZone(rect_t zone) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -34,12 +34,8 @@ const uint8_t LBM_LAYOUT_1x1[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ZoneOption OPTIONS_LAYOUT_1x1[] = {
|
const ZoneOption OPTIONS_LAYOUT_1x1[] = {
|
||||||
{ STR_TOP_BAR, ZoneOption::Bool },
|
LAYOUT_COMMON_OPTIONS,
|
||||||
{ STR_FLIGHT_MODE, ZoneOption::Bool },
|
LAYOUT_OPTIONS_END
|
||||||
{ STR_SLIDERS, ZoneOption::Bool },
|
|
||||||
{ STR_TRIMS, ZoneOption::Bool },
|
|
||||||
{ STR_MIRROR, ZoneOption::Bool },
|
|
||||||
{ nullptr, ZoneOption::Bool }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Layout1x1: public Layout
|
class Layout1x1: public Layout
|
||||||
@@ -48,27 +44,23 @@ class Layout1x1: public Layout
|
|||||||
Layout1x1(const LayoutFactory * factory, Layout::PersistentData * persistentData):
|
Layout1x1(const LayoutFactory * factory, Layout::PersistentData * persistentData):
|
||||||
Layout(factory, persistentData)
|
Layout(factory, persistentData)
|
||||||
{
|
{
|
||||||
decorate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void create() override
|
void create() override
|
||||||
{
|
{
|
||||||
Layout::create();
|
Layout::create();
|
||||||
|
// TODO: make this common to all layouts as well
|
||||||
persistentData->options[0].value.boolValue = true;
|
persistentData->options[0].value.boolValue = true;
|
||||||
persistentData->options[1].value.boolValue = true;
|
persistentData->options[1].value.boolValue = true;
|
||||||
persistentData->options[2].value.boolValue = true;
|
persistentData->options[2].value.boolValue = true;
|
||||||
persistentData->options[3].value.boolValue = true;
|
persistentData->options[3].value.boolValue = true;
|
||||||
persistentData->options[4].value.boolValue = false;
|
persistentData->options[4].value.boolValue = false;
|
||||||
persistentData->options[5].value.boolValue = false;
|
persistentData->options[5].value.boolValue = false;
|
||||||
|
|
||||||
|
// TODO: really needed?
|
||||||
decorate();
|
decorate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void decorate()
|
|
||||||
{
|
|
||||||
Layout::decorate(HAS_TOPBAR(), HAS_SLIDERS(), HAS_TRIMS(), HAS_FM());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
unsigned int getZonesCount() const override
|
unsigned int getZonesCount() const override
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
@@ -80,14 +72,6 @@ class Layout1x1: public Layout
|
|||||||
|
|
||||||
return zone;
|
return zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkEvents() override
|
|
||||||
{
|
|
||||||
Layout::checkEvents();
|
|
||||||
decorate();
|
|
||||||
}
|
|
||||||
protected:
|
|
||||||
uint8_t value = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BaseLayoutFactory<Layout1x1> layout1x1("Layout1x1", "Fullscreen", LBM_LAYOUT_1x1, OPTIONS_LAYOUT_1x1);
|
BaseLayoutFactory<Layout1x1> layout1x1("Layout1x1", "Fullscreen", LBM_LAYOUT_1x1, OPTIONS_LAYOUT_1x1);
|
||||||
|
|||||||
@@ -33,12 +33,8 @@ const uint8_t LBM_LAYOUT_2P1[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ZoneOption OPTIONS_LAYOUT_2P1[] = {
|
const ZoneOption OPTIONS_LAYOUT_2P1[] = {
|
||||||
{ STR_TOP_BAR, ZoneOption::Bool },
|
LAYOUT_COMMON_OPTIONS,
|
||||||
{ STR_FLIGHT_MODE, ZoneOption::Bool },
|
LAYOUT_OPTIONS_END
|
||||||
{ STR_SLIDERS, ZoneOption::Bool },
|
|
||||||
{ STR_TRIMS, ZoneOption::Bool },
|
|
||||||
{ STR_MIRROR, ZoneOption::Bool },
|
|
||||||
{ nullptr, ZoneOption::Bool }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const rect_t ZONES_LAYOUT_2P1[3] = {
|
const rect_t ZONES_LAYOUT_2P1[3] = {
|
||||||
@@ -53,7 +49,6 @@ class Layout2P1: public Layout
|
|||||||
Layout2P1(const LayoutFactory * factory, Layout::PersistentData * persistentData):
|
Layout2P1(const LayoutFactory * factory, Layout::PersistentData * persistentData):
|
||||||
Layout(factory, persistentData)
|
Layout(factory, persistentData)
|
||||||
{
|
{
|
||||||
decorate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void create() override
|
void create() override
|
||||||
@@ -68,11 +63,6 @@ class Layout2P1: public Layout
|
|||||||
decorate();
|
decorate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void decorate()
|
|
||||||
{
|
|
||||||
Layout::decorate(HAS_TOPBAR(), HAS_SLIDERS(), HAS_TRIMS(), HAS_FM());
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int getZonesCount() const override
|
unsigned int getZonesCount() const override
|
||||||
{
|
{
|
||||||
return DIM(ZONES_LAYOUT_2P1);
|
return DIM(ZONES_LAYOUT_2P1);
|
||||||
@@ -82,15 +72,6 @@ class Layout2P1: public Layout
|
|||||||
{
|
{
|
||||||
return ZONES_LAYOUT_2P1[index];
|
return ZONES_LAYOUT_2P1[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkEvents() override
|
|
||||||
{
|
|
||||||
Layout::checkEvents();
|
|
||||||
// TODO call this from the Layout config window
|
|
||||||
decorate();
|
|
||||||
}
|
|
||||||
protected:
|
|
||||||
uint8_t value = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BaseLayoutFactory<Layout2P1> layout2P1("Layout2P1", "2 + 1", LBM_LAYOUT_2P1, OPTIONS_LAYOUT_2P1);
|
BaseLayoutFactory<Layout2P1> layout2P1("Layout2P1", "2 + 1", LBM_LAYOUT_2P1, OPTIONS_LAYOUT_2P1);
|
||||||
|
|||||||
@@ -33,12 +33,8 @@ const uint8_t LBM_LAYOUT_2x1[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ZoneOption OPTIONS_LAYOUT_2x1[] = {
|
const ZoneOption OPTIONS_LAYOUT_2x1[] = {
|
||||||
{ STR_TOP_BAR, ZoneOption::Bool },
|
LAYOUT_COMMON_OPTIONS,
|
||||||
{ STR_FLIGHT_MODE, ZoneOption::Bool },
|
LAYOUT_OPTIONS_END
|
||||||
{ STR_SLIDERS, ZoneOption::Bool },
|
|
||||||
{ STR_TRIMS, ZoneOption::Bool },
|
|
||||||
{ STR_MIRROR, ZoneOption::Bool },
|
|
||||||
{ nullptr, ZoneOption::Bool }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Layout2x1: public Layout
|
class Layout2x1: public Layout
|
||||||
@@ -47,7 +43,6 @@ class Layout2x1: public Layout
|
|||||||
Layout2x1(const LayoutFactory * factory, Layout::PersistentData * persistentData):
|
Layout2x1(const LayoutFactory * factory, Layout::PersistentData * persistentData):
|
||||||
Layout(factory, persistentData)
|
Layout(factory, persistentData)
|
||||||
{
|
{
|
||||||
decorate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void create() override
|
void create() override
|
||||||
@@ -62,12 +57,6 @@ class Layout2x1: public Layout
|
|||||||
decorate();
|
decorate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void decorate()
|
|
||||||
{
|
|
||||||
Layout::decorate(HAS_TOPBAR(), HAS_SLIDERS(), HAS_TRIMS(), HAS_FM());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
unsigned int getZonesCount() const override
|
unsigned int getZonesCount() const override
|
||||||
{
|
{
|
||||||
return 2;
|
return 2;
|
||||||
@@ -88,14 +77,6 @@ class Layout2x1: public Layout
|
|||||||
}
|
}
|
||||||
return zone;
|
return zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkEvents() override
|
|
||||||
{
|
|
||||||
Layout::checkEvents();
|
|
||||||
decorate();
|
|
||||||
}
|
|
||||||
protected:
|
|
||||||
uint8_t value = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BaseLayoutFactory<Layout2x1> Layout2x1("Layout2x1", "2 x 1", LBM_LAYOUT_2x1, OPTIONS_LAYOUT_2x1);
|
BaseLayoutFactory<Layout2x1> Layout2x1("Layout2x1", "2 x 1", LBM_LAYOUT_2x1, OPTIONS_LAYOUT_2x1);
|
||||||
|
|||||||
@@ -33,12 +33,8 @@ const uint8_t LBM_LAYOUT_2x2[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ZoneOption OPTIONS_LAYOUT_2x2[] = {
|
const ZoneOption OPTIONS_LAYOUT_2x2[] = {
|
||||||
{ STR_TOP_BAR, ZoneOption::Bool },
|
LAYOUT_COMMON_OPTIONS,
|
||||||
{ STR_FLIGHT_MODE, ZoneOption::Bool },
|
LAYOUT_OPTIONS_END
|
||||||
{ STR_SLIDERS, ZoneOption::Bool },
|
|
||||||
{ STR_TRIMS, ZoneOption::Bool },
|
|
||||||
{ STR_MIRROR, ZoneOption::Bool },
|
|
||||||
{ nullptr, ZoneOption::Bool }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Layout2x2: public Layout
|
class Layout2x2: public Layout
|
||||||
@@ -47,7 +43,6 @@ class Layout2x2: public Layout
|
|||||||
Layout2x2(const LayoutFactory * factory, Layout::PersistentData * persistentData):
|
Layout2x2(const LayoutFactory * factory, Layout::PersistentData * persistentData):
|
||||||
Layout(factory, persistentData)
|
Layout(factory, persistentData)
|
||||||
{
|
{
|
||||||
decorate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void create() override
|
void create() override
|
||||||
@@ -62,11 +57,6 @@ class Layout2x2: public Layout
|
|||||||
decorate();
|
decorate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void decorate()
|
|
||||||
{
|
|
||||||
Layout::decorate(HAS_TOPBAR(), HAS_SLIDERS(), HAS_TRIMS(), HAS_FM());
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int getZonesCount() const override
|
unsigned int getZonesCount() const override
|
||||||
{
|
{
|
||||||
return 4;
|
return 4;
|
||||||
@@ -90,15 +80,6 @@ class Layout2x2: public Layout
|
|||||||
}
|
}
|
||||||
return zone;
|
return zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkEvents() override
|
|
||||||
{
|
|
||||||
Layout::checkEvents();
|
|
||||||
decorate();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
uint8_t value = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BaseLayoutFactory<Layout2x2> layout2x2("Layout2x2", "2 x 2", LBM_LAYOUT_2x2, OPTIONS_LAYOUT_2x2);
|
BaseLayoutFactory<Layout2x2> layout2x2("Layout2x2", "2 x 2", LBM_LAYOUT_2x2, OPTIONS_LAYOUT_2x2);
|
||||||
|
|||||||
@@ -25,15 +25,12 @@ const uint8_t LBM_LAYOUT_2x4[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ZoneOption OPTIONS_LAYOUT_2x4[] = {
|
const ZoneOption OPTIONS_LAYOUT_2x4[] = {
|
||||||
{ "Top bar", ZoneOption::Bool },
|
LAYOUT_COMMON_OPTIONS,
|
||||||
{ "Flight mode", ZoneOption::Bool },
|
|
||||||
{ "Sliders", ZoneOption::Bool },
|
|
||||||
{ "Trims", ZoneOption::Bool },
|
|
||||||
{ "Panel1 background", ZoneOption::Bool },
|
{ "Panel1 background", ZoneOption::Bool },
|
||||||
{ " Color", ZoneOption::Color },
|
{ " Color", ZoneOption::Color },
|
||||||
{ "Panel2 background", ZoneOption::Bool },
|
{ "Panel2 background", ZoneOption::Bool },
|
||||||
{ " Color", ZoneOption::Color },
|
{ " Color", ZoneOption::Color },
|
||||||
{ nullptr, ZoneOption::Bool }
|
LAYOUT_OPTIONS_END
|
||||||
};
|
};
|
||||||
|
|
||||||
class Layout2x4: public Layout
|
class Layout2x4: public Layout
|
||||||
|
|||||||
Reference in New Issue
Block a user