[All] Code refactoring
- keys beep and haptic refactoring (not anymore audio events) - trims move/mid/min/max refactoring (trim end splitted to trim min / trim max) - S6R new alarms - S6R servos/rx status displayed as a text (not an integer which has no sense) - Timer countdown configuration - The splash was not displayed (but the timeout was there) after the first calibration
This commit is contained in:
@@ -186,7 +186,7 @@ bool menuGeneralSdManager(evt_t _event)
|
||||
killEvents(_event);
|
||||
POPUP_MENU_ADD_ITEM(STR_SD_INFO);
|
||||
POPUP_MENU_ADD_ITEM(STR_SD_FORMAT);
|
||||
popupMenuHandler = onSdManagerMenu;
|
||||
POPUP_MENU_START(onSdManagerMenu);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@@ -248,7 +248,7 @@ bool menuGeneralSdManager(evt_t _event)
|
||||
if (IS_FILE(line))
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE_FILE);
|
||||
}
|
||||
popupMenuHandler = onSdManagerMenu;
|
||||
POPUP_MENU_START(onSdManagerMenu);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ bool menuModelCurveOne(evt_t event)
|
||||
POPUP_MENU_ADD_ITEM(STR_CURVE_PRESET);
|
||||
POPUP_MENU_ADD_ITEM(STR_MIRROR);
|
||||
POPUP_MENU_ADD_ITEM(STR_CLEAR);
|
||||
popupMenuHandler = onCurveOneMenu;
|
||||
POPUP_MENU_START(onCurveOneMenu);
|
||||
}
|
||||
break;
|
||||
// TODO?
|
||||
|
||||
@@ -158,7 +158,7 @@ bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
|
||||
break;
|
||||
}
|
||||
}
|
||||
popupMenuHandler = onCustomFunctionsMenu;
|
||||
POPUP_MENU_START(onCustomFunctionsMenu);
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
@@ -285,7 +285,7 @@ bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
|
||||
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
}
|
||||
if (sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), cfn->play.name)) {
|
||||
popupMenuHandler = onCustomFunctionsFileSelectionMenu;
|
||||
POPUP_MENU_START(onCustomFunctionsFileSelectionMenu);
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
|
||||
@@ -370,7 +370,7 @@ bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
|
||||
POPUP_MENU_ADD_ITEM(STR_GLOBALVAR);
|
||||
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_INCDEC)
|
||||
POPUP_MENU_ADD_ITEM(STR_INCDEC);
|
||||
popupMenuHandler = onAdjustGvarSourceLongEnterPress;
|
||||
POPUP_MENU_START(onAdjustGvarSourceLongEnterPress);
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ bool menuModelCustomScriptOne(evt_t event)
|
||||
if (attr && event==EVT_KEY_FIRST(KEY_ENTER) && !READ_ONLY()) {
|
||||
killEvents(KEY_ENTER);
|
||||
if (sdListFiles(SCRIPTS_MIXES_PATH, SCRIPTS_EXT, sizeof(sd.file), sd.file, LIST_NONE_SD_FILE)) {
|
||||
popupMenuHandler = onModelCustomScriptMenu;
|
||||
POPUP_MENU_START(onModelCustomScriptMenu);
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
|
||||
|
||||
@@ -103,7 +103,7 @@ bool menuModelGVars(evt_t event)
|
||||
else
|
||||
POPUP_MENU_ADD_ITEM(STR_ENABLE_POPUP);
|
||||
POPUP_MENU_ADD_ITEM(STR_CLEAR);
|
||||
popupMenuHandler = onGVARSMenu;
|
||||
POPUP_MENU_START(onGVARSMenu);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -445,7 +445,7 @@ bool menuModelExposAll(evt_t event)
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||
POPUP_MENU_ADD_ITEM(STR_MOVE);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE);
|
||||
popupMenuHandler = onExposMenu;
|
||||
POPUP_MENU_START(onExposMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ bool menuModelLimits(evt_t 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);
|
||||
popupMenuHandler = onLimitsMenu;
|
||||
POPUP_MENU_START(onLimitsMenu);
|
||||
}
|
||||
|
||||
for (uint8_t j=0; j<ITEM_LIMITS_COUNT; j++) {
|
||||
|
||||
@@ -96,7 +96,7 @@ bool menuModelLogicalSwitches(evt_t event)
|
||||
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);
|
||||
popupMenuHandler = onLogicalSwitchesMenu;
|
||||
POPUP_MENU_START(onLogicalSwitchesMenu);
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; ++i) {
|
||||
|
||||
@@ -416,7 +416,7 @@ bool menuModelMixAll(evt_t event)
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||
POPUP_MENU_ADD_ITEM(STR_MOVE);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE);
|
||||
popupMenuHandler = onMixesMenu;
|
||||
POPUP_MENU_START(onMixesMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ void onModelSelectMenu(const char * result)
|
||||
SET_WARNING_INFO(currentModel->name, LEN_MODEL_FILENAME, 0);
|
||||
}
|
||||
else if (result == STR_CHANGE_CATEGORY) {
|
||||
|
||||
|
||||
}
|
||||
else if (result == STR_DUPLICATE_MODEL) {
|
||||
char duplicatedFilename[LEN_MODEL_FILENAME+1];
|
||||
@@ -194,7 +194,7 @@ bool menuModelSelect(evt_t event)
|
||||
if (currentCategoryIndex > 0) {
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE_CATEGORY);
|
||||
}
|
||||
popupMenuHandler = onCategorySelectMenu;
|
||||
POPUP_MENU_START(onCategorySelectMenu);
|
||||
}
|
||||
else if (selectMode == MODE_SELECT_MODEL) {
|
||||
killEvents(event);
|
||||
@@ -212,7 +212,7 @@ bool menuModelSelect(evt_t event)
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE_MODEL);
|
||||
// POPUP_MENU_ADD_ITEM(STR_CREATE_MODEL);
|
||||
// POPUP_MENU_ADD_ITEM(STR_RESTORE_MODEL);
|
||||
popupMenuHandler = onModelSelectMenu;
|
||||
POPUP_MENU_START(onModelSelectMenu);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ enum menuModelSetupItems {
|
||||
};
|
||||
|
||||
#define MODEL_SETUP_2ND_COLUMN 200
|
||||
#define MODEL_SETUP_3RD_COLUMN 270
|
||||
#define MODEL_SETUP_BIND_OFS 40
|
||||
#define MODEL_SETUP_RANGE_OFS 80
|
||||
#define MODEL_SETUP_SET_FAILSAFE_OFS 100
|
||||
@@ -99,28 +100,28 @@ void onModelSetupBitmapMenu(const char *result)
|
||||
|
||||
void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, evt_t event)
|
||||
{
|
||||
TimerData * timer = &g_model.timers[timerIdx];
|
||||
TimerData & timer = g_model.timers[timerIdx];
|
||||
if (attr && menuHorizontalPosition < 0) {
|
||||
lcdDrawSolidFilledRect(MODEL_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN+1, 115+2*INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
drawStringWithIndex(MENUS_MARGIN_LEFT, y, STR_TIMER, timerIdx+1);
|
||||
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, (menuHorizontalPosition<=0 ? attr : 0));
|
||||
putsTimer(MODEL_SETUP_2ND_COLUMN+50, y, timer->start, (menuHorizontalPosition!=0 ? attr|TIMEHOUR : TIMEHOUR));
|
||||
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer.mode, (menuHorizontalPosition<=0 ? attr : 0));
|
||||
putsTimer(MODEL_SETUP_2ND_COLUMN+50, y, timer.start, (menuHorizontalPosition!=0 ? attr|TIMEHOUR : TIMEHOUR));
|
||||
if (attr && s_editMode>0) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
{
|
||||
int8_t timerMode = timer->mode;
|
||||
int8_t timerMode = timer.mode;
|
||||
if (timerMode < 0) timerMode -= TMRMODE_COUNT-1;
|
||||
CHECK_INCDEC_MODELVAR_CHECK(event, timerMode, -TMRMODE_COUNT-SWSRC_LAST+1, TMRMODE_COUNT+SWSRC_LAST-1, isSwitchAvailableInTimers);
|
||||
if (timerMode < 0) timerMode += TMRMODE_COUNT-1;
|
||||
timer->mode = timerMode;
|
||||
timer.mode = timerMode;
|
||||
#if defined(AUTOSWITCH)
|
||||
if (s_editMode>0) {
|
||||
int8_t val = timer->mode - (TMRMODE_COUNT-1);
|
||||
int8_t val = timer.mode - (TMRMODE_COUNT-1);
|
||||
int8_t switchVal = checkIncDecMovedSwitch(val);
|
||||
if (val != switchVal) {
|
||||
timer->mode = switchVal + (TMRMODE_COUNT-1);
|
||||
timer.mode = switchVal + (TMRMODE_COUNT-1);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
@@ -130,13 +131,33 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, evt_t event)
|
||||
case 1:
|
||||
{
|
||||
const int stopsMinutes[] = { 8, 60, 120, 180, 240, 300, 600, 900, 1200 };
|
||||
timer->start = checkIncDec(event, timer->start, 0, 60*60, EE_MODEL, NULL, (const CheckIncDecStops&)stopsMinutes);
|
||||
timer.start = checkIncDec(event, timer.start, 0, 60*60, EE_MODEL, NULL, (const CheckIncDecStops&)stopsMinutes);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, evt_t event)
|
||||
{
|
||||
TimerData & timer = g_model.timers[timerIdx];
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BEEPCOUNTDOWN);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VBEEPCOUNTDOWN, timer.countdownBeep, (menuHorizontalPosition == 0 ? attr : 0));
|
||||
if (timer.countdownBeep != COUNTDOWN_SILENT) {
|
||||
lcdDrawNumber(MODEL_SETUP_3RD_COLUMN, y, TIMER_COUNTDOWN_START(timerIdx), (menuHorizontalPosition == 1 ? attr : 0) | LEFT, 0, NULL, "s");
|
||||
}
|
||||
if (attr && s_editMode > 0) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, timer.countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT - 1);
|
||||
break;
|
||||
case 1:
|
||||
timer.countdownStart = -checkIncDecModel(event, -timer.countdownStart, -1, +2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define CURRENT_MODULE_EDITED(k) (k>=ITEM_MODEL_TRAINER_LABEL ? TRAINER_MODULE : (k>=ITEM_MODEL_EXTERNAL_MODULE_LABEL ? EXTERNAL_MODULE : INTERNAL_MODULE))
|
||||
|
||||
int getSwitchWarningsCount()
|
||||
@@ -236,7 +257,7 @@ bool menuModelSetup(evt_t event)
|
||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
|
||||
s_editMode = 0;
|
||||
if (sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), g_model.header.bitmap, LIST_NONE_SD_FILE)) {
|
||||
popupMenuHandler = onModelSetupBitmapMenu;
|
||||
POPUP_MENU_START(onModelSetupBitmapMenu);
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(STR_NO_BITMAPS_ON_SD);
|
||||
@@ -259,8 +280,7 @@ bool menuModelSetup(evt_t event)
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TIMER1_COUNTDOWN_BEEP:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BEEPCOUNTDOWN);
|
||||
g_model.timers[0].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_VBEEPCOUNTDOWN, g_model.timers[0].countdownBeep, 0, 2, attr, event);
|
||||
editTimerCountdown(0, y, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TIMER1_PERSISTENT:
|
||||
@@ -284,8 +304,7 @@ bool menuModelSetup(evt_t event)
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TIMER2_COUNTDOWN_BEEP:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BEEPCOUNTDOWN);
|
||||
g_model.timers[1].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_VBEEPCOUNTDOWN, g_model.timers[1].countdownBeep, 0, 2, attr, event);
|
||||
editTimerCountdown(1, y, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TIMER2_PERSISTENT:
|
||||
@@ -310,8 +329,7 @@ bool menuModelSetup(evt_t event)
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TIMER3_COUNTDOWN_BEEP:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BEEPCOUNTDOWN);
|
||||
g_model.timers[2].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_VBEEPCOUNTDOWN, g_model.timers[2].countdownBeep, 0, 2, attr, event);
|
||||
editTimerCountdown(2, y, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TIMER3_PERSISTENT:
|
||||
@@ -529,7 +547,7 @@ bool menuModelSetup(evt_t event)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ITEM_MODEL_INTERNAL_MODULE_ANTENNA:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_ANTENNASELECTION);
|
||||
newAntennaSel = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_VANTENNATYPES, g_model.moduleData[INTERNAL_MODULE].ppm.pulsePol, 0, 1, attr, event);
|
||||
@@ -556,9 +574,9 @@ bool menuModelSetup(evt_t event)
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MODE);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].type, (menuHorizontalPosition==0 ? attr : 0));
|
||||
if (IS_MODULE_XJT(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+70, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, (menuHorizontalPosition==1 ? attr : 0));
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, (menuHorizontalPosition==1 ? attr : 0));
|
||||
else if (IS_MODULE_DSM2(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+70, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, (menuHorizontalPosition==1 ? attr : 0));
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, (menuHorizontalPosition==1 ? attr : 0));
|
||||
if (attr && s_editMode>0) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
|
||||
@@ -447,7 +447,7 @@ bool menuModelTelemetry(evt_t event)
|
||||
POPUP_MENU_ADD_ITEM(STR_EDIT);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE);
|
||||
popupMenuHandler = onSensorMenu;
|
||||
POPUP_MENU_START(onSensorMenu);
|
||||
}
|
||||
else if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
pushMenu(menuModelSensor);
|
||||
|
||||
@@ -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
|
||||
*
|
||||
@@ -30,6 +30,7 @@ void popMenu()
|
||||
assert(menuLevel>0);
|
||||
menuLevel = menuLevel-1;
|
||||
menuEvent = EVT_ENTRY_UP;
|
||||
AUDIO_KEY_PRESS();
|
||||
TRACE("popMenu(%d)", menuLevel);
|
||||
}
|
||||
|
||||
@@ -37,6 +38,7 @@ void chainMenu(MenuHandlerFunc newMenu)
|
||||
{
|
||||
menuHandlers[menuLevel] = newMenu;
|
||||
menuEvent = EVT_ENTRY;
|
||||
AUDIO_KEY_PRESS();
|
||||
TRACE("chainMenu(%d, %p)", menuLevel, newMenu);
|
||||
}
|
||||
|
||||
@@ -60,6 +62,7 @@ void pushMenu(MenuHandlerFunc newMenu)
|
||||
|
||||
menuHandlers[menuLevel] = newMenu;
|
||||
menuEvent = EVT_ENTRY;
|
||||
AUDIO_KEY_PRESS();
|
||||
TRACE("pushMenu(%d, %p)", menuLevel, newMenu);
|
||||
}
|
||||
|
||||
|
||||
@@ -487,6 +487,7 @@ extern uint8_t warningInfoFlags;
|
||||
|
||||
#define NAVIGATION_MENUS
|
||||
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuNoItems < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuNoItems++] = s; } while (0)
|
||||
#define POPUP_MENU_START(func) do { popupMenuHandler = (func); AUDIO_KEY_PRESS(); } while(0)
|
||||
#define POPUP_MENU_MAX_LINES 12
|
||||
#define MENU_MAX_DISPLAY_LINES 9
|
||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
|
||||
|
||||
@@ -159,14 +159,9 @@ int checkIncDec(evt_t event, int val, int i_min, int i_max, unsigned int i_flags
|
||||
newval++;
|
||||
}
|
||||
} while (isValueAvailable && !isValueAvailable(newval) && newval<=i_max);
|
||||
|
||||
if (newval > i_max) {
|
||||
newval = val;
|
||||
killEvents(event);
|
||||
AUDIO_WARNING2();
|
||||
}
|
||||
else {
|
||||
AUDIO_KEYPAD_UP();
|
||||
AUDIO_KEY_ERROR();
|
||||
}
|
||||
}
|
||||
else if (s_editMode>0 && event==EVT_ROTARY_LEFT) {
|
||||
@@ -178,14 +173,9 @@ int checkIncDec(evt_t event, int val, int i_min, int i_max, unsigned int i_flags
|
||||
newval--;
|
||||
}
|
||||
} while (isValueAvailable && !isValueAvailable(newval) && newval>=i_min);
|
||||
|
||||
if (newval < i_min) {
|
||||
newval = val;
|
||||
killEvents(event);
|
||||
AUDIO_WARNING2();
|
||||
}
|
||||
else {
|
||||
AUDIO_KEYPAD_DOWN();
|
||||
AUDIO_KEY_ERROR();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,28 +208,11 @@ int checkIncDec(evt_t event, int val, int i_min, int i_max, unsigned int i_flags
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (newval > i_max || newval < i_min) {
|
||||
newval = (newval > i_max ? i_max : i_min);
|
||||
killEvents(event);
|
||||
AUDIO_WARNING2();
|
||||
}
|
||||
|
||||
|
||||
if (newval != val) {
|
||||
#if 0
|
||||
if (!(i_flags & NO_INCDEC_MARKS) && (newval != i_max) && (newval != i_min) && stops.contains(newval) && !IS_ROTARY_EVENT(event)) {
|
||||
bool pause = (newval > val ? !stops.contains(newval+1) : !stops.contains(newval-1));
|
||||
if (pause) {
|
||||
pauseEvents(event); // delay before auto-repeat continues
|
||||
if (newval>val) // without AUDIO it's optimized, because the 2 sounds are the same
|
||||
AUDIO_KEYPAD_UP();
|
||||
else
|
||||
AUDIO_KEYPAD_DOWN();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
storageDirty(i_flags & (EE_GENERAL|EE_MODEL));
|
||||
checkIncDec_Ret = (newval > val ? 1 : -1);
|
||||
AUDIO_KEY_PRESS();
|
||||
}
|
||||
else {
|
||||
checkIncDec_Ret = 0;
|
||||
@@ -285,7 +258,7 @@ int checkIncDec(evt_t event, int val, int i_min, int i_max, unsigned int i_flags
|
||||
}
|
||||
}
|
||||
}
|
||||
popupMenuHandler = onSourceLongEnterPress;
|
||||
POPUP_MENU_START(onSourceLongEnterPress);
|
||||
}
|
||||
if (checkIncDecSelection != 0) {
|
||||
newval = checkIncDecSelection;
|
||||
@@ -310,7 +283,7 @@ int checkIncDec(evt_t event, int val, int i_min, int i_max, unsigned int i_flags
|
||||
}
|
||||
if (isValueAvailable && isValueAvailable(SWSRC_ON)) POPUP_MENU_ADD_ITEM(STR_MENU_OTHER);
|
||||
if (isValueAvailable && isValueAvailable(-newval)) POPUP_MENU_ADD_ITEM(STR_MENU_INVERT);
|
||||
popupMenuHandler = onSwitchLongEnterPress;
|
||||
POPUP_MENU_START(onSwitchLongEnterPress);
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
}
|
||||
if (checkIncDecSelection != 0) {
|
||||
@@ -450,15 +423,18 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
|
||||
if (s_editMode > 1) break;
|
||||
if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
|
||||
menuHorizontalPosition = 0;
|
||||
AUDIO_KEY_PRESS();
|
||||
}
|
||||
else if (READ_ONLY_UNLOCKED() && rowcount > 0) {
|
||||
s_editMode = (s_editMode<=0);
|
||||
AUDIO_KEY_PRESS();
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
if (s_editMode > 0) {
|
||||
s_editMode = 0;
|
||||
AUDIO_KEY_PRESS();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -468,6 +444,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
|
||||
|
||||
if (menuHorizontalPosition >= 0 && (COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE)) {
|
||||
menuHorizontalPosition = -1;
|
||||
AUDIO_KEY_PRESS();
|
||||
}
|
||||
else {
|
||||
uint8_t posVertInit = MENU_FIRST_LINE_EDIT;
|
||||
@@ -475,6 +452,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
|
||||
menuVerticalOffset = 0;
|
||||
menuVerticalPosition = posVertInit;
|
||||
menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition);
|
||||
AUDIO_KEY_PRESS();
|
||||
}
|
||||
else if (!calibrationState) {
|
||||
popMenu();
|
||||
@@ -483,6 +461,8 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
AUDIO_KEY_PRESS();
|
||||
// no break
|
||||
case EVT_KEY_REPT(KEY_RIGHT):
|
||||
if (s_editMode == 0) {
|
||||
INC(menuHorizontalPosition, 0, maxcol);
|
||||
@@ -490,6 +470,8 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_LEFT):
|
||||
AUDIO_KEY_PRESS();
|
||||
// no break
|
||||
case EVT_KEY_REPT(KEY_LEFT):
|
||||
if (s_editMode == 0) {
|
||||
DEC(menuHorizontalPosition, 0, maxcol);
|
||||
@@ -498,6 +480,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
|
||||
|
||||
case EVT_ROTARY_RIGHT:
|
||||
if (s_editMode != 0) break;
|
||||
AUDIO_KEY_PRESS();
|
||||
if ((COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE)) {
|
||||
if (menuHorizontalPosition >= 0) {
|
||||
INC(menuHorizontalPosition, 0, maxcol);
|
||||
@@ -512,10 +495,12 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
|
||||
INC(menuVerticalPosition, MENU_FIRST_LINE_EDIT, rowcount-1);
|
||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(menuVerticalPosition));
|
||||
menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition);
|
||||
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_LEFT:
|
||||
if (s_editMode != 0) break;
|
||||
AUDIO_KEY_PRESS();
|
||||
if ((COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE)) {
|
||||
if (menuHorizontalPosition >= 0) {
|
||||
DEC(menuHorizontalPosition, 0, maxcol);
|
||||
|
||||
@@ -94,7 +94,7 @@ bool editZoneOption(coord_t y, const ZoneOption * option, ZoneOptionValue * valu
|
||||
s_editMode = 0;
|
||||
if (sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(value->stringValue), value->stringValue, LIST_NONE_SD_FILE)) {
|
||||
fileSelectionDone = false;
|
||||
popupMenuHandler = onZoneOptionFileSelectionMenu;
|
||||
POPUP_MENU_START(onZoneOptionFileSelectionMenu);
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(STR_NO_BITMAPS_ON_SD);
|
||||
@@ -330,7 +330,7 @@ bool menuWidgetsSetup(evt_t event)
|
||||
if (currentWidget->getFactory()->getOptions())
|
||||
POPUP_MENU_ADD_ITEM(STR_WIDGET_SETTINGS);
|
||||
POPUP_MENU_ADD_ITEM(STR_REMOVE_WIDGET);
|
||||
popupMenuHandler = onZoneMenu;
|
||||
POPUP_MENU_START(onZoneMenu);
|
||||
}
|
||||
else {
|
||||
onZoneMenu(STR_SELECT_WIDGET);
|
||||
|
||||
@@ -144,7 +144,7 @@ bool menuMainView(evt_t event)
|
||||
POPUP_MENU_ADD_ITEM(STR_STATISTICS);
|
||||
POPUP_MENU_ADD_ITEM(STR_SETUP_SCREENS);
|
||||
POPUP_MENU_ADD_ITEM(STR_ABOUT_US);
|
||||
popupMenuHandler = onMainViewMenu;
|
||||
POPUP_MENU_START(onMainViewMenu);
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_MODEL):
|
||||
@@ -179,7 +179,6 @@ bool menuMainView(evt_t event)
|
||||
gvarDisplayTimer = 0;
|
||||
}
|
||||
#endif
|
||||
AUDIO_KEYPAD_UP();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,9 @@ bool menuStatsGraph(evt_t event)
|
||||
storageDirty(EE_GENERAL);
|
||||
sessionTimer = 0;
|
||||
killEvents(event);
|
||||
AUDIO_KEYPAD_UP();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
MENU("Statistics", STATS_ICONS, menuTabStats, e_StatsGraph, 0, { 0 });
|
||||
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP, "Session");
|
||||
@@ -107,7 +106,6 @@ bool menuStatsDebug(evt_t event)
|
||||
maxLuaInterval = 0;
|
||||
maxLuaDuration = 0;
|
||||
#endif
|
||||
AUDIO_KEYPAD_UP();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user