Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bsongis/issue2418_better_fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
kilrah committed Sep 6, 2015
2 parents 9083b1f + 6374f52 commit 3f48f28
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 15 deletions.
64 changes: 52 additions & 12 deletions radio/src/gui/Taranis/menu_model_custom_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,35 @@ void onCustomFunctionsMenu(const char *result)
}
}

void onAdjustGvarSourceLongEnterPress(const char * result)
{
CustomFunctionData * cfn = &g_model.customFn[m_posVert];

if (result == STR_CONSTANT) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_CONSTANT;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
}
else if (result == STR_MIXSOURCE) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_SOURCE;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
}
else if (result == STR_GLOBALVAR) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_GVAR;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
}
else if (result == STR_INCDEC) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_INC;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
}
else {
onSourceLongEnterPress(result);
}
}

void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
{
int sub = m_posVert;
Expand Down Expand Up @@ -325,36 +354,47 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
case FUNC_ADJUST_GVAR_SOURCE:
val_max = MIXSRC_LAST_CH;
putsMixerSource(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr);
// TODO later, we have a conflict on [Enter Long] here ...
// INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
INCDEC_ENABLE_CHECK(isSourceAvailable);
break;
case FUNC_ADJUST_GVAR_GVAR:
val_max = MAX_GVARS-1;
putsStrIdx(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_GV, val_displayed+1, attr);
break;
default: // FUNC_ADJUST_GVAR_INC
#if 0 // TODO 2.2.X
val_min = -100; val_max = +100;
if (val_displayed < 0)
lcd_putsAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, "-=", attr);
else
lcd_putsAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, "+=", attr);
lcd_outdezAtt(lcdNextPos, y, abs(val_displayed), attr|LEFT);
#endif
val_max = 1;
lcd_putsiAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, PSTR("\003-=1+=1"), val_displayed, attr);
break;
}

if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event);
s_editMode = !s_editMode;
active = true;
CFN_GVAR_MODE(cfn) += 1;
CFN_GVAR_MODE(cfn) &= 0x03;
val_displayed = 0;
}
}
#endif
else if (attr) {
REPEAT_LAST_CURSOR_MOVE();
}

if (active) {
if (active || event==EVT_KEY_LONG(KEY_ENTER)) {
CFN_PARAM(cfn) = CHECK_INCDEC_PARAM(event, val_displayed, val_min, val_max);
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_CONSTANT)
MENU_ADD_ITEM(STR_CONSTANT);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_SOURCE)
MENU_ADD_ITEM(STR_MIXSOURCE);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_GVAR)
MENU_ADD_ITEM(STR_GLOBALVAR);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_INC)
MENU_ADD_ITEM(STR_INCDEC);
menuHandler = onAdjustGvarSourceLongEnterPress;
s_editMode = EDIT_MODIFY_FIELD;
}
}
break;
}
Expand Down
4 changes: 4 additions & 0 deletions radio/src/translations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,10 @@ const pm_char STR_BLCOLOR[] PROGMEM = TR_BLCOLOR;
const pm_char STR_SMOOTH[] PROGMEM = TR_SMOOTH;
const pm_char STR_COPY_STICKS_TO_OFS[] PROGMEM = TR_COPY_STICKS_TO_OFS;
const pm_char STR_COPY_TRIMS_TO_OFS[] PROGMEM = TR_COPY_TRIMS_TO_OFS;
const pm_char STR_INCDEC[] PROGMEM = TR_INCDEC;
const pm_char STR_GLOBALVAR[] PROGMEM = TR_GLOBALVAR;
const pm_char STR_MIXSOURCE[] PROGMEM = TR_MIXSOURCE;
const pm_char STR_CONSTANT[] PROGMEM = TR_CONSTANT;
const pm_char STR_TOP_BAR[] PROGMEM = TR_TOP_BAR;
const pm_char STR_ALTITUDE[] PROGMEM = TR_ALTITUDE;
const pm_char STR_SCALE[] PROGMEM = TR_SCALE;
Expand Down
10 changes: 7 additions & 3 deletions radio/src/translations.h
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,10 @@ extern const pm_char STR_BLCOLOR[];
extern const pm_char STR_SMOOTH[];
extern const pm_char STR_COPY_STICKS_TO_OFS[];
extern const pm_char STR_COPY_TRIMS_TO_OFS[];
extern const pm_char STR_INCDEC[];
extern const pm_char STR_GLOBALVAR[];
extern const pm_char STR_MIXSOURCE[];
extern const pm_char STR_CONSTANT[];
extern const pm_char STR_TOP_BAR[];
extern const pm_char STR_ALTITUDE[];
extern const pm_char STR_SCALE[];
Expand All @@ -831,13 +835,13 @@ extern const pm_char STR_BLCOLOR[];
extern const pm_char STR_MENU_HELI[];
extern const pm_char STR_MENU_TRIMS[];
extern const pm_char STR_MENU_SWITCHES[];
extern const pm_char STR_MENU_LOGICAL_SWITCHES[];
extern const pm_char STR_MENU_LOGICAL_SWITCHES[];
extern const pm_char STR_MENU_TRAINER[];
extern const pm_char STR_MENU_CHANNELS[];
extern const pm_char STR_MENU_GVARS[];
extern const pm_char STR_MENU_TELEMETRY[];
extern const pm_char STR_MENU_OTHER[];
extern const pm_char STR_MENU_INVERT[];
extern const pm_char STR_MENU_OTHER[];
extern const pm_char STR_MENU_INVERT[];
#endif

#if MENUS_LOCK == 1
Expand Down
4 changes: 4 additions & 0 deletions radio/src/translations/cz.h.txt
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,10 @@
#define TR_SMOOTH "Hladká"
#define TR_COPY_STICKS_TO_OFS "Kopie pák do subtrimu"
#define TR_COPY_TRIMS_TO_OFS "Kopíe trimů do subtrimu"
#define TR_INCDEC "Inc/Decrement"
#define TR_GLOBALVAR "Global Var"
#define TR_MIXSOURCE "Mixer Source"
#define TR_CONSTANT "Constant"
#define TR_PERSISTENT_MAH TR(INDENT "Str mAh", INDENT "Ukládat mAh")
#define TR_PREFLIGHT "Předletová kontrola"
#define TR_CHECKLIST INDENT "Zobrazit poznámky"
Expand Down
4 changes: 4 additions & 0 deletions radio/src/translations/de.h.txt
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,10 @@
#define TR_SMOOTH "Runden"
#define TR_COPY_STICKS_TO_OFS "Kopie Stick to Servo-Mitte"
#define TR_COPY_TRIMS_TO_OFS "Kopie Trimm to Servo-Mitte" // "Trim to Subtrim"
#define TR_INCDEC "Inc/Decrement"
#define TR_GLOBALVAR "Global Var"
#define TR_MIXSOURCE "Mixer Source"
#define TR_CONSTANT "Constant"
#define TR_PERSISTENT_MAH TR(INDENT "Spr. mAh", INDENT "Speichern mAh") //9XR-Pro
#define TR_PREFLIGHT TR("---Vorflug-Checkliste--", "----Vorflug-Checkliste----")
#define TR_CHECKLIST TR(INDENT "Checkliste", INDENT "Checkliste anzeigen") //9XR-Pro
Expand Down
4 changes: 4 additions & 0 deletions radio/src/translations/en.h.txt
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,10 @@
#define TR_SMOOTH "Smooth"
#define TR_COPY_STICKS_TO_OFS "Copy sticks to subtrim"
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
#define TR_INCDEC "Inc/Decrement"
#define TR_GLOBALVAR "Global Var"
#define TR_MIXSOURCE "Mixer Source"
#define TR_CONSTANT "Constant"
#define TR_PERSISTENT_MAH TR(INDENT "Str mAh", INDENT "Persistent mAh")
#define TR_PREFLIGHT "Preflight Checks"
#define TR_CHECKLIST TR(INDENT "Checklist", INDENT "Display Checklist")
Expand Down
4 changes: 4 additions & 0 deletions radio/src/translations/es.h.txt
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,10 @@
#define TR_SMOOTH "Smooth"
#define TR_COPY_STICKS_TO_OFS "Copy Sticks To Offset"
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
#define TR_INCDEC "Inc/Decrement"
#define TR_GLOBALVAR "Global Var"
#define TR_MIXSOURCE "Mixer Source"
#define TR_CONSTANT "Constant"
#define TR_PERSISTENT_MAH INDENT "Valor mAh"
#define TR_PREFLIGHT "Preflight Checks"
#define TR_CHECKLIST INDENT "Display Checklist"
Expand Down
4 changes: 4 additions & 0 deletions radio/src/translations/fi.h.txt
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,10 @@
#define TR_SMOOTH "Smooth"
#define TR_COPY_STICKS_TO_OFS "Copy Sticks To Offset"
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
#define TR_INCDEC "Inc/Decrement"
#define TR_GLOBALVAR "Global Var"
#define TR_MIXSOURCE "Mixer Source"
#define TR_CONSTANT "Constant"
#define TR_PERSISTENT_MAH INDENT "Store mAh"
#define TR_PREFLIGHT "Preflight Checks"
#define TR_CHECKLIST INDENT "Display Checklist"
Expand Down
4 changes: 4 additions & 0 deletions radio/src/translations/fr.h.txt
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,10 @@
#define TR_SMOOTH "Lissage"
#define TR_COPY_STICKS_TO_OFS "Manche vers subtrim"
#define TR_COPY_TRIMS_TO_OFS "Trim vers subtrim"
#define TR_INCDEC "Inc/Decrement"
#define TR_GLOBALVAR "Global Var"
#define TR_MIXSOURCE "Mixer Source"
#define TR_CONSTANT "Constant"
#define TR_PERSISTENT_MAH TR(INDENT "Enr. mAh", INDENT "Enregistrer mAh")
#define TR_PREFLIGHT "Vérifications avant vol"
#define TR_CHECKLIST TR(INDENT "Notes", INDENT "Afficher notes")
Expand Down
4 changes: 4 additions & 0 deletions radio/src/translations/it.h.txt
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,10 @@
#define TR_SMOOTH "Smussa"
#define TR_COPY_STICKS_TO_OFS "Copia Stick su Offset"
#define TR_COPY_TRIMS_TO_OFS "Copia Trim in Subtrim"
#define TR_INCDEC "Inc/Decrement"
#define TR_GLOBALVAR "Global Var"
#define TR_MIXSOURCE "Mixer Source"
#define TR_CONSTANT "Constant"
#define TR_PERSISTENT_MAH INDENT "Memo mAh"
#define TR_PREFLIGHT "Controlli Prevolo"
#define TR_CHECKLIST INDENT "Mostra Checklist"
Expand Down
4 changes: 4 additions & 0 deletions radio/src/translations/nl.h.txt
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,10 @@
#define TR_SMOOTH "Zacht"
#define TR_COPY_STICKS_TO_OFS "Kopieer Sticks naar Subtrim"
#define TR_COPY_TRIMS_TO_OFS "Kopieer Trim naar Subtrim"
#define TR_INCDEC "Inc/Decrement"
#define TR_GLOBALVAR "Global Var"
#define TR_MIXSOURCE "Mixer Source"
#define TR_CONSTANT "Constant"
#define TR_PERSISTENT_MAH TR(INDENT "Str mAh", INDENT "Vasthouden mAh")
#define TR_PREFLIGHT "Preflight Checks"
#define TR_CHECKLIST TR(INDENT "Checklist", INDENT "Display Checklist")
Expand Down
4 changes: 4 additions & 0 deletions radio/src/translations/pl.h.txt
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,10 @@
#define TR_SMOOTH "Gładka"
#define TR_COPY_STICKS_TO_OFS "Skopiuj Drążki Do Offsetu"
#define TR_COPY_TRIMS_TO_OFS "Skopiuj Trymery Do subtrymerów"
#define TR_INCDEC "Inc/Decrement"
#define TR_GLOBALVAR "Global Var"
#define TR_MIXSOURCE "Mixer Source"
#define TR_CONSTANT "Constant"
#define TR_PERSISTENT_MAH TR(INDENT "Zap. mAh", INDENT "Zapisz mAh")
#define TR_PREFLIGHT "Lista Ostrzeżeń"
#define TR_CHECKLIST TR(INDENT "Czeklista",INDENT "Pokaż Listę Ostrzeżeń")
Expand Down
4 changes: 4 additions & 0 deletions radio/src/translations/pt.h.txt
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,10 @@
#define TR_SMOOTH "Smooth"
#define TR_COPY_STICKS_TO_OFS "Copy Sticks To Offset"
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
#define TR_INCDEC "Inc/Decrement"
#define TR_GLOBALVAR "Global Var"
#define TR_MIXSOURCE "Mixer Source"
#define TR_CONSTANT "Constant"
#define TR_PERSISTENT_MAH INDENT "Store mAh"
#define TR_PREFLIGHT "Preflight Checks"
#define TR_CHECKLIST INDENT "Display Checklist"
Expand Down
4 changes: 4 additions & 0 deletions radio/src/translations/se.h.txt
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,10 @@
#define TR_SMOOTH "Mjuk"
#define TR_COPY_STICKS_TO_OFS "Spara spakar som offset"
#define TR_COPY_TRIMS_TO_OFS "Spara trimmar som offset"
#define TR_INCDEC "Inc/Decrement"
#define TR_GLOBALVAR "Global Var"
#define TR_MIXSOURCE "Mixer Source"
#define TR_CONSTANT "Constant"
#define TR_PERSISTENT_MAH INDENT "Lagra mAh"
#define TR_PREFLIGHT "Startkontroller"
#define TR_CHECKLIST TR(INDENT "Checklista", INDENT "Visa Checklista")
Expand Down

0 comments on commit 3f48f28

Please sign in to comment.