mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 16:55:20 +03:00
Cosmetics
This commit is contained in:
parent
f34de72e25
commit
643a731979
21 changed files with 77 additions and 85 deletions
|
@ -59,9 +59,6 @@
|
|||
#define MAX_SCRIPTS 7
|
||||
#define MAX_INPUTS 32
|
||||
#define MAX_TRAINER_CHANNELS 16
|
||||
#define NUM_POTS 4 // TODO board.h
|
||||
#define NUM_SLIDERS 0 // TODO board.h
|
||||
#define NUM_XPOTS 0 // TODO board.h
|
||||
#define MAX_TELEMETRY_SENSORS 32
|
||||
#elif defined(PCBTARANIS)
|
||||
#define MAX_MODELS 60
|
||||
|
|
|
@ -40,9 +40,9 @@
|
|||
|
||||
/* drawText flags */
|
||||
#define INVERS 0x02
|
||||
#define LEFT 0x00
|
||||
#define CENTERED 0x04 /* align left */
|
||||
#define RIGHT 0x08 /* align left */
|
||||
#define LEFT 0x00 /* align left */
|
||||
#define CENTERED 0x04 /* align center */
|
||||
#define RIGHT 0x08 /* align right */
|
||||
|
||||
/* drawNumber flags */
|
||||
#define LEADING0 0x10
|
||||
|
|
|
@ -38,11 +38,8 @@ const MenuHandlerFunc menuTabModel[] = {
|
|||
#endif
|
||||
CASE_FRSKY(menuModelTelemetryFrsky)
|
||||
CASE_MAVLINK(menuModelTelemetryMavlink)
|
||||
CASE_TEMPLATES(menuModelTemplates)
|
||||
};
|
||||
|
||||
extern uint8_t s_curveChan;
|
||||
|
||||
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)
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
extern uint8_t menuPageIndex;
|
||||
extern uint8_t menuPageCount;
|
||||
extern uint16_t linesCount;
|
||||
extern uint8_t linesDisplayed;
|
||||
extern int menuVerticalPosition;
|
||||
extern int menuHorizontalPosition;
|
||||
extern int menuVerticalOffset;
|
||||
|
@ -349,7 +350,7 @@ swsrc_t checkIncDecMovedSwitch(swsrc_t val);
|
|||
checkIncDec(event, var, min, max, incdecFlag, isValueAvailable)
|
||||
|
||||
int8_t navigate(event_t event, int count, int rows, int columns=1, bool loop=true);
|
||||
bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, int maxrow, uint8_t flags=0);
|
||||
bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const uint8_t * horTab, uint8_t horTabMax, int maxrow, uint8_t flags=0);
|
||||
bool check_simple(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, int maxrow);
|
||||
bool check_submenu_simple(event_t event, uint8_t maxrow);
|
||||
|
||||
|
|
|
@ -443,7 +443,7 @@ bool menuModelExposAll(event_t event)
|
|||
pushMenu(menuModelExpoOne);
|
||||
s_copyMode = 0;
|
||||
}
|
||||
else if (menuVerticalPosition >= 0) {
|
||||
else {
|
||||
event = 0;
|
||||
s_copyMode = 0;
|
||||
POPUP_MENU_ADD_ITEM(STR_EDIT);
|
||||
|
|
|
@ -355,16 +355,14 @@ void displayMixLine(coord_t y, MixData *md)
|
|||
lcdDrawSizedText(MIX_LINE_NAME_FM_POS, y, md->name, sizeof(md->name), ZCHAR);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (md->name[0]) {
|
||||
else if (md->name[0]) {
|
||||
lcd->drawBitmap(MIX_LINE_NAME_FM_ICON, y + 2, mixerSetupLabelBitmap);
|
||||
lcdDrawSizedText(MIX_LINE_NAME_FM_POS, y, md->name, sizeof(md->name), ZCHAR);
|
||||
}
|
||||
if (md->flightModes) {
|
||||
else if (md->flightModes) {
|
||||
lcd->drawBitmap(MIX_LINE_NAME_FM_ICON, y + 2, mixerSetupFlightmodeBitmap);
|
||||
displayMixSmallFlightModes(MIX_LINE_NAME_FM_POS, y + 2, md->flightModes);
|
||||
}
|
||||
}
|
||||
displayMixInfos(y, md);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
uint8_t g_moduleIdx;
|
||||
bool menuModelFailsafe(event_t event);
|
||||
|
||||
enum menuModelSetupItems {
|
||||
enum MenuModelSetupItems {
|
||||
ITEM_MODEL_NAME,
|
||||
ITEM_MODEL_BITMAP,
|
||||
ITEM_MODEL_TIMER1,
|
||||
|
|
|
@ -174,8 +174,8 @@ bool menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
drawStringWithIndex(MENUS_MARGIN_LEFT, y, functions == g_model.customFn ? STR_SF : STR_GF, k+1, (menuVerticalPosition==k && menuHorizontalPosition<0) ? INVERS : 0);
|
||||
|
||||
CustomFunctionData * cfn = &functions[k];
|
||||
unsigned int func = CFN_FUNC(cfn);
|
||||
for (int j=0; j<ITEM_SPECIAL_FUNCTIONS_COUNT; j++) {
|
||||
uint8_t func = CFN_FUNC(cfn);
|
||||
for (uint8_t j=0; j<ITEM_SPECIAL_FUNCTIONS_COUNT; j++) {
|
||||
LcdFlags attr = ((menuVerticalPosition==k && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
LcdFlags active = (attr && s_editMode>0);
|
||||
switch (j) {
|
||||
|
@ -224,7 +224,7 @@ bool menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
}
|
||||
#endif
|
||||
else if (func == FUNC_SET_TIMER) {
|
||||
maxParam = MAX_TIMERS-1;
|
||||
maxParam = TIMERS-1;
|
||||
drawStringWithIndex(MODEL_SPECIAL_FUNC_2ND_COLUMN_EXT, y, STR_TIMER, CFN_TIMER_INDEX(cfn)+1, attr);
|
||||
if (active) CFN_TIMER_INDEX(cfn) = checkIncDec(event, CFN_TIMER_INDEX(cfn), 0, maxParam, eeFlags);
|
||||
break;
|
||||
|
@ -259,6 +259,7 @@ bool menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
}
|
||||
#endif
|
||||
else if (func == FUNC_SET_TIMER) {
|
||||
// TODO 539 ? TIMEHOUR ?
|
||||
val_max = 59*60+59;
|
||||
drawTimer(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
}
|
||||
|
@ -324,14 +325,6 @@ bool menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_MMMINV, 0, attr);
|
||||
}
|
||||
}
|
||||
#if defined(PCBX9DP) || defined(PCBX9E)
|
||||
else if (func == FUNC_BACKLIGHT) {
|
||||
drawSlider(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, CFN_PARAM(cfn), 100, attr);
|
||||
INCDEC_SET_FLAG(eeFlags | NO_INCDEC_MARKS);
|
||||
val_min = 0;
|
||||
val_max = 100;
|
||||
}
|
||||
#endif
|
||||
#if defined(GVARS)
|
||||
else if (func == FUNC_ADJUST_GVAR) {
|
||||
switch (CFN_GVAR_MODE(cfn)) {
|
||||
|
@ -359,6 +352,7 @@ bool menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
else
|
||||
lcdDrawText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, "+= ", attr);
|
||||
lcdDrawNumber(lcdNextPos, y, abs(val_displayed), attr|LEFT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -115,9 +115,10 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
|
|||
if (!(i_flags & NO_DBLKEYS) && (EVT_KEY_MASK(event))) {
|
||||
bool dblkey = true;
|
||||
if (DBLKEYS_PRESSED_RGT_LFT(in)) {
|
||||
if (!isValueAvailable || isValueAvailable(-val))
|
||||
if (!isValueAvailable || isValueAvailable(-val)) {
|
||||
newval = -val;
|
||||
}
|
||||
}
|
||||
else if (DBLKEYS_PRESSED_RGT_UP(in)) {
|
||||
newval = (i_max > stops.max() ? stops.max() : i_max);
|
||||
while (isValueAvailable && !isValueAvailable(newval) && newval>i_min) {
|
||||
|
@ -297,6 +298,7 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
|
|||
uint8_t menuPageIndex;
|
||||
uint8_t menuPageCount;
|
||||
uint16_t linesCount;
|
||||
uint8_t linesDisplayed;
|
||||
|
||||
int8_t navigate(event_t event, int count, int rows, int columns, bool loop)
|
||||
{
|
||||
|
@ -477,7 +479,6 @@ bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
|
|||
INC(menuVerticalPosition, MENU_FIRST_LINE_EDIT, rowcount-1);
|
||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(menuVerticalPosition));
|
||||
menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition);
|
||||
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_LEFT:
|
||||
|
|
|
@ -139,9 +139,11 @@ const char * runPopupMenu(event_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;
|
||||
|
|
|
@ -43,17 +43,16 @@ bool menuAboutView(event_t event)
|
|||
static uint8_t screenIndex = 0;
|
||||
static uint8_t greyIndex = 0;
|
||||
|
||||
switch(event)
|
||||
{
|
||||
switch (event) {
|
||||
case EVT_ENTRY:
|
||||
screenIndex = 0;
|
||||
greyIndex = 0;
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
case EVT_KEY_FIRST(KEY_PGDN):
|
||||
screenIndex < ABOUT_PARENTS ? screenIndex++ : screenIndex = ABOUT_OPENTX;
|
||||
greyIndex = 0;
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_LEFT):
|
||||
case EVT_KEY_FIRST(KEY_PGUP):
|
||||
screenIndex > ABOUT_OPENTX ? screenIndex-- : screenIndex = ABOUT_PARENTS;
|
||||
greyIndex = 0;
|
||||
break;
|
||||
|
|
|
@ -126,8 +126,6 @@ void drawShadow(coord_t x, coord_t y, coord_t w, coord_t h)
|
|||
lcdDrawSolidHorizontalLine(x+2, y+h+1, w, LINE_COLOR);
|
||||
}
|
||||
|
||||
uint8_t linesDisplayed;
|
||||
|
||||
void drawMenuTemplate(const char * title, uint8_t icon, const uint8_t * icons, uint32_t options)
|
||||
{
|
||||
coord_t bodyTop, bodyBottom;
|
||||
|
|
|
@ -80,6 +80,4 @@ void drawTopBar();
|
|||
void drawMainPots();
|
||||
void drawTrims(uint8_t flightMode);
|
||||
|
||||
extern uint8_t linesDisplayed;
|
||||
|
||||
#endif // _WIDGETS_H_
|
||||
|
|
|
@ -51,14 +51,11 @@
|
|||
#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)
|
||||
#if defined(PCBHORUS) || defined(PCBFLAMENCO) || defined(PCBTARANIS)
|
||||
#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
|
||||
#elif defined(PCBTARANIS) || defined(PCBFLAMENCO)
|
||||
#define EVT_ROTARY_BREAK EVT_KEY_BREAK(KEY_ENTER)
|
||||
#define EVT_ROTARY_LONG EVT_KEY_LONG(KEY_ENTER)
|
||||
#else
|
||||
#define EVT_ROTARY_BREAK 0xcf
|
||||
#define EVT_ROTARY_LONG 0xce
|
||||
|
|
|
@ -238,7 +238,12 @@ void Open9xSim::updateKeysAndSwitches(bool start)
|
|||
KEY_Down, KEY_DOWN,
|
||||
KEY_Right, KEY_RIGHT,
|
||||
KEY_Left, KEY_LEFT,
|
||||
#elif defined(PCBTARANIS) || defined(PCBFLAMENCO)
|
||||
#elif defined(PCBFLAMENCO)
|
||||
KEY_Page_Up, KEY_MENU,
|
||||
KEY_Page_Down, KEY_PAGE,
|
||||
KEY_Return, KEY_ENTER,
|
||||
KEY_BackSpace, KEY_EXIT,
|
||||
#elif defined(PCBTARANIS)
|
||||
KEY_Page_Up, KEY_MENU,
|
||||
KEY_Page_Down, KEY_PAGE,
|
||||
KEY_Return, KEY_ENTER,
|
||||
|
@ -353,13 +358,13 @@ long Open9xSim::onTimeout(FXObject*, FXSelector, void*)
|
|||
|
||||
updateKeysAndSwitches();
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#if defined(PCBHORUS) || defined(PCBFLAMENCO)
|
||||
#define ROTENC_VALUE rotencValue
|
||||
#else
|
||||
#define ROTENC_VALUE g_rotenc[0]
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBHORUS)
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBHORUS) || defined(PCBFLAMENCO)
|
||||
static bool rotencAction = false;
|
||||
if (getApp()->getKeyState(KEY_X)) {
|
||||
if (!rotencAction) ROTENC_VALUE += ROTARY_ENCODER_GRANULARITY;
|
||||
|
|
|
@ -169,7 +169,6 @@ void init_trainer_capture(void);
|
|||
void stop_trainer_capture(void);
|
||||
|
||||
// Keys driver
|
||||
#define NUM_SWITCHES 8
|
||||
enum EnumKeys
|
||||
{
|
||||
KEY_PGUP,
|
||||
|
@ -211,7 +210,8 @@ enum EnumSwitches
|
|||
SW_SE,
|
||||
SW_SF,
|
||||
SW_SG,
|
||||
SW_SH
|
||||
SW_SH,
|
||||
NUM_SWITCHES
|
||||
};
|
||||
#define IS_3POS(x) ((x) != SW_SF && (x) != SW_SH)
|
||||
|
||||
|
@ -253,6 +253,8 @@ uint32_t readTrims(void);
|
|||
#define DBLKEYS_PRESSED_UP_DWN(in) ((in & (KEYS_GPIO_PIN_UP + KEYS_GPIO_PIN_DOWN)) == (KEYS_GPIO_PIN_UP + KEYS_GPIO_PIN_DOWN))
|
||||
#define DBLKEYS_PRESSED_RGT_UP(in) ((in & (KEYS_GPIO_PIN_RIGHT + KEYS_GPIO_PIN_UP)) == (KEYS_GPIO_PIN_RIGHT + KEYS_GPIO_PIN_UP))
|
||||
#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
|
||||
|
|
|
@ -144,7 +144,7 @@ void readKeysAndTrims()
|
|||
}
|
||||
|
||||
in = readTrims();
|
||||
for (i = 1; i < 4096; i <<= 1) {
|
||||
for (i = 1; i <= 1 << (TRM_LAST-TRM_BASE); i <<= 1) {
|
||||
keys[index++].input(in & i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,7 +171,10 @@ void simuSetKey(uint8_t key, bool state)
|
|||
KEY_CASE(KEY_RADIO, KEYS_GPIO_REG_LEFT, KEYS_GPIO_PIN_LEFT)
|
||||
KEY_CASE(KEY_MODEL, KEYS_GPIO_REG_UP, KEYS_GPIO_PIN_UP)
|
||||
KEY_CASE(KEY_EXIT, KEYS_GPIO_REG_DOWN, KEYS_GPIO_PIN_DOWN)
|
||||
#elif defined(PCBTARANIS) || defined(PCBFLAMENCO)
|
||||
#elif defined(PCBFLAMENCO)
|
||||
KEY_CASE(KEY_ENTER, KEYS_GPIO_REG_ENTER, KEYS_GPIO_PIN_ENTER)
|
||||
KEY_CASE(KEY_PAGE, KEYS_GPIO_REG_PAGE, KEYS_GPIO_PIN_PAGE)
|
||||
#elif defined(PCBTARANIS)
|
||||
KEY_CASE(KEY_ENTER, KEYS_GPIO_REG_ENTER, KEYS_GPIO_PIN_ENTER)
|
||||
KEY_CASE(KEY_PAGE, KEYS_GPIO_REG_PAGE, KEYS_GPIO_PIN_PAGE)
|
||||
KEY_CASE(KEY_MINUS, KEYS_GPIO_REG_MINUS, KEYS_GPIO_PIN_MINUS)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue