mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +03:00
[Horus] Martin's design to choose the layout
This commit is contained in:
parent
2e76be5b0b
commit
2037c33ce1
17 changed files with 108 additions and 50 deletions
|
@ -65,7 +65,7 @@ if(PCB STREQUAL HORUS)
|
||||||
add_definitions(-DPCBHORUS -DCOLORLCD -DSTM32F429_439xx -DPPM_PIN_HW_SERIAL)
|
add_definitions(-DPCBHORUS -DCOLORLCD -DSTM32F429_439xx -DPPM_PIN_HW_SERIAL)
|
||||||
add_definitions(-DEEPROM_VARIANT=0 -DAUDIO -DVOICE -DRTCLOCK)
|
add_definitions(-DEEPROM_VARIANT=0 -DAUDIO -DVOICE -DRTCLOCK)
|
||||||
add_definitions(-DLUAINPUTS -DXCURVES -DVARIO)
|
add_definitions(-DLUAINPUTS -DXCURVES -DVARIO)
|
||||||
include_directories(${RADIO_SRC_DIRECTORY}/fonts/horus gui/${GUI_DIR})
|
include_directories(${RADIO_SRC_DIRECTORY}/fonts/horus gui/${GUI_DIR} gui/${GUI_DIR}/layouts)
|
||||||
file(GLOB LAYOUTS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/horus ${RADIO_SRC_DIRECTORY}/gui/horus/layouts/*.cpp)
|
file(GLOB LAYOUTS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/horus ${RADIO_SRC_DIRECTORY}/gui/horus/layouts/*.cpp)
|
||||||
file(GLOB WIDGETS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/horus ${RADIO_SRC_DIRECTORY}/gui/horus/widgets/*.cpp)
|
file(GLOB WIDGETS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/horus ${RADIO_SRC_DIRECTORY}/gui/horus/widgets/*.cpp)
|
||||||
set(GUI_SRC
|
set(GUI_SRC
|
||||||
|
|
|
@ -13,5 +13,6 @@ add_bitmaps_target(horus_alpha_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/alp
|
||||||
add_bitmaps_target(horus_alpha_calibration_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/calibration/alpha_*.png" 480 5/6/5/8)
|
add_bitmaps_target(horus_alpha_calibration_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/calibration/alpha_*.png" 480 5/6/5/8)
|
||||||
add_bitmaps_target(horus_masks ${RADIO_SRC_DIRECTORY}/bitmaps/horus/mask_*.png 480 8bits)
|
add_bitmaps_target(horus_masks ${RADIO_SRC_DIRECTORY}/bitmaps/horus/mask_*.png 480 8bits)
|
||||||
add_bitmaps_target(horus_slider_masks "${RADIO_SRC_DIRECTORY}/bitmaps/horus/slider/*.png" 480 8bits)
|
add_bitmaps_target(horus_slider_masks "${RADIO_SRC_DIRECTORY}/bitmaps/horus/slider/*.png" 480 8bits)
|
||||||
|
add_bitmaps_target(horus_layouts_masks "${RADIO_SRC_DIRECTORY}/gui/horus/layouts/*.png" 480 8bits)
|
||||||
add_bitmaps_target(horus_fonts ${RADIO_SRC_DIRECTORY}/fonts/horus/*.png 480 8bits)
|
add_bitmaps_target(horus_fonts ${RADIO_SRC_DIRECTORY}/fonts/horus/*.png 480 8bits)
|
||||||
add_dependencies(horus_bitmaps horus_calibration_bitmaps horus_alpha_bitmaps horus_alpha_calibration_bitmaps horus_masks horus_slider_masks horus_fonts)
|
add_dependencies(horus_bitmaps horus_calibration_bitmaps horus_alpha_bitmaps horus_alpha_calibration_bitmaps horus_masks horus_slider_masks horus_layouts_masks horus_fonts)
|
||||||
|
|
|
@ -307,3 +307,12 @@ const uint8_t LBM_SLIDER_POINT_MID[] __DMA = {
|
||||||
const uint8_t LBM_SLIDER_POINT_IN[] __DMA = {
|
const uint8_t LBM_SLIDER_POINT_IN[] __DMA = {
|
||||||
#include "point_in.lbm"
|
#include "point_in.lbm"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_CARROUSSEL_LEFT[] __DMA = {
|
||||||
|
#include "mask_carroussel_left.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_CARROUSSEL_RIGHT[] __DMA = {
|
||||||
|
#include "mask_carroussel_right.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
@ -85,4 +85,8 @@ extern const uint8_t LBM_SLIDER_POINT_OUT[];
|
||||||
extern const uint8_t LBM_SLIDER_POINT_MID[];
|
extern const uint8_t LBM_SLIDER_POINT_MID[];
|
||||||
extern const uint8_t LBM_SLIDER_POINT_IN[];
|
extern const uint8_t LBM_SLIDER_POINT_IN[];
|
||||||
|
|
||||||
|
// Carroussel bitmaps
|
||||||
|
extern const uint8_t LBM_CARROUSSEL_LEFT[];
|
||||||
|
extern const uint8_t LBM_CARROUSSEL_RIGHT[];
|
||||||
|
|
||||||
#endif // _BITMAPS_H_
|
#endif // _BITMAPS_H_
|
||||||
|
|
|
@ -81,15 +81,6 @@ const LayoutFactory * getLayoutFactory(const char * name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Layout * createLayout(const char * name, Layout::PersistentData * persistentData)
|
|
||||||
{
|
|
||||||
const LayoutFactory * factory = getLayoutFactory(name);
|
|
||||||
if (factory) {
|
|
||||||
return factory->create(persistentData);
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Layout * loadLayout(const char * name, Layout::PersistentData * persistentData)
|
Layout * loadLayout(const char * name, Layout::PersistentData * persistentData)
|
||||||
{
|
{
|
||||||
const LayoutFactory * factory = getLayoutFactory(name);
|
const LayoutFactory * factory = getLayoutFactory(name);
|
||||||
|
|
|
@ -99,7 +99,7 @@ class LayoutFactory
|
||||||
registerLayout(this);
|
registerLayout(this);
|
||||||
}
|
}
|
||||||
const char * getName() const { return name; }
|
const char * getName() const { return name; }
|
||||||
virtual void drawThumb(uint16_t x, uint16_t y, uint32_t flags) = 0;
|
virtual void drawThumb(uint16_t x, uint16_t y, uint32_t flags) const = 0;
|
||||||
virtual const ZoneOption * getOptions() const = 0;
|
virtual const ZoneOption * getOptions() const = 0;
|
||||||
virtual Layout * create(Layout::PersistentData * persistentData) const = 0;
|
virtual Layout * create(Layout::PersistentData * persistentData) const = 0;
|
||||||
virtual Layout * load(Layout::PersistentData * persistentData) const = 0;
|
virtual Layout * load(Layout::PersistentData * persistentData) const = 0;
|
||||||
|
@ -119,7 +119,7 @@ class BaseLayoutFactory: public LayoutFactory
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void drawThumb(uint16_t x, uint16_t y, uint32_t flags)
|
virtual void drawThumb(uint16_t x, uint16_t y, uint32_t flags) const
|
||||||
{
|
{
|
||||||
extern void lcdDrawBitmapPattern(int x, int y, const uint8_t * bitmap, uint32_t flags, int width=0, int offset=0);
|
extern void lcdDrawBitmapPattern(int x, int y, const uint8_t * bitmap, uint32_t flags, int width=0, int offset=0);
|
||||||
lcdDrawBitmapPattern(x, y, bitmap, flags);
|
lcdDrawBitmapPattern(x, y, bitmap, flags);
|
||||||
|
@ -152,7 +152,6 @@ class BaseLayoutFactory: public LayoutFactory
|
||||||
|
|
||||||
extern unsigned int countRegisteredLayouts;
|
extern unsigned int countRegisteredLayouts;
|
||||||
extern const LayoutFactory * registeredLayouts[MAX_REGISTERED_LAYOUTS];
|
extern const LayoutFactory * registeredLayouts[MAX_REGISTERED_LAYOUTS];
|
||||||
Layout * createLayout(const char * name, Layout::PersistentData * persistentData);
|
|
||||||
Layout * loadLayout(const char * name, Layout::PersistentData * persistentData);
|
Layout * loadLayout(const char * name, Layout::PersistentData * persistentData);
|
||||||
|
|
||||||
#endif // _LAYOUT_H_
|
#endif // _LAYOUT_H_
|
||||||
|
|
|
@ -100,4 +100,8 @@ void Layout2P1::refresh(bool setup)
|
||||||
Layout::refresh(setup);
|
Layout::refresh(setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseLayoutFactory<Layout2P1> layout2P1("Layout2P1", NULL, Layout2P1::options);
|
const uint8_t LBM_LAYOUT_2P1[] __DMA = {
|
||||||
|
#include "mask_layout2+1.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseLayoutFactory<Layout2P1> layout2P1("Layout2P1", LBM_LAYOUT_2P1, Layout2P1::options);
|
||||||
|
|
|
@ -83,4 +83,8 @@ void Layout2x2::refresh(bool setup)
|
||||||
Layout::refresh(setup);
|
Layout::refresh(setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseLayoutFactory<Layout2x2> layout2x2("Layout2x2", NULL, Layout2x2::options);
|
const uint8_t LBM_LAYOUT_2x2[] __DMA = {
|
||||||
|
#include "mask_layout2x2.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseLayoutFactory<Layout2x2> layout2x2("Layout2x2", LBM_LAYOUT_2x2, Layout2x2::options);
|
||||||
|
|
|
@ -30,7 +30,6 @@ class Layout2x4: public Layout
|
||||||
|
|
||||||
virtual void create()
|
virtual void create()
|
||||||
{
|
{
|
||||||
TRACE("create");
|
|
||||||
persistentData->options[0].boolValue = true;
|
persistentData->options[0].boolValue = true;
|
||||||
persistentData->options[1].boolValue = true;
|
persistentData->options[1].boolValue = true;
|
||||||
persistentData->options[2].boolValue = true;
|
persistentData->options[2].boolValue = true;
|
||||||
|
@ -116,4 +115,8 @@ void Layout2x4::refresh(bool setup)
|
||||||
Layout::refresh(setup);
|
Layout::refresh(setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseLayoutFactory<Layout2x4> layout2x4("Layout2x4", NULL, Layout2x4::options);
|
const uint8_t LBM_LAYOUT_2x4[] __DMA = {
|
||||||
|
#include "mask_layout2x4.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseLayoutFactory<Layout2x4> layout2x4("Layout2x4", LBM_LAYOUT_2x4, Layout2x4::options);
|
||||||
|
|
BIN
radio/src/gui/horus/layouts/mask_layout2+1.png
Normal file
BIN
radio/src/gui/horus/layouts/mask_layout2+1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 233 B |
BIN
radio/src/gui/horus/layouts/mask_layout2x2.png
Normal file
BIN
radio/src/gui/horus/layouts/mask_layout2x2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 208 B |
BIN
radio/src/gui/horus/layouts/mask_layout2x4.png
Normal file
BIN
radio/src/gui/horus/layouts/mask_layout2x4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 212 B |
|
@ -185,7 +185,8 @@ extern int8_t s_editMode; // global editmode
|
||||||
|
|
||||||
// mawrow special values
|
// mawrow special values
|
||||||
#define TITLE_ROW ((uint8_t)-1)
|
#define TITLE_ROW ((uint8_t)-1)
|
||||||
#define HIDDEN_ROW ((uint8_t)-2)
|
#define ORPHAN_ROW ((uint8_t)-2)
|
||||||
|
#define HIDDEN_ROW ((uint8_t)-3)
|
||||||
|
|
||||||
struct CheckIncDecStops {
|
struct CheckIncDecStops {
|
||||||
const int count;
|
const int count;
|
||||||
|
|
|
@ -597,7 +597,6 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
|
||||||
}
|
}
|
||||||
|
|
||||||
linesCount = rowcount;
|
linesCount = rowcount;
|
||||||
int maxBodyLines = (menuTab ? NUM_BODY_LINES : NUM_BODY_LINES+1);
|
|
||||||
|
|
||||||
if (menuVerticalPosition <= MENU_FIRST_LINE_EDIT) {
|
if (menuVerticalPosition <= MENU_FIRST_LINE_EDIT) {
|
||||||
menuVerticalOffset = 0;
|
menuVerticalOffset = 0;
|
||||||
|
@ -611,7 +610,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (horTab) {
|
else if (horTab) {
|
||||||
if (rowcount > maxBodyLines) {
|
if (rowcount > linesDisplayed) {
|
||||||
while (1) {
|
while (1) {
|
||||||
vertpos_t firstLine = 0;
|
vertpos_t firstLine = 0;
|
||||||
for (int numLines=0; firstLine<rowcount && numLines<menuVerticalOffset; firstLine++) {
|
for (int numLines=0; firstLine<rowcount && numLines<menuVerticalOffset; firstLine++) {
|
||||||
|
@ -624,16 +623,16 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vertpos_t lastLine = firstLine;
|
vertpos_t lastLine = firstLine;
|
||||||
for (int numLines=0; lastLine<rowcount && numLines<maxBodyLines; lastLine++) {
|
for (int numLines=0; lastLine<rowcount && numLines<linesDisplayed; lastLine++) {
|
||||||
if (lastLine >= horTabMax || horTab[lastLine] != HIDDEN_ROW) {
|
if (lastLine >= horTabMax || horTab[lastLine] != HIDDEN_ROW) {
|
||||||
numLines++;
|
numLines++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (menuVerticalPosition >= lastLine) {
|
if (menuVerticalPosition >= lastLine || horTab[firstLine] == ORPHAN_ROW) {
|
||||||
menuVerticalOffset++;
|
menuVerticalOffset++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
linesCount = menuVerticalOffset + maxBodyLines;
|
linesCount = menuVerticalOffset + linesDisplayed;
|
||||||
for (int i=lastLine; i<rowcount; i++) {
|
for (int i=lastLine; i<rowcount; i++) {
|
||||||
if (i > horTabMax || horTab[i] != HIDDEN_ROW) {
|
if (i > horTabMax || horTab[i] != HIDDEN_ROW) {
|
||||||
linesCount++;
|
linesCount++;
|
||||||
|
@ -646,8 +645,8 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (menuVerticalPosition >= maxBodyLines + menuVerticalOffset) {
|
if (menuVerticalPosition >= linesDisplayed + menuVerticalOffset) {
|
||||||
menuVerticalOffset = menuVerticalPosition-maxBodyLines+1;
|
menuVerticalOffset = menuVerticalPosition-linesDisplayed+1;
|
||||||
}
|
}
|
||||||
else if (menuVerticalPosition < menuVerticalOffset) {
|
else if (menuVerticalPosition < menuVerticalOffset) {
|
||||||
menuVerticalOffset = menuVerticalPosition;
|
menuVerticalOffset = menuVerticalPosition;
|
||||||
|
|
|
@ -32,7 +32,7 @@ void onWidgetChoiceMenu(const char * result)
|
||||||
|
|
||||||
ZoneOptionValue editZoneOption(coord_t y, const ZoneOption * option, ZoneOptionValue value, LcdFlags attr, evt_t event)
|
ZoneOptionValue editZoneOption(coord_t y, const ZoneOption * option, ZoneOptionValue value, LcdFlags attr, evt_t event)
|
||||||
{
|
{
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT + INDENT_WIDTH, y, option->name);
|
lcdDrawText(MENUS_MARGIN_LEFT, y, option->name);
|
||||||
|
|
||||||
if (option->type == ZoneOption::Bool) {
|
if (option->type == ZoneOption::Bool) {
|
||||||
value.boolValue = editCheckBox(value.boolValue, SCREENS_SETUP_2ND_COLUMN, y, attr, event);
|
value.boolValue = editCheckBox(value.boolValue, SCREENS_SETUP_2ND_COLUMN, y, attr, event);
|
||||||
|
@ -162,6 +162,9 @@ bool menuSetupWidgets(evt_t event)
|
||||||
|
|
||||||
bool menuSetupScreensView(evt_t event)
|
bool menuSetupScreensView(evt_t event)
|
||||||
{
|
{
|
||||||
|
static uint8_t menuHorizontalOffset;
|
||||||
|
static uint8_t lastPositionVertical;
|
||||||
|
|
||||||
currentScreen = customScreens[0];
|
currentScreen = customScreens[0];
|
||||||
|
|
||||||
unsigned int layoutIndex = 0;
|
unsigned int layoutIndex = 0;
|
||||||
|
@ -172,41 +175,78 @@ bool menuSetupScreensView(evt_t event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
linesCount = 1;
|
linesCount = 3;
|
||||||
const ZoneOption * options = currentScreen->getFactory()->getOptions();
|
const ZoneOption * options = currentScreen->getFactory()->getOptions();
|
||||||
for (const ZoneOption * option = options; option->name; option++) {
|
for (const ZoneOption * option = options; option->name; option++) {
|
||||||
linesCount++;
|
linesCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBMENU_WITH_OPTIONS("Main views setup", LBM_MAINVIEWS_ICON, linesCount, OPTION_MENU_TITLE_BAR, { 0, 0, 0 });
|
SUBMENU_WITH_OPTIONS("Main views setup", LBM_MAINVIEWS_ICON, linesCount, OPTION_MENU_TITLE_BAR, { countRegisteredLayouts-1, ORPHAN_ROW, 0, 0, 0, 0 });
|
||||||
|
|
||||||
for (int i=0; i<NUM_BODY_LINES+1; i++) {
|
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||||
coord_t y = MENU_CONTENT_TOP + i * FH;
|
coord_t y = MENU_CONTENT_TOP + i * FH;
|
||||||
int k = i + menuVerticalOffset;
|
int k = i + menuVerticalOffset;
|
||||||
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||||
LcdFlags attr = (menuVerticalPosition == k ? blink : 0);
|
LcdFlags attr = (menuVerticalPosition == k ? blink : 0);
|
||||||
if (k == 0) {
|
switch(k) {
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT, y, "Layout");
|
case 0: {
|
||||||
lcdDrawText(SCREENS_SETUP_2ND_COLUMN, y, currentScreen->getFactory()->getName(), attr);
|
lcdDrawText(MENUS_MARGIN_LEFT, y + FH / 2, "Layout");
|
||||||
if (attr) {
|
if (attr) {
|
||||||
layoutIndex = checkIncDec(event, layoutIndex, 0, countRegisteredLayouts-1, EE_MODEL);
|
if (lastPositionVertical != menuVerticalPosition) {
|
||||||
if (checkIncDec_Ret) {
|
menuHorizontalOffset = max<int>(0, min<int>(layoutIndex - 1, countRegisteredLayouts - 4));
|
||||||
customScreens[0] = registeredLayouts[layoutIndex]->create(&g_model.screenData[0].layoutData);
|
menuHorizontalPosition = layoutIndex;
|
||||||
strncpy(g_model.screenData[0].layoutName, customScreens[0]->getFactory()->getName(), sizeof(g_model.screenData[0].layoutName));
|
|
||||||
}
|
}
|
||||||
else if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
else if (menuHorizontalPosition < menuHorizontalOffset) {
|
||||||
|
menuHorizontalOffset = menuHorizontalPosition;
|
||||||
|
}
|
||||||
|
else if (menuHorizontalPosition > menuHorizontalOffset + 3) {
|
||||||
|
menuHorizontalOffset = menuHorizontalPosition - 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lastPositionVertical = menuVerticalPosition;
|
||||||
|
int lastDisplayedLayout = min<int>(menuHorizontalOffset + 4, countRegisteredLayouts);
|
||||||
|
for (int i=menuHorizontalOffset, x=SCREENS_SETUP_2ND_COLUMN; i<lastDisplayedLayout; i++, x += 56) {
|
||||||
|
const LayoutFactory * factory = registeredLayouts[i];
|
||||||
|
factory->drawThumb(x, y, currentScreen->getFactory() == factory ? TEXT_INVERTED_BGCOLOR : LINE_COLOR);
|
||||||
|
}
|
||||||
|
if (menuHorizontalOffset > 0)
|
||||||
|
lcdDrawBitmapPattern(SCREENS_SETUP_2ND_COLUMN - 12, y, LBM_CARROUSSEL_LEFT, LINE_COLOR);
|
||||||
|
if (lastDisplayedLayout < countRegisteredLayouts)
|
||||||
|
lcdDrawBitmapPattern(SCREENS_SETUP_2ND_COLUMN + 4 * 56, y, LBM_CARROUSSEL_RIGHT, LINE_COLOR);
|
||||||
|
if (attr) {
|
||||||
|
lcdDrawSolidRect(SCREENS_SETUP_2ND_COLUMN + (menuHorizontalPosition - menuHorizontalOffset) * 56 - 3, y - 2, 57, 35, TEXT_INVERTED_BGCOLOR);
|
||||||
|
if (menuHorizontalPosition != layoutIndex && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
|
s_editMode = 0;
|
||||||
|
customScreens[0] = registeredLayouts[menuHorizontalPosition]->create(&g_model.screenData[0].layoutData);
|
||||||
|
strncpy(g_model.screenData[0].layoutName, customScreens[0]->getFactory()->getName(), sizeof(g_model.screenData[0].layoutName));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
drawButton(SCREENS_SETUP_2ND_COLUMN, y, "Setup widgets", attr);
|
||||||
|
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
pushMenu(menuSetupWidgets);
|
pushMenu(menuSetupWidgets);
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
}
|
|
||||||
else if (k < linesCount) {
|
default:
|
||||||
const ZoneOption * option = &options[k-1];
|
if (k < linesCount) {
|
||||||
ZoneOptionValue value = currentScreen->getOptionValue(k-1);
|
uint8_t index = k - 3;
|
||||||
|
const ZoneOption *option = &options[index];
|
||||||
|
ZoneOptionValue value = currentScreen->getOptionValue(index);
|
||||||
value = editZoneOption(y, option, value, attr, event);
|
value = editZoneOption(y, option, value, attr, event);
|
||||||
if (attr) {
|
if (attr) {
|
||||||
currentScreen->setOptionValue(k-1, value);
|
currentScreen->setOptionValue(index, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -130,9 +130,10 @@ void drawShadow(coord_t x, coord_t y, coord_t w, coord_t h)
|
||||||
lcdDrawSolidHorizontalLine(x+2, y+h+1, w, LINE_COLOR);
|
lcdDrawSolidHorizontalLine(x+2, y+h+1, w, LINE_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t linesDisplayed;
|
||||||
|
|
||||||
void drawScreenTemplate(const char * title, const uint8_t * icon, uint32_t options)
|
void drawScreenTemplate(const char * title, const uint8_t * icon, uint32_t options)
|
||||||
{
|
{
|
||||||
uint8_t linesDisplayed;
|
|
||||||
coord_t bodyTop, bodyBottom;
|
coord_t bodyTop, bodyBottom;
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
|
@ -152,7 +153,7 @@ void drawScreenTemplate(const char * title, const uint8_t * icon, uint32_t optio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
linesDisplayed = NUM_BODY_LINES;
|
linesDisplayed = NUM_BODY_LINES + 1;
|
||||||
bodyTop = MENU_HEADER_HEIGHT;
|
bodyTop = MENU_HEADER_HEIGHT;
|
||||||
if (title) {
|
if (title) {
|
||||||
lcdDrawText(50, 3, title, MENU_TITLE_COLOR);
|
lcdDrawText(50, 3, title, MENU_TITLE_COLOR);
|
||||||
|
|
|
@ -79,4 +79,6 @@ void drawMainViewTopBar();
|
||||||
void drawMainPots();
|
void drawMainPots();
|
||||||
void drawTrims(uint8_t flightMode);
|
void drawTrims(uint8_t flightMode);
|
||||||
|
|
||||||
|
extern uint8_t linesDisplayed;
|
||||||
|
|
||||||
#endif // _WIDGETS_H_
|
#endif // _WIDGETS_H_
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue