1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-19 14:25:09 +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 index = (i >> 16) & 0xFF;
uint8_t event = i & 0xFF;
event_t event = i & 0xFF;
// TRACE("isAudioFileReferenced(%08x)", i);
@ -474,7 +474,7 @@ bool isAudioFileReferenced(uint32_t i, char * filename)
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];
// 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)
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_ON(phase) playModelEvent(PHASE_AUDIO_CATEGORY, phase, AUDIO_EVENT_ON)
#define PLAY_SWITCH_MOVED(sw) playModelEvent(SWITCH_AUDIO_CATEGORY, sw)

View file

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

View file

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

View file

@ -351,7 +351,7 @@ void evalFunctions()
#if ROTARY_ENCODERS > 1
case FUNC_RESET_ROTENC2:
#endif
g_rotenc[CFN_PARAM(cfn)-FUNC_RESET_ROTENC1] = 0;
rotencValue[CFN_PARAM(cfn)-FUNC_RESET_ROTENC1] = 0;
break;
#endif
}
@ -423,7 +423,7 @@ void evalFunctions()
}
#if defined(ROTARY_ENCODERS)
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) {
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)
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
}

View file

@ -146,21 +146,21 @@ extern const CheckIncDecStops &stopsSwitch;
const CheckIncDecStops &var = (const CheckIncDecStops&)_ ## var;
#define CATEGORY_END(val) \
(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
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
int8_t checkIncDecMovedSwitch(int8_t val);
#if defined(CPUM64)
int8_t checkIncDecModel(uint8_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 checkIncDecGen(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(event_t event, int8_t i_val, int8_t i_max);
int8_t checkIncDecGen(event_t event, int8_t i_val, int8_t i_min, int8_t i_max);
#else
#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 checkIncDecGen(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_GENERAL)
#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 checkIncDecGen(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_GENERAL)
#endif
#define CHECK_INCDEC_MODELVAR(event, var, min, max) \
@ -289,9 +289,9 @@ typedef int choice_t;
typedef int8_t choice_t;
#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);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char * label, LcdFlags attr, uint8_t event);
int8_t editSwitch(coord_t x, coord_t y, int8_t value, 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, event_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)
@ -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)
#endif
#if defined(GVARS)
#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, uint8_t event);
#else
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)
#if defined(GVARS) && 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);
#elif defined(GVARS)
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, event_t event);
#else
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event);
#define displayGVar(x, y, v, min, max) lcdDraw8bitsNumber(x, y, v)
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, event_t event);
#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)
#define editSingleName(x, y, label, name, size, event, active) editName(x, y, name, size, event, active)
#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
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 WARNING_TYPE_ASTERISK 0
@ -358,7 +360,7 @@ void drawStatusLine();
#if defined(CPUARM)
#define TEXT_FILENAME_MAXLEN 40
extern char s_text_file[TEXT_FILENAME_MAXLEN];
void menuTextView(uint8_t event);
void menuTextView(event_t event);
void pushMenuTextView(const char *filename);
void pushModelNotes();
#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_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)
#define IS_ROTARY_LEFT(evt) (evt == EVT_ROTARY_LEFT)
#define IS_ROTARY_RIGHT(evt) (evt == EVT_ROTARY_RIGHT)
#define IS_ROTARY_BREAK(evt) (evt == EVT_ROTARY_BREAK)
#define IS_ROTARY_LONG(evt) (evt == EVT_ROTARY_LONG)
#define IS_ROTARY_EVENT(evt) (EVT_KEY_MASK(evt) >= 0x0e)
#define CASE_EVT_ROTARY_BREAK case EVT_ROTARY_BREAK:
#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);
void repeatLastCursorMove(event_t 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()
#else
@ -387,17 +393,17 @@ void drawStatusLine();
#define IS_ROTARY_BREAK(evt) (0)
#define IS_ROTARY_LONG(evt) (0)
#define IS_ROTARY_EVENT(evt) (0)
#define CASE_EVT_ROTARY_BREAK
#define CASE_EVT_ROTARY_LONG
#define CASE_EVT_ROTARY_LEFT
#define CASE_EVT_ROTARY_RIGHT
void repeatLastCursorMove(uint8_t event);
void repeatLastCursorMove(event_t event);
#define REPEAT_LAST_CURSOR_MOVE() repeatLastCursorMove(event)
#define MOVE_CURSOR_FROM_HERE() REPEAT_LAST_CURSOR_MOVE()
#endif
#define POS_HORZ_INIT(posVert) 0
// TODO enum
#if defined(PCBX7D)
#define EDIT_MODE_INIT 0
#else
#define EDIT_MODE_INIT -1
#endif
typedef int (*FnFuncP) (int x);
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
#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
#if defined(FLIGHT_MODES)
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
#define displayFlightModes(...)
#endif

View file

@ -24,7 +24,7 @@
#include "view_mavlink.h"
#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);
lcdDrawNumber(MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
@ -46,7 +46,7 @@ uint8_t s_copySrcCh;
#endif
#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
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
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)
// 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
#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);
editName(x, y, name, size, event, active);

View file

@ -21,7 +21,7 @@
#include "opentx.h"
#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*/ });
return menuSpecialFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext);

View file

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

View file

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

View file

@ -20,7 +20,7 @@
#include "opentx.h"
void displayPresetChoice(uint8_t event)
void displayPresetChoice(event_t event)
{
runPopupWarning(event);
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];
int8_t * points = curveAddress(s_curveChan);

View file

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

View file

@ -82,7 +82,7 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
}
#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) });

View file

@ -32,7 +32,7 @@ void displayFlightModes(coord_t x, coord_t y, FlightModesType value)
}
#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);
@ -84,7 +84,7 @@ bool isTrimModeAvailable(int mode)
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);
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)
#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);

View file

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

View file

@ -229,7 +229,7 @@ enum ExposFields {
#define CURVE_ROWS 0
void menuModelExpoOne(uint8_t event)
void menuModelExpoOne(event_t event)
{
ExpoData * ed = expoAddress(s_currIdx);
drawSource(7*FW+FW/2, 0, MIXSRC_Rud+ed->chn, 0);
@ -339,7 +339,7 @@ enum MixFields {
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;
MD_WEIGHT_TO_UNION(md, weight);
@ -400,7 +400,7 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
#undef GAUGE_HEIGHT
#endif
void menuModelMixOne(uint8_t event)
void menuModelMixOne(event_t event)
{
TITLE(STR_MIXER);
MixData * md2 = mixAddress(s_currIdx) ;
@ -658,7 +658,7 @@ void displayExpoLine(coord_t y, ExpoData *ed)
displayFlightModes(EXPO_LINE_FM_POS, y, ed->flightModes)
#endif
void menuModelExpoMix(uint8_t expo, uint8_t event)
void menuModelExpoMix(uint8_t expo, event_t event)
{
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;
}
void menuModelExposAll(uint8_t event)
void menuModelExposAll(event_t event)
{
return menuModelExpoMix(1, event);
}
void menuModelMixAll(uint8_t event)
void menuModelMixAll(event_t 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)
void menuModelLogicalSwitchOne(uint8_t event)
void menuModelLogicalSwitchOne(event_t event)
{
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);
@ -294,7 +294,7 @@ void menuModelLogicalSwitches(uint8_t event)
#else
void menuModelLogicalSwitches(uint8_t event)
void menuModelLogicalSwitches(event_t event)
{
INCDEC_DECLARE_VARS(EE_MODEL);

View file

@ -142,7 +142,7 @@ enum MixFields {
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;
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)) {
// TODO pushMenu(menuChannelsView);
@ -375,7 +375,7 @@ void displayMixLine(coord_t y, MixData * md)
displayFlightModes(MIX_LINE_FM_POS, y, md->flightModes);
}
void menuModelMixAll(uint8_t event)
void menuModelMixAll(event_t event)
{
int8_t sub = menuVerticalPosition - HEADER_LINE;

View file

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

View file

@ -24,7 +24,7 @@
#define MODELSEL_W LCD_W
#if defined(NAVIGATION_MENUS)
void onModelSelectMenu(const char *result)
void onModelSelectMenu(const char * result)
{
int8_t sub = menuVerticalPosition;
@ -75,7 +75,7 @@ void onModelSelectMenu(const char *result)
}
#endif
void menuModelSelect(uint8_t event)
void menuModelSelect(event_t event)
{
if (warningResult) {
warningResult = 0;
@ -84,7 +84,7 @@ void menuModelSelect(uint8_t event)
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)) {
_event_ -= KEY_EXIT;
@ -137,7 +137,7 @@ void menuModelSelect(uint8_t event)
}
break;
#if defined(ROTARY_ENCODER_NAVIGATION)
#if defined(ROTARY_ENCODERS)
case EVT_ROTARY_LONG:
killEvents(event);
if (s_editMode < 0) {
@ -165,7 +165,7 @@ void menuModelSelect(uint8_t event)
}
break;
#if defined(ROTARY_ENCODER_NAVIGATION)
#if defined(ROTARY_ENCODERS)
case EVT_ROTARY_BREAK:
if (s_editMode == -1) {
s_editMode = 0;
@ -285,6 +285,10 @@ void menuModelSelect(uint8_t event)
#endif
#endif
#if defined(PCBX7D)
case EVT_ROTARY_LEFT:
case EVT_ROTARY_RIGHT:
#endif
case EVT_KEY_FIRST(KEY_UP):
case EVT_KEY_REPT(KEY_UP):
case EVT_KEY_FIRST(KEY_DOWN):
@ -325,7 +329,7 @@ void menuModelSelect(uint8_t event)
#if defined(PCBX7D)
drawScreenIndex(MENU_MODEL_SELECT, DIM(menuTabModel), 0);
#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
drawScreenIndex(MENU_MODEL_SELECT, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? INVERS : 0);
#endif

View file

@ -22,7 +22,7 @@
#if defined(CPUARM)
uint8_t g_moduleIdx;
void menuModelFailsafe(uint8_t event);
void menuModelFailsafe(event_t event);
#endif
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)
#endif
void menuModelSetup(uint8_t event)
void menuModelSetup(event_t event)
{
#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,
@ -1080,7 +1080,7 @@ void menuModelSetup(uint8_t event)
}
#if defined(CPUARM)
void menuModelFailsafe(uint8_t event)
void menuModelFailsafe(event_t event)
{
static bool longNames = false;
bool newLongNames = false;

View file

@ -70,7 +70,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
}
#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;
@ -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*/});
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_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];
@ -458,7 +458,7 @@ void onSensorMenu(const char *result)
}
#endif
void menuModelTelemetryFrsky(uint8_t event)
void menuModelTelemetryFrsky(event_t event)
{
#if defined(CPUARM)
if (warningResult) {

View file

@ -20,7 +20,7 @@
#include "opentx.h"
void menuModelTemplates(uint8_t event)
void menuModelTemplates(event_t event)
{
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(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)
int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int i_flags, IsValueAvailable isValueAvailable, const CheckIncDecStops &stops)
#if defined(PCBX7D)
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;
#if defined(DBLKEYS)
#if 0 // TODO ? defined(DBLKEYS)
uint32_t in = KEYS_PRESSED();
if (!(i_flags & NO_DBLKEYS) && (EVT_KEY_MASK(event))) {
bool dblkey = true;
@ -117,33 +117,23 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
}
#endif
if (s_editMode>0 && (event==EVT_KEY_FIRST(KEY_PLUS) || event==EVT_KEY_REPT(KEY_PLUS))) {
do {
if (IS_KEY_REPT(event) && (i_flags & INCDEC_REP10)) {
newval += min(10, i_max-val);
}
else {
if (s_editMode>0 && event==EVT_ROTARY_RIGHT) {
newval += min<int>(rotencSpeed, i_max-val);
while (isValueAvailable && !isValueAvailable(newval) && newval<=i_max) {
newval++;
}
} while (isValueAvailable && !isValueAvailable(newval) && newval<=i_max);
if (newval > i_max) {
newval = val;
killEvents(event);
AUDIO_KEY_ERROR();
}
}
else if (s_editMode>0 && (event==EVT_KEY_FIRST(KEY_MINUS) || event==EVT_KEY_REPT(KEY_MINUS))) {
do {
if (IS_KEY_REPT(event) && (i_flags & INCDEC_REP10)) {
newval -= min(10, val-i_min);
}
else {
else if (s_editMode>0 && event==EVT_ROTARY_LEFT) {
newval -= min<int>(rotencSpeed, val-i_min);
while (isValueAvailable && !isValueAvailable(newval) && newval>=i_min) {
newval--;
}
} while (isValueAvailable && !isValueAvailable(newval) && newval>=i_min);
if (newval < i_min) {
newval = val;
killEvents(event);
AUDIO_KEY_ERROR();
}
}
@ -179,17 +169,8 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
#endif
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));
checkIncDec_Ret = (newval > val ? 1 : -1);
if (!IS_KEY_REPT(event)) {
AUDIO_KEY_PRESS();
}
}
else {
checkIncDec_Ret = 0;
@ -275,8 +256,8 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
#endif
return newval;
}
#else
int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int i_flags, IsValueAvailable isValueAvailable, const CheckIncDecStops &stops)
#else
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;
@ -397,7 +378,7 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
}
#endif
#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;
@ -497,17 +478,17 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
#endif
#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);
}
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);
}
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);
}
@ -522,7 +503,6 @@ 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)
#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 DEC(val, min, max) if (val>min) {val--;} else {val=max;}
@ -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 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 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)
{
@ -649,6 +628,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
}
break;
case EVT_ROTARY_RIGHT:
case EVT_KEY_FIRST(KEY_RIGHT):
AUDIO_KEY_PRESS();
// 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);
break;
case EVT_ROTARY_LEFT:
case EVT_KEY_FIRST(KEY_LEFT):
AUDIO_KEY_PRESS();
// no break
@ -777,6 +758,9 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
menuHorizontalPosition = l_posHorz;
}
#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)
{
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 (IS_RE_NAVIGATION_ENABLE() && s_editMode < 0)
if (IS_ROTARY_ENCODER_NAVIGATION_ENABLE() && s_editMode < 0)
attr = INVERS|BLINK;
#endif
}
@ -1144,7 +1128,7 @@ void check_submenu_simple(event_t event, uint8_t 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)) {
putEvent(event);

View file

@ -94,7 +94,7 @@ void showAlertBox(const pm_char * title, const pm_char * text, const char * acti
clearKeyEvents();
}
void runPopupWarning(uint8_t event)
void runPopupWarning(event_t event)
{
warningResult = false;
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);
switch (event) {
#if defined(ROTARY_ENCODER_NAVIGATION)
case EVT_ROTARY_BREAK:
#endif
case EVT_KEY_BREAK(KEY_ENTER):
if (warningType == WARNING_TYPE_ASTERISK)
break;
warningResult = true;
// no break
#if defined(ROTARY_ENCODER_NAVIGATION)
case EVT_ROTARY_LONG:
killEvents(event);
#endif
case EVT_KEY_BREAK(KEY_EXIT):
warningText = NULL;
warningType = WARNING_TYPE_ASTERISK;
@ -131,7 +124,7 @@ void runPopupWarning(uint8_t event)
}
#if defined(CPUARM)
void (*popupFunc)(uint8_t event) = NULL;
void (*popupFunc)(event_t event) = NULL;
#endif
#if defined(NAVIGATION_MENUS)
@ -146,7 +139,7 @@ void (*popupMenuHandler)(const char * result);
uint8_t popupMenuOffsetType = MENU_OFFSET_INTERNAL;
#endif
const char * runPopupMenu(uint8_t event)
const char * runPopupMenu(event_t event)
{
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);
}
switch(event) {
switch (event) {
#if defined(ROTARY_ENCODER_NAVIGATION)
CASE_EVT_ROTARY_LEFT
#endif

View file

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

View file

@ -31,7 +31,7 @@ enum CalibrationState {
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
int16_t vt = anaIn(i);
@ -108,7 +108,7 @@ void menuCommonCalib(uint8_t event)
doMainScreenGraphics();
}
void menuRadioCalibration(uint8_t event)
void menuRadioCalibration(event_t event)
{
check_simple(event, MENU_RADIO_CALIBRATION, menuTabGeneral, DIM(menuTabGeneral), 0);
@ -120,7 +120,7 @@ void menuRadioCalibration(uint8_t 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) {
menuCalibrationState = CALIB_START;

View file

@ -20,7 +20,7 @@
#include "opentx.h"
void menuRadioDiagAnalogs(uint8_t event)
void menuRadioDiagAnalogs(event_t event)
{
// TODO enum
#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);
}
void menuRadioDiagKeys(uint8_t event)
void menuRadioDiagKeys(event_t event)
{
SIMPLE_MENU(STR_MENU_RADIO_SWITCHES, menuTabGeneral, MENU_RADIO_SWITCHES_TEST, 1);
@ -64,11 +64,15 @@ void menuRadioDiagKeys(uint8_t event)
#endif
}
#if defined(ROTARY_ENCODERS) || defined(ROTARY_ENCODER_NAVIGATION) // TODO || defined(PCBX7D)
for (uint8_t i=0; i<DIM(g_rotenc); i++) {
#if defined(ROTARY_ENCODER_NAVIGATION)
for (uint8_t i=0; i<DIM(rotencValue); i++) {
coord_t y = MENU_HEADER_HEIGHT /* ??? + 1 ??? */ + i*FH;
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

View file

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

View file

@ -20,7 +20,7 @@
#include "opentx.h"
void menuRadioSdManagerInfo(uint8_t event)
void menuRadioSdManagerInfo(event_t event)
{
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);
}
void onSdManagerMenu(const char *result)
void onSdManagerMenu(const char * result)
{
TCHAR lfn[_MAX_LFN+1];
@ -95,7 +95,7 @@ void onSdManagerMenu(const char *result)
#endif
}
void menuRadioSdManager(uint8_t _event)
void menuRadioSdManager(event_t _event)
{
#if defined(SDCARD)
if (warningResult) {
@ -118,7 +118,7 @@ void menuRadioSdManager(uint8_t _event)
}
#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);

View file

@ -117,7 +117,7 @@ enum MenuRadioSetupItems {
#define COL_TX_MODE LABEL(TX_MODE)
#endif
void menuRadioSetup(uint8_t event)
void menuRadioSetup(event_t event)
{
#if defined(RTCLOCK)
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
break;
#if ROTARY_ENCODERS > 0
#if defined(ROTARY_ENCODERS)
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);
if (attr && checkIncDec_Ret) {
g_rotenc[NAVIGATION_RE_IDX()] = 0;
ROTARY_ENCODER_NAVIGATION_VALUE = 0;
}
break;
#endif

View file

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

View file

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

View file

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

View file

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

View file

@ -283,7 +283,7 @@ void onMainViewMenu(const char *result)
}
#endif
void menuMainView(uint8_t event)
void menuMainView(event_t event)
{
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
* extension is reinitialized.
*/
void menuViewTelemetryMavlink(uint8_t event) {
void menuViewTelemetryMavlink(event_t event) {
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.
void menuTelemetryMavlinkDump(uint8_t event) {
void menuTelemetryMavlinkDump(event_t event) {
uint8_t x = 0;
uint8_t y = FH;
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
* 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*/});

View file

@ -31,7 +31,7 @@
#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 mav_title(const pm_char * s, uint8_t index);
void menuTelemetryMavlinkInfos(void);
@ -41,7 +41,7 @@ void menuTelemetryMavlinkNavigation(void);
void menuTelemetryMavlinkGPS(void);
#ifdef DUMP_RX_TX
void lcd_outhex2(uint8_t x, uint8_t y, uint8_t val);
void menuTelemetryMavlinkDump(uint8_t event);
void menuTelemetryMavlinkDump(event_t event);
#endif
/*! \brief Mavlink menu enumerator

View file

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

View file

@ -490,7 +490,7 @@ void incrTelemetryScreen()
}
#endif
void menuViewTelemetryFrsky(uint8_t event)
void menuViewTelemetryFrsky(event_t event)
{
#if defined(CPUARM)
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;

View file

@ -72,7 +72,7 @@ void title(const pm_char * s)
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);
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;
}
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)
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
}
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);
drawSwitch(x, y, value, attr);
@ -120,7 +120,7 @@ bool noZero(int val)
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);
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;
}
#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);
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;
}
#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);
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) \
(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);
#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)
@ -194,7 +194,7 @@ swsrc_t checkIncDecMovedSwitch(swsrc_t val);
#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_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);
#define TITLE(str) title(str)
@ -238,36 +238,36 @@ void title(const pm_char * s);
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);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, uint8_t event);
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, 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, event_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)
#if defined(GVARS)
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);
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 displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0)
#else
#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)
#endif
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;
void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_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 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, event_t event, uint8_t active);
#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)
#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)
#endif
@ -309,16 +309,21 @@ void drawStatusLine();
#define TEXT_FILENAME_MAXLEN 40
extern char s_text_file[TEXT_FILENAME_MAXLEN];
void menuTextView(uint8_t event);
void menuTextView(event_t event);
void pushMenuTextView(const char *filename);
void pushModelNotes();
void menuChannelsView(uint8_t event);
void menuChannelsView(event_t event);
#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_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 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)
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
#define displayFlightModes(...)
#endif

View file

@ -37,13 +37,13 @@ const MenuHandlerFunc menuTabModel[] = {
#if defined(LUA_MODEL_SCRIPTS)
menuModelCustomScripts,
#endif
menuModelTelemetryFrsky,
CASE_FRSKY(menuModelTelemetryFrsky)
CASE_MAVLINK(menuModelTelemetryMavlink)
menuModelDisplay
};
#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);
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;
}
#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);
lcdDrawNumber(MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
@ -71,7 +71,7 @@ uint8_t s_copySrcCh;
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;
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 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) {
v = checkIncDec(event, abs(v), 0, ZCHAR_MAX, 0);
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) {
case EVT_ROTARY_BREAK:
case EVT_KEY_BREAK(KEY_ENTER):
if (s_editMode == EDIT_MODIFY_FIELD) {
s_editMode = EDIT_MODIFY_STRING;
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;
break;
case EVT_ROTARY_LONG:
case EVT_KEY_LONG(KEY_ENTER):
if (attr & ZCHAR) {
if (v == 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);
editName(x, y, name, size, event, active);

View file

@ -32,7 +32,7 @@ const MenuHandlerFunc menuTabGeneral[] = {
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*/ });
return menuSpecialFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext);

View file

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

View file

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

View file

@ -20,7 +20,7 @@
#include "opentx.h"
void displayPresetChoice(uint8_t event)
void displayPresetChoice(event_t event)
{
runPopupWarning(event);
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;
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_3RD_COLUMN_POS (23*FW)
void menuModelCustomScriptOne(uint8_t event)
void menuModelCustomScriptOne(event_t event)
{
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);
lcdDrawText(19*FW+1, 0, STR_BYTES);

View file

@ -81,7 +81,7 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
}
#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) });

View file

@ -48,7 +48,7 @@ bool isTrimModeAvailable(int mode)
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 });

View file

@ -20,7 +20,7 @@
#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];
gvar_t & v = fm->gvars[gvar];
@ -62,7 +62,7 @@ enum GVarFields {
#define GVAR_2ND_COLUMN (12*FW)
void menuModelGVarOne(uint8_t event)
void menuModelGVarOne(event_t event)
{
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_FM_COLUMN(p) (7*FW - 7 + (p)*20)
void menuModelGVars(uint8_t event)
void menuModelGVars(event_t event)
{
tmr10ms_t tmr10ms = get_tmr10ms();
const char * menuTitle;

View file

@ -175,7 +175,7 @@ enum ExposFields {
#define CURVE_ROWS 1
void menuModelExpoOne(uint8_t event)
void menuModelExpoOne(event_t event)
{
if (event == EVT_KEY_LONG(KEY_MENU)) {
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;

View file

@ -39,7 +39,7 @@ enum LogicalSwitchFields {
#define CSW_5TH_COLUMN (26*FW+3)
#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, '[');
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);
@ -98,7 +98,7 @@ void menuModelLogicalSwitches(uint8_t event)
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;
k = i+menuVerticalOffset;
LcdFlags attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);

View file

@ -142,7 +142,7 @@ enum MixFields {
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;
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)) {
pushMenu(menuChannelsView);
@ -382,7 +382,7 @@ void displayMixLine(coord_t y, MixData * md)
lcdDrawChar(MIX_LINE_DELAY_POS, y, cs);
}
void menuModelMixAll(uint8_t event)
void menuModelMixAll(event_t event)
{
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;

View file

@ -23,7 +23,7 @@
#define MODELSIZE_POS_X 170
#define MODELSEL_W 133
void onModelSelectMenu(const char *result)
void onModelSelectMenu(const char * result)
{
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) {
warningResult = 0;
@ -73,7 +73,7 @@ void menuModelSelect(uint8_t event)
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)) {
_event_ -= KEY_EXIT;
@ -87,8 +87,7 @@ void menuModelSelect(uint8_t event)
int sub = menuVerticalPosition;
switch (event)
{
switch (event) {
case EVT_ENTRY:
menuVerticalPosition = sub = g_eeGeneral.currModel;
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_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)
memset(dst, 0, size);
@ -106,7 +106,7 @@ void copySelection(char *dst, const char *src, uint8_t size)
memcpy(dst, src, size);
}
void onModelSetupBitmapMenu(const char *result)
void onModelSetupBitmapMenu(const char * result)
{
if (result == STR_UPDATE_LIST) {
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];
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];
lcdDrawTextAlignedLeft(y, STR_BEEPCOUNTDOWN);
@ -258,7 +258,7 @@ int getSwitchWarningsCount()
#endif
void menuModelSetup(uint8_t event)
void menuModelSetup(event_t event)
{
horzpos_t l_posHorz = menuHorizontalPosition;
bool CURSOR_ON_CELL = (menuHorizontalPosition >= 0);
@ -1024,7 +1024,7 @@ void menuModelSetup(uint8_t event)
#endif
}
void menuModelFailsafe(uint8_t event)
void menuModelFailsafe(event_t event)
{
static bool longNames = false;
bool newLongNames = false;

View file

@ -144,7 +144,7 @@ enum CustomFunctionsItems {
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;
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*/ });
return menuSpecialFunctions(event, g_model.customFn, &modelFunctionsContext);

View file

@ -31,7 +31,7 @@ int checkIncDecSelection = 0;
#if defined(AUTOSWITCH)
swsrc_t checkIncDecMovedSwitch(swsrc_t val)
{
if (s_editMode>0) {
if (s_editMode > 0) {
swsrc_t swtch = getMovedSwitch();
if (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)
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_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;
@ -157,6 +157,28 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
}
#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))) {
do {
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();
}
}
#endif
if (!READ_ONLY() && i_min==0 && i_max==1 && event==EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0;
@ -219,17 +242,19 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
#endif
if (newval != val) {
#if !defined(ROTARY_ENCODER_NAVIGATION)
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));
checkIncDec_Ret = (newval > val ? 1 : -1);
if (!IS_KEY_REPT(event)) {
AUDIO_KEY_PRESS();
}
#endif
storageDirty(i_flags & (EE_GENERAL|EE_MODEL));
checkIncDec_Ret = (newval > val ? 1 : -1);
}
else {
checkIncDec_Ret = 0;
@ -316,12 +341,12 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
#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 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;}
coord_t scrollbar_X = DEFAULT_SCROLLBAR_X;
void onLongMenuPress(const char *result)
void onLongMenuPress(const char * result)
{
if (result == STR_VIEW_CHANNELS) {
pushMenu(menuChannelsView);
@ -331,7 +356,6 @@ void onLongMenuPress(const char *result)
}
}
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)
@ -403,7 +427,7 @@ void check(const char * name, event_t event, uint8_t curr, const MenuHandlerFunc
SET_SCROLLBAR_X(LCD_W-1);
break;
case EVT_ROTARY_BREAK:
case EVT_KEY_BREAK(KEY_ENTER):
if (s_editMode > 1) break;
if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
l_posHorz = 0;
@ -445,6 +469,7 @@ void check(const char * name, event_t event, uint8_t curr, const MenuHandlerFunc
}
break;
CASE_EVT_ROTARY_RIGHT
case EVT_KEY_FIRST(KEY_RIGHT):
AUDIO_KEY_PRESS();
// no break
@ -475,6 +500,7 @@ void check(const char * name, event_t event, uint8_t curr, const MenuHandlerFunc
l_posHorz = POS_HORZ_INIT(l_posVert);
break;
CASE_EVT_ROTARY_LEFT
case EVT_KEY_FIRST(KEY_LEFT):
AUDIO_KEY_PRESS();
// 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);
}
void repeatLastCursorMove(uint8_t event)
void repeatLastCursorMove(event_t event)
{
if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) {
putEvent(event);

View file

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

View file

@ -30,9 +30,9 @@
void drawMessageBox(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 warningInputValueMin;
extern int16_t warningInputValueMax;
@ -61,7 +61,7 @@ enum {
MENU_OFFSET_EXTERNAL
};
extern uint8_t popupMenuOffsetType;
const char * runPopupMenu(uint8_t event);
const char * runPopupMenu(event_t event);
extern void (*popupMenuHandler)(const char * result);
#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
int16_t vt = anaIn(i);
@ -196,7 +196,7 @@ void menuCommonCalib(uint8_t event)
#endif
}
void menuRadioCalibration(uint8_t event)
void menuRadioCalibration(event_t event)
{
check_simple(STR_MENUCALIBRATION, event, MENU_RADIO_CALIBRATION, menuTabGeneral, DIM(menuTabGeneral), 0);
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) {
menuCalibrationState = CALIB_START;

View file

@ -20,7 +20,7 @@
#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);

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);
}
void menuRadioDiagKeys(uint8_t event)
void menuRadioDiagKeys(event_t event)
{
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)
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 });

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -204,7 +204,7 @@ enum NavigationDirection {
#define decrTelemetryScreen() direction = up
#define incrTelemetryScreen() direction = down
void menuViewTelemetryFrsky(uint8_t event)
void menuViewTelemetryFrsky(event_t event)
{
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;

View file

@ -129,7 +129,7 @@ void title(const pm_char * s)
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);
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;
}
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);
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);
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);
}
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);
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;
}
#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);
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);
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);
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;
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);
extern uint8_t s_curveChan;

View file

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

View file

@ -41,7 +41,7 @@ void drawCurve(coord_t offset)
} while (1);
}
void menuModelCurvesAll(uint8_t event)
void menuModelCurvesAll(event_t event)
{
#if defined(GVARS_IN_CURVES_SCREEN)
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)
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;
if (flags & RIGHT) {

View file

@ -45,7 +45,7 @@ enum MenuModelHeliItems {
#define MODEL_HELI_2ND_COLUMN (14*FW)
#endif
void menuModelHeli(uint8_t event)
void menuModelHeli(event_t event)
{
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)
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;

View file

@ -24,6 +24,14 @@
#include "lcd.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)
typedef bool (*IsValueAvailable)(int);

View file

@ -122,23 +122,24 @@ uint8_t Key::key() const
return (this - keys);
}
void pauseEvents(uint8_t event)
void pauseEvents(event_t event)
{
event = EVT_KEY_MASK(event);
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) {
killEvents(BTN_REa + NAVIGATION_RE_IDX());
killEvents(BTN_REa + g_eeGeneral.reNavigation - 1);
return;
}
else
#endif
{
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);
return true;
}
#else // #if defined(CPUARM)
#else
void clearKeyEvents()
{
// loop until all keys are up

View file

@ -51,16 +51,26 @@
#define IS_KEY_LONG(evt) (((evt) & _MSK_KEY_FLAGS) == _MSK_KEY_LONG)
#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)
typedef uint16_t event_t;
#define EVT_ROTARY_BREAK EVT_KEY_BREAK(KEY_ENTER)
#define EVT_ROTARY_LONG EVT_KEY_LONG(KEY_ENTER)
#define EVT_ROTARY_LEFT 0xDF00
#define EVT_ROTARY_RIGHT 0xDE00
#else
#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
typedef uint8_t event_t;
#define IS_NEXT_EVENT(event) (event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_REPT(KEY_DOWN))
#define IS_PREVIOUS_EVENT(event) (event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_UP))
#endif
#if defined(COLORLCD)
@ -97,18 +107,12 @@ class Key
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;
#define putEvent(evt) s_evt = evt
void pauseEvents(uint8_t index);
void killEvents(uint8_t index);
void pauseEvents(event_t event);
void killEvents(event_t event);
#if defined(CPUARM)
bool clearKeyEvents();

View file

@ -788,7 +788,7 @@ Run function (key pressed)
*/
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);
warningInputValueMin = luaL_checkinteger(L, 4);
warningInputValueMax = luaL_checkinteger(L, 5);

View file

@ -282,7 +282,7 @@ void guiMain(event_t evt)
}
#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)
// else if Lua telemetry view, run it and don't clear the screen
// else clear scren and show normal menus

View file

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

View file

@ -133,23 +133,27 @@ void per10ms()
readKeysAndTrims();
#if defined(ROTARY_ENCODER_NAVIGATION)
if (IS_RE_NAVIGATION_ENABLE()) {
if (IS_ROTARY_ENCODER_NAVIGATION_ENABLE()) {
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;
if (scrollRE) {
rePreviousValue = reNewValue;
putEvent(scrollRE < 0 ? EVT_ROTARY_LEFT : EVT_ROTARY_RIGHT);
}
uint8_t evt = s_evt;
if (EVT_KEY_MASK(evt) == BTN_REa + NAVIGATION_RE_IDX()) {
if (IS_KEY_BREAK(evt)) {
putEvent(EVT_ROTARY_BREAK);
}
else if (IS_KEY_LONG(evt)) {
putEvent(EVT_ROTARY_LONG);
}
#if defined(CPUARM)
if (scrollRE) {
static uint32_t lastTick = 0;
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;
}
#endif
}
#endif
@ -656,7 +660,7 @@ int16_t getRotaryEncoder(uint8_t idx)
void incRotaryEncoder(uint8_t idx, int8_t inc)
{
g_rotenc[idx] += inc;
rotencValue[idx] += inc;
int16_t *value = &(flightModeAddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx]);
*value = limit((int16_t)-RESX, (int16_t)(*value + (inc * 8)), (int16_t)+RESX);
storageDirty(EE_MODEL);
@ -1344,7 +1348,7 @@ void checkTrims()
if (event && !IS_KEY_BREAK(event)) {
int8_t k = EVT_KEY_MASK(event) - TRM_BASE;
#else
uint8_t checkTrim(uint8_t event)
uint8_t checkTrim(event_t event)
{
int8_t k = EVT_KEY_MASK(event) - TRM_BASE;
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)
volatile rotenc_t g_rotenc[ROTARY_ENCODERS] = {0};
volatile rotenc_t rotencValue[ROTARY_ENCODERS] = {0};
#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
#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
#endif
#if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS)
#define IS_RE_NAVIGATION_ENABLE() true
#define NAVIGATION_RE_IDX() 0
#elif defined(ROTARY_ENCODERS)
#define NAVIGATION_RE_IDX() (g_eeGeneral.reNavigation - 1)
#define IS_RE_NAVIGATION_ENABLE() g_eeGeneral.reNavigation
#if defined(ROTARY_ENCODERS)
#define IS_ROTARY_ENCODER_NAVIGATION_ENABLE() g_eeGeneral.reNavigation
extern volatile rotenc_t rotencValue[ROTARY_ENCODERS];
#define ROTARY_ENCODER_NAVIGATION_VALUE rotencValue[g_eeGeneral.reNavigation - 1]
#elif defined(ROTARY_ENCODER_NAVIGATION)
#define IS_RE_NAVIGATION_ENABLE() true
#define NAVIGATION_RE_IDX() 0
#define IS_ROTARY_ENCODER_NAVIGATION_ENABLE() true
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
#define HEART_TIMER_10MS 1
@ -1127,11 +1135,11 @@ extern uint16_t lightOffCounter;
extern uint8_t flashCounter;
extern uint8_t mixWarning;
FlightModeData *flightModeAddress(uint8_t idx);
ExpoData *expoAddress(uint8_t idx);
MixData *mixAddress(uint8_t idx);
LimitData *limitAddress(uint8_t idx);
LogicalSwitchData *lswAddress(uint8_t idx);
FlightModeData * flightModeAddress(uint8_t idx);
ExpoData * expoAddress(uint8_t idx);
MixData * mixAddress(uint8_t idx);
LimitData * limitAddress(uint8_t idx);
LogicalSwitchData * lswAddress(uint8_t idx);
// static variables used in evalFlightModeMixes - moved here so they don't interfere with the stack
// It's also easier to initialize them here.
@ -1253,13 +1261,6 @@ void evalFunctions();
#define customFunctionsReset() modelFunctionsContext.reset()
#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"
#if defined(CPUARM)

View file

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

View file

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

View file

@ -14,7 +14,7 @@ set(LUA_EXPORT lua_export_horus)
set(FLAVOUR horus)
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)
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))
// Rotary encoder driver
extern int32_t rotencValue;
extern uint32_t rotencSpeed;
#define ROTENC_LOWSPEED 1
#define ROTENC_MIDSPEED 5
#define ROTENC_HIGHSPEED 50
#define ROTARY_ENCODER_NAVIGATION
void checkRotaryEncoder(void);
// WDT driver

View file

@ -20,6 +20,8 @@
#include "opentx.h"
uint32_t rotencPosition;
uint32_t readKeys()
{
uint32_t result = 0;
@ -89,22 +91,15 @@ uint8_t keyDown()
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()
{
register uint32_t newpos = ROTARY_ENCODER_POSITION();
if (newpos != rotencPosition) {
if ((rotencPosition & 0x01) ^ ((newpos & 0x02) >> 1)) {
--rotencValue;
--rotencValue[0];
}
else {
++rotencValue;
++rotencValue[0];
}
rotencPosition = newpos;
}
@ -121,28 +116,6 @@ void readKeysAndTrims()
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();
for (i = 1; i <= 1 << (TRM_LAST-TRM_BASE); i <<= 1) {
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)
{
#if ROTARY_ENCODERS > 0
g_rotenc[0] = 0;
#endif
#if ROTARY_ENCODERS > 1
g_rotenc[1] = 0;
#if defined(ROTARY_ENCODER_NAVIGATION)
for (int i=0; i<DIM(rotencValue); i++)
rotencValue[i] = 0;
#endif
StartEepromThread(filename);
@ -157,20 +155,8 @@ void OpenTxSimulator::getTrims(Trims & trims)
void OpenTxSimulator::wheelEvent(int steps)
{
#if defined(PCBHORUS) || defined(PCBFLAMENCO)
if (steps > 0)
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;
#if defined(ROTARY_ENCODER_NAVIGATION)
ROTARY_ENCODER_NAVIGATION_VALUE += steps * ROTARY_ENCODER_GRANULARITY;
#endif
}

View file

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

View file

@ -26,7 +26,6 @@ else()
set(FLAVOUR sky9x)
option(PCBREV "PCB Revision" REVC)
set(TARGET_SRC ${TARGET_SRC} coproc_driver.cpp rotenc_driver.cpp rtc_driver.cpp)
add_definitions(-DROTARY_ENCODERS=1)
set(BOOTLOADER bootflash4.lbm)
if(PCBREV STREQUAL REVA)
add_definitions(-DDREVA)

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