[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
+20 -15
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
+8 -8
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);
+1 -1
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);
+1 -1
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 "/");
+38 -38
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];
+2 -2
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];
@@ -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);
+1 -1
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) });
+1 -1
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 });
+3 -3
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;
+2 -2
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;
@@ -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);
+3 -3
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;
+1 -1
View File
@@ -97,7 +97,7 @@ void onLimitsMenu(const char *result)
}
}
void menuModelLimits(uint8_t event)
void menuModelLimits(event_t event)
{
int sub = menuVerticalPosition;
+4 -5
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);
+6 -6
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;
@@ -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);
+42 -16
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;
@@ -312,16 +337,16 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
return newval;
}
#define CURSOR_NOT_ALLOWED_IN_ROW(row) ((int8_t)MAXCOL(row) < 0)
#define MAXCOL_RAW(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
#define MAXCOL(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 DEC(val, min, max) if (val>min) {val--;} else {val=max;}
#define CURSOR_NOT_ALLOWED_IN_ROW(row) ((int8_t)MAXCOL(row) < 0)
#define MAXCOL_RAW(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
#define MAXCOL(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 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
@@ -474,7 +499,8 @@ 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);
+8 -4
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) {
@@ -156,7 +157,8 @@ 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;
+3 -3
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_
+3 -3
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;
+1 -1
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);
+1 -1
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);
+1 -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 });
+1 -1
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;
+1 -1
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();
+1 -1
View File
@@ -20,7 +20,7 @@
#include "opentx.h"
void menuRadioVersion(uint8_t event)
void menuRadioVersion(event_t event)
{
if (warningResult) {
warningResult = 0;
+1 -1
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;
+1 -1
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;
+2 -2
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();
+3 -3
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)
{
+1 -1
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;
+1 -1
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;
+5 -5
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);