5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
23 const uint8_t LBM_LAYOUT_2x4
[] = {
24 #include "mask_layout2x4.lbm"
27 const ZoneOption OPTIONS_LAYOUT_2x4
[] = {
28 { "Top bar", ZoneOption::Bool
},
29 { "Flight mode", ZoneOption::Bool
},
30 { "Sliders", ZoneOption::Bool
},
31 { "Trims", ZoneOption::Bool
},
32 { "Panel1 background", ZoneOption::Bool
},
33 { " Color", ZoneOption::Color
},
34 { "Panel2 background", ZoneOption::Bool
},
35 { " Color", ZoneOption::Color
},
36 { NULL
, ZoneOption::Bool
}
39 class Layout2x4
: public Layout
42 Layout2x4(const LayoutFactory
* factory
, Layout::PersistentData
* persistentData
):
43 Layout(factory
, persistentData
)
50 persistentData
->options
[0].boolValue
= true;
51 persistentData
->options
[1].boolValue
= true;
52 persistentData
->options
[2].boolValue
= true;
53 persistentData
->options
[3].boolValue
= true;
54 persistentData
->options
[4].boolValue
= true;
55 persistentData
->options
[5].unsignedValue
= RGB(77, 112, 203);
56 persistentData
->options
[6].boolValue
= false;
57 persistentData
->options
[7].unsignedValue
= RGB(77, 112, 203);
60 virtual unsigned int getZonesCount() const
65 virtual Zone
getZone(unsigned int index
) const
68 zone
.x
= (index
>= 4) ? 260 : 60;
69 zone
.y
= 56 + (index
% 4) * 42;
75 virtual void refresh();
78 void Layout2x4::refresh()
80 theme
->drawBackground();
82 if (persistentData
->options
[0].boolValue
) {
86 if (persistentData
->options
[1].boolValue
) {
88 lcdDrawSizedText(LCD_W
/ 2 - getTextWidth(g_model
.flightModeData
[mixerCurrentFlightMode
].name
,
89 sizeof(g_model
.flightModeData
[mixerCurrentFlightMode
].name
),
92 g_model
.flightModeData
[mixerCurrentFlightMode
].name
,
93 sizeof(g_model
.flightModeData
[mixerCurrentFlightMode
].name
), ZCHAR
| SMLSIZE
);
96 if (persistentData
->options
[2].boolValue
) {
97 // Pots and rear sliders positions
101 if (persistentData
->options
[3].boolValue
) {
103 drawTrims(mixerCurrentFlightMode
);
106 if (persistentData
->options
[4].boolValue
) {
107 lcdSetColor(persistentData
->options
[5].unsignedValue
);
108 lcdDrawSolidFilledRect(50, 50, 180, 170, CUSTOM_COLOR
);
111 if (persistentData
->options
[6].boolValue
) {
112 lcdSetColor(persistentData
->options
[7].unsignedValue
);
113 lcdDrawSolidFilledRect(250, 50, 180, 170, CUSTOM_COLOR
);
119 BaseLayoutFactory
<Layout2x4
> layout2x4("Layout2x4", LBM_LAYOUT_2x4
, OPTIONS_LAYOUT_2x4
);