1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 14:25:11 +03:00

[X9E/X7D] Rotary encoder navigation speed implemented (#3724)

This commit is contained in:
Bertrand Songis 2016-08-27 18:19:44 +02:00 committed by Andre Bernet
parent 3cb64d984a
commit 1d735f2bd3
114 changed files with 785 additions and 865 deletions

View file

@ -440,7 +440,7 @@ bool isAudioFileReferenced(uint32_t i, char * filename)
{ {
uint8_t category = (i >> 24); uint8_t category = (i >> 24);
uint8_t index = (i >> 16) & 0xFF; uint8_t index = (i >> 16) & 0xFF;
uint8_t event = i & 0xFF; event_t event = i & 0xFF;
// TRACE("isAudioFileReferenced(%08x)", i); // TRACE("isAudioFileReferenced(%08x)", i);
@ -474,7 +474,7 @@ bool isAudioFileReferenced(uint32_t i, char * filename)
tmr10ms_t timeAutomaticPromptsSilence = 0; tmr10ms_t timeAutomaticPromptsSilence = 0;
void playModelEvent(uint8_t category, uint8_t index, uint8_t event) void playModelEvent(uint8_t category, uint8_t index, event_t event)
{ {
char filename[AUDIO_FILENAME_MAXLEN+1]; char filename[AUDIO_FILENAME_MAXLEN+1];
// TRACE("playModelEvent(): cat: %u, idx: %u, evt:%u", (uint32_t)category, (uint32_t)index, (uint32_t)event); // TRACE("playModelEvent(): cat: %u, idx: %u, evt:%u", (uint32_t)category, (uint32_t)index, (uint32_t)event);

View file

@ -380,7 +380,7 @@ void playModelName();
#if defined(SDCARD) #if defined(SDCARD)
extern tmr10ms_t timeAutomaticPromptsSilence; extern tmr10ms_t timeAutomaticPromptsSilence;
void playModelEvent(uint8_t category, uint8_t index, uint8_t event=0); void playModelEvent(uint8_t category, uint8_t index, event_t event=0);
#define PLAY_PHASE_OFF(phase) playModelEvent(PHASE_AUDIO_CATEGORY, phase, AUDIO_EVENT_OFF) #define PLAY_PHASE_OFF(phase) playModelEvent(PHASE_AUDIO_CATEGORY, phase, AUDIO_EVENT_OFF)
#define PLAY_PHASE_ON(phase) playModelEvent(PHASE_AUDIO_CATEGORY, phase, AUDIO_EVENT_ON) #define PLAY_PHASE_ON(phase) playModelEvent(PHASE_AUDIO_CATEGORY, phase, AUDIO_EVENT_ON)
#define PLAY_SWITCH_MOVED(sw) playModelEvent(SWITCH_AUDIO_CATEGORY, sw) #define PLAY_SWITCH_MOVED(sw) playModelEvent(SWITCH_AUDIO_CATEGORY, sw)

View file

@ -502,8 +502,8 @@ int cliDisplay(const char ** argv)
name[len] = '\0'; name[len] = '\0';
serialPrint("[%s] = %s", name, keyState(i) ? "on" : "off"); serialPrint("[%s] = %s", name, keyState(i) ? "on" : "off");
} }
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBX9E) || defined(PCBHORUS) || defined(PCBFLAMENCO) #if defined(ROTARY_ENCODER_NAVIGATION)
serialPrint("[Enc.] = %d", rotencValue / 2); serialPrint("[Enc.] = %d", rotencValue[0] / ROTARY_ENCODER_GRANULARITY);
#endif #endif
for (int i=TRM_BASE; i<=TRM_LAST; i++) { for (int i=TRM_BASE; i<=TRM_LAST; i++) {
serialPrint("[Trim%d] = %s", i-TRM_BASE, keyState(i) ? "on" : "off"); serialPrint("[Trim%d] = %s", i-TRM_BASE, keyState(i) ? "on" : "off");

View file

@ -118,7 +118,7 @@ enum TraceEvent {
struct TraceElement { struct TraceElement {
gtime_t time; gtime_t time;
uint8_t time_ms; uint8_t time_ms;
uint8_t event; event_t event;
uint32_t data; uint32_t data;
}; };

View file

@ -351,7 +351,7 @@ void evalFunctions()
#if ROTARY_ENCODERS > 1 #if ROTARY_ENCODERS > 1
case FUNC_RESET_ROTENC2: case FUNC_RESET_ROTENC2:
#endif #endif
g_rotenc[CFN_PARAM(cfn)-FUNC_RESET_ROTENC1] = 0; rotencValue[CFN_PARAM(cfn)-FUNC_RESET_ROTENC1] = 0;
break; break;
#endif #endif
} }
@ -423,7 +423,7 @@ void evalFunctions()
} }
#if defined(ROTARY_ENCODERS) #if defined(ROTARY_ENCODERS)
else if (CFN_PARAM(cfn) >= MIXSRC_REa && CFN_PARAM(cfn) < MIXSRC_TrimRud) { else if (CFN_PARAM(cfn) >= MIXSRC_REa && CFN_PARAM(cfn) < MIXSRC_TrimRud) {
int8_t scroll = rePreviousValues[CFN_PARAM(cfn)-MIXSRC_REa] - (g_rotenc[CFN_PARAM(cfn)-MIXSRC_REa] / ROTARY_ENCODER_GRANULARITY); int8_t scroll = rePreviousValues[CFN_PARAM(cfn)-MIXSRC_REa] - (rotencValue[CFN_PARAM(cfn)-MIXSRC_REa] / ROTARY_ENCODER_GRANULARITY);
if (scroll) { if (scroll) {
SET_GVAR(CFN_GVAR_INDEX(cfn), GVAR_VALUE(CFN_GVAR_INDEX(cfn), getGVarFlightMode(mixerCurrentFlightMode, CFN_GVAR_INDEX(cfn))) + scroll, mixerCurrentFlightMode); SET_GVAR(CFN_GVAR_INDEX(cfn), GVAR_VALUE(CFN_GVAR_INDEX(cfn), getGVarFlightMode(mixerCurrentFlightMode, CFN_GVAR_INDEX(cfn))) + scroll, mixerCurrentFlightMode);
} }
@ -612,7 +612,7 @@ void evalFunctions()
#if defined(ROTARY_ENCODERS) && defined(GVARS) #if defined(ROTARY_ENCODERS) && defined(GVARS)
for (uint8_t i=0; i<ROTARY_ENCODERS; i++) { for (uint8_t i=0; i<ROTARY_ENCODERS; i++) {
rePreviousValues[i] = (g_rotenc[i] / ROTARY_ENCODER_GRANULARITY); rePreviousValues[i] = (rotencValue[i] / ROTARY_ENCODER_GRANULARITY);
} }
#endif #endif
} }

View file

@ -146,21 +146,21 @@ extern const CheckIncDecStops &stopsSwitch;
const CheckIncDecStops &var = (const CheckIncDecStops&)_ ## var; const CheckIncDecStops &var = (const CheckIncDecStops&)_ ## var;
#define CATEGORY_END(val) \ #define CATEGORY_END(val) \
(val), (val+1) (val), (val+1)
int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int i_flags=0, IsValueAvailable isValueAvailable=NULL, const CheckIncDecStops &stops=stops100); int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_flags=0, IsValueAvailable isValueAvailable=NULL, const CheckIncDecStops &stops=stops100);
#else #else
int16_t checkIncDec(uint8_t event, int16_t i_pval, int16_t i_min, int16_t i_max, uint8_t i_flags=0); int16_t checkIncDec(event_t event, int16_t i_pval, int16_t i_min, int16_t i_max, uint8_t i_flags=0);
#endif #endif
int8_t checkIncDecMovedSwitch(int8_t val); int8_t checkIncDecMovedSwitch(int8_t val);
#if defined(CPUM64) #if defined(CPUM64)
int8_t checkIncDecModel(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max); int8_t checkIncDecModel(event_t event, int8_t i_val, int8_t i_min, int8_t i_max);
int8_t checkIncDecModelZero(uint8_t event, int8_t i_val, int8_t i_max); int8_t checkIncDecModelZero(event_t event, int8_t i_val, int8_t i_max);
int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max); int8_t checkIncDecGen(event_t event, int8_t i_val, int8_t i_min, int8_t i_max);
#else #else
#define checkIncDecModel(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_MODEL) #define checkIncDecModel(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_MODEL)
#define checkIncDecModelZero(event, i_val, i_max) checkIncDec(event, i_val, 0, i_max, EE_MODEL) #define checkIncDecModelZero(event, i_val, i_max) checkIncDec(event, i_val, 0, i_max, EE_MODEL)
#define checkIncDecGen(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_GENERAL) #define checkIncDecGen(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_GENERAL)
#endif #endif
#define CHECK_INCDEC_MODELVAR(event, var, min, max) \ #define CHECK_INCDEC_MODELVAR(event, var, min, max) \
@ -289,9 +289,9 @@ typedef int choice_t;
typedef int8_t choice_t; typedef int8_t choice_t;
#endif #endif
choice_t editChoice(coord_t x, coord_t y, const pm_char * label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, uint8_t event); choice_t editChoice(coord_t x, coord_t y, const pm_char * label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char * label, LcdFlags attr, uint8_t event); uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char * label, LcdFlags attr, event_t event);
int8_t editSwitch(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t event); int8_t editSwitch(coord_t x, coord_t y, int8_t value, LcdFlags attr, event_t event);
#define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = editCheckBox(value, x, y, label, attr, event) #define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = editCheckBox(value, x, y, label, attr, event)
@ -301,27 +301,29 @@ int8_t editSwitch(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t eve
#define GVAR_MENU_ITEM(x, y, v, min, max, attr, editflags, event) editGVarFieldValue(x, y, v, min, max, attr, event) #define GVAR_MENU_ITEM(x, y, v, min, max, attr, editflags, event) editGVarFieldValue(x, y, v, min, max, attr, event)
#endif #endif
#if defined(GVARS) #if defined(GVARS) && defined(CPUARM)
#if defined(CPUARM) int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, event_t event);
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, uint8_t event); #elif defined(GVARS)
#else int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, event_t event);
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event); // @@@ open.20.fsguruh
#endif
#define displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0)
#else #else
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event); int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, event_t event);
#define displayGVar(x, y, v, min, max) lcdDraw8bitsNumber(x, y, v)
#endif #endif
void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uint8_t active); #if defined(GVARS)
#define displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0)
#else
#define displayGVar(x, y, v, min, max) lcdDraw8bitsNumber(x, y, v)
#endif
void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active);
#if defined(CPUM64) #if defined(CPUM64)
#define editSingleName(x, y, label, name, size, event, active) editName(x, y, name, size, event, active) #define editSingleName(x, y, label, name, size, event, active) editName(x, y, name, size, event, active)
#else #else
void editSingleName(coord_t x, coord_t y, const pm_char *label, char *name, uint8_t size, uint8_t event, uint8_t active); void editSingleName(coord_t x, coord_t y, const pm_char * label, char * name, uint8_t size, event_t event, uint8_t active);
#endif #endif
uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, const pm_char * str, uint8_t delay); uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const pm_char * str, uint8_t delay);
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay) #define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay)
#define WARNING_TYPE_ASTERISK 0 #define WARNING_TYPE_ASTERISK 0
@ -358,7 +360,7 @@ void drawStatusLine();
#if defined(CPUARM) #if defined(CPUARM)
#define TEXT_FILENAME_MAXLEN 40 #define TEXT_FILENAME_MAXLEN 40
extern char s_text_file[TEXT_FILENAME_MAXLEN]; extern char s_text_file[TEXT_FILENAME_MAXLEN];
void menuTextView(uint8_t event); void menuTextView(event_t event);
void pushMenuTextView(const char *filename); void pushMenuTextView(const char *filename);
void pushModelNotes(); void pushModelNotes();
#endif #endif
@ -368,17 +370,21 @@ void drawStatusLine();
#define CURSOR_MOVED_LEFT(event) (IS_ROTARY_LEFT(event) || EVT_KEY_MASK(event) == KEY_LEFT) #define CURSOR_MOVED_LEFT(event) (IS_ROTARY_LEFT(event) || EVT_KEY_MASK(event) == KEY_LEFT)
#define CURSOR_MOVED_RIGHT(event) (IS_ROTARY_RIGHT(event) || EVT_KEY_MASK(event) == KEY_RIGHT) #define CURSOR_MOVED_RIGHT(event) (IS_ROTARY_RIGHT(event) || EVT_KEY_MASK(event) == KEY_RIGHT)
#if defined(ROTARY_ENCODERS)
#define CASE_EVT_ROTARY_BREAK case EVT_ROTARY_BREAK:
#define CASE_EVT_ROTARY_LONG case EVT_ROTARY_LONG:
#else
#define CASE_EVT_ROTARY_BREAK
#define CASE_EVT_ROTARY_LONG
#endif
#if defined(ROTARY_ENCODER_NAVIGATION) #if defined(ROTARY_ENCODER_NAVIGATION)
#define IS_ROTARY_LEFT(evt) (evt == EVT_ROTARY_LEFT) #define IS_ROTARY_LEFT(evt) (evt == EVT_ROTARY_LEFT)
#define IS_ROTARY_RIGHT(evt) (evt == EVT_ROTARY_RIGHT) #define IS_ROTARY_RIGHT(evt) (evt == EVT_ROTARY_RIGHT)
#define IS_ROTARY_BREAK(evt) (evt == EVT_ROTARY_BREAK) #define IS_ROTARY_BREAK(evt) (evt == EVT_ROTARY_BREAK)
#define IS_ROTARY_LONG(evt) (evt == EVT_ROTARY_LONG) #define IS_ROTARY_LONG(evt) (evt == EVT_ROTARY_LONG)
#define IS_ROTARY_EVENT(evt) (EVT_KEY_MASK(evt) >= 0x0e) #define IS_ROTARY_EVENT(evt) (EVT_KEY_MASK(evt) >= 0x0e)
#define CASE_EVT_ROTARY_BREAK case EVT_ROTARY_BREAK: void repeatLastCursorMove(event_t event);
#define CASE_EVT_ROTARY_LONG case EVT_ROTARY_LONG:
#define CASE_EVT_ROTARY_LEFT case EVT_ROTARY_LEFT:
#define CASE_EVT_ROTARY_RIGHT case EVT_ROTARY_RIGHT:
void repeatLastCursorMove(uint8_t event);
#define REPEAT_LAST_CURSOR_MOVE() { if (EVT_KEY_MASK(event) >= 0x0e) putEvent(event); else repeatLastCursorMove(event); } #define REPEAT_LAST_CURSOR_MOVE() { if (EVT_KEY_MASK(event) >= 0x0e) putEvent(event); else repeatLastCursorMove(event); }
#define MOVE_CURSOR_FROM_HERE() if (menuHorizontalPosition > 0) REPEAT_LAST_CURSOR_MOVE() #define MOVE_CURSOR_FROM_HERE() if (menuHorizontalPosition > 0) REPEAT_LAST_CURSOR_MOVE()
#else #else
@ -387,17 +393,17 @@ void drawStatusLine();
#define IS_ROTARY_BREAK(evt) (0) #define IS_ROTARY_BREAK(evt) (0)
#define IS_ROTARY_LONG(evt) (0) #define IS_ROTARY_LONG(evt) (0)
#define IS_ROTARY_EVENT(evt) (0) #define IS_ROTARY_EVENT(evt) (0)
#define CASE_EVT_ROTARY_BREAK void repeatLastCursorMove(event_t event);
#define CASE_EVT_ROTARY_LONG
#define CASE_EVT_ROTARY_LEFT
#define CASE_EVT_ROTARY_RIGHT
void repeatLastCursorMove(uint8_t event);
#define REPEAT_LAST_CURSOR_MOVE() repeatLastCursorMove(event) #define REPEAT_LAST_CURSOR_MOVE() repeatLastCursorMove(event)
#define MOVE_CURSOR_FROM_HERE() REPEAT_LAST_CURSOR_MOVE() #define MOVE_CURSOR_FROM_HERE() REPEAT_LAST_CURSOR_MOVE()
#endif #endif
#define POS_HORZ_INIT(posVert) 0 // TODO enum
#if defined(PCBX7D)
#define EDIT_MODE_INIT 0
#else
#define EDIT_MODE_INIT -1 #define EDIT_MODE_INIT -1
#endif
typedef int (*FnFuncP) (int x); typedef int (*FnFuncP) (int x);
void drawFunction(FnFuncP fn, uint8_t offset=0); void drawFunction(FnFuncP fn, uint8_t offset=0);
@ -457,12 +463,12 @@ void showAlertBox(const pm_char * title, const pm_char * text, const char * acti
#define IS_OTHER_VIEW_DISPLAYED() false #define IS_OTHER_VIEW_DISPLAYED() false
#if defined(CPUARM) #if defined(CPUARM)
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, LcdFlags flags); void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags);
#endif #endif
#if defined(FLIGHT_MODES) #if defined(FLIGHT_MODES)
void displayFlightModes(coord_t x, coord_t y, FlightModesType value); void displayFlightModes(coord_t x, coord_t y, FlightModesType value);
FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModesType value, uint8_t attr); FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModesType value, uint8_t attr);
#else #else
#define displayFlightModes(...) #define displayFlightModes(...)
#endif #endif

View file

@ -24,7 +24,7 @@
#include "view_mavlink.h" #include "view_mavlink.h"
#endif #endif
uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay) uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const pm_char * str, uint8_t delay)
{ {
lcdDrawTextAlignedLeft(y, str); lcdDrawTextAlignedLeft(y, str);
lcdDrawNumber(MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT); lcdDrawNumber(MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
@ -46,7 +46,7 @@ uint8_t s_copySrcCh;
#endif #endif
#if defined(PCBX7D) #if defined(PCBX7D)
void editName(coord_t x, coord_t y, char * name, uint8_t size, uint8_t event, uint8_t active/* TODO, uint8_t attr*/) void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active/* TODO, uint8_t attr*/)
{ {
LcdFlags attr = ZCHAR; // TODO in args LcdFlags attr = ZCHAR; // TODO in args
uint8_t mode = 0; uint8_t mode = 0;
@ -135,7 +135,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, uint8_t event, ui
} }
} }
#else #else
void editName(coord_t x, coord_t y, char * name, uint8_t size, uint8_t event, uint8_t active) void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active)
{ {
#if defined(CPUM64) #if defined(CPUM64)
// in order to save flash // in order to save flash
@ -221,7 +221,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, uint8_t event, ui
#endif #endif
#if !defined(CPUM64) #if !defined(CPUM64)
void editSingleName(coord_t x, coord_t y, const pm_char * label, char * name, uint8_t size, uint8_t event, uint8_t active) void editSingleName(coord_t x, coord_t y, const pm_char * label, char * name, uint8_t size, event_t event, uint8_t active)
{ {
lcdDrawTextAlignedLeft(y, label); lcdDrawTextAlignedLeft(y, label);
editName(x, y, name, size, event, active); editName(x, y, name, size, event, active);

View file

@ -21,7 +21,7 @@
#include "opentx.h" #include "opentx.h"
#if defined(CPUARM) #if defined(CPUARM)
void menuRadioSpecialFunctions(uint8_t event) void menuRadioSpecialFunctions(event_t event)
{ {
MENU(STR_MENUSPECIALFUNCS, menuTabGeneral, MENU_RADIO_SPECIAL_FUNCTIONS, HEADER_LINE+MAX_SPECIAL_FUNCTIONS, { HEADER_LINE_COLUMNS NAVIGATION_LINE_BY_LINE|4/*repeated*/ }); MENU(STR_MENUSPECIALFUNCS, menuTabGeneral, MENU_RADIO_SPECIAL_FUNCTIONS, HEADER_LINE+MAX_SPECIAL_FUNCTIONS, { HEADER_LINE_COLUMNS NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuSpecialFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext); return menuSpecialFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext);

View file

@ -61,7 +61,7 @@ void pushMenu(MenuHandlerFunc newMenu)
} }
#if defined(CPUARM) #if defined(CPUARM)
void menuModelNotes(uint8_t event) void menuModelNotes(event_t event)
{ {
if (event == EVT_ENTRY) { if (event == EVT_ENTRY) {
strcpy(s_text_file, MODELS_PATH "/"); strcpy(s_text_file, MODELS_PATH "/");

View file

@ -39,7 +39,7 @@ typedef uint16_t vertpos_t;
typedef uint8_t vertpos_t; typedef uint8_t vertpos_t;
#endif #endif
typedef void (*MenuHandlerFunc)(uint8_t event); typedef void (*MenuHandlerFunc)(event_t event);
#if defined(CPUARM) #if defined(CPUARM)
extern tmr10ms_t menuEntryTime; extern tmr10ms_t menuEntryTime;
@ -66,11 +66,11 @@ inline MenuHandlerFunc lastPopMenu()
void onMainViewMenu(const char * result); void onMainViewMenu(const char * result);
void menuFirstCalib(uint8_t event); void menuFirstCalib(event_t event);
void menuMainView(uint8_t event); void menuMainView(event_t event);
void menuViewTelemetryFrsky(uint8_t event); void menuViewTelemetryFrsky(event_t event);
void menuViewTelemetryMavlink(uint8_t event); void menuViewTelemetryMavlink(event_t event);
void menuSpecialFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext); void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext);
enum MenuRadioIndexes enum MenuRadioIndexes
{ {
@ -86,15 +86,15 @@ enum MenuRadioIndexes
MENU_RADIO_PAGES_COUNT MENU_RADIO_PAGES_COUNT
}; };
void menuRadioSetup(uint8_t event); void menuRadioSetup(event_t event);
void menuRadioSdManager(uint8_t event); void menuRadioSdManager(event_t event);
void menuRadioSpecialFunctions(uint8_t event); void menuRadioSpecialFunctions(event_t event);
void menuRadioTrainer(uint8_t event); void menuRadioTrainer(event_t event);
void menuRadioVersion(uint8_t event); void menuRadioVersion(event_t event);
void menuRadioDiagKeys(uint8_t event); void menuRadioDiagKeys(event_t event);
void menuRadioDiagAnalogs(uint8_t event); void menuRadioDiagAnalogs(event_t event);
void menuRadioHardware(uint8_t event); void menuRadioHardware(event_t event);
void menuRadioCalibration(uint8_t event); void menuRadioCalibration(event_t event);
static const MenuHandlerFunc menuTabGeneral[] PROGMEM = { static const MenuHandlerFunc menuTabGeneral[] PROGMEM = {
menuRadioSetup, menuRadioSetup,
@ -126,23 +126,23 @@ enum MenuModelIndexes {
MENU_MODEL_PAGES_COUNT MENU_MODEL_PAGES_COUNT
}; };
void menuModelSelect(uint8_t event); void menuModelSelect(event_t event);
void menuModelSetup(uint8_t event); void menuModelSetup(event_t event);
void menuModelHeli(uint8_t event); void menuModelHeli(event_t event);
void menuModelFlightModesAll(uint8_t event); void menuModelFlightModesAll(event_t event);
void menuModelExposAll(uint8_t event); void menuModelExposAll(event_t event);
void menuModelMixAll(uint8_t event); void menuModelMixAll(event_t event);
void menuModelLimits(uint8_t event); void menuModelLimits(event_t event);
void menuModelCurvesAll(uint8_t event); void menuModelCurvesAll(event_t event);
void menuModelCurveOne(uint8_t event); void menuModelCurveOne(event_t event);
void menuModelGVars(uint8_t event); void menuModelGVars(event_t event);
void menuModelLogicalSwitches(uint8_t event); void menuModelLogicalSwitches(event_t event);
void menuModelSpecialFunctions(uint8_t event); void menuModelSpecialFunctions(event_t event);
void menuModelTelemetryFrsky(uint8_t event); void menuModelTelemetryFrsky(event_t event);
void menuModelTelemetryMavlink(uint8_t event); void menuModelTelemetryMavlink(event_t event);
void menuModelDisplay(uint8_t event); void menuModelDisplay(event_t event);
void menuModelTemplates(uint8_t event); void menuModelTemplates(event_t event);
void menuModelExpoOne(uint8_t event); void menuModelExpoOne(event_t event);
static const MenuHandlerFunc menuTabModel[] PROGMEM = { static const MenuHandlerFunc menuTabModel[] PROGMEM = {
menuModelSelect, menuModelSelect,
@ -161,12 +161,12 @@ static const MenuHandlerFunc menuTabModel[] PROGMEM = {
CASE_TEMPLATES(menuModelTemplates) CASE_TEMPLATES(menuModelTemplates)
}; };
void menuStatisticsView(uint8_t event); void menuStatisticsView(event_t event);
void menuStatisticsDebug(uint8_t event); void menuStatisticsDebug(event_t event);
void menuAboutView(uint8_t event); void menuAboutView(event_t event);
#if defined(DEBUG_TRACE_BUFFER) #if defined(DEBUG_TRACE_BUFFER)
void menuTraceBuffer(uint8_t event); void menuTraceBuffer(event_t event);
#endif #endif
#endif // _MENUS_H_ #endif // _MENUS_H_

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void displayPresetChoice(uint8_t event) void displayPresetChoice(event_t event)
{ {
runPopupWarning(event); runPopupWarning(event);
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45*warningInputValue/4, LEFT|INVERS); lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45*warningInputValue/4, LEFT|INVERS);
@ -64,7 +64,7 @@ void onCurveOneMenu(const char * result)
} }
} }
void menuModelCurveOne(uint8_t event) void menuModelCurveOne(event_t event)
{ {
CurveData & crv = g_model.curves[s_curveChan]; CurveData & crv = g_model.curves[s_curveChan];
int8_t * points = curveAddress(s_curveChan); int8_t * points = curveAddress(s_curveChan);

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void menuModelCurveOne(uint8_t event) void menuModelCurveOne(event_t event)
{ {
TITLE(STR_MENUCURVE); TITLE(STR_MENUCURVE);
lcdDrawNumber(PSIZE(TR_MENUCURVE)*FW+1, 0, s_curveChan+1, INVERS|LEFT); lcdDrawNumber(PSIZE(TR_MENUCURVE)*FW+1, 0, s_curveChan+1, INVERS|LEFT);

View file

@ -82,7 +82,7 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
} }
#endif #endif
void menuModelDisplay(uint8_t event) void menuModelDisplay(event_t event)
{ {
MENU(STR_MENU_DISPLAY, menuTabModel, MENU_MODEL_DISPLAY, HEADER_LINE + ITEM_DISPLAY_MAX, { HEADER_LINE_COLUMNS TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), TELEMETRY_SCREEN_ROWS(2), TELEMETRY_SCREEN_ROWS(3) }); MENU(STR_MENU_DISPLAY, menuTabModel, MENU_MODEL_DISPLAY, HEADER_LINE + ITEM_DISPLAY_MAX, { HEADER_LINE_COLUMNS TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), TELEMETRY_SCREEN_ROWS(2), TELEMETRY_SCREEN_ROWS(3) });

View file

@ -32,7 +32,7 @@ void displayFlightModes(coord_t x, coord_t y, FlightModesType value)
} }
#if !defined(CPUARM) #if !defined(CPUARM)
FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModesType value, uint8_t attr) FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModesType value, uint8_t attr)
{ {
drawFieldLabel(x, y, STR_FLMODE); drawFieldLabel(x, y, STR_FLMODE);
@ -84,7 +84,7 @@ bool isTrimModeAvailable(int mode)
return (mode < 0 || (mode%2) == 0 || (mode/2) != s_currIdx); return (mode < 0 || (mode%2) == 0 || (mode/2) != s_currIdx);
} }
void menuModelPhaseOne(uint8_t event) void menuModelPhaseOne(event_t event)
{ {
FlightModeData * fm = flightModeAddress(s_currIdx); FlightModeData * fm = flightModeAddress(s_currIdx);
drawFlightMode(13*FW, 0, s_currIdx+1, (getFlightMode()==s_currIdx ? BOLD : 0)); drawFlightMode(13*FW, 0, s_currIdx+1, (getFlightMode()==s_currIdx ? BOLD : 0));
@ -246,7 +246,7 @@ void menuModelPhaseOne(uint8_t event)
#define TRIMS_OFS (FW/2) #define TRIMS_OFS (FW/2)
#endif #endif
void menuModelFlightModesAll(uint8_t event) void menuModelFlightModesAll(event_t event)
{ {
SIMPLE_MENU(STR_MENUFLIGHTMODES, menuTabModel, MENU_MODEL_FLIGHT_MODES, HEADER_LINE+MAX_FLIGHT_MODES+1); SIMPLE_MENU(STR_MENUFLIGHTMODES, menuTabModel, MENU_MODEL_FLIGHT_MODES, HEADER_LINE+MAX_FLIGHT_MODES+1);

View file

@ -175,7 +175,7 @@ enum ExposFields {
EXPO_FIELD_MAX EXPO_FIELD_MAX
}; };
void menuModelExpoOne(uint8_t event) void menuModelExpoOne(event_t event)
{ {
if (event == EVT_KEY_LONG(KEY_MENU)) { if (event == EVT_KEY_LONG(KEY_MENU)) {
// TODO pushMenu(menuChannelsView); // TODO pushMenu(menuChannelsView);
@ -350,7 +350,7 @@ void displayExpoLine(coord_t y, ExpoData * ed)
displayFlightModes(EXPO_LINE_INFOS_POS, y, ed->flightModes); displayFlightModes(EXPO_LINE_INFOS_POS, y, ed->flightModes);
} }
void menuModelExposAll(uint8_t event) void menuModelExposAll(event_t event)
{ {
int8_t sub = menuVerticalPosition - HEADER_LINE; int8_t sub = menuVerticalPosition - HEADER_LINE;

View file

@ -229,7 +229,7 @@ enum ExposFields {
#define CURVE_ROWS 0 #define CURVE_ROWS 0
void menuModelExpoOne(uint8_t event) void menuModelExpoOne(event_t event)
{ {
ExpoData * ed = expoAddress(s_currIdx); ExpoData * ed = expoAddress(s_currIdx);
drawSource(7*FW+FW/2, 0, MIXSRC_Rud+ed->chn, 0); drawSource(7*FW+FW/2, 0, MIXSRC_Rud+ed->chn, 0);
@ -339,7 +339,7 @@ enum MixFields {
MIX_FIELD_COUNT MIX_FIELD_COUNT
}; };
void gvarWeightItem(coord_t x, coord_t y, MixData *md, uint8_t attr, uint8_t event) void gvarWeightItem(coord_t x, coord_t y, MixData * md, uint8_t attr, event_t event)
{ {
u_int8int16_t weight; u_int8int16_t weight;
MD_WEIGHT_TO_UNION(md, weight); MD_WEIGHT_TO_UNION(md, weight);
@ -400,7 +400,7 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
#undef GAUGE_HEIGHT #undef GAUGE_HEIGHT
#endif #endif
void menuModelMixOne(uint8_t event) void menuModelMixOne(event_t event)
{ {
TITLE(STR_MIXER); TITLE(STR_MIXER);
MixData * md2 = mixAddress(s_currIdx) ; MixData * md2 = mixAddress(s_currIdx) ;
@ -658,7 +658,7 @@ void displayExpoLine(coord_t y, ExpoData *ed)
displayFlightModes(EXPO_LINE_FM_POS, y, ed->flightModes) displayFlightModes(EXPO_LINE_FM_POS, y, ed->flightModes)
#endif #endif
void menuModelExpoMix(uint8_t expo, uint8_t event) void menuModelExpoMix(uint8_t expo, event_t event)
{ {
uint8_t sub = menuVerticalPosition; uint8_t sub = menuVerticalPosition;
@ -920,12 +920,12 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
if (sub >= s_maxLines-1) menuVerticalPosition = s_maxLines-1; if (sub >= s_maxLines-1) menuVerticalPosition = s_maxLines-1;
} }
void menuModelExposAll(uint8_t event) void menuModelExposAll(event_t event)
{ {
return menuModelExpoMix(1, event); return menuModelExpoMix(1, event);
} }
void menuModelMixAll(uint8_t event) void menuModelMixAll(event_t event)
{ {
return menuModelExpoMix(0, event); return menuModelExpoMix(0, event);
} }

View file

@ -58,7 +58,7 @@ void putsEdgeDelayParam(coord_t x, coord_t y, LogicalSwitchData *cs, uint8_t lat
#define CSWONE_2ND_COLUMN (11*FW) #define CSWONE_2ND_COLUMN (11*FW)
void menuModelLogicalSwitchOne(uint8_t event) void menuModelLogicalSwitchOne(event_t event)
{ {
TITLE(STR_MENULOGICALSWITCH); TITLE(STR_MENULOGICALSWITCH);
@ -215,7 +215,7 @@ void menuModelLogicalSwitchOne(uint8_t event)
} }
} }
void menuModelLogicalSwitches(uint8_t event) void menuModelLogicalSwitches(event_t event)
{ {
SIMPLE_MENU(STR_MENULOGICALSWITCHES, menuTabModel, MENU_MODEL_LOGICAL_SWITCHES, HEADER_LINE+MAX_LOGICAL_SWITCHES); SIMPLE_MENU(STR_MENULOGICALSWITCHES, menuTabModel, MENU_MODEL_LOGICAL_SWITCHES, HEADER_LINE+MAX_LOGICAL_SWITCHES);
@ -294,7 +294,7 @@ void menuModelLogicalSwitches(uint8_t event)
#else #else
void menuModelLogicalSwitches(uint8_t event) void menuModelLogicalSwitches(event_t event)
{ {
INCDEC_DECLARE_VARS(EE_MODEL); INCDEC_DECLARE_VARS(EE_MODEL);

View file

@ -142,7 +142,7 @@ enum MixFields {
MIX_FIELD_COUNT MIX_FIELD_COUNT
}; };
void gvarWeightItem(coord_t x, coord_t y, MixData *md, uint8_t attr, uint8_t event) void gvarWeightItem(coord_t x, coord_t y, MixData *md, uint8_t attr, event_t event)
{ {
u_int8int16_t weight; u_int8int16_t weight;
MD_WEIGHT_TO_UNION(md, weight); MD_WEIGHT_TO_UNION(md, weight);
@ -195,7 +195,7 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
} }
} }
void menuModelMixOne(uint8_t event) void menuModelMixOne(event_t event)
{ {
if (event == EVT_KEY_LONG(KEY_MENU)) { if (event == EVT_KEY_LONG(KEY_MENU)) {
// TODO pushMenu(menuChannelsView); // TODO pushMenu(menuChannelsView);
@ -375,7 +375,7 @@ void displayMixLine(coord_t y, MixData * md)
displayFlightModes(MIX_LINE_FM_POS, y, md->flightModes); displayFlightModes(MIX_LINE_FM_POS, y, md->flightModes);
} }
void menuModelMixAll(uint8_t event) void menuModelMixAll(event_t event)
{ {
int8_t sub = menuVerticalPosition - HEADER_LINE; int8_t sub = menuVerticalPosition - HEADER_LINE;

View file

@ -87,7 +87,7 @@ enum MenuModelOutputsItems {
#define MIN_MAX_DISPLAY(x) ((int8_t)(x)) #define MIN_MAX_DISPLAY(x) ((int8_t)(x))
#endif #endif
void menuModelLimits(uint8_t event) void menuModelLimits(event_t event)
{ {
uint8_t sub = menuVerticalPosition - HEADER_LINE; uint8_t sub = menuVerticalPosition - HEADER_LINE;

View file

@ -20,11 +20,11 @@
#include "opentx.h" #include "opentx.h"
#define MODELSIZE_POS_X 170 #define MODELSIZE_POS_X 170
#define MODELSEL_W LCD_W #define MODELSEL_W LCD_W
#if defined(NAVIGATION_MENUS) #if defined(NAVIGATION_MENUS)
void onModelSelectMenu(const char *result) void onModelSelectMenu(const char * result)
{ {
int8_t sub = menuVerticalPosition; int8_t sub = menuVerticalPosition;
@ -75,7 +75,7 @@ void onModelSelectMenu(const char *result)
} }
#endif #endif
void menuModelSelect(uint8_t event) void menuModelSelect(event_t event)
{ {
if (warningResult) { if (warningResult) {
warningResult = 0; warningResult = 0;
@ -84,7 +84,7 @@ void menuModelSelect(uint8_t event)
event = EVT_ENTRY_UP; event = EVT_ENTRY_UP;
} }
uint8_t _event_ = (IS_ROTARY_BREAK(event) || IS_ROTARY_LONG(event) ? 0 : event); event_t _event_ = (IS_ROTARY_BREAK(event) || IS_ROTARY_LONG(event) ? 0 : event);
if ((s_copyMode && EVT_KEY_MASK(event) == KEY_EXIT) || event == EVT_KEY_BREAK(KEY_EXIT)) { if ((s_copyMode && EVT_KEY_MASK(event) == KEY_EXIT) || event == EVT_KEY_BREAK(KEY_EXIT)) {
_event_ -= KEY_EXIT; _event_ -= KEY_EXIT;
@ -111,205 +111,209 @@ void menuModelSelect(uint8_t event)
int8_t sub = menuVerticalPosition; int8_t sub = menuVerticalPosition;
switch (event) { switch (event) {
case EVT_ENTRY: case EVT_ENTRY:
menuVerticalPosition = sub = g_eeGeneral.currModel;
if (sub >= LCD_LINES-1) menuVerticalOffset = sub-LCD_LINES+2;
s_copyMode = 0;
s_editMode = EDIT_MODE_INIT;
storageCheck(true);
break;
case EVT_KEY_LONG(KEY_EXIT):
killEvents(event);
if (s_copyMode && s_copyTgtOfs == 0 && g_eeGeneral.currModel != sub && eeModelExists(sub)) {
POPUP_CONFIRMATION(STR_DELETEMODEL);
#if defined(CPUARM)
SET_WARNING_INFO(modelHeaders[sub].name, sizeof(g_model.header.name), ZCHAR);
#else
char * name = reusableBuffer.modelsel.mainname;
eeLoadModelName(sub, name);
SET_WARNING_INFO(name, sizeof(g_model.header.name), ZCHAR);
#endif
}
else {
s_copyMode = 0;
menuVerticalPosition = g_eeGeneral.currModel;
}
break;
#if defined(ROTARY_ENCODERS)
case EVT_ROTARY_LONG:
killEvents(event);
if (s_editMode < 0) {
popMenu();
break;
}
else if (!s_copyMode) {
menuVerticalPosition = sub = g_eeGeneral.currModel; menuVerticalPosition = sub = g_eeGeneral.currModel;
if (sub >= LCD_LINES-1) menuVerticalOffset = sub-LCD_LINES+2;
s_copyMode = 0; s_copyMode = 0;
s_editMode = EDIT_MODE_INIT; s_editMode = EDIT_MODE_INIT;
storageCheck(true); }
break; // no break
case EVT_KEY_LONG(KEY_EXIT):
killEvents(event);
if (s_copyMode && s_copyTgtOfs == 0 && g_eeGeneral.currModel != sub && eeModelExists(sub)) {
POPUP_CONFIRMATION(STR_DELETEMODEL);
#if defined(CPUARM)
SET_WARNING_INFO(modelHeaders[sub].name, sizeof(g_model.header.name), ZCHAR);
#else
char * name = reusableBuffer.modelsel.mainname;
eeLoadModelName(sub, name);
SET_WARNING_INFO(name, sizeof(g_model.header.name), ZCHAR);
#endif
}
else {
s_copyMode = 0;
menuVerticalPosition = g_eeGeneral.currModel;
}
break;
#if defined(ROTARY_ENCODER_NAVIGATION)
case EVT_ROTARY_LONG:
killEvents(event);
if (s_editMode < 0) {
popMenu();
break;
}
else if (!s_copyMode) {
menuVerticalPosition = sub = g_eeGeneral.currModel;
s_copyMode = 0;
s_editMode = EDIT_MODE_INIT;
}
// no break
#endif #endif
case EVT_KEY_BREAK(KEY_EXIT): case EVT_KEY_BREAK(KEY_EXIT):
if (s_copyMode) { if (s_copyMode) {
sub = menuVerticalPosition = (s_copyMode == MOVE_MODE || s_copySrcRow<0) ? (MAX_MODELS+sub+s_copyTgtOfs) % MAX_MODELS : s_copySrcRow; sub = menuVerticalPosition = (s_copyMode == MOVE_MODE || s_copySrcRow<0) ? (MAX_MODELS+sub+s_copyTgtOfs) % MAX_MODELS : s_copySrcRow;
s_copyMode = 0; s_copyMode = 0;
} }
else if (uint8_t(menuVerticalPosition) != g_eeGeneral.currModel) { else if (uint8_t(menuVerticalPosition) != g_eeGeneral.currModel) {
menuVerticalPosition = g_eeGeneral.currModel; menuVerticalPosition = g_eeGeneral.currModel;
} }
else { else {
popMenu(); popMenu();
} }
break; break;
#if defined(ROTARY_ENCODER_NAVIGATION) #if defined(ROTARY_ENCODERS)
case EVT_ROTARY_BREAK: case EVT_ROTARY_BREAK:
if (s_editMode == -1) { if (s_editMode == -1) {
s_editMode = 0;
break;
}
// no break;
#endif
case EVT_KEY_LONG(KEY_ENTER):
case EVT_KEY_BREAK(KEY_ENTER):
s_editMode = 0; s_editMode = 0;
if (READ_ONLY()) { break;
if (g_eeGeneral.currModel != sub && eeModelExists(sub)) { }
selectModel(sub); // no break;
}
}
else if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) {
showMessageBox(s_copyMode==COPY_MODE ? STR_COPYINGMODEL : STR_MOVINGMODEL);
storageCheck(true); // force writing of current model data before this is changed
uint8_t cur = (MAX_MODELS + sub + s_copyTgtOfs) % MAX_MODELS;
if (s_copyMode == COPY_MODE) {
if (!eeCopyModel(cur, s_copySrcRow)) {
cur = sub;
}
}
s_copySrcRow = g_eeGeneral.currModel; // to update the currModel value
while (sub != cur) {
uint8_t src = cur;
cur = (s_copyTgtOfs > 0 ? cur+MAX_MODELS-1 : cur+1) % MAX_MODELS;
eeSwapModels(src, cur);
if (src == s_copySrcRow)
s_copySrcRow = cur;
else if (cur == s_copySrcRow)
s_copySrcRow = src;
}
if (s_copySrcRow != g_eeGeneral.currModel) {
g_eeGeneral.currModel = s_copySrcRow;
storageDirty(EE_GENERAL);
}
s_copyMode = 0;
event = EVT_ENTRY_UP;
}
else if (event == EVT_KEY_LONG(KEY_ENTER) || IS_ROTARY_BREAK(event)) {
s_copyMode = 0;
killEvents(event);
#if defined(NAVIGATION_MENUS)
if (g_eeGeneral.currModel != sub) {
if (eeModelExists(sub)) {
POPUP_MENU_ADD_ITEM(STR_SELECT_MODEL);
POPUP_MENU_ADD_SD_ITEM(STR_BACKUP_MODEL);
POPUP_MENU_ADD_ITEM(STR_COPY_MODEL);
POPUP_MENU_ADD_ITEM(STR_MOVE_MODEL);
POPUP_MENU_ADD_ITEM(STR_DELETE_MODEL);
}
else {
#if defined(SDCARD)
POPUP_MENU_ADD_ITEM(STR_CREATE_MODEL);
POPUP_MENU_ADD_ITEM(STR_RESTORE_MODEL);
#else
selectModel(sub);
#endif #endif
}
case EVT_KEY_LONG(KEY_ENTER):
case EVT_KEY_BREAK(KEY_ENTER):
s_editMode = 0;
if (READ_ONLY()) {
if (g_eeGeneral.currModel != sub && eeModelExists(sub)) {
selectModel(sub);
}
}
else if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) {
showMessageBox(s_copyMode==COPY_MODE ? STR_COPYINGMODEL : STR_MOVINGMODEL);
storageCheck(true); // force writing of current model data before this is changed
uint8_t cur = (MAX_MODELS + sub + s_copyTgtOfs) % MAX_MODELS;
if (s_copyMode == COPY_MODE) {
if (!eeCopyModel(cur, s_copySrcRow)) {
cur = sub;
} }
else { }
s_copySrcRow = g_eeGeneral.currModel; // to update the currModel value
while (sub != cur) {
uint8_t src = cur;
cur = (s_copyTgtOfs > 0 ? cur+MAX_MODELS-1 : cur+1) % MAX_MODELS;
eeSwapModels(src, cur);
if (src == s_copySrcRow)
s_copySrcRow = cur;
else if (cur == s_copySrcRow)
s_copySrcRow = src;
}
if (s_copySrcRow != g_eeGeneral.currModel) {
g_eeGeneral.currModel = s_copySrcRow;
storageDirty(EE_GENERAL);
}
s_copyMode = 0;
event = EVT_ENTRY_UP;
}
else if (event == EVT_KEY_LONG(KEY_ENTER) || IS_ROTARY_BREAK(event)) {
s_copyMode = 0;
killEvents(event);
#if defined(NAVIGATION_MENUS)
if (g_eeGeneral.currModel != sub) {
if (eeModelExists(sub)) {
POPUP_MENU_ADD_ITEM(STR_SELECT_MODEL);
POPUP_MENU_ADD_SD_ITEM(STR_BACKUP_MODEL); POPUP_MENU_ADD_SD_ITEM(STR_BACKUP_MODEL);
POPUP_MENU_ADD_ITEM(STR_COPY_MODEL); POPUP_MENU_ADD_ITEM(STR_COPY_MODEL);
POPUP_MENU_ADD_ITEM(STR_MOVE_MODEL); POPUP_MENU_ADD_ITEM(STR_MOVE_MODEL);
POPUP_MENU_ADD_ITEM(STR_DELETE_MODEL);
} }
POPUP_MENU_START(onModelSelectMenu); else {
#if defined(SDCARD)
POPUP_MENU_ADD_ITEM(STR_CREATE_MODEL);
POPUP_MENU_ADD_ITEM(STR_RESTORE_MODEL);
#else #else
if (g_eeGeneral.currModel != sub) {
selectModel(sub); selectModel(sub);
#endif
} }
#endif
}
else if (eeModelExists(sub)) {
s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
s_copyTgtOfs = 0;
s_copySrcRow = -1;
}
break;
#if defined(PCBX7D)
case EVT_KEY_LONG(KEY_PAGE):
chainMenu(menuTabModel[DIM(menuTabModel)-1]);
killEvents(event);
break;
case EVT_KEY_BREAK(KEY_PAGE):
chainMenu(menuModelSetup);
break;
#else
#if defined(ROTARY_ENCODER_NAVIGATION)
case EVT_ROTARY_LEFT:
case EVT_ROTARY_RIGHT:
#endif
case EVT_KEY_FIRST(KEY_LEFT):
case EVT_KEY_FIRST(KEY_RIGHT):
#if defined(ROTARY_ENCODER_NAVIGATION)
if ((!IS_ROTARY_RIGHT(event) && !IS_ROTARY_LEFT(event)) || s_editMode < 0) {
#endif
if (sub == g_eeGeneral.currModel) {
chainMenu((IS_ROTARY_RIGHT(event) || event == EVT_KEY_FIRST(KEY_RIGHT)) ? menuModelSetup : menuTabModel[DIM(menuTabModel)-1]);
} }
else { else {
AUDIO_WARNING2(); POPUP_MENU_ADD_SD_ITEM(STR_BACKUP_MODEL);
POPUP_MENU_ADD_ITEM(STR_COPY_MODEL);
POPUP_MENU_ADD_ITEM(STR_MOVE_MODEL);
} }
break; POPUP_MENU_START(onModelSelectMenu);
#else
if (g_eeGeneral.currModel != sub) {
selectModel(sub);
}
#endif
}
else if (eeModelExists(sub)) {
s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
s_copyTgtOfs = 0;
s_copySrcRow = -1;
}
break;
#if defined(PCBX7D)
case EVT_KEY_LONG(KEY_PAGE):
chainMenu(menuTabModel[DIM(menuTabModel)-1]);
killEvents(event);
break;
case EVT_KEY_BREAK(KEY_PAGE):
chainMenu(menuModelSetup);
break;
#else
#if defined(ROTARY_ENCODER_NAVIGATION) #if defined(ROTARY_ENCODER_NAVIGATION)
} case EVT_ROTARY_LEFT:
// no break case EVT_ROTARY_RIGHT:
#endif
case EVT_KEY_FIRST(KEY_LEFT):
case EVT_KEY_FIRST(KEY_RIGHT):
#if defined(ROTARY_ENCODER_NAVIGATION)
if ((!IS_ROTARY_RIGHT(event) && !IS_ROTARY_LEFT(event)) || s_editMode < 0) {
#endif
if (sub == g_eeGeneral.currModel) {
chainMenu((IS_ROTARY_RIGHT(event) || event == EVT_KEY_FIRST(KEY_RIGHT)) ? menuModelSetup : menuTabModel[DIM(menuTabModel)-1]);
}
else {
AUDIO_WARNING2();
}
break;
#if defined(ROTARY_ENCODER_NAVIGATION)
}
// no break
#endif #endif
#endif #endif
case EVT_KEY_FIRST(KEY_UP): #if defined(PCBX7D)
case EVT_KEY_REPT(KEY_UP): case EVT_ROTARY_LEFT:
case EVT_KEY_FIRST(KEY_DOWN): case EVT_ROTARY_RIGHT:
case EVT_KEY_REPT(KEY_DOWN): #endif
if (s_copyMode) { case EVT_KEY_FIRST(KEY_UP):
int8_t next_ofs = s_copyTgtOfs + oldSub - menuVerticalPosition; case EVT_KEY_REPT(KEY_UP):
if (next_ofs == MAX_MODELS || next_ofs == -MAX_MODELS) case EVT_KEY_FIRST(KEY_DOWN):
next_ofs = 0; case EVT_KEY_REPT(KEY_DOWN):
if (s_copyMode) {
int8_t next_ofs = s_copyTgtOfs + oldSub - menuVerticalPosition;
if (next_ofs == MAX_MODELS || next_ofs == -MAX_MODELS)
next_ofs = 0;
if (s_copySrcRow < 0 && s_copyMode==COPY_MODE) { if (s_copySrcRow < 0 && s_copyMode==COPY_MODE) {
s_copySrcRow = oldSub; s_copySrcRow = oldSub;
// find a hole (in the first empty slot above / below) // find a hole (in the first empty slot above / below)
sub = eeFindEmptyModel(s_copySrcRow, IS_ROTARY_RIGHT(event) || event==EVT_KEY_FIRST(KEY_DOWN)); sub = eeFindEmptyModel(s_copySrcRow, IS_ROTARY_RIGHT(event) || event==EVT_KEY_FIRST(KEY_DOWN));
if (sub < 0) { if (sub < 0) {
// no free room for duplicating the model // no free room for duplicating the model
AUDIO_ERROR(); AUDIO_ERROR();
sub = oldSub; sub = oldSub;
s_copyMode = 0; s_copyMode = 0;
}
next_ofs = 0;
menuVerticalPosition = sub;
} }
s_copyTgtOfs = next_ofs; next_ofs = 0;
menuVerticalPosition = sub;
} }
break; s_copyTgtOfs = next_ofs;
}
break;
} }
#if defined(EEPROM_RLC) && defined(CPUARM) #if defined(EEPROM_RLC) && defined(CPUARM)
@ -325,7 +329,7 @@ void menuModelSelect(uint8_t event)
#if defined(PCBX7D) #if defined(PCBX7D)
drawScreenIndex(MENU_MODEL_SELECT, DIM(menuTabModel), 0); drawScreenIndex(MENU_MODEL_SELECT, DIM(menuTabModel), 0);
#elif defined(ROTARY_ENCODER_NAVIGATION) #elif defined(ROTARY_ENCODER_NAVIGATION)
drawScreenIndex(MENU_MODEL_SELECT, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? ((IS_RE_NAVIGATION_ENABLE() && s_editMode < 0) ? INVERS|BLINK : INVERS) : 0); drawScreenIndex(MENU_MODEL_SELECT, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? ((IS_ROTARY_ENCODER_NAVIGATION_ENABLE() && s_editMode < 0) ? INVERS|BLINK : INVERS) : 0);
#else #else
drawScreenIndex(MENU_MODEL_SELECT, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? INVERS : 0); drawScreenIndex(MENU_MODEL_SELECT, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? INVERS : 0);
#endif #endif

View file

@ -22,7 +22,7 @@
#if defined(CPUARM) #if defined(CPUARM)
uint8_t g_moduleIdx; uint8_t g_moduleIdx;
void menuModelFailsafe(uint8_t event); void menuModelFailsafe(event_t event);
#endif #endif
enum MenuModelSetupItems { enum MenuModelSetupItems {
@ -190,7 +190,7 @@ enum MenuModelSetupItems {
#define MODEL_SETUP_MAX_LINES ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? HEADER_LINE+ITEM_MODEL_SETUP_MAX : HEADER_LINE+ITEM_MODEL_SETUP_MAX-1) #define MODEL_SETUP_MAX_LINES ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? HEADER_LINE+ITEM_MODEL_SETUP_MAX : HEADER_LINE+ITEM_MODEL_SETUP_MAX-1)
#endif #endif
void menuModelSetup(uint8_t event) void menuModelSetup(event_t event)
{ {
#if defined(CPUARM) #if defined(CPUARM)
MENU_TAB({ HEADER_LINE_COLUMNS 0, TIMER_ROWS, TIMER_ROWS, TIMER_ROWS, 0, 1, 0, 0, 0, 0, 0, CASE_CPUARM(LABEL(PreflightCheck)) CASE_CPUARM(0) 0, NUM_SWITCHES-1, NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_ROTARY_ENCODERS-1, 0, MENU_TAB({ HEADER_LINE_COLUMNS 0, TIMER_ROWS, TIMER_ROWS, TIMER_ROWS, 0, 1, 0, 0, 0, 0, 0, CASE_CPUARM(LABEL(PreflightCheck)) CASE_CPUARM(0) 0, NUM_SWITCHES-1, NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_ROTARY_ENCODERS-1, 0,
@ -1080,7 +1080,7 @@ void menuModelSetup(uint8_t event)
} }
#if defined(CPUARM) #if defined(CPUARM)
void menuModelFailsafe(uint8_t event) void menuModelFailsafe(event_t event)
{ {
static bool longNames = false; static bool longNames = false;
bool newLongNames = false; bool newLongNames = false;

View file

@ -70,7 +70,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
} }
#endif #endif
void menuSpecialFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext) void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
{ {
int8_t sub = menuVerticalPosition - HEADER_LINE; int8_t sub = menuVerticalPosition - HEADER_LINE;
@ -375,7 +375,7 @@ void menuSpecialFunctions(uint8_t event, CustomFunctionData * functions, CustomF
} }
} }
void menuModelSpecialFunctions(uint8_t event) void menuModelSpecialFunctions(event_t event)
{ {
MENU(STR_MENUCUSTOMFUNC, menuTabModel, MENU_MODEL_SPECIAL_FUNCTIONS, MAX_SPECIAL_FUNCTIONS+1, {0, NAVIGATION_LINE_BY_LINE|4/*repeated*/}); MENU(STR_MENUCUSTOMFUNC, menuTabModel, MENU_MODEL_SPECIAL_FUNCTIONS, MAX_SPECIAL_FUNCTIONS+1, {0, NAVIGATION_LINE_BY_LINE|4/*repeated*/});
return menuSpecialFunctions(event, g_model.customFn, &modelFunctionsContext); return menuSpecialFunctions(event, g_model.customFn, &modelFunctionsContext);

View file

@ -212,7 +212,7 @@ enum SensorFields {
#define SENSOR_FILTER_ROWS (sensor->isConfigurable() ? (uint8_t)0 : HIDDEN_ROW) #define SENSOR_FILTER_ROWS (sensor->isConfigurable() ? (uint8_t)0 : HIDDEN_ROW)
#define SENSOR_PERSISTENT_ROWS (sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : HIDDEN_ROW) #define SENSOR_PERSISTENT_ROWS (sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : HIDDEN_ROW)
void menuModelSensor(uint8_t event) void menuModelSensor(event_t event)
{ {
TelemetrySensor * sensor = & g_model.telemetrySensors[s_currIdx]; TelemetrySensor * sensor = & g_model.telemetrySensors[s_currIdx];
@ -458,7 +458,7 @@ void onSensorMenu(const char *result)
} }
#endif #endif
void menuModelTelemetryFrsky(uint8_t event) void menuModelTelemetryFrsky(event_t event)
{ {
#if defined(CPUARM) #if defined(CPUARM)
if (warningResult) { if (warningResult) {

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void menuModelTemplates(uint8_t event) void menuModelTemplates(event_t event)
{ {
SIMPLE_MENU(STR_MENUTEMPLATES, menuTabModel, MENU_MODEL_TEMPLATES, 1+TMPL_COUNT); SIMPLE_MENU(STR_MENUTEMPLATES, menuTabModel, MENU_MODEL_TEMPLATES, 1+TMPL_COUNT);

View file

@ -70,12 +70,12 @@ INIT_STOPS(stops100, 3, -100, 0, 100)
INIT_STOPS(stops1000, 3, -1000, 0, 1000) INIT_STOPS(stops1000, 3, -1000, 0, 1000)
INIT_STOPS(stopsSwitch, 15, SWSRC_FIRST, CATEGORY_END(-SWSRC_FIRST_LOGICAL_SWITCH), CATEGORY_END(-SWSRC_FIRST_TRIM), CATEGORY_END(-SWSRC_LAST_SWITCH+1), 0, CATEGORY_END(SWSRC_LAST_SWITCH), CATEGORY_END(SWSRC_FIRST_TRIM-1), CATEGORY_END(SWSRC_FIRST_LOGICAL_SWITCH-1), SWSRC_LAST) INIT_STOPS(stopsSwitch, 15, SWSRC_FIRST, CATEGORY_END(-SWSRC_FIRST_LOGICAL_SWITCH), CATEGORY_END(-SWSRC_FIRST_TRIM), CATEGORY_END(-SWSRC_LAST_SWITCH+1), 0, CATEGORY_END(SWSRC_LAST_SWITCH), CATEGORY_END(SWSRC_FIRST_TRIM-1), CATEGORY_END(SWSRC_FIRST_LOGICAL_SWITCH-1), SWSRC_LAST)
#if defined(PCBX7D) #if defined(PCBX7D)
int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int i_flags, IsValueAvailable isValueAvailable, const CheckIncDecStops &stops) int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_flags, IsValueAvailable isValueAvailable, const CheckIncDecStops &stops)
{ {
int newval = val; int newval = val;
#if defined(DBLKEYS) #if 0 // TODO ? defined(DBLKEYS)
uint32_t in = KEYS_PRESSED(); uint32_t in = KEYS_PRESSED();
if (!(i_flags & NO_DBLKEYS) && (EVT_KEY_MASK(event))) { if (!(i_flags & NO_DBLKEYS) && (EVT_KEY_MASK(event))) {
bool dblkey = true; bool dblkey = true;
@ -117,33 +117,23 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
} }
#endif #endif
if (s_editMode>0 && (event==EVT_KEY_FIRST(KEY_PLUS) || event==EVT_KEY_REPT(KEY_PLUS))) { if (s_editMode>0 && event==EVT_ROTARY_RIGHT) {
do { newval += min<int>(rotencSpeed, i_max-val);
if (IS_KEY_REPT(event) && (i_flags & INCDEC_REP10)) { while (isValueAvailable && !isValueAvailable(newval) && newval<=i_max) {
newval += min(10, i_max-val); newval++;
} }
else {
newval++;
}
} while (isValueAvailable && !isValueAvailable(newval) && newval<=i_max);
if (newval > i_max) { if (newval > i_max) {
newval = val; newval = val;
killEvents(event);
AUDIO_KEY_ERROR(); AUDIO_KEY_ERROR();
} }
} }
else if (s_editMode>0 && (event==EVT_KEY_FIRST(KEY_MINUS) || event==EVT_KEY_REPT(KEY_MINUS))) { else if (s_editMode>0 && event==EVT_ROTARY_LEFT) {
do { newval -= min<int>(rotencSpeed, val-i_min);
if (IS_KEY_REPT(event) && (i_flags & INCDEC_REP10)) { while (isValueAvailable && !isValueAvailable(newval) && newval>=i_min) {
newval -= min(10, val-i_min); newval--;
} }
else {
newval--;
}
} while (isValueAvailable && !isValueAvailable(newval) && newval>=i_min);
if (newval < i_min) { if (newval < i_min) {
newval = val; newval = val;
killEvents(event);
AUDIO_KEY_ERROR(); AUDIO_KEY_ERROR();
} }
} }
@ -179,17 +169,8 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
#endif #endif
if (newval != val) { if (newval != val) {
if (!(i_flags & NO_INCDEC_MARKS) && (newval != i_max) && (newval != i_min) && stops.contains(newval)) {
bool pause = (newval > val ? !stops.contains(newval+1) : !stops.contains(newval-1));
if (pause) {
pauseEvents(event); // delay before auto-repeat continues
}
}
storageDirty(i_flags & (EE_GENERAL|EE_MODEL)); storageDirty(i_flags & (EE_GENERAL|EE_MODEL));
checkIncDec_Ret = (newval > val ? 1 : -1); checkIncDec_Ret = (newval > val ? 1 : -1);
if (!IS_KEY_REPT(event)) {
AUDIO_KEY_PRESS();
}
} }
else { else {
checkIncDec_Ret = 0; checkIncDec_Ret = 0;
@ -275,8 +256,8 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
#endif #endif
return newval; return newval;
} }
#else #else
int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int i_flags, IsValueAvailable isValueAvailable, const CheckIncDecStops &stops) int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_flags, IsValueAvailable isValueAvailable, const CheckIncDecStops &stops)
{ {
int newval = val; int newval = val;
@ -397,7 +378,7 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
} }
#endif #endif
#else #else
int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, uint8_t i_flags) int16_t checkIncDec(event_t event, int16_t val, int16_t i_min, int16_t i_max, uint8_t i_flags)
{ {
int16_t newval = val; int16_t newval = val;
@ -497,17 +478,17 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
#endif #endif
#if defined(CPUM64) #if defined(CPUM64)
int8_t checkIncDecModel(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max) int8_t checkIncDecModel(event_t event, int8_t i_val, int8_t i_min, int8_t i_max)
{ {
return checkIncDec(event, i_val, i_min, i_max, EE_MODEL); return checkIncDec(event, i_val, i_min, i_max, EE_MODEL);
} }
int8_t checkIncDecModelZero(uint8_t event, int8_t i_val, int8_t i_max) int8_t checkIncDecModelZero(event_t event, int8_t i_val, int8_t i_max)
{ {
return checkIncDecModel(event, i_val, 0, i_max); return checkIncDecModel(event, i_val, 0, i_max);
} }
int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max) int8_t checkIncDecGen(event_t event, int8_t i_val, int8_t i_min, int8_t i_max)
{ {
return checkIncDec(event, i_val, i_min, i_max, EE_GENERAL); return checkIncDec(event, i_val, i_min, i_max, EE_GENERAL);
} }
@ -522,9 +503,8 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max)
#define CURSOR_NOT_ALLOWED_IN_ROW(row) (MAXCOL(row) == TITLE_ROW) #define CURSOR_NOT_ALLOWED_IN_ROW(row) (MAXCOL(row) == TITLE_ROW)
#endif #endif
#define MAXCOL(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0) #define INC(val, min, max) if (val<max) {val++;} else {val=min;}
#define INC(val, min, max) if (val<max) {val++;} else {val=min;} #define DEC(val, min, max) if (val>min) {val--;} else {val=max;}
#define DEC(val, min, max) if (val>min) {val--;} else {val=max;}
#if defined(CPUARM) #if defined(CPUARM)
tmr10ms_t menuEntryTime; tmr10ms_t menuEntryTime;
@ -536,7 +516,6 @@ tmr10ms_t menuEntryTime;
#define COLATTR(row) (MAXCOL_RAW(row) == (uint8_t)-1 ? (const uint8_t)0 : (const uint8_t)(MAXCOL_RAW(row) & NAVIGATION_LINE_BY_LINE)) #define COLATTR(row) (MAXCOL_RAW(row) == (uint8_t)-1 ? (const uint8_t)0 : (const uint8_t)(MAXCOL_RAW(row) & NAVIGATION_LINE_BY_LINE))
#define MENU_FIRST_LINE_EDIT (menuTab ? (MAXCOL((uint16_t)0) >= HIDDEN_ROW ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? 2 : 1) : 0) : 0) #define MENU_FIRST_LINE_EDIT (menuTab ? (MAXCOL((uint16_t)0) >= HIDDEN_ROW ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? 2 : 1) : 0) : 0)
#define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0) #define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0)
#define EDIT_MODE_INIT 0 // TODO enum
void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t * horTab, uint8_t horTabMax, vertpos_t rowcount) void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t * horTab, uint8_t horTabMax, vertpos_t rowcount)
{ {
@ -649,6 +628,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
} }
break; break;
case EVT_ROTARY_RIGHT:
case EVT_KEY_FIRST(KEY_RIGHT): case EVT_KEY_FIRST(KEY_RIGHT):
AUDIO_KEY_PRESS(); AUDIO_KEY_PRESS();
// no break // no break
@ -679,6 +659,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
l_posHorz = POS_HORZ_INIT(l_posVert); l_posHorz = POS_HORZ_INIT(l_posVert);
break; break;
case EVT_ROTARY_LEFT:
case EVT_KEY_FIRST(KEY_LEFT): case EVT_KEY_FIRST(KEY_LEFT):
AUDIO_KEY_PRESS(); AUDIO_KEY_PRESS();
// no break // no break
@ -777,6 +758,9 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
menuHorizontalPosition = l_posHorz; menuHorizontalPosition = l_posHorz;
} }
#else #else
#define MAXCOL(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
#define POS_HORZ_INIT(posVert) 0
void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow) void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow)
{ {
vertpos_t l_posVert = menuVerticalPosition; vertpos_t l_posVert = menuVerticalPosition;
@ -871,7 +855,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
} }
#if defined(ROTARY_ENCODER_NAVIGATION) #if defined(ROTARY_ENCODER_NAVIGATION)
if (IS_RE_NAVIGATION_ENABLE() && s_editMode < 0) if (IS_ROTARY_ENCODER_NAVIGATION_ENABLE() && s_editMode < 0)
attr = INVERS|BLINK; attr = INVERS|BLINK;
#endif #endif
} }
@ -1144,7 +1128,7 @@ void check_submenu_simple(event_t event, uint8_t maxrow)
check_simple(event, 0, 0, 0, maxrow); check_simple(event, 0, 0, 0, maxrow);
} }
void repeatLastCursorMove(uint8_t event) void repeatLastCursorMove(event_t event)
{ {
if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) {
putEvent(event); putEvent(event);

View file

@ -94,7 +94,7 @@ void showAlertBox(const pm_char * title, const pm_char * text, const char * acti
clearKeyEvents(); clearKeyEvents();
} }
void runPopupWarning(uint8_t event) void runPopupWarning(event_t event)
{ {
warningResult = false; warningResult = false;
drawMessageBox(); drawMessageBox();
@ -103,18 +103,11 @@ void runPopupWarning(uint8_t event)
} }
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+2*FH, warningType == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS); lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+2*FH, warningType == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS);
switch (event) { switch (event) {
#if defined(ROTARY_ENCODER_NAVIGATION)
case EVT_ROTARY_BREAK:
#endif
case EVT_KEY_BREAK(KEY_ENTER): case EVT_KEY_BREAK(KEY_ENTER):
if (warningType == WARNING_TYPE_ASTERISK) if (warningType == WARNING_TYPE_ASTERISK)
break; break;
warningResult = true; warningResult = true;
// no break // no break
#if defined(ROTARY_ENCODER_NAVIGATION)
case EVT_ROTARY_LONG:
killEvents(event);
#endif
case EVT_KEY_BREAK(KEY_EXIT): case EVT_KEY_BREAK(KEY_EXIT):
warningText = NULL; warningText = NULL;
warningType = WARNING_TYPE_ASTERISK; warningType = WARNING_TYPE_ASTERISK;
@ -131,7 +124,7 @@ void runPopupWarning(uint8_t event)
} }
#if defined(CPUARM) #if defined(CPUARM)
void (*popupFunc)(uint8_t event) = NULL; void (*popupFunc)(event_t event) = NULL;
#endif #endif
#if defined(NAVIGATION_MENUS) #if defined(NAVIGATION_MENUS)
@ -146,7 +139,7 @@ void (*popupMenuHandler)(const char * result);
uint8_t popupMenuOffsetType = MENU_OFFSET_INTERNAL; uint8_t popupMenuOffsetType = MENU_OFFSET_INTERNAL;
#endif #endif
const char * runPopupMenu(uint8_t event) const char * runPopupMenu(event_t event)
{ {
const char * result = NULL; const char * result = NULL;
@ -164,7 +157,7 @@ const char * runPopupMenu(uint8_t event)
drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, POPUP_MENU_MAX_LINES * (FH+1), popupMenuOffset, popupMenuNoItems, POPUP_MENU_MAX_LINES); drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, POPUP_MENU_MAX_LINES * (FH+1), popupMenuOffset, popupMenuNoItems, POPUP_MENU_MAX_LINES);
} }
switch(event) { switch (event) {
#if defined(ROTARY_ENCODER_NAVIGATION) #if defined(ROTARY_ENCODER_NAVIGATION)
CASE_EVT_ROTARY_LEFT CASE_EVT_ROTARY_LEFT
#endif #endif

View file

@ -30,10 +30,10 @@
void drawMessageBox(); void drawMessageBox();
void showMessageBox(const pm_char * title); void showMessageBox(const pm_char * title);
void runPopupWarning(uint8_t event); void runPopupWarning(event_t event);
#if defined(CPUARM) #if defined(CPUARM)
extern void (*popupFunc)(uint8_t event); extern void (*popupFunc)(event_t event);
extern int16_t warningInputValue; extern int16_t warningInputValue;
extern int16_t warningInputValueMin; extern int16_t warningInputValueMin;
extern int16_t warningInputValueMax; extern int16_t warningInputValueMax;
@ -100,7 +100,7 @@ extern uint8_t warningInfoFlags;
extern uint16_t popupMenuOffset; extern uint16_t popupMenuOffset;
extern const char * popupMenuItems[POPUP_MENU_MAX_LINES]; extern const char * popupMenuItems[POPUP_MENU_MAX_LINES];
extern uint16_t popupMenuNoItems; extern uint16_t popupMenuNoItems;
const char * runPopupMenu(uint8_t event); const char * runPopupMenu(event_t event);
extern void (*popupMenuHandler)(const char * result); extern void (*popupMenuHandler)(const char * result);
#endif #endif

View file

@ -31,7 +31,7 @@ enum CalibrationState {
CALIB_FINISHED CALIB_FINISHED
}; };
void menuCommonCalib(uint8_t event) void menuCommonCalib(event_t event)
{ {
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) { // get low and high vals for sticks and trims for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) { // get low and high vals for sticks and trims
int16_t vt = anaIn(i); int16_t vt = anaIn(i);
@ -108,7 +108,7 @@ void menuCommonCalib(uint8_t event)
doMainScreenGraphics(); doMainScreenGraphics();
} }
void menuRadioCalibration(uint8_t event) void menuRadioCalibration(event_t event)
{ {
check_simple(event, MENU_RADIO_CALIBRATION, menuTabGeneral, DIM(menuTabGeneral), 0); check_simple(event, MENU_RADIO_CALIBRATION, menuTabGeneral, DIM(menuTabGeneral), 0);
@ -120,7 +120,7 @@ void menuRadioCalibration(uint8_t event)
menuCommonCalib(READ_ONLY() ? 0 : event); menuCommonCalib(READ_ONLY() ? 0 : event);
} }
void menuFirstCalib(uint8_t event) void menuFirstCalib(event_t event)
{ {
if (event == EVT_KEY_BREAK(KEY_EXIT) || reusableBuffer.calib.state == CALIB_FINISHED) { if (event == EVT_KEY_BREAK(KEY_EXIT) || reusableBuffer.calib.state == CALIB_FINISHED) {
menuCalibrationState = CALIB_START; menuCalibrationState = CALIB_START;

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void menuRadioDiagAnalogs(uint8_t event) void menuRadioDiagAnalogs(event_t event)
{ {
// TODO enum // TODO enum
#if defined(TX_CAPACITY_MEASUREMENT) #if defined(TX_CAPACITY_MEASUREMENT)

View file

@ -26,7 +26,7 @@ void displayKeyState(uint8_t x, uint8_t y, uint8_t key)
lcdDrawChar(x, y, t+'0', t ? INVERS : 0); lcdDrawChar(x, y, t+'0', t ? INVERS : 0);
} }
void menuRadioDiagKeys(uint8_t event) void menuRadioDiagKeys(event_t event)
{ {
SIMPLE_MENU(STR_MENU_RADIO_SWITCHES, menuTabGeneral, MENU_RADIO_SWITCHES_TEST, 1); SIMPLE_MENU(STR_MENU_RADIO_SWITCHES, menuTabGeneral, MENU_RADIO_SWITCHES_TEST, 1);
@ -64,11 +64,15 @@ void menuRadioDiagKeys(uint8_t event)
#endif #endif
} }
#if defined(ROTARY_ENCODERS) || defined(ROTARY_ENCODER_NAVIGATION) // TODO || defined(PCBX7D) #if defined(ROTARY_ENCODER_NAVIGATION)
for (uint8_t i=0; i<DIM(g_rotenc); i++) { for (uint8_t i=0; i<DIM(rotencValue); i++) {
coord_t y = MENU_HEADER_HEIGHT /* ??? + 1 ??? */ + i*FH; coord_t y = MENU_HEADER_HEIGHT /* ??? + 1 ??? */ + i*FH;
lcdDrawTextAtIndex(14*FW, y, STR_VRENCODERS, i, 0); lcdDrawTextAtIndex(14*FW, y, STR_VRENCODERS, i, 0);
lcdDrawNumber(18*FW, y, g_rotenc[i], LEFT|(keyState(BTN_REa+i) ? INVERS : 0)); #if defined(ROTARY_ENCODERS)
lcdDrawNumber(18*FW, y, rotencValue[i], LEFT|(keyState(BTN_REa+i) ? INVERS : 0));
#else
lcdDrawNumber(18*FW, y, rotencValue[i], LEFT);
#endif
} }
#endif #endif

View file

@ -33,7 +33,7 @@ enum MenuRadioHardwareItems {
}; };
#define GENERAL_HW_PARAM_OFS (2+(15*FW)) #define GENERAL_HW_PARAM_OFS (2+(15*FW))
void menuRadioHardware(uint8_t event) void menuRadioHardware(event_t event)
{ {
#if defined(PCBX7D) #if defined(PCBX7D)
#else #else

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void menuRadioSdManagerInfo(uint8_t event) void menuRadioSdManagerInfo(event_t event)
{ {
SIMPLE_SUBMENU(STR_SD_INFO_TITLE, 1); SIMPLE_SUBMENU(STR_SD_INFO_TITLE, 1);
@ -56,7 +56,7 @@ inline bool isFilenameLower(bool isfile, const char * fn, const char * line)
return (!isfile && line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcasecmp(fn, line) < 0); return (!isfile && line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcasecmp(fn, line) < 0);
} }
void onSdManagerMenu(const char *result) void onSdManagerMenu(const char * result)
{ {
TCHAR lfn[_MAX_LFN+1]; TCHAR lfn[_MAX_LFN+1];
@ -95,7 +95,7 @@ void onSdManagerMenu(const char *result)
#endif #endif
} }
void menuRadioSdManager(uint8_t _event) void menuRadioSdManager(event_t _event)
{ {
#if defined(SDCARD) #if defined(SDCARD)
if (warningResult) { if (warningResult) {
@ -118,7 +118,7 @@ void menuRadioSdManager(uint8_t _event)
} }
#endif #endif
uint8_t event = ((READ_ONLY() && EVT_KEY_MASK(_event) == KEY_ENTER) ? 0 : _event); event_t event = ((READ_ONLY() && EVT_KEY_MASK(_event) == KEY_ENTER) ? 0 : _event);
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, MENU_RADIO_SD_MANAGER, HEADER_LINE+reusableBuffer.sdmanager.count); SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, MENU_RADIO_SD_MANAGER, HEADER_LINE+reusableBuffer.sdmanager.count);

View file

@ -117,7 +117,7 @@ enum MenuRadioSetupItems {
#define COL_TX_MODE LABEL(TX_MODE) #define COL_TX_MODE LABEL(TX_MODE)
#endif #endif
void menuRadioSetup(uint8_t event) void menuRadioSetup(event_t event)
{ {
#if defined(RTCLOCK) #if defined(RTCLOCK)
struct gtm t; struct gtm t;
@ -409,11 +409,11 @@ void menuRadioSetup(uint8_t event)
if(attr) g_eeGeneral.inactivityTimer = checkIncDec(event, g_eeGeneral.inactivityTimer, 0, 250, EE_GENERAL); //0..250minutes if(attr) g_eeGeneral.inactivityTimer = checkIncDec(event, g_eeGeneral.inactivityTimer, 0, 250, EE_GENERAL); //0..250minutes
break; break;
#if ROTARY_ENCODERS > 0 #if defined(ROTARY_ENCODERS)
case ITEM_SETUP_RE_NAVIGATION: case ITEM_SETUP_RE_NAVIGATION:
g_eeGeneral.reNavigation = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_RENAVIG, STR_VRENAVIG, g_eeGeneral.reNavigation, 0, NUM_ROTARY_ENCODERS, attr, event); g_eeGeneral.reNavigation = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_RENAVIG, STR_VRENAVIG, g_eeGeneral.reNavigation, 0, NUM_ROTARY_ENCODERS, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
g_rotenc[NAVIGATION_RE_IDX()] = 0; ROTARY_ENCODER_NAVIGATION_VALUE = 0;
} }
break; break;
#endif #endif

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void menuRadioTrainer(uint8_t event) void menuRadioTrainer(event_t event)
{ {
uint8_t y; uint8_t y;
bool slave = SLAVE_MODE(); bool slave = SLAVE_MODE();

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void menuRadioVersion(uint8_t event) void menuRadioVersion(event_t event)
{ {
#if defined(CPUARM) && defined(EEPROM_RLC) #if defined(CPUARM) && defined(EEPROM_RLC)
if (warningResult) { if (warningResult) {

View file

@ -42,7 +42,7 @@ enum AboutScreens {
#define ABOUT_X 2 #define ABOUT_X 2
#define ABOUT_INDENT 4 #define ABOUT_INDENT 4
void menuAboutView(uint8_t event) void menuAboutView(event_t event)
{ {
static uint8_t screenIndex; static uint8_t screenIndex;
static uint8_t greyIndex; static uint8_t greyIndex;

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void menuChannelsView(uint8_t event) void menuChannelsView(event_t event)
{ {
static bool longNames = false; static bool longNames = false;
bool newLongNames = false; bool newLongNames = false;

View file

@ -283,7 +283,7 @@ void onMainViewMenu(const char *result)
} }
#endif #endif
void menuMainView(uint8_t event) void menuMainView(event_t event)
{ {
STICK_SCROLL_DISABLE(); STICK_SCROLL_DISABLE();

View file

@ -35,7 +35,7 @@ uint8_t MAVLINK_menu = MENU_INFO;
* lanuched by the menu button. On exit (with exit button) the mavlink * lanuched by the menu button. On exit (with exit button) the mavlink
* extension is reinitialized. * extension is reinitialized.
*/ */
void menuViewTelemetryMavlink(uint8_t event) { void menuViewTelemetryMavlink(event_t event) {
switch (event) // new event received, branch accordingly switch (event) // new event received, branch accordingly
{ {
@ -433,7 +433,7 @@ void lcd_outhex2(uint8_t x, uint8_t y, uint8_t val) {
} }
//! \brief Hex dump of the current mavlink message. //! \brief Hex dump of the current mavlink message.
void menuTelemetryMavlinkDump(uint8_t event) { void menuTelemetryMavlinkDump(event_t event) {
uint8_t x = 0; uint8_t x = 0;
uint8_t y = FH; uint8_t y = FH;
uint16_t count = 0; uint16_t count = 0;
@ -481,7 +481,7 @@ void menuTelemetryMavlinkDump(uint8_t event) {
* This funcion is called from the model setup menus, not directly by the * This funcion is called from the model setup menus, not directly by the
* telemetry menus * telemetry menus
*/ */
void menuModelTelemetryMavlink(uint8_t event) { void menuModelTelemetryMavlink(event_t event) {
MENU(STR_MAVMENUSETUP_TITLE, menuTabModel, MENU_MODEL_TELEMETRY_MAVLINK, ITEM_MAVLINK_MAX + 1, {0, 0, 1/*to force edit mode*/}); MENU(STR_MAVMENUSETUP_TITLE, menuTabModel, MENU_MODEL_TELEMETRY_MAVLINK, ITEM_MAVLINK_MAX + 1, {0, 0, 1/*to force edit mode*/});

View file

@ -31,7 +31,7 @@
#define APSIZE (BSS | DBLSIZE) #define APSIZE (BSS | DBLSIZE)
void menuViewTelemetryMavlink(uint8_t event); void menuViewTelemetryMavlink(event_t event);
void lcd_outdezFloat(uint8_t x, uint8_t y, float val, uint8_t precis, uint8_t mode = 0); void lcd_outdezFloat(uint8_t x, uint8_t y, float val, uint8_t precis, uint8_t mode = 0);
void mav_title(const pm_char * s, uint8_t index); void mav_title(const pm_char * s, uint8_t index);
void menuTelemetryMavlinkInfos(void); void menuTelemetryMavlinkInfos(void);
@ -41,7 +41,7 @@ void menuTelemetryMavlinkNavigation(void);
void menuTelemetryMavlinkGPS(void); void menuTelemetryMavlinkGPS(void);
#ifdef DUMP_RX_TX #ifdef DUMP_RX_TX
void lcd_outhex2(uint8_t x, uint8_t y, uint8_t val); void lcd_outhex2(uint8_t x, uint8_t y, uint8_t val);
void menuTelemetryMavlinkDump(uint8_t event); void menuTelemetryMavlinkDump(event_t event);
#endif #endif
/*! \brief Mavlink menu enumerator /*! \brief Mavlink menu enumerator

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void menuStatisticsView(uint8_t event) void menuStatisticsView(event_t event)
{ {
TITLE(STR_MENUSTAT); TITLE(STR_MENUSTAT);
@ -81,7 +81,7 @@ void menuStatisticsView(uint8_t event)
#define MENU_DEBUG_COL1_OFS (14*FW) #define MENU_DEBUG_COL1_OFS (14*FW)
#endif #endif
void menuStatisticsDebug(uint8_t event) void menuStatisticsDebug(event_t event)
{ {
TITLE(STR_MENUDEBUG); TITLE(STR_MENUDEBUG);

View file

@ -490,7 +490,7 @@ void incrTelemetryScreen()
} }
#endif #endif
void menuViewTelemetryFrsky(uint8_t event) void menuViewTelemetryFrsky(event_t event)
{ {
#if defined(CPUARM) #if defined(CPUARM)
enum NavigationDirection direction = none; enum NavigationDirection direction = none;

View file

@ -88,7 +88,7 @@ void readTextFile(int & lines_count)
} }
} }
void menuTextView(uint8_t event) void menuTextView(event_t event)
{ {
static int lines_count; static int lines_count;

View file

@ -72,7 +72,7 @@ void title(const pm_char * s)
lcdDrawText(0, 0, s, INVERS); lcdDrawText(0, 0, s, INVERS);
} }
choice_t editChoice(coord_t x, coord_t y, const pm_char *label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, uint8_t event) choice_t editChoice(coord_t x, coord_t y, const pm_char * label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event)
{ {
drawFieldLabel(x, y, label); drawFieldLabel(x, y, label);
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr); if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
@ -80,7 +80,7 @@ choice_t editChoice(coord_t x, coord_t y, const pm_char *label, const pm_char *v
return value; return value;
} }
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, uint8_t event ) uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, event_t event )
{ {
#if defined(GRAPHICS) #if defined(GRAPHICS)
drawCheckBox(x, y, value, attr); drawCheckBox(x, y, value, attr);
@ -90,7 +90,7 @@ uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label,
#endif #endif
} }
int8_t editSwitch(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t event) int8_t editSwitch(coord_t x, coord_t y, int8_t value, LcdFlags attr, event_t event)
{ {
drawFieldLabel(x, y, STR_SWITCH); drawFieldLabel(x, y, STR_SWITCH);
drawSwitch(x, y, value, attr); drawSwitch(x, y, value, attr);
@ -120,7 +120,7 @@ bool noZero(int val)
return val != 0; return val != 0;
} }
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, uint8_t event) int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, event_t event)
{ {
uint16_t delta = GV_GET_GV1_VALUE(max); uint16_t delta = GV_GET_GV1_VALUE(max);
bool invers = (attr & INVERS); bool invers = (attr & INVERS);
@ -167,7 +167,7 @@ int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int
return value; return value;
} }
#elif defined(GVARS) #elif defined(GVARS)
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event) int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, event_t event)
{ {
uint16_t delta = GV_GET_GV1_VALUE(max); uint16_t delta = GV_GET_GV1_VALUE(max);
bool invers = (attr & INVERS); bool invers = (attr & INVERS);
@ -207,7 +207,7 @@ int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int
return value; return value;
} }
#else #else
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event) int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, event_t event)
{ {
lcdDrawNumber(x, y, value, attr); lcdDrawNumber(x, y, value, attr);
if (attr&INVERS) value = checkIncDec(event, value, min, max, EE_MODEL); if (attr&INVERS) value = checkIncDec(event, value, min, max, EE_MODEL);

View file

@ -158,7 +158,7 @@ extern const CheckIncDecStops &stopsSwitch;
#define CATEGORY_END(val) \ #define CATEGORY_END(val) \
(val), (val+1) (val), (val+1)
int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int i_flags=0, IsValueAvailable isValueAvailable=NULL, const CheckIncDecStops &stops=stops100); int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_flags=0, IsValueAvailable isValueAvailable=NULL, const CheckIncDecStops &stops=stops100);
swsrc_t checkIncDecMovedSwitch(swsrc_t val); swsrc_t checkIncDecMovedSwitch(swsrc_t val);
#define checkIncDecModel(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_MODEL) #define checkIncDecModel(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_MODEL)
#define checkIncDecModelZero(event, i_val, i_max) checkIncDec(event, i_val, 0, i_max, EE_MODEL) #define checkIncDecModelZero(event, i_val, i_max) checkIncDec(event, i_val, 0, i_max, EE_MODEL)
@ -194,7 +194,7 @@ swsrc_t checkIncDecMovedSwitch(swsrc_t val);
#define CHECK_FLAG_NO_SCREEN_INDEX 1 #define CHECK_FLAG_NO_SCREEN_INDEX 1
void check(const char * title, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0); void check(const char * title, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0);
void check_simple(const char *title, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow); void check_simple(const char *title, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
void check_submenu_simple(const char *title, event_t event, uint8_t maxrow); void check_submenu_simple(const char * title, event_t event, uint8_t maxrow);
void title(const pm_char * s); void title(const pm_char * s);
#define TITLE(str) title(str) #define TITLE(str) title(str)
@ -238,36 +238,36 @@ void title(const pm_char * s);
typedef int choice_t; typedef int choice_t;
choice_t editChoice(coord_t x, coord_t y, const pm_char *label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, uint8_t event); choice_t editChoice(coord_t x, coord_t y, const pm_char *label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, uint8_t event); uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, event_t event);
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, uint8_t event); swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t event);
#define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = editCheckBox(value, x, y, label, attr, event) #define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = editCheckBox(value, x, y, label, attr, event)
#if defined(GVARS) #if defined(GVARS)
void drawGVarName(coord_t x, coord_t y, int8_t index, LcdFlags flags=0); void drawGVarName(coord_t x, coord_t y, int8_t index, LcdFlags flags=0);
void drawGVarValue(coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags flags=0); void drawGVarValue(coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags flags=0);
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, uint8_t event); int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, event_t event);
#define GVAR_MENU_ITEM(x, y, v, min, max, lcdattr, editflags, event) editGVarFieldValue(x, y, v, min, max, lcdattr, editflags, event) #define GVAR_MENU_ITEM(x, y, v, min, max, lcdattr, editflags, event) editGVarFieldValue(x, y, v, min, max, lcdattr, editflags, event)
#define displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0) #define displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0)
#else #else
#define GVAR_MENU_ITEM(x, y, v, min, max, lcdattr, editflags, event) editGVarFieldValue(x, y, v, min, max, lcdattr, event) #define GVAR_MENU_ITEM(x, y, v, min, max, lcdattr, editflags, event) editGVarFieldValue(x, y, v, min, max, lcdattr, event)
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event); int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, event_t event);
#define displayGVar(x, y, v, min, max) lcdDrawNumber(x, y, v) #define displayGVar(x, y, v, min, max) lcdDrawNumber(x, y, v)
#endif #endif
extern uint8_t s_curveChan; extern uint8_t s_curveChan;
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, LcdFlags flags); void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags);
extern uint8_t editNameCursorPos; extern uint8_t editNameCursorPos;
void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uint8_t active, uint8_t attr=ZCHAR); void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active, uint8_t attr=ZCHAR);
void editSingleName(coord_t x, coord_t y, const pm_char *label, char *name, uint8_t size, uint8_t event, uint8_t active); void editSingleName(coord_t x, coord_t y, const pm_char * label, char * name, uint8_t size, event_t event, uint8_t active);
#if MENU_COLUMNS > 1 #if MENU_COLUMNS > 1
uint8_t editDelay(const coord_t x, const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay); uint8_t editDelay(coord_t x, coord_t y, event_t event, uint8_t attr, const pm_char * str, uint8_t delay);
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(x, y, event, attr, str, delay) #define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(x, y, event, attr, str, delay)
#else #else
uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay); uint8_t editDelay(const coord_t y, const event_t event, const uint8_t attr, const pm_char *str, uint8_t delay);
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay) #define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay)
#endif #endif
@ -309,16 +309,21 @@ void drawStatusLine();
#define TEXT_FILENAME_MAXLEN 40 #define TEXT_FILENAME_MAXLEN 40
extern char s_text_file[TEXT_FILENAME_MAXLEN]; extern char s_text_file[TEXT_FILENAME_MAXLEN];
void menuTextView(uint8_t event); void menuTextView(event_t event);
void pushMenuTextView(const char *filename); void pushMenuTextView(const char *filename);
void pushModelNotes(); void pushModelNotes();
void menuChannelsView(uint8_t event); void menuChannelsView(event_t event);
#define LABEL(...) (uint8_t)-1 #define LABEL(...) (uint8_t)-1
#if defined(ROTARY_ENCODER_NAVIGATION)
#define CURSOR_MOVED_LEFT(event) (event==EVT_ROTARY_LEFT)
#define CURSOR_MOVED_RIGHT(event) (event==EVT_ROTARY_RIGHT)
#else
#define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_LEFT) #define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_LEFT)
#define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_RIGHT) #define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_RIGHT)
#endif
#define REPEAT_LAST_CURSOR_MOVE() { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else menuHorizontalPosition = 0; } #define REPEAT_LAST_CURSOR_MOVE() { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else menuHorizontalPosition = 0; }
#define MOVE_CURSOR_FROM_HERE() if (menuHorizontalPosition > 0) REPEAT_LAST_CURSOR_MOVE() #define MOVE_CURSOR_FROM_HERE() if (menuHorizontalPosition > 0) REPEAT_LAST_CURSOR_MOVE()
@ -341,7 +346,7 @@ extern const pm_uchar sticks[] PROGMEM;
#if defined(FLIGHT_MODES) #if defined(FLIGHT_MODES)
void displayFlightModes(coord_t x, coord_t y, FlightModesType value); void displayFlightModes(coord_t x, coord_t y, FlightModesType value);
FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModesType value, uint8_t attr); FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModesType value, uint8_t attr);
#else #else
#define displayFlightModes(...) #define displayFlightModes(...)
#endif #endif

View file

@ -37,13 +37,13 @@ const MenuHandlerFunc menuTabModel[] = {
#if defined(LUA_MODEL_SCRIPTS) #if defined(LUA_MODEL_SCRIPTS)
menuModelCustomScripts, menuModelCustomScripts,
#endif #endif
menuModelTelemetryFrsky, CASE_FRSKY(menuModelTelemetryFrsky)
CASE_MAVLINK(menuModelTelemetryMavlink) CASE_MAVLINK(menuModelTelemetryMavlink)
menuModelDisplay menuModelDisplay
}; };
#if MENU_COLUMNS > 1 #if MENU_COLUMNS > 1
uint8_t editDelay(const coord_t x, const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay) uint8_t editDelay(coord_t x, coord_t y, event_t event, uint8_t attr, const pm_char * str, uint8_t delay)
{ {
lcdDrawText(x, y, str); lcdDrawText(x, y, str);
lcdDrawNumber(x+MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT); lcdDrawNumber(x+MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
@ -51,7 +51,7 @@ uint8_t editDelay(const coord_t x, const coord_t y, const uint8_t event, const u
return delay; return delay;
} }
#else #else
uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay) uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const pm_char * str, uint8_t delay)
{ {
lcdDrawTextAlignedLeft(y, str); lcdDrawTextAlignedLeft(y, str);
lcdDrawNumber(MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT); lcdDrawNumber(MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
@ -71,7 +71,7 @@ uint8_t s_copySrcCh;
uint8_t editNameCursorPos = 0; uint8_t editNameCursorPos = 0;
void editName(coord_t x, coord_t y, char * name, uint8_t size, uint8_t event, uint8_t active, uint8_t attr) void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active, uint8_t attr)
{ {
uint8_t mode = 0; uint8_t mode = 0;
if (active) { if (active) {
@ -90,7 +90,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, uint8_t event, ui
int8_t c = name[cur]; int8_t c = name[cur];
int8_t v = c; int8_t v = c;
if (event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_DOWN) || event==EVT_KEY_REPT(KEY_UP)) { if (IS_NEXT_EVENT(event) || IS_PREVIOUS_EVENT(event)) {
if (attr == ZCHAR) { if (attr == ZCHAR) {
v = checkIncDec(event, abs(v), 0, ZCHAR_MAX, 0); v = checkIncDec(event, abs(v), 0, ZCHAR_MAX, 0);
if (c <= 0) v = -v; if (c <= 0) v = -v;
@ -102,7 +102,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, uint8_t event, ui
} }
switch (event) { switch (event) {
case EVT_ROTARY_BREAK: case EVT_KEY_BREAK(KEY_ENTER):
if (s_editMode == EDIT_MODIFY_FIELD) { if (s_editMode == EDIT_MODIFY_FIELD) {
s_editMode = EDIT_MODIFY_STRING; s_editMode = EDIT_MODIFY_STRING;
cur = 0; cur = 0;
@ -113,7 +113,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, uint8_t event, ui
s_editMode = 0; s_editMode = 0;
break; break;
case EVT_ROTARY_LONG: case EVT_KEY_LONG(KEY_ENTER):
if (attr & ZCHAR) { if (attr & ZCHAR) {
if (v == 0) { if (v == 0) {
s_editMode = 0; s_editMode = 0;
@ -159,7 +159,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, uint8_t event, ui
} }
} }
void editSingleName(coord_t x, coord_t y, const pm_char * label, char *name, uint8_t size, uint8_t event, uint8_t active) void editSingleName(coord_t x, coord_t y, const pm_char * label, char *name, uint8_t size, event_t event, uint8_t active)
{ {
lcdDrawTextAlignedLeft(y, label); lcdDrawTextAlignedLeft(y, label);
editName(x, y, name, size, event, active); editName(x, y, name, size, event, active);

View file

@ -32,7 +32,7 @@ const MenuHandlerFunc menuTabGeneral[] = {
menuRadioCalibration menuRadioCalibration
}; };
void menuRadioSpecialFunctions(uint8_t event) void menuRadioSpecialFunctions(event_t event)
{ {
MENU(STR_MENUSPECIALFUNCS, menuTabGeneral, MENU_RADIO_SPECIAL_FUNCTIONS, MAX_SPECIAL_FUNCTIONS, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ }); MENU(STR_MENUSPECIALFUNCS, menuTabGeneral, MENU_RADIO_SPECIAL_FUNCTIONS, MAX_SPECIAL_FUNCTIONS, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuSpecialFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext); return menuSpecialFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext);

View file

@ -66,7 +66,7 @@ void pushMenu(MenuHandlerFunc newMenu)
TRACE("pushMenu(%d, %p)", menuLevel, newMenu); TRACE("pushMenu(%d, %p)", menuLevel, newMenu);
} }
void menuModelNotes(uint8_t event) void menuModelNotes(event_t event)
{ {
if (event == EVT_ENTRY) { if (event == EVT_ENTRY) {
strcpy(s_text_file, MODELS_PATH "/"); strcpy(s_text_file, MODELS_PATH "/");

View file

@ -26,7 +26,7 @@
typedef int8_t horzpos_t; typedef int8_t horzpos_t;
typedef uint16_t vertpos_t; typedef uint16_t vertpos_t;
typedef void (*MenuHandlerFunc)(uint8_t event); typedef void (*MenuHandlerFunc)(event_t event);
extern tmr10ms_t menuEntryTime; extern tmr10ms_t menuEntryTime;
extern vertpos_t menuVerticalPosition; extern vertpos_t menuVerticalPosition;
@ -45,18 +45,18 @@ void popMenu();
void onMainViewMenu(const char * result); void onMainViewMenu(const char * result);
void menuFirstCalib(uint8_t event); void menuFirstCalib(event_t event);
void menuMainViewChannelsMonitor(uint8_t event); void menuMainViewChannelsMonitor(event_t event);
void menuChannelsView(uint8_t event); void menuChannelsView(event_t event);
void menuMainView(uint8_t event); void menuMainView(event_t event);
void menuViewTelemetryFrsky(uint8_t event); void menuViewTelemetryFrsky(event_t event);
void menuSpecialFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext); void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext);
void menuModelNotes(uint8_t event); void menuModelNotes(event_t event);
void menuStatisticsView(uint8_t event); void menuStatisticsView(event_t event);
void menuStatisticsDebug(uint8_t event); void menuStatisticsDebug(event_t event);
void menuAboutView(uint8_t event); void menuAboutView(event_t event);
#if defined(DEBUG_TRACE_BUFFER) #if defined(DEBUG_TRACE_BUFFER)
void menuTraceBuffer(uint8_t event); void menuTraceBuffer(event_t event);
#endif #endif
enum MenuRadioIndexes { enum MenuRadioIndexes {
@ -72,15 +72,15 @@ enum MenuRadioIndexes {
MENU_RADIO_PAGES_COUNT MENU_RADIO_PAGES_COUNT
}; };
void menuRadioSetup(uint8_t event); void menuRadioSetup(event_t event);
void menuRadioSdManager(uint8_t event); void menuRadioSdManager(event_t event);
void menuRadioSpecialFunctions(uint8_t event); void menuRadioSpecialFunctions(event_t event);
void menuRadioTrainer(uint8_t event); void menuRadioTrainer(event_t event);
void menuRadioVersion(uint8_t event); void menuRadioVersion(event_t event);
void menuRadioDiagKeys(uint8_t event); void menuRadioDiagKeys(event_t event);
void menuRadioDiagAnalogs(uint8_t event); void menuRadioDiagAnalogs(event_t event);
void menuRadioHardware(uint8_t event); void menuRadioHardware(event_t event);
void menuRadioCalibration(uint8_t event); void menuRadioCalibration(event_t event);
extern const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT]; extern const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT];
@ -105,23 +105,23 @@ enum MenuModelIndexes {
MENU_MODEL_PAGES_COUNT MENU_MODEL_PAGES_COUNT
}; };
void menuModelSelect(uint8_t event); void menuModelSelect(event_t event);
void menuModelSetup(uint8_t event); void menuModelSetup(event_t event);
void menuModelFailsafe(uint8_t event); void menuModelFailsafe(event_t event);
void menuModelHeli(uint8_t event); void menuModelHeli(event_t event);
void menuModelFlightModesAll(uint8_t event); void menuModelFlightModesAll(event_t event);
void menuModelExposAll(uint8_t event); void menuModelExposAll(event_t event);
void menuModelMixAll(uint8_t event); void menuModelMixAll(event_t event);
void menuModelLimits(uint8_t event); void menuModelLimits(event_t event);
void menuModelCurvesAll(uint8_t event); void menuModelCurvesAll(event_t event);
void menuModelCurveOne(uint8_t event); void menuModelCurveOne(event_t event);
void menuModelGVars(uint8_t event); void menuModelGVars(event_t event);
void menuModelLogicalSwitches(uint8_t event); void menuModelLogicalSwitches(event_t event);
void menuModelSpecialFunctions(uint8_t event); void menuModelSpecialFunctions(event_t event);
void menuModelCustomScripts(uint8_t event); void menuModelCustomScripts(event_t event);
void menuModelTelemetryFrsky(uint8_t event); void menuModelTelemetryFrsky(event_t event);
void menuModelDisplay(uint8_t event); void menuModelDisplay(event_t event);
void menuModelExpoOne(uint8_t event); void menuModelExpoOne(event_t event);
extern const MenuHandlerFunc menuTabModel[MENU_MODEL_PAGES_COUNT]; extern const MenuHandlerFunc menuTabModel[MENU_MODEL_PAGES_COUNT];

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void displayPresetChoice(uint8_t event) void displayPresetChoice(event_t event)
{ {
runPopupWarning(event); runPopupWarning(event);
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45*warningInputValue/4, LEFT|INVERS); lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45*warningInputValue/4, LEFT|INVERS);
@ -64,7 +64,7 @@ void onCurveOneMenu(const char * result)
} }
} }
void menuModelCurveOne(uint8_t event) void menuModelCurveOne(event_t event)
{ {
static uint8_t pointsOfs = 0; static uint8_t pointsOfs = 0;
CurveData & crv = g_model.curves[s_curveChan]; CurveData & crv = g_model.curves[s_curveChan];

View file

@ -47,7 +47,7 @@ enum menuModelCustomScriptItems {
#define SCRIPT_ONE_2ND_COLUMN_POS (12*FW) #define SCRIPT_ONE_2ND_COLUMN_POS (12*FW)
#define SCRIPT_ONE_3RD_COLUMN_POS (23*FW) #define SCRIPT_ONE_3RD_COLUMN_POS (23*FW)
void menuModelCustomScriptOne(uint8_t event) void menuModelCustomScriptOne(event_t event)
{ {
ScriptData & sd = g_model.scriptsData[s_currIdx]; ScriptData & sd = g_model.scriptsData[s_currIdx];
@ -116,7 +116,7 @@ void menuModelCustomScriptOne(uint8_t event)
} }
} }
void menuModelCustomScripts(uint8_t event) void menuModelCustomScripts(event_t event)
{ {
lcdDrawNumber(19*FW, 0, luaGetMemUsed(), RIGHT); lcdDrawNumber(19*FW, 0, luaGetMemUsed(), RIGHT);
lcdDrawText(19*FW+1, 0, STR_BYTES); lcdDrawText(19*FW+1, 0, STR_BYTES);

View file

@ -81,7 +81,7 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
} }
#endif #endif
void menuModelDisplay(uint8_t event) void menuModelDisplay(event_t event)
{ {
MENU(STR_MENU_DISPLAY, menuTabModel, MENU_MODEL_DISPLAY, ITEM_DISPLAY_MAX, { LABEL(TopBar), 0, 0, TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), TELEMETRY_SCREEN_ROWS(2), TELEMETRY_SCREEN_ROWS(3) }); MENU(STR_MENU_DISPLAY, menuTabModel, MENU_MODEL_DISPLAY, ITEM_DISPLAY_MAX, { LABEL(TopBar), 0, 0, TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), TELEMETRY_SCREEN_ROWS(2), TELEMETRY_SCREEN_ROWS(3) });

View file

@ -48,7 +48,7 @@ bool isTrimModeAvailable(int mode)
return (mode < 0 || (mode%2) == 0 || (mode/2) != menuVerticalPosition); return (mode < 0 || (mode%2) == 0 || (mode/2) != menuVerticalPosition);
} }
void menuModelFlightModesAll(uint8_t event) void menuModelFlightModesAll(event_t event)
{ {
MENU(STR_MENUFLIGHTMODES, menuTabModel, MENU_MODEL_FLIGHT_MODES, MAX_FLIGHT_MODES+1, { NAVIGATION_LINE_BY_LINE|(ITEM_FLIGHT_MODES_LAST-1), NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, 0 }); MENU(STR_MENUFLIGHTMODES, menuTabModel, MENU_MODEL_FLIGHT_MODES, MAX_FLIGHT_MODES+1, { NAVIGATION_LINE_BY_LINE|(ITEM_FLIGHT_MODES_LAST-1), NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, 0 });

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void editGVarValue(coord_t x, coord_t y, uint8_t event, uint8_t gvar, uint8_t flightMode, LcdFlags flags) void editGVarValue(coord_t x, coord_t y, event_t event, uint8_t gvar, uint8_t flightMode, LcdFlags flags)
{ {
FlightModeData * fm = &g_model.flightModeData[flightMode]; FlightModeData * fm = &g_model.flightModeData[flightMode];
gvar_t & v = fm->gvars[gvar]; gvar_t & v = fm->gvars[gvar];
@ -62,7 +62,7 @@ enum GVarFields {
#define GVAR_2ND_COLUMN (12*FW) #define GVAR_2ND_COLUMN (12*FW)
void menuModelGVarOne(uint8_t event) void menuModelGVarOne(event_t event)
{ {
GVarData * gvar = &g_model.gvars[s_currIdx]; GVarData * gvar = &g_model.gvars[s_currIdx];
@ -133,7 +133,7 @@ void onGVARSMenu(const char *result)
#define GVARS_COLUMNS (NAVIGATION_LINE_BY_LINE|(MAX_FLIGHT_MODES-1)) #define GVARS_COLUMNS (NAVIGATION_LINE_BY_LINE|(MAX_FLIGHT_MODES-1))
#define GVARS_FM_COLUMN(p) (7*FW - 7 + (p)*20) #define GVARS_FM_COLUMN(p) (7*FW - 7 + (p)*20)
void menuModelGVars(uint8_t event) void menuModelGVars(event_t event)
{ {
tmr10ms_t tmr10ms = get_tmr10ms(); tmr10ms_t tmr10ms = get_tmr10ms();
const char * menuTitle; const char * menuTitle;

View file

@ -175,7 +175,7 @@ enum ExposFields {
#define CURVE_ROWS 1 #define CURVE_ROWS 1
void menuModelExpoOne(uint8_t event) void menuModelExpoOne(event_t event)
{ {
if (event == EVT_KEY_LONG(KEY_MENU)) { if (event == EVT_KEY_LONG(KEY_MENU)) {
pushMenu(menuChannelsView); pushMenu(menuChannelsView);
@ -352,7 +352,7 @@ void displayExpoLine(coord_t y, ExpoData * ed)
} }
} }
void menuModelExposAll(uint8_t event) void menuModelExposAll(event_t event)
{ {
uint8_t sub = menuVerticalPosition; uint8_t sub = menuVerticalPosition;

View file

@ -39,7 +39,7 @@ enum LogicalSwitchFields {
#define CSW_5TH_COLUMN (26*FW+3) #define CSW_5TH_COLUMN (26*FW+3)
#define CSW_6TH_COLUMN (31*FW+1) #define CSW_6TH_COLUMN (31*FW+1)
void putsEdgeDelayParam(coord_t x, coord_t y, LogicalSwitchData *cs, uint8_t lattr, uint8_t rattr) void putsEdgeDelayParam(coord_t x, coord_t y, LogicalSwitchData * cs, uint8_t lattr, uint8_t rattr)
{ {
lcdDrawChar(x-4, y, '['); lcdDrawChar(x-4, y, '[');
lcdDrawNumber(x, y, lswTimerValue(cs->v2), LEFT|PREC1|lattr); lcdDrawNumber(x, y, lswTimerValue(cs->v2), LEFT|PREC1|lattr);
@ -72,7 +72,7 @@ void onLogicalSwitchesMenu(const char *result)
} }
} }
void menuModelLogicalSwitches(uint8_t event) void menuModelLogicalSwitches(event_t event)
{ {
INCDEC_DECLARE_VARS(EE_MODEL); INCDEC_DECLARE_VARS(EE_MODEL);
@ -98,7 +98,7 @@ void menuModelLogicalSwitches(uint8_t event)
POPUP_MENU_START(onLogicalSwitchesMenu); POPUP_MENU_START(onLogicalSwitchesMenu);
} }
for (int i=0; i<NUM_BODY_LINES; ++i) { for (uint8_t i=0; i<NUM_BODY_LINES; ++i) {
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH; coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
k = i+menuVerticalOffset; k = i+menuVerticalOffset;
LcdFlags attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); LcdFlags attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);

View file

@ -142,7 +142,7 @@ enum MixFields {
MIX_FIELD_COUNT MIX_FIELD_COUNT
}; };
void gvarWeightItem(coord_t x, coord_t y, MixData *md, uint8_t attr, uint8_t event) void gvarWeightItem(coord_t x, coord_t y, MixData *md, uint8_t attr, event_t event)
{ {
u_int8int16_t weight; u_int8int16_t weight;
MD_WEIGHT_TO_UNION(md, weight); MD_WEIGHT_TO_UNION(md, weight);
@ -195,7 +195,7 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
} }
} }
void menuModelMixOne(uint8_t event) void menuModelMixOne(event_t event)
{ {
if (event == EVT_KEY_LONG(KEY_MENU)) { if (event == EVT_KEY_LONG(KEY_MENU)) {
pushMenu(menuChannelsView); pushMenu(menuChannelsView);
@ -382,7 +382,7 @@ void displayMixLine(coord_t y, MixData * md)
lcdDrawChar(MIX_LINE_DELAY_POS, y, cs); lcdDrawChar(MIX_LINE_DELAY_POS, y, cs);
} }
void menuModelMixAll(uint8_t event) void menuModelMixAll(event_t event)
{ {
uint8_t sub = menuVerticalPosition; uint8_t sub = menuVerticalPosition;

View file

@ -97,7 +97,7 @@ void onLimitsMenu(const char *result)
} }
} }
void menuModelLimits(uint8_t event) void menuModelLimits(event_t event)
{ {
int sub = menuVerticalPosition; int sub = menuVerticalPosition;

View file

@ -23,7 +23,7 @@
#define MODELSIZE_POS_X 170 #define MODELSIZE_POS_X 170
#define MODELSEL_W 133 #define MODELSEL_W 133
void onModelSelectMenu(const char *result) void onModelSelectMenu(const char * result)
{ {
int8_t sub = menuVerticalPosition; int8_t sub = menuVerticalPosition;
@ -63,7 +63,7 @@ void onModelSelectMenu(const char *result)
} }
} }
void menuModelSelect(uint8_t event) void menuModelSelect(event_t event)
{ {
if (warningResult) { if (warningResult) {
warningResult = 0; warningResult = 0;
@ -73,7 +73,7 @@ void menuModelSelect(uint8_t event)
event = EVT_ENTRY_UP; event = EVT_ENTRY_UP;
} }
uint8_t _event_ = ((event==EVT_KEY_BREAK(KEY_ENTER) || event==EVT_KEY_LONG(KEY_ENTER)) ? 0 : event); event_t _event_ = ((event==EVT_KEY_BREAK(KEY_ENTER) || event==EVT_KEY_LONG(KEY_ENTER)) ? 0 : event);
if ((s_copyMode && EVT_KEY_MASK(event) == KEY_EXIT) || event == EVT_KEY_BREAK(KEY_EXIT)) { if ((s_copyMode && EVT_KEY_MASK(event) == KEY_EXIT) || event == EVT_KEY_BREAK(KEY_EXIT)) {
_event_ -= KEY_EXIT; _event_ -= KEY_EXIT;
@ -87,8 +87,7 @@ void menuModelSelect(uint8_t event)
int sub = menuVerticalPosition; int sub = menuVerticalPosition;
switch (event) switch (event) {
{
case EVT_ENTRY: case EVT_ENTRY:
menuVerticalPosition = sub = g_eeGeneral.currModel; menuVerticalPosition = sub = g_eeGeneral.currModel;
if (sub >= NUM_BODY_LINES) menuVerticalOffset = sub-(NUM_BODY_LINES-1); if (sub >= NUM_BODY_LINES) menuVerticalOffset = sub-(NUM_BODY_LINES-1);

View file

@ -98,7 +98,7 @@ enum MenuModelSetupItems {
#define MODEL_SETUP_RANGE_OFS 7*FW #define MODEL_SETUP_RANGE_OFS 7*FW
#define MODEL_SETUP_SET_FAILSAFE_OFS 10*FW-2 #define MODEL_SETUP_SET_FAILSAFE_OFS 10*FW-2
void copySelection(char *dst, const char *src, uint8_t size) void copySelection(char * dst, const char * src, uint8_t size)
{ {
if (memcmp(src, "---", 3) == 0) if (memcmp(src, "---", 3) == 0)
memset(dst, 0, size); memset(dst, 0, size);
@ -106,7 +106,7 @@ void copySelection(char *dst, const char *src, uint8_t size)
memcpy(dst, src, size); memcpy(dst, src, size);
} }
void onModelSetupBitmapMenu(const char *result) void onModelSetupBitmapMenu(const char * result)
{ {
if (result == STR_UPDATE_LIST) { if (result == STR_UPDATE_LIST) {
if (!sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), NULL)) { if (!sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), NULL)) {
@ -121,7 +121,7 @@ void onModelSetupBitmapMenu(const char *result)
} }
} }
void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, uint8_t event) void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, event_t event)
{ {
TimerData & timer = g_model.timers[timerIdx]; TimerData & timer = g_model.timers[timerIdx];
drawStringWithIndex(0*FW, y, STR_TIMER, timerIdx+1); drawStringWithIndex(0*FW, y, STR_TIMER, timerIdx+1);
@ -166,7 +166,7 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, uint8_t event)
} }
} }
void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, uint8_t event) void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, event_t event)
{ {
TimerData & timer = g_model.timers[timerIdx]; TimerData & timer = g_model.timers[timerIdx];
lcdDrawTextAlignedLeft(y, STR_BEEPCOUNTDOWN); lcdDrawTextAlignedLeft(y, STR_BEEPCOUNTDOWN);
@ -258,7 +258,7 @@ int getSwitchWarningsCount()
#endif #endif
void menuModelSetup(uint8_t event) void menuModelSetup(event_t event)
{ {
horzpos_t l_posHorz = menuHorizontalPosition; horzpos_t l_posHorz = menuHorizontalPosition;
bool CURSOR_ON_CELL = (menuHorizontalPosition >= 0); bool CURSOR_ON_CELL = (menuHorizontalPosition >= 0);
@ -1024,7 +1024,7 @@ void menuModelSetup(uint8_t event)
#endif #endif
} }
void menuModelFailsafe(uint8_t event) void menuModelFailsafe(event_t event)
{ {
static bool longNames = false; static bool longNames = false;
bool newLongNames = false; bool newLongNames = false;

View file

@ -144,7 +144,7 @@ enum CustomFunctionsItems {
ITEM_CUSTOM_FUNCTIONS_LAST = ITEM_CUSTOM_FUNCTIONS_COUNT-1 ITEM_CUSTOM_FUNCTIONS_LAST = ITEM_CUSTOM_FUNCTIONS_COUNT-1
}; };
void menuSpecialFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext) void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
{ {
int sub = menuVerticalPosition; int sub = menuVerticalPosition;
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL; uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
@ -421,7 +421,7 @@ void menuSpecialFunctions(uint8_t event, CustomFunctionData * functions, CustomF
} }
} }
void menuModelSpecialFunctions(uint8_t event) void menuModelSpecialFunctions(event_t event)
{ {
MENU(STR_MENUCUSTOMFUNC, menuTabModel, MENU_MODEL_SPECIAL_FUNCTIONS, MAX_SPECIAL_FUNCTIONS, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ }); MENU(STR_MENUCUSTOMFUNC, menuTabModel, MENU_MODEL_SPECIAL_FUNCTIONS, MAX_SPECIAL_FUNCTIONS, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuSpecialFunctions(event, g_model.customFn, &modelFunctionsContext); return menuSpecialFunctions(event, g_model.customFn, &modelFunctionsContext);

View file

@ -31,7 +31,7 @@ int checkIncDecSelection = 0;
#if defined(AUTOSWITCH) #if defined(AUTOSWITCH)
swsrc_t checkIncDecMovedSwitch(swsrc_t val) swsrc_t checkIncDecMovedSwitch(swsrc_t val)
{ {
if (s_editMode>0) { if (s_editMode > 0) {
swsrc_t swtch = getMovedSwitch(); swsrc_t swtch = getMovedSwitch();
if (swtch) { if (swtch) {
div_t info = switchInfo(swtch); div_t info = switchInfo(swtch);
@ -92,7 +92,7 @@ void onSourceLongEnterPress(const char * result)
} }
} }
void onSwitchLongEnterPress(const char *result) void onSwitchLongEnterPress(const char * result)
{ {
if (result == STR_MENU_SWITCHES) if (result == STR_MENU_SWITCHES)
checkIncDecSelection = SWSRC_FIRST_SWITCH; checkIncDecSelection = SWSRC_FIRST_SWITCH;
@ -111,7 +111,7 @@ void onSwitchLongEnterPress(const char *result)
#define DBLKEYS_PRESSED_RGT_UP(in) ((in & ((1<<KEY_ENTER) + (1<<KEY_MINUS))) == ((1<<KEY_ENTER) + (1<<KEY_MINUS))) #define DBLKEYS_PRESSED_RGT_UP(in) ((in & ((1<<KEY_ENTER) + (1<<KEY_MINUS))) == ((1<<KEY_ENTER) + (1<<KEY_MINUS)))
#define DBLKEYS_PRESSED_LFT_DWN(in) ((in & ((1<<KEY_PAGE) + (1<<KEY_EXIT))) == ((1<<KEY_PAGE) + (1<<KEY_EXIT))) #define DBLKEYS_PRESSED_LFT_DWN(in) ((in & ((1<<KEY_PAGE) + (1<<KEY_EXIT))) == ((1<<KEY_PAGE) + (1<<KEY_EXIT)))
int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int i_flags, IsValueAvailable isValueAvailable, const CheckIncDecStops &stops) int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_flags, IsValueAvailable isValueAvailable, const CheckIncDecStops &stops)
{ {
int newval = val; int newval = val;
@ -157,6 +157,28 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
} }
#endif #endif
#if defined(ROTARY_ENCODER_NAVIGATION)
if (s_editMode>0 && event==EVT_ROTARY_RIGHT) {
newval += min<int>(rotencSpeed, i_max-val);
while (isValueAvailable && !isValueAvailable(newval) && newval<=i_max) {
newval++;
}
if (newval > i_max) {
newval = val;
AUDIO_KEY_ERROR();
}
}
else if (s_editMode>0 && event==EVT_ROTARY_LEFT) {
newval -= min<int>(rotencSpeed, val-i_min);
while (isValueAvailable && !isValueAvailable(newval) && newval>=i_min) {
newval--;
}
if (newval < i_min) {
newval = val;
AUDIO_KEY_ERROR();
}
}
#else
if (s_editMode>0 && (event==EVT_KEY_FIRST(KEY_PLUS) || event==EVT_KEY_REPT(KEY_PLUS))) { if (s_editMode>0 && (event==EVT_KEY_FIRST(KEY_PLUS) || event==EVT_KEY_REPT(KEY_PLUS))) {
do { do {
if (IS_KEY_REPT(event) && (i_flags & INCDEC_REP10)) { if (IS_KEY_REPT(event) && (i_flags & INCDEC_REP10)) {
@ -187,6 +209,7 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
AUDIO_KEY_ERROR(); AUDIO_KEY_ERROR();
} }
} }
#endif
if (!READ_ONLY() && i_min==0 && i_max==1 && event==EVT_KEY_BREAK(KEY_ENTER)) { if (!READ_ONLY() && i_min==0 && i_max==1 && event==EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0; s_editMode = 0;
@ -219,17 +242,19 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
#endif #endif
if (newval != val) { if (newval != val) {
#if !defined(ROTARY_ENCODER_NAVIGATION)
if (!(i_flags & NO_INCDEC_MARKS) && (newval != i_max) && (newval != i_min) && stops.contains(newval)) { if (!(i_flags & NO_INCDEC_MARKS) && (newval != i_max) && (newval != i_min) && stops.contains(newval)) {
bool pause = (newval > val ? !stops.contains(newval+1) : !stops.contains(newval-1)); bool pause = (newval > val ? !stops.contains(newval+1) : !stops.contains(newval-1));
if (pause) { if (pause) {
pauseEvents(event); // delay before auto-repeat continues pauseEvents(event); // delay before auto-repeat continues
} }
} }
storageDirty(i_flags & (EE_GENERAL|EE_MODEL));
checkIncDec_Ret = (newval > val ? 1 : -1);
if (!IS_KEY_REPT(event)) { if (!IS_KEY_REPT(event)) {
AUDIO_KEY_PRESS(); AUDIO_KEY_PRESS();
} }
#endif
storageDirty(i_flags & (EE_GENERAL|EE_MODEL));
checkIncDec_Ret = (newval > val ? 1 : -1);
} }
else { else {
checkIncDec_Ret = 0; checkIncDec_Ret = 0;
@ -312,16 +337,16 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
return newval; return newval;
} }
#define CURSOR_NOT_ALLOWED_IN_ROW(row) ((int8_t)MAXCOL(row) < 0) #define CURSOR_NOT_ALLOWED_IN_ROW(row) ((int8_t)MAXCOL(row) < 0)
#define MAXCOL_RAW(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0) #define MAXCOL_RAW(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
#define MAXCOL(row) (MAXCOL_RAW(row) >= HIDDEN_ROW ? MAXCOL_RAW(row) : (const uint8_t)(MAXCOL_RAW(row) & (~NAVIGATION_LINE_BY_LINE))) #define MAXCOL(row) (MAXCOL_RAW(row) >= HIDDEN_ROW ? MAXCOL_RAW(row) : (const uint8_t)(MAXCOL_RAW(row) & (~NAVIGATION_LINE_BY_LINE)))
#define COLATTR(row) (MAXCOL_RAW(row) == (uint8_t)-1 ? (const uint8_t)0 : (const uint8_t)(MAXCOL_RAW(row) & NAVIGATION_LINE_BY_LINE)) #define COLATTR(row) (MAXCOL_RAW(row) == (uint8_t)-1 ? (const uint8_t)0 : (const uint8_t)(MAXCOL_RAW(row) & NAVIGATION_LINE_BY_LINE))
#define INC(val, min, max) if (val<max) {val++;} else {val=min;} #define INC(val, min, max) if (val<max) {val++;} else if (max>min) {val=min;}
#define DEC(val, min, max) if (val>min) {val--;} else {val=max;} #define DEC(val, min, max) if (val>min) {val--;} else {val=max;}
coord_t scrollbar_X = DEFAULT_SCROLLBAR_X; coord_t scrollbar_X = DEFAULT_SCROLLBAR_X;
void onLongMenuPress(const char *result) void onLongMenuPress(const char * result)
{ {
if (result == STR_VIEW_CHANNELS) { if (result == STR_VIEW_CHANNELS) {
pushMenu(menuChannelsView); pushMenu(menuChannelsView);
@ -331,7 +356,6 @@ void onLongMenuPress(const char *result)
} }
} }
tmr10ms_t menuEntryTime; tmr10ms_t menuEntryTime;
void check(const char * name, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags) void check(const char * name, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
@ -403,7 +427,7 @@ void check(const char * name, event_t event, uint8_t curr, const MenuHandlerFunc
SET_SCROLLBAR_X(LCD_W-1); SET_SCROLLBAR_X(LCD_W-1);
break; break;
case EVT_ROTARY_BREAK: case EVT_KEY_BREAK(KEY_ENTER):
if (s_editMode > 1) break; if (s_editMode > 1) break;
if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) { if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
l_posHorz = 0; l_posHorz = 0;
@ -445,6 +469,7 @@ void check(const char * name, event_t event, uint8_t curr, const MenuHandlerFunc
} }
break; break;
CASE_EVT_ROTARY_RIGHT
case EVT_KEY_FIRST(KEY_RIGHT): case EVT_KEY_FIRST(KEY_RIGHT):
AUDIO_KEY_PRESS(); AUDIO_KEY_PRESS();
// no break // no break
@ -474,7 +499,8 @@ void check(const char * name, event_t event, uint8_t curr, const MenuHandlerFunc
l_posHorz = POS_HORZ_INIT(l_posVert); l_posHorz = POS_HORZ_INIT(l_posVert);
break; break;
CASE_EVT_ROTARY_LEFT
case EVT_KEY_FIRST(KEY_LEFT): case EVT_KEY_FIRST(KEY_LEFT):
AUDIO_KEY_PRESS(); AUDIO_KEY_PRESS();
// no break // no break
@ -588,7 +614,7 @@ void check_submenu_simple(const char * name, event_t event, uint8_t rowcount)
check_simple(name, event, 0, 0, 0, rowcount); check_simple(name, event, 0, 0, 0, rowcount);
} }
void repeatLastCursorMove(uint8_t event) void repeatLastCursorMove(event_t event)
{ {
if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) {
putEvent(event); putEvent(event);

View file

@ -29,7 +29,7 @@ uint8_t warningInfoFlags = ZCHAR;
int16_t warningInputValue; int16_t warningInputValue;
int16_t warningInputValueMin; int16_t warningInputValueMin;
int16_t warningInputValueMax; int16_t warningInputValueMax;
void (*popupFunc)(uint8_t event) = NULL; void (*popupFunc)(event_t event) = NULL;
const char * popupMenuItems[POPUP_MENU_MAX_LINES]; const char * popupMenuItems[POPUP_MENU_MAX_LINES];
uint8_t s_menu_item = 0; uint8_t s_menu_item = 0;
uint16_t popupMenuNoItems = 0; uint16_t popupMenuNoItems = 0;
@ -92,7 +92,7 @@ void showAlertBox(const char * title, const char * text, const char * action, ui
clearKeyEvents(); clearKeyEvents();
} }
void runPopupWarning(uint8_t event) void runPopupWarning(event_t event)
{ {
warningResult = false; warningResult = false;
drawMessageBox(warningText); drawMessageBox(warningText);
@ -120,7 +120,7 @@ void runPopupWarning(uint8_t event)
} }
} }
const char * runPopupMenu(uint8_t event) const char * runPopupMenu(event_t event)
{ {
const char * result = NULL; const char * result = NULL;
@ -139,6 +139,7 @@ const char * runPopupMenu(uint8_t event)
} }
switch (event) { switch (event) {
CASE_EVT_ROTARY_LEFT
case EVT_KEY_FIRST(KEY_UP): case EVT_KEY_FIRST(KEY_UP):
case EVT_KEY_REPT(KEY_UP): case EVT_KEY_REPT(KEY_UP):
if (s_menu_item > 0) { if (s_menu_item > 0) {
@ -156,7 +157,8 @@ const char * runPopupMenu(uint8_t event)
} }
} }
break; break;
CASE_EVT_ROTARY_RIGHT
case EVT_KEY_FIRST(KEY_DOWN): case EVT_KEY_FIRST(KEY_DOWN):
case EVT_KEY_REPT(KEY_DOWN): case EVT_KEY_REPT(KEY_DOWN):
if (s_menu_item < display_count - 1 && popupMenuOffset + s_menu_item + 1 < popupMenuNoItems) { if (s_menu_item < display_count - 1 && popupMenuOffset + s_menu_item + 1 < popupMenuNoItems) {
@ -174,9 +176,11 @@ const char * runPopupMenu(uint8_t event)
} }
} }
break; break;
case EVT_KEY_BREAK(KEY_ENTER): case EVT_KEY_BREAK(KEY_ENTER):
result = popupMenuItems[s_menu_item + (popupMenuOffsetType == MENU_OFFSET_INTERNAL ? popupMenuOffset : 0)]; result = popupMenuItems[s_menu_item + (popupMenuOffsetType == MENU_OFFSET_INTERNAL ? popupMenuOffset : 0)];
// no break // no break
case EVT_KEY_BREAK(KEY_EXIT): case EVT_KEY_BREAK(KEY_EXIT):
popupMenuNoItems = 0; popupMenuNoItems = 0;
s_menu_item = 0; s_menu_item = 0;

View file

@ -30,9 +30,9 @@
void drawMessageBox(const char * title); void drawMessageBox(const char * title);
void showMessageBox(const char * title); void showMessageBox(const char * title);
void runPopupWarning(uint8_t event); void runPopupWarning(event_t event);
extern void (*popupFunc)(uint8_t event); extern void (*popupFunc)(event_t event);
extern int16_t warningInputValue; extern int16_t warningInputValue;
extern int16_t warningInputValueMin; extern int16_t warningInputValueMin;
extern int16_t warningInputValueMax; extern int16_t warningInputValueMax;
@ -61,7 +61,7 @@ enum {
MENU_OFFSET_EXTERNAL MENU_OFFSET_EXTERNAL
}; };
extern uint8_t popupMenuOffsetType; extern uint8_t popupMenuOffsetType;
const char * runPopupMenu(uint8_t event); const char * runPopupMenu(event_t event);
extern void (*popupMenuHandler)(const char * result); extern void (*popupMenuHandler)(const char * result);
#endif // _POPUPS_H_ #endif // _POPUPS_H_

View file

@ -45,7 +45,7 @@ void drawPotsBars()
} }
} }
void menuCommonCalib(uint8_t event) void menuCommonCalib(event_t event)
{ {
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) { // get low and high vals for sticks and trims for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) { // get low and high vals for sticks and trims
int16_t vt = anaIn(i); int16_t vt = anaIn(i);
@ -196,7 +196,7 @@ void menuCommonCalib(uint8_t event)
#endif #endif
} }
void menuRadioCalibration(uint8_t event) void menuRadioCalibration(event_t event)
{ {
check_simple(STR_MENUCALIBRATION, event, MENU_RADIO_CALIBRATION, menuTabGeneral, DIM(menuTabGeneral), 0); check_simple(STR_MENUCALIBRATION, event, MENU_RADIO_CALIBRATION, menuTabGeneral, DIM(menuTabGeneral), 0);
menuCommonCalib(READ_ONLY() ? 0 : event); menuCommonCalib(READ_ONLY() ? 0 : event);
@ -205,7 +205,7 @@ void menuRadioCalibration(uint8_t event)
} }
} }
void menuFirstCalib(uint8_t event) void menuFirstCalib(event_t event)
{ {
if (event == EVT_KEY_BREAK(KEY_EXIT) || reusableBuffer.calib.state == CALIB_FINISHED) { if (event == EVT_KEY_BREAK(KEY_EXIT) || reusableBuffer.calib.state == CALIB_FINISHED) {
menuCalibrationState = CALIB_START; menuCalibrationState = CALIB_START;

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void menuRadioDiagAnalogs(uint8_t event) void menuRadioDiagAnalogs(event_t event)
{ {
SIMPLE_MENU(STR_MENU_RADIO_ANALOGS, menuTabGeneral, MENU_RADIO_ANALOGS_TEST, 0); SIMPLE_MENU(STR_MENU_RADIO_ANALOGS, menuTabGeneral, MENU_RADIO_ANALOGS_TEST, 0);

View file

@ -26,7 +26,7 @@ void displayKeyState(uint8_t x, uint8_t y, uint8_t key)
lcdDrawChar(x, y, t+'0', t ? INVERS : 0); lcdDrawChar(x, y, t+'0', t ? INVERS : 0);
} }
void menuRadioDiagKeys(uint8_t event) void menuRadioDiagKeys(event_t event)
{ {
SIMPLE_MENU(STR_MENU_RADIO_SWITCHES, menuTabGeneral, MENU_RADIO_SWITCHES_TEST, 1); SIMPLE_MENU(STR_MENU_RADIO_SWITCHES, menuTabGeneral, MENU_RADIO_SWITCHES_TEST, 1);

View file

@ -81,7 +81,7 @@ enum menuRadioHwItems {
#define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS) #define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
void menuRadioHardware(uint8_t event) void menuRadioHardware(event_t event)
{ {
MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_RADIO_HARDWARE_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 }); MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_RADIO_HARDWARE_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 });

View file

@ -93,7 +93,7 @@ enum MenuRadioSetupItems {
ITEM_SETUP_MAX ITEM_SETUP_MAX
}; };
void menuRadioSetup(uint8_t event) void menuRadioSetup(event_t event)
{ {
#if defined(RTCLOCK) #if defined(RTCLOCK)
struct gtm t; struct gtm t;

View file

@ -22,7 +22,7 @@
#define TRAINER_CALIB_POS 12 #define TRAINER_CALIB_POS 12
void menuRadioTrainer(uint8_t event) void menuRadioTrainer(event_t event)
{ {
uint8_t y; uint8_t y;
bool slave = SLAVE_MODE(); bool slave = SLAVE_MODE();

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void menuRadioVersion(uint8_t event) void menuRadioVersion(event_t event)
{ {
if (warningResult) { if (warningResult) {
warningResult = 0; warningResult = 0;

View file

@ -42,7 +42,7 @@ enum AboutScreens {
#define ABOUT_X 62 #define ABOUT_X 62
#define ABOUT_INDENT 6 #define ABOUT_INDENT 6
void menuAboutView(uint8_t event) void menuAboutView(event_t event)
{ {
static uint8_t screenIndex; static uint8_t screenIndex;
static uint8_t greyIndex; static uint8_t greyIndex;

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
void menuChannelsView(uint8_t event) void menuChannelsView(event_t event)
{ {
static bool longNames = false; static bool longNames = false;
bool newLongNames = false; bool newLongNames = false;

View file

@ -330,7 +330,7 @@ void displayTimers()
} }
} }
void menuMainViewChannelsMonitor(uint8_t event) void menuMainViewChannelsMonitor(event_t event)
{ {
switch(event) { switch(event) {
case EVT_KEY_BREAK(KEY_PAGE): case EVT_KEY_BREAK(KEY_PAGE):
@ -440,7 +440,7 @@ int getSwitchCount()
return count; return count;
} }
void menuMainView(uint8_t event) void menuMainView(event_t event)
{ {
STICK_SCROLL_DISABLE(); STICK_SCROLL_DISABLE();

View file

@ -25,7 +25,7 @@
#define STATS_3RD_COLUMN 24*FW+FW/2 #define STATS_3RD_COLUMN 24*FW+FW/2
#define STATS_LABEL_WIDTH 4*FW #define STATS_LABEL_WIDTH 4*FW
void menuStatisticsView(uint8_t event) void menuStatisticsView(event_t event)
{ {
TITLE(STR_MENUSTAT); TITLE(STR_MENUSTAT);
@ -97,7 +97,7 @@ void menuStatisticsView(uint8_t event)
extern "C" volatile uint32_t APP_Rx_ptr_in; extern "C" volatile uint32_t APP_Rx_ptr_in;
#endif #endif
void menuStatisticsDebug(uint8_t event) void menuStatisticsDebug(event_t event)
{ {
TITLE(STR_MENUDEBUG); TITLE(STR_MENUDEBUG);
@ -192,7 +192,7 @@ void menuStatisticsDebug(uint8_t event)
#if defined(DEBUG_TRACE_BUFFER) #if defined(DEBUG_TRACE_BUFFER)
#include "stamp-opentx.h" #include "stamp-opentx.h"
void menuTraceBuffer(uint8_t event) void menuTraceBuffer(event_t event)
{ {
switch(event) switch(event)
{ {

View file

@ -204,7 +204,7 @@ enum NavigationDirection {
#define decrTelemetryScreen() direction = up #define decrTelemetryScreen() direction = up
#define incrTelemetryScreen() direction = down #define incrTelemetryScreen() direction = down
void menuViewTelemetryFrsky(uint8_t event) void menuViewTelemetryFrsky(event_t event)
{ {
enum NavigationDirection direction = none; enum NavigationDirection direction = none;

View file

@ -94,7 +94,7 @@ void readTextFile(int & lines_count)
} }
} }
void menuTextView(uint8_t event) void menuTextView(event_t event)
{ {
static int lines_count; static int lines_count;

View file

@ -129,7 +129,7 @@ void title(const pm_char * s)
lcdDrawText(0, 0, s, INVERS); lcdDrawText(0, 0, s, INVERS);
} }
choice_t editChoice(coord_t x, coord_t y, const pm_char *label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, uint8_t event) choice_t editChoice(coord_t x, coord_t y, const pm_char * label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event)
{ {
drawFieldLabel(x, y, label); drawFieldLabel(x, y, label);
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr); if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
@ -137,13 +137,13 @@ choice_t editChoice(coord_t x, coord_t y, const pm_char *label, const pm_char *v
return value; return value;
} }
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, uint8_t event ) uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, event_t event )
{ {
drawCheckBox(x, y, value, attr); drawCheckBox(x, y, value, attr);
return editChoice(x, y, label, NULL, value, 0, 1, attr, event); return editChoice(x, y, label, NULL, value, 0, 1, attr, event);
} }
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, uint8_t event) swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t event)
{ {
drawFieldLabel(x, y, STR_SWITCH); drawFieldLabel(x, y, STR_SWITCH);
drawSwitch(x, y, value, attr); drawSwitch(x, y, value, attr);
@ -181,7 +181,7 @@ void drawGVarValue(coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags fl
drawValueWithUnit(x, y, value, g_model.gvars[gvar].unit ? UNIT_PERCENT : UNIT_RAW, flags); drawValueWithUnit(x, y, value, g_model.gvars[gvar].unit ? UNIT_PERCENT : UNIT_RAW, flags);
} }
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, uint8_t event) int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, event_t event)
{ {
uint16_t delta = GV_GET_GV1_VALUE(max); uint16_t delta = GV_GET_GV1_VALUE(max);
bool invers = (attr & INVERS); bool invers = (attr & INVERS);
@ -227,7 +227,7 @@ int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int
return value; return value;
} }
#else #else
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event) int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, event_t event)
{ {
lcdDrawNumber(x, y, value, attr); lcdDrawNumber(x, y, value, attr);
if (attr&INVERS) value = checkIncDec(event, value, min, max, EE_MODEL); if (attr&INVERS) value = checkIncDec(event, value, min, max, EE_MODEL);

View file

@ -42,7 +42,7 @@ const MenuHandlerFunc menuTabModel[] = {
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags attr); void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags attr);
uint8_t editDelay(const coord_t x, const coord_t y, const event_t event, const uint8_t attr, uint8_t delay) uint8_t editDelay(coord_t x, coord_t y, event_t event, uint8_t attr, uint8_t delay)
{ {
lcdDrawNumber(x+MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT); lcdDrawNumber(x+MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX);

View file

@ -418,7 +418,7 @@ bool check_submenu_simple(event_t event, uint8_t maxrow);
extern uint8_t editNameCursorPos; extern uint8_t editNameCursorPos;
void editName(coord_t x, coord_t y, char *name, uint8_t size, event_t event, uint8_t active, LcdFlags flags=ZCHAR); void editName(coord_t x, coord_t y, char *name, uint8_t size, event_t event, uint8_t active, LcdFlags flags=ZCHAR);
uint8_t editDelay(const coord_t x, const coord_t y, const event_t event, const uint8_t attr, uint8_t delay); uint8_t editDelay(coord_t x, coord_t y, event_t event, uint8_t attr, uint8_t delay);
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags); void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags);
extern uint8_t s_curveChan; extern uint8_t s_curveChan;

View file

@ -335,7 +335,7 @@ bool menuModelSetup(event_t event)
g_model.timers[1].persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_VPERSISTENT, g_model.timers[1].persistent, 0, 2, attr, event); g_model.timers[1].persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_VPERSISTENT, g_model.timers[1].persistent, 0, 2, attr, event);
break; break;
#endif #endif
#if TIMERS > 2 #if TIMERS > 2
case ITEM_MODEL_TIMER3: case ITEM_MODEL_TIMER3:
editTimerMode(2, y, attr, event); editTimerMode(2, y, attr, event);

View file

@ -31,7 +31,7 @@ int checkIncDecSelection = 0;
#if defined(AUTOSWITCH) #if defined(AUTOSWITCH)
swsrc_t checkIncDecMovedSwitch(swsrc_t val) swsrc_t checkIncDecMovedSwitch(swsrc_t val)
{ {
if (s_editMode>0) { if (s_editMode > 0) {
swsrc_t swtch = getMovedSwitch(); swsrc_t swtch = getMovedSwitch();
if (swtch) { if (swtch) {
div_t info = switchInfo(swtch); div_t info = switchInfo(swtch);

View file

@ -41,7 +41,7 @@ void drawCurve(coord_t offset)
} while (1); } while (1);
} }
void menuModelCurvesAll(uint8_t event) void menuModelCurvesAll(event_t event)
{ {
#if defined(GVARS_IN_CURVES_SCREEN) #if defined(GVARS_IN_CURVES_SCREEN)
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, MENU_MODEL_CURVES, HEADER_LINE+MAX_CURVES+MAX_GVARS); SIMPLE_MENU(STR_MENUCURVES, menuTabModel, MENU_MODEL_CURVES, HEADER_LINE+MAX_CURVES+MAX_GVARS);
@ -105,7 +105,7 @@ void menuModelCurvesAll(uint8_t event)
} }
#if defined(CPUARM) #if defined(CPUARM)
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, LcdFlags flags) void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags)
{ {
coord_t x1 = x; coord_t x1 = x;
if (flags & RIGHT) { if (flags & RIGHT) {

View file

@ -45,7 +45,7 @@ enum MenuModelHeliItems {
#define MODEL_HELI_2ND_COLUMN (14*FW) #define MODEL_HELI_2ND_COLUMN (14*FW)
#endif #endif
void menuModelHeli(uint8_t event) void menuModelHeli(event_t event)
{ {
SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, MENU_MODEL_HELI, HEADER_LINE+ITEM_HELI_MAX); SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, MENU_MODEL_HELI, HEADER_LINE+ITEM_HELI_MAX);

View file

@ -27,7 +27,7 @@ void drawStringWithIndex(coord_t x, coord_t y, const pm_char * str, uint8_t idx,
} }
#if defined(CPUARM) #if defined(CPUARM)
FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModesType value, uint8_t attr) FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModesType value, uint8_t attr)
{ {
int posHorz = menuHorizontalPosition; int posHorz = menuHorizontalPosition;

View file

@ -24,6 +24,14 @@
#include "lcd.h" #include "lcd.h"
#include "keys.h" #include "keys.h"
#if defined(ROTARY_ENCODER_NAVIGATION)
#define CASE_EVT_ROTARY_LEFT case EVT_ROTARY_LEFT:
#define CASE_EVT_ROTARY_RIGHT case EVT_ROTARY_RIGHT:
#else
#define CASE_EVT_ROTARY_LEFT
#define CASE_EVT_ROTARY_RIGHT
#endif
#if defined(CPUARM) #if defined(CPUARM)
typedef bool (*IsValueAvailable)(int); typedef bool (*IsValueAvailable)(int);

View file

@ -122,23 +122,24 @@ uint8_t Key::key() const
return (this - keys); return (this - keys);
} }
void pauseEvents(uint8_t event) void pauseEvents(event_t event)
{ {
event = EVT_KEY_MASK(event); event = EVT_KEY_MASK(event);
if (event < (int)DIM(keys)) keys[event].pauseEvents(); if (event < (int)DIM(keys)) keys[event].pauseEvents();
} }
void killEvents(uint8_t event) void killEvents(event_t event)
{ {
#if defined(ROTARY_ENCODER_NAVIGATION) #if defined(ROTARY_ENCODERS)
if (event == EVT_ROTARY_LONG) { if (event == EVT_ROTARY_LONG) {
killEvents(BTN_REa + NAVIGATION_RE_IDX()); killEvents(BTN_REa + g_eeGeneral.reNavigation - 1);
return;
} }
else
#endif #endif
{
event = EVT_KEY_MASK(event); event = EVT_KEY_MASK(event);
if (event < (int)DIM(keys)) keys[event].killEvents(); if (event < (int)DIM(keys)) {
keys[event].killEvents();
} }
} }
@ -174,7 +175,7 @@ bool clearKeyEvents()
putEvent(0); putEvent(0);
return true; return true;
} }
#else // #if defined(CPUARM) #else
void clearKeyEvents() void clearKeyEvents()
{ {
// loop until all keys are up // loop until all keys are up

View file

@ -21,67 +21,77 @@
#ifndef _KEYS_H_ #ifndef _KEYS_H_
#define _KEYS_H_ #define _KEYS_H_
#define EVT_KEY_MASK(e) ((e) & 0x1f) #define EVT_KEY_MASK(e) ((e) & 0x1f)
#if defined(PCBHORUS) #if defined(PCBHORUS)
#define _MSK_KEY_BREAK 0x0200 #define _MSK_KEY_BREAK 0x0200
#define _MSK_KEY_REPT 0x0400 #define _MSK_KEY_REPT 0x0400
#define _MSK_KEY_FIRST 0x0600 #define _MSK_KEY_FIRST 0x0600
#define _MSK_KEY_LONG 0x0800 #define _MSK_KEY_LONG 0x0800
#define _MSK_KEY_FLAGS 0x0e00 #define _MSK_KEY_FLAGS 0x0e00
#define EVT_ENTRY 0x1000 #define EVT_ENTRY 0x1000
#define EVT_ENTRY_UP 0x2000 #define EVT_ENTRY_UP 0x2000
#else #else
#define _MSK_KEY_BREAK 0x20 #define _MSK_KEY_BREAK 0x20
#define _MSK_KEY_REPT 0x40 #define _MSK_KEY_REPT 0x40
#define _MSK_KEY_FIRST 0x60 #define _MSK_KEY_FIRST 0x60
#define _MSK_KEY_LONG 0x80 #define _MSK_KEY_LONG 0x80
#define _MSK_KEY_FLAGS 0xe0 #define _MSK_KEY_FLAGS 0xe0
#define EVT_ENTRY 0xbf #define EVT_ENTRY 0xbf
#define EVT_ENTRY_UP 0xbe #define EVT_ENTRY_UP 0xbe
#endif #endif
#define EVT_KEY_BREAK(key) ((key)|_MSK_KEY_BREAK) #define EVT_KEY_BREAK(key) ((key)|_MSK_KEY_BREAK)
#define EVT_KEY_FIRST(key) ((key)|_MSK_KEY_FIRST) #define EVT_KEY_FIRST(key) ((key)|_MSK_KEY_FIRST)
#define EVT_KEY_REPT(key) ((key)|_MSK_KEY_REPT) #define EVT_KEY_REPT(key) ((key)|_MSK_KEY_REPT)
#define EVT_KEY_LONG(key) ((key)|_MSK_KEY_LONG) #define EVT_KEY_LONG(key) ((key)|_MSK_KEY_LONG)
#define IS_KEY_BREAK(evt) (((evt) & _MSK_KEY_FLAGS) == _MSK_KEY_BREAK) #define IS_KEY_BREAK(evt) (((evt) & _MSK_KEY_FLAGS) == _MSK_KEY_BREAK)
#define IS_KEY_FIRST(evt) (((evt) & _MSK_KEY_FLAGS) == _MSK_KEY_FIRST) #define IS_KEY_FIRST(evt) (((evt) & _MSK_KEY_FLAGS) == _MSK_KEY_FIRST)
#define IS_KEY_LONG(evt) (((evt) & _MSK_KEY_FLAGS) == _MSK_KEY_LONG) #define IS_KEY_LONG(evt) (((evt) & _MSK_KEY_FLAGS) == _MSK_KEY_LONG)
#define IS_KEY_REPT(evt) (((evt) & _MSK_KEY_FLAGS) == _MSK_KEY_REPT) #define IS_KEY_REPT(evt) (((evt) & _MSK_KEY_FLAGS) == _MSK_KEY_REPT)
#if defined(PCBHORUS) || defined(PCBFLAMENCO) || defined(PCBTARANIS) #if (defined(PCBHORUS) || defined(PCBFLAMENCO) || defined(PCBTARANIS)) && defined(ROTARY_ENCODER_NAVIGATION)
#define EVT_ROTARY_BREAK EVT_KEY_BREAK(KEY_ENTER) typedef uint16_t event_t;
#define EVT_ROTARY_LONG EVT_KEY_LONG(KEY_ENTER) #define EVT_ROTARY_BREAK EVT_KEY_BREAK(KEY_ENTER)
#define EVT_ROTARY_LEFT 0xDF00 #define EVT_ROTARY_LONG EVT_KEY_LONG(KEY_ENTER)
#define EVT_ROTARY_RIGHT 0xDE00 #define EVT_ROTARY_LEFT 0xDF00
#define EVT_ROTARY_RIGHT 0xDE00
#define IS_NEXT_EVENT(event) (event==EVT_ROTARY_RIGHT)
#define IS_PREVIOUS_EVENT(event) (event==EVT_ROTARY_LEFT)
#elif defined(ROTARY_ENCODER_NAVIGATION)
typedef uint8_t event_t;
#define EVT_ROTARY_BREAK 0xcf
#define EVT_ROTARY_LONG 0xce
#define EVT_ROTARY_LEFT 0xdf
#define EVT_ROTARY_RIGHT 0xde
#define IS_NEXT_EVENT(event) (event==EVT_ROTARY_RIGHT || event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_REPT(KEY_DOWN))
#define IS_PREVIOUS_EVENT(event) (event==EVT_ROTARY_LEFT || event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_UP))
#else #else
#define EVT_ROTARY_BREAK 0xcf typedef uint8_t event_t;
#define EVT_ROTARY_LONG 0xce #define IS_NEXT_EVENT(event) (event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_REPT(KEY_DOWN))
#define EVT_ROTARY_LEFT 0xdf #define IS_PREVIOUS_EVENT(event) (event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_UP))
#define EVT_ROTARY_RIGHT 0xde
#endif #endif
#if defined(COLORLCD) #if defined(COLORLCD)
#define EVT_REFRESH 0xDD00 #define EVT_REFRESH 0xDD00
#endif #endif
class Key class Key
{ {
#define FILTERBITS 4 #define FILTERBITS 4
#ifdef SIMU #ifdef SIMU
#define FFVAL 1 #define FFVAL 1
#else #else
#define FFVAL ((1<<FILTERBITS)-1) #define FFVAL ((1<<FILTERBITS)-1)
#endif #endif
#define KSTATE_OFF 0 #define KSTATE_OFF 0
#define KSTATE_RPTDELAY 95 // gruvin: delay state before key repeating starts #define KSTATE_RPTDELAY 95 // gruvin: delay state before key repeating starts
#define KSTATE_START 97 #define KSTATE_START 97
#define KSTATE_PAUSE 98 #define KSTATE_PAUSE 98
#define KSTATE_KILLED 99 #define KSTATE_KILLED 99
private: private:
uint8_t m_vals; // key debounce? 4 = 40ms uint8_t m_vals; // key debounce? 4 = 40ms
@ -97,18 +107,12 @@ class Key
extern Key keys[NUM_KEYS]; extern Key keys[NUM_KEYS];
#if defined(COLORLCD)
typedef uint16_t event_t;
#else
typedef uint8_t event_t;
#endif
extern event_t s_evt; extern event_t s_evt;
#define putEvent(evt) s_evt = evt #define putEvent(evt) s_evt = evt
void pauseEvents(uint8_t index); void pauseEvents(event_t event);
void killEvents(uint8_t index); void killEvents(event_t event);
#if defined(CPUARM) #if defined(CPUARM)
bool clearKeyEvents(); bool clearKeyEvents();

View file

@ -788,7 +788,7 @@ Run function (key pressed)
*/ */
static int luaPopupInput(lua_State * L) static int luaPopupInput(lua_State * L)
{ {
uint8_t event = luaL_checkinteger(L, 2); event_t event = luaL_checkinteger(L, 2);
warningInputValue = luaL_checkinteger(L, 3); warningInputValue = luaL_checkinteger(L, 3);
warningInputValueMin = luaL_checkinteger(L, 4); warningInputValueMin = luaL_checkinteger(L, 4);
warningInputValueMax = luaL_checkinteger(L, 5); warningInputValueMax = luaL_checkinteger(L, 5);

View file

@ -282,7 +282,7 @@ void guiMain(event_t evt)
} }
#elif defined(GUI) #elif defined(GUI)
void handleGui(uint8_t event) { void handleGui(event_t event) {
// if Lua standalone, run it and don't clear the screen (Lua will do it) // if Lua standalone, run it and don't clear the screen (Lua will do it)
// else if Lua telemetry view, run it and don't clear the screen // else if Lua telemetry view, run it and don't clear the screen
// else clear scren and show normal menus // else clear scren and show normal menus

View file

@ -21,7 +21,7 @@
#include "opentx.h" #include "opentx.h"
void checkBattery(); void checkBattery();
uint8_t checkTrim(uint8_t event); uint8_t checkTrim(event_t event);
void perMain() void perMain()
{ {

View file

@ -133,23 +133,27 @@ void per10ms()
readKeysAndTrims(); readKeysAndTrims();
#if defined(ROTARY_ENCODER_NAVIGATION) #if defined(ROTARY_ENCODER_NAVIGATION)
if (IS_RE_NAVIGATION_ENABLE()) { if (IS_ROTARY_ENCODER_NAVIGATION_ENABLE()) {
static rotenc_t rePreviousValue; static rotenc_t rePreviousValue;
rotenc_t reNewValue = (g_rotenc[NAVIGATION_RE_IDX()] / ROTARY_ENCODER_GRANULARITY); rotenc_t reNewValue = (ROTARY_ENCODER_NAVIGATION_VALUE / ROTARY_ENCODER_GRANULARITY);
int8_t scrollRE = reNewValue - rePreviousValue; int8_t scrollRE = reNewValue - rePreviousValue;
if (scrollRE) { if (scrollRE) {
rePreviousValue = reNewValue; rePreviousValue = reNewValue;
putEvent(scrollRE < 0 ? EVT_ROTARY_LEFT : EVT_ROTARY_RIGHT); putEvent(scrollRE < 0 ? EVT_ROTARY_LEFT : EVT_ROTARY_RIGHT);
} }
uint8_t evt = s_evt; #if defined(CPUARM)
if (EVT_KEY_MASK(evt) == BTN_REa + NAVIGATION_RE_IDX()) { if (scrollRE) {
if (IS_KEY_BREAK(evt)) { static uint32_t lastTick = 0;
putEvent(EVT_ROTARY_BREAK); uint32_t delay = get_tmr10ms() - lastTick;
} lastTick = get_tmr10ms();
else if (IS_KEY_LONG(evt)) { if (delay < ROTENC_DELAY_HIGHSPEED)
putEvent(EVT_ROTARY_LONG); rotencSpeed = ROTENC_HIGHSPEED;
} else if (delay < ROTENC_DELAY_MIDSPEED)
rotencSpeed = ROTENC_MIDSPEED;
else
rotencSpeed = ROTENC_LOWSPEED;
} }
#endif
} }
#endif #endif
@ -656,7 +660,7 @@ int16_t getRotaryEncoder(uint8_t idx)
void incRotaryEncoder(uint8_t idx, int8_t inc) void incRotaryEncoder(uint8_t idx, int8_t inc)
{ {
g_rotenc[idx] += inc; rotencValue[idx] += inc;
int16_t *value = &(flightModeAddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx]); int16_t *value = &(flightModeAddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx]);
*value = limit((int16_t)-RESX, (int16_t)(*value + (inc * 8)), (int16_t)+RESX); *value = limit((int16_t)-RESX, (int16_t)(*value + (inc * 8)), (int16_t)+RESX);
storageDirty(EE_MODEL); storageDirty(EE_MODEL);
@ -1344,7 +1348,7 @@ void checkTrims()
if (event && !IS_KEY_BREAK(event)) { if (event && !IS_KEY_BREAK(event)) {
int8_t k = EVT_KEY_MASK(event) - TRM_BASE; int8_t k = EVT_KEY_MASK(event) - TRM_BASE;
#else #else
uint8_t checkTrim(uint8_t event) uint8_t checkTrim(event_t event)
{ {
int8_t k = EVT_KEY_MASK(event) - TRM_BASE; int8_t k = EVT_KEY_MASK(event) - TRM_BASE;
if (k>=0 && k<8 && !IS_KEY_BREAK(event)) { if (k>=0 && k<8 && !IS_KEY_BREAK(event)) {
@ -2469,9 +2473,13 @@ void moveTrimsToOffsets() // copy state of 3 primary to subtrim
} }
#if defined(ROTARY_ENCODERS) #if defined(ROTARY_ENCODERS)
volatile rotenc_t g_rotenc[ROTARY_ENCODERS] = {0}; volatile rotenc_t rotencValue[ROTARY_ENCODERS] = {0};
#elif defined(ROTARY_ENCODER_NAVIGATION) #elif defined(ROTARY_ENCODER_NAVIGATION)
volatile rotenc_t g_rotenc[1] = {0}; volatile rotenc_t rotencValue[1] = {0};
#endif
#if defined(CPUARM) && defined(ROTARY_ENCODER_NAVIGATION)
uint8_t rotencSpeed;
#endif #endif
#if !defined(CPUARM) && !defined(SIMU) #if !defined(CPUARM) && !defined(SIMU)

View file

@ -526,15 +526,23 @@ extern uint8_t channel_order(uint8_t x);
#define SPLASH_TIMEOUT (4*100) // 4 seconds #define SPLASH_TIMEOUT (4*100) // 4 seconds
#endif #endif
#if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS) #if defined(ROTARY_ENCODERS)
#define IS_RE_NAVIGATION_ENABLE() true #define IS_ROTARY_ENCODER_NAVIGATION_ENABLE() g_eeGeneral.reNavigation
#define NAVIGATION_RE_IDX() 0 extern volatile rotenc_t rotencValue[ROTARY_ENCODERS];
#elif defined(ROTARY_ENCODERS) #define ROTARY_ENCODER_NAVIGATION_VALUE rotencValue[g_eeGeneral.reNavigation - 1]
#define NAVIGATION_RE_IDX() (g_eeGeneral.reNavigation - 1)
#define IS_RE_NAVIGATION_ENABLE() g_eeGeneral.reNavigation
#elif defined(ROTARY_ENCODER_NAVIGATION) #elif defined(ROTARY_ENCODER_NAVIGATION)
#define IS_RE_NAVIGATION_ENABLE() true #define IS_ROTARY_ENCODER_NAVIGATION_ENABLE() true
#define NAVIGATION_RE_IDX() 0 extern volatile rotenc_t rotencValue[1];
#define ROTARY_ENCODER_NAVIGATION_VALUE rotencValue[0]
#endif
#if defined(CPUARM) && defined(ROTARY_ENCODER_NAVIGATION)
extern uint8_t rotencSpeed;
#define ROTENC_LOWSPEED 1
#define ROTENC_MIDSPEED 5
#define ROTENC_HIGHSPEED 50
#define ROTENC_DELAY_MIDSPEED 4
#define ROTENC_DELAY_HIGHSPEED 2
#endif #endif
#define HEART_TIMER_10MS 1 #define HEART_TIMER_10MS 1
@ -1127,11 +1135,11 @@ extern uint16_t lightOffCounter;
extern uint8_t flashCounter; extern uint8_t flashCounter;
extern uint8_t mixWarning; extern uint8_t mixWarning;
FlightModeData *flightModeAddress(uint8_t idx); FlightModeData * flightModeAddress(uint8_t idx);
ExpoData *expoAddress(uint8_t idx); ExpoData * expoAddress(uint8_t idx);
MixData *mixAddress(uint8_t idx); MixData * mixAddress(uint8_t idx);
LimitData *limitAddress(uint8_t idx); LimitData * limitAddress(uint8_t idx);
LogicalSwitchData *lswAddress(uint8_t idx); LogicalSwitchData * lswAddress(uint8_t idx);
// static variables used in evalFlightModeMixes - moved here so they don't interfere with the stack // static variables used in evalFlightModeMixes - moved here so they don't interfere with the stack
// It's also easier to initialize them here. // It's also easier to initialize them here.
@ -1253,13 +1261,6 @@ void evalFunctions();
#define customFunctionsReset() modelFunctionsContext.reset() #define customFunctionsReset() modelFunctionsContext.reset()
#endif #endif
#if defined(ROTARY_ENCODERS)
// Global rotary encoder registers
extern volatile rotenc_t g_rotenc[ROTARY_ENCODERS];
#elif defined(ROTARY_ENCODER_NAVIGATION)
extern volatile rotenc_t g_rotenc[1];
#endif
#include "telemetry/telemetry.h" #include "telemetry/telemetry.h"
#if defined(CPUARM) #if defined(CPUARM)

View file

@ -358,20 +358,14 @@ long Open9xSim::onTimeout(FXObject*, FXSelector, void*)
updateKeysAndSwitches(); updateKeysAndSwitches();
#if defined(PCBHORUS) || defined(PCBFLAMENCO) #if defined(ROTARY_ENCODER_NAVIGATION)
#define ROTENC_VALUE rotencValue
#else
#define ROTENC_VALUE g_rotenc[0]
#endif
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBHORUS) || defined(PCBFLAMENCO)
static bool rotencAction = false; static bool rotencAction = false;
if (getApp()->getKeyState(KEY_X)) { if (getApp()->getKeyState(KEY_X)) {
if (!rotencAction) ROTENC_VALUE += ROTARY_ENCODER_GRANULARITY; if (!rotencAction) ROTARY_ENCODER_NAVIGATION_VALUE += ROTARY_ENCODER_GRANULARITY;
rotencAction = true; rotencAction = true;
} }
else if (getApp()->getKeyState(KEY_W)) { else if (getApp()->getKeyState(KEY_W)) {
if (!rotencAction) ROTENC_VALUE -= ROTARY_ENCODER_GRANULARITY; if (!rotencAction) ROTARY_ENCODER_NAVIGATION_VALUE -= ROTARY_ENCODER_GRANULARITY;
rotencAction = true; rotencAction = true;
} }
else { else {

View file

@ -40,7 +40,7 @@ void rotencPoll()
{ {
#if defined(TELEMETREZ) #if defined(TELEMETREZ)
if (TrotCount != LastTrotCount) { if (TrotCount != LastTrotCount) {
g_rotenc[0] = LastTrotCount = TrotCount ; rotencValue[0] = LastTrotCount = TrotCount ;
} }
#else #else
// Rotary Encoder polling // Rotary Encoder polling
@ -64,10 +64,10 @@ void rotencPoll()
x <<= 1 ; x <<= 1 ;
x ^= rotary & 0x80 ; x ^= rotary & 0x80 ;
if ( x ) { if ( x ) {
g_rotenc[0] -= 1 ; rotencValue[0] -= 1 ;
} }
else { else {
g_rotenc[0] += 1 ; rotencValue[0] += 1 ;
} }
RotPosition = rotary ; RotPosition = rotary ;
} }

View file

@ -14,7 +14,7 @@ set(LUA_EXPORT lua_export_horus)
set(FLAVOUR horus) set(FLAVOUR horus)
set(RAMBACKUP YES) set(RAMBACKUP YES)
add_definitions(-DPCBHORUS -DPCBREV=${PCBREV} -DCOLORLCD -DSTM32F429_439xx -DSDRAM -DPPM_PIN_UART -DPPM_PIN_TIMER) add_definitions(-DPCBHORUS -DPCBREV=${PCBREV} -DSTM32F429_439xx -DSDRAM -DCOLORLCD -DPPM_PIN_UART -DPPM_PIN_TIMER)
add_definitions(-DEEPROM_VARIANT=0 -DAUDIO -DVOICE -DRTCLOCK) add_definitions(-DEEPROM_VARIANT=0 -DAUDIO -DVOICE -DRTCLOCK)
include_directories(${RADIO_SRC_DIRECTORY}/fonts/480x272 gui/${GUI_DIR} gui/${GUI_DIR}/layouts) include_directories(${RADIO_SRC_DIRECTORY}/fonts/480x272 gui/${GUI_DIR} gui/${GUI_DIR}/layouts)

View file

@ -255,11 +255,7 @@ uint32_t readTrims(void);
#define DBLKEYS_PRESSED_LFT_DWN(in) ((in & (KEYS_GPIO_PIN_LEFT + KEYS_GPIO_PIN_DOWN)) == (KEYS_GPIO_PIN_LEFT + KEYS_GPIO_PIN_DOWN)) #define DBLKEYS_PRESSED_LFT_DWN(in) ((in & (KEYS_GPIO_PIN_LEFT + KEYS_GPIO_PIN_DOWN)) == (KEYS_GPIO_PIN_LEFT + KEYS_GPIO_PIN_DOWN))
// Rotary encoder driver // Rotary encoder driver
extern int32_t rotencValue; #define ROTARY_ENCODER_NAVIGATION
extern uint32_t rotencSpeed;
#define ROTENC_LOWSPEED 1
#define ROTENC_MIDSPEED 5
#define ROTENC_HIGHSPEED 50
void checkRotaryEncoder(void); void checkRotaryEncoder(void);
// WDT driver // WDT driver

View file

@ -20,6 +20,8 @@
#include "opentx.h" #include "opentx.h"
uint32_t rotencPosition;
uint32_t readKeys() uint32_t readKeys()
{ {
uint32_t result = 0; uint32_t result = 0;
@ -89,22 +91,15 @@ uint8_t keyDown()
return readKeys(); return readKeys();
} }
int32_t rotencValue;
uint32_t rotencPosition;
uint32_t rotencSpeed = ROTENC_LOWSPEED;
#define ROTENC_DELAY_MIDSPEED 4
#define ROTENC_DELAY_HIGHSPEED 2
void checkRotaryEncoder() void checkRotaryEncoder()
{ {
register uint32_t newpos = ROTARY_ENCODER_POSITION(); register uint32_t newpos = ROTARY_ENCODER_POSITION();
if (newpos != rotencPosition) { if (newpos != rotencPosition) {
if ((rotencPosition & 0x01) ^ ((newpos & 0x02) >> 1)) { if ((rotencPosition & 0x01) ^ ((newpos & 0x02) >> 1)) {
--rotencValue; --rotencValue[0];
} }
else { else {
++rotencValue; ++rotencValue[0];
} }
rotencPosition = newpos; rotencPosition = newpos;
} }
@ -121,28 +116,6 @@ void readKeysAndTrims()
keys[index++].input(in & (1 << i)); keys[index++].input(in & (1 << i));
} }
static rotenc_t rePreviousValue;
rotenc_t reNewValue = (rotencValue / 2);
int8_t scrollRE = reNewValue - rePreviousValue;
static uint32_t lastTick = 0;
if (scrollRE) {
rePreviousValue = reNewValue;
if (scrollRE < 0) {
putEvent(EVT_ROTARY_LEFT);
}
else {
putEvent(EVT_ROTARY_RIGHT);
}
uint32_t delay = get_tmr10ms() - lastTick;
lastTick = get_tmr10ms();
if (delay < ROTENC_DELAY_HIGHSPEED)
rotencSpeed = ROTENC_HIGHSPEED;
else if (delay < ROTENC_DELAY_MIDSPEED)
rotencSpeed = ROTENC_MIDSPEED;
else
rotencSpeed = ROTENC_LOWSPEED;
}
in = readTrims(); in = readTrims();
for (i = 1; i <= 1 << (TRM_LAST-TRM_BASE); i <<= 1) { for (i = 1; i <= 1 << (TRM_LAST-TRM_BASE); i <<= 1) {
keys[index++].input(in & i); keys[index++].input(in & i);

View file

@ -98,11 +98,9 @@ void OpenTxSimulator::start(QByteArray & ee, bool tests)
void OpenTxSimulator::start(const char * filename, bool tests) void OpenTxSimulator::start(const char * filename, bool tests)
{ {
#if ROTARY_ENCODERS > 0 #if defined(ROTARY_ENCODER_NAVIGATION)
g_rotenc[0] = 0; for (int i=0; i<DIM(rotencValue); i++)
#endif rotencValue[i] = 0;
#if ROTARY_ENCODERS > 1
g_rotenc[1] = 0;
#endif #endif
StartEepromThread(filename); StartEepromThread(filename);
@ -157,20 +155,8 @@ void OpenTxSimulator::getTrims(Trims & trims)
void OpenTxSimulator::wheelEvent(int steps) void OpenTxSimulator::wheelEvent(int steps)
{ {
#if defined(PCBHORUS) || defined(PCBFLAMENCO) #if defined(ROTARY_ENCODER_NAVIGATION)
if (steps > 0) ROTARY_ENCODER_NAVIGATION_VALUE += steps * ROTARY_ENCODER_GRANULARITY;
rotencValue -= 2;
else
rotencValue += 2;
#elif defined(PCBX9E)
if (steps == 255)
rotencValue -= 2;
else
rotencValue += 2;
#elif defined(PCBSKY9X) && ROTARY_ENCODERS > 0
g_rotenc[0] += steps*4;
#elif defined(PCBGRUVIN9X)
g_rotenc[0] += steps;
#endif #endif
} }

View file

@ -189,7 +189,7 @@ void simuSetKey(uint8_t key, bool state)
KEY_CASE(BTN_REa, PIOB->PIO_PDSR, 0x40) KEY_CASE(BTN_REa, PIOB->PIO_PDSR, 0x40)
#elif defined(PCBGRUVIN9X) || defined(PCBMEGA2560) #elif defined(PCBGRUVIN9X) || defined(PCBMEGA2560)
KEY_CASE(BTN_REa, pind, 0x20) KEY_CASE(BTN_REa, pind, 0x20)
#elif defined(ROTARY_ENCODER_NAVIGATION) #elif defined(PCB9X) && defined(ROTARY_ENCODER_NAVIGATION)
KEY_CASE(BTN_REa, RotEncoder, 0x20) KEY_CASE(BTN_REa, RotEncoder, 0x20)
#endif #endif
} }

Some files were not shown because too many files have changed in this diff Show more