X7-improvement (#4208)

* Allow autoswitch for LS AND

* Add POPUPMENU base edit/clear/copy/paste to LS screen

* Add long menu to OUTPUTS screen

* Compil fix

* Compil fix

* Translations for outputs POPMENU 128x64
This commit is contained in:
3djc
2017-01-08 19:54:57 +01:00
committed by Bertrand Songis
parent 1642732e8f
commit 651f7b3f93
13 changed files with 94 additions and 38 deletions
+37 -14
View File
@@ -195,7 +195,7 @@ void menuModelLogicalSwitchOne(event_t event)
case LS_FIELD_ANDSW:
lcdDrawTextAlignedLeft(y, STR_AND_SWITCH);
drawSwitch(CSWONE_2ND_COLUMN, y, cs->andsw, attr);
if (attr) CHECK_INCDEC_MODELVAR_CHECK(event, cs->andsw, -MAX_LS_ANDSW, MAX_LS_ANDSW, isSwitchAvailableInLogicalSwitches);
if (attr) CHECK_INCDEC_MODELSWITCH(event, cs->andsw, -MAX_LS_ANDSW, MAX_LS_ANDSW, isSwitchAvailableInLogicalSwitches);
break;
case LS_FIELD_DURATION:
@@ -219,6 +219,29 @@ void menuModelLogicalSwitchOne(event_t event)
}
}
void onLogicalSwitchesMenu(const char *result)
{
int8_t sub = menuVerticalPosition;
LogicalSwitchData * cs = lswAddress(sub);
if (result == STR_EDIT) {
pushMenu(menuModelLogicalSwitchOne);
}
if (result == STR_COPY) {
clipboard.type = CLIPBOARD_TYPE_CUSTOM_SWITCH;
clipboard.data.csw = *cs;
}
else if (result == STR_PASTE) {
*cs = clipboard.data.csw;
storageDirty(EE_MODEL);
}
else if (result == STR_CLEAR) {
memset(cs, 0, sizeof(LogicalSwitchData));
storageDirty(EE_MODEL);
}
}
void menuModelLogicalSwitches(event_t event)
{
SIMPLE_MENU(STR_MENULOGICALSWITCHES, menuTabModel, MENU_MODEL_LOGICAL_SWITCHES, HEADER_LINE+MAX_LOGICAL_SWITCHES);
@@ -227,19 +250,19 @@ void menuModelLogicalSwitches(event_t event)
uint8_t k = 0;
int8_t sub = menuVerticalPosition - HEADER_LINE;
switch (event) {
#if defined(ROTARY_ENCODER_NAVIGATION)
case EVT_ROTARY_BREAK:
#endif
#if !defined(PCBX7)
case EVT_KEY_FIRST(KEY_RIGHT):
#endif
case EVT_KEY_FIRST(KEY_ENTER):
if (sub >= 0) {
s_currIdx = sub;
pushMenu(menuModelLogicalSwitchOne);
}
break;
if (event==EVT_KEY_FIRST(KEY_ENTER)) {
killEvents(event);
LogicalSwitchData * cs = lswAddress(sub);
if (cs->func)
s_currIdx = sub;
POPUP_MENU_ADD_ITEM(STR_EDIT);
if (cs->func || cs->v1 || cs->v2 || cs->delay || cs->duration || cs->andsw)
POPUP_MENU_ADD_ITEM(STR_COPY);
if (clipboard.type == CLIPBOARD_TYPE_CUSTOM_SWITCH)
POPUP_MENU_ADD_ITEM(STR_PASTE);
if (cs->func || cs->v1 || cs->v2 || cs->delay || cs->duration || cs->andsw)
POPUP_MENU_ADD_ITEM(STR_CLEAR);
POPUP_MENU_START(onLogicalSwitchesMenu);
}
for (uint8_t i=0; i<LCD_LINES-1; i++) {
+35 -2
View File
@@ -2,7 +2,7 @@
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
@@ -87,6 +87,29 @@ enum MenuModelOutputsItems {
#define MIN_MAX_DISPLAY(x) ((int8_t)(x))
#endif
#if defined(CPUARM)
void onLimitsMenu(const char *result)
{
int ch = menuVerticalPosition;
if (result == STR_RESET) {
LimitData *ld = limitAddress(ch);
ld->min = 0;
ld->max = 0;
ld->offset = 0;
ld->ppmCenter = 0;
ld->revert = false;
ld->curve = 0;
}
else if (result == STR_COPY_STICKS_TO_OFS) {
copySticksToOffset(ch);
}
else if (result == STR_COPY_TRIMS_TO_OFS) {
copyTrimsToOffset(ch);
}
}
#endif
void menuModelLimits(event_t event)
{
uint8_t sub = menuVerticalPosition - HEADER_LINE;
@@ -144,9 +167,19 @@ void menuModelLimits(event_t event)
#endif
limit_min_max_t limit = (g_model.extendedLimits ? LIMIT_EXT_MAX : 100);
putsChn(0, y, k+1, IS_LINE_SELECTED(sub, k) ? INVERS : 0);
#if defined(CPUARM)
if (sub==k && CURSOR_ON_LINE() && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
killEvents(event);
POPUP_MENU_ADD_ITEM(STR_RESET);
POPUP_MENU_ADD_ITEM(STR_COPY_TRIMS_TO_OFS);
POPUP_MENU_ADD_ITEM(STR_COPY_STICKS_TO_OFS);
POPUP_MENU_START(onLimitsMenu);
}
#endif
for (uint8_t j=0; j<ITEM_OUTPUTS_COUNT; j++) {
uint8_t attr = ((sub==k && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
uint8_t active = (attr && (s_editMode>0 || p1valdiff)) ;