mirror of
https://github.com/opentx/opentx.git
synced 2025-07-13 11:29:51 +03:00
[V10] Fixes
This commit is contained in:
parent
fe18f5a17f
commit
9cccae08d4
35 changed files with 608 additions and 275 deletions
|
@ -431,7 +431,7 @@ enum SwitchSources {
|
||||||
SWSRC_SD2,
|
SWSRC_SD2,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES) && defined(RADIO_TPRO)
|
#if FUNCTION_SWITCHES > 0 && defined(RADIO_TPRO)
|
||||||
SWSRC_FIRST_FUNCTION_SWITCH,
|
SWSRC_FIRST_FUNCTION_SWITCH,
|
||||||
SWSRC_SE0 = SWSRC_FIRST_FUNCTION_SWITCH,
|
SWSRC_SE0 = SWSRC_FIRST_FUNCTION_SWITCH,
|
||||||
SWSRC_SE1,
|
SWSRC_SE1,
|
||||||
|
@ -536,6 +536,11 @@ enum SwitchSources {
|
||||||
SWSRC_LAST_SWITCH = SWSRC_FIRST_SWITCH + STORAGE_NUM_SWITCHES_POSITIONS - 1,
|
SWSRC_LAST_SWITCH = SWSRC_FIRST_SWITCH + STORAGE_NUM_SWITCHES_POSITIONS - 1,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if FUNCTION_SWITCHES > 0
|
||||||
|
SWSRC_FIRST_FUNCTION_SWITCH,
|
||||||
|
SWSRC_LAST_FUNCTION_SWITCH = SWSRC_FIRST_FUNCTION_SWITCH + FUNCTION_SWITCHES - 1,
|
||||||
|
#endif
|
||||||
|
|
||||||
#if NUM_XPOTS > 0
|
#if NUM_XPOTS > 0
|
||||||
SWSRC_FIRST_MULTIPOS_SWITCH,
|
SWSRC_FIRST_MULTIPOS_SWITCH,
|
||||||
SWSRC_LAST_MULTIPOS_SWITCH = SWSRC_FIRST_MULTIPOS_SWITCH + (NUM_XPOTS * XPOTS_MULTIPOS_COUNT) - 1,
|
SWSRC_LAST_MULTIPOS_SWITCH = SWSRC_FIRST_MULTIPOS_SWITCH + (NUM_XPOTS * XPOTS_MULTIPOS_COUNT) - 1,
|
||||||
|
@ -565,7 +570,7 @@ enum SwitchSources {
|
||||||
SWSRC_SW1 = SWSRC_FIRST_LOGICAL_SWITCH,
|
SWSRC_SW1 = SWSRC_FIRST_LOGICAL_SWITCH,
|
||||||
SWSRC_SW2,
|
SWSRC_SW2,
|
||||||
// ...
|
// ...
|
||||||
SWSRC_LAST_LOGICAL_SWITCH = SWSRC_FIRST_LOGICAL_SWITCH+MAX_LOGICAL_SWITCHES-1,
|
SWSRC_LAST_LOGICAL_SWITCH = SWSRC_FIRST_LOGICAL_SWITCH + MAX_LOGICAL_SWITCHES - 1,
|
||||||
|
|
||||||
SWSRC_ON,
|
SWSRC_ON,
|
||||||
SWSRC_ONE,
|
SWSRC_ONE,
|
||||||
|
@ -600,7 +605,7 @@ enum SwitchSources {
|
||||||
SWSRC_INVERT = SWSRC_COUNT+1,
|
SWSRC_INVERT = SWSRC_COUNT+1,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if NUM_SWITCHES - NUM_FUNCTIONS_SWITCHES >= 8
|
#if NUM_SWITCHES - FUNCTION_SWITCHES >= 8
|
||||||
#define SWSRC_TRAINER SWSRC_SH2
|
#define SWSRC_TRAINER SWSRC_SH2
|
||||||
#else
|
#else
|
||||||
#define SWSRC_TRAINER SWSRC_LAST_SWITCH,
|
#define SWSRC_TRAINER SWSRC_LAST_SWITCH,
|
||||||
|
@ -778,6 +783,14 @@ enum MixSources {
|
||||||
MIXSRC_GEA,
|
MIXSRC_GEA,
|
||||||
MIXSRC_TRN,
|
MIXSRC_TRN,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
MIXSRC_LAST_SWITCH = MIXSRC_FIRST_SWITCH + STORAGE_NUM_SWITCHES - 1,
|
||||||
|
|
||||||
|
#if FUNCTION_SWITCHES > 0
|
||||||
|
MIXSRC_FIRST_FS_SWITCH,
|
||||||
|
MIXSRC_LAST_FS_SWITCH = MIXSRC_FIRST_FS_SWITCH + FUNCTION_SWITCHES - 1,
|
||||||
|
#endif
|
||||||
|
|
||||||
MIXSRC_FIRST_LOGICAL_SWITCH,
|
MIXSRC_FIRST_LOGICAL_SWITCH,
|
||||||
MIXSRC_SW1 = MIXSRC_FIRST_LOGICAL_SWITCH, LUA_EXPORT_MULTIPLE("ls", "Logical switch L%d", MAX_LOGICAL_SWITCHES)
|
MIXSRC_SW1 = MIXSRC_FIRST_LOGICAL_SWITCH, LUA_EXPORT_MULTIPLE("ls", "Logical switch L%d", MAX_LOGICAL_SWITCHES)
|
||||||
MIXSRC_LAST_LOGICAL_SWITCH = MIXSRC_FIRST_LOGICAL_SWITCH+MAX_LOGICAL_SWITCHES-1,
|
MIXSRC_LAST_LOGICAL_SWITCH = MIXSRC_FIRST_LOGICAL_SWITCH+MAX_LOGICAL_SWITCHES-1,
|
||||||
|
@ -830,19 +843,10 @@ enum MixSources {
|
||||||
MIXSRC_LAST_TELEM = MIXSRC_FIRST_TELEM+3*MAX_TELEMETRY_SENSORS-1
|
MIXSRC_LAST_TELEM = MIXSRC_FIRST_TELEM+3*MAX_TELEMETRY_SENSORS-1
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
static_assert(MIXSRC_FIRST_LOGICAL_SWITCH == MIXSRC_FIRST_SWITCH + STORAGE_NUM_SWITCHES, "Wrong switches definition in MIXSRC list");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MIXSRC_FIRST (MIXSRC_NONE + 1)
|
#define MIXSRC_FIRST (MIXSRC_NONE + 1)
|
||||||
#define MIXSRC_LAST MIXSRC_LAST_CH
|
#define MIXSRC_LAST MIXSRC_LAST_CH
|
||||||
#define MIXSRC_LAST_SWITCH (MIXSRC_FIRST_SWITCH + STORAGE_NUM_SWITCHES - 1)
|
|
||||||
#define INPUTSRC_FIRST MIXSRC_Rud
|
#define INPUTSRC_FIRST MIXSRC_Rud
|
||||||
#define INPUTSRC_LAST MIXSRC_LAST_TELEM
|
#define INPUTSRC_LAST MIXSRC_LAST_TELEM
|
||||||
#if defined(FUNCTION_SWITCHES)
|
|
||||||
#define MIXSRC_LAST_REGULAR_SWITCH (MIXSRC_FIRST_SWITCH + NUM_REGULAR_SWITCHES - 1)
|
|
||||||
#define MIXSRC_FIRST_FS_SWITCH (MIXSRC_LAST_REGULAR_SWITCH + 1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum BacklightMode {
|
enum BacklightMode {
|
||||||
e_backlight_mode_off = 0,
|
e_backlight_mode_off = 0,
|
||||||
|
|
|
@ -577,13 +577,13 @@ PACK(struct CustomScreenData {
|
||||||
#define SCRIPT_DATA
|
#define SCRIPT_DATA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES) && NUM_FUNCTIONS_SWITCHES < 8
|
#if FUNCTION_SWITCHES > 0
|
||||||
#define FUNCTION_SWITCHS_FIELDS \
|
#define FUNCTION_SWITCHS_FIELDS \
|
||||||
uint16_t functionSwitchConfig; \
|
uint16_t functionSwitchConfig; \
|
||||||
uint16_t functionSwitchGroup; \
|
uint16_t functionSwitchGroup; \
|
||||||
uint16_t functionSwitchStartConfig; \
|
uint16_t functionSwitchStartConfig; \
|
||||||
uint8_t functionSwitchLogicalState; \
|
uint8_t functionSwitchLogicalState; \
|
||||||
char switchNames[NUM_FUNCTIONS_SWITCHES][LEN_SWITCH_NAME];
|
char switchNames[FUNCTION_SWITCHES][LEN_SWITCH_NAME];
|
||||||
#else
|
#else
|
||||||
#define FUNCTION_SWITCHS_FIELDS
|
#define FUNCTION_SWITCHS_FIELDS
|
||||||
#endif
|
#endif
|
||||||
|
@ -752,7 +752,7 @@ PACK(struct TrainerData {
|
||||||
uint8_t backlightColor; \
|
uint8_t backlightColor; \
|
||||||
swarnstate_t switchUnlockStates; \
|
swarnstate_t switchUnlockStates; \
|
||||||
swconfig_t switchConfig; \
|
swconfig_t switchConfig; \
|
||||||
char switchNames[STORAGE_NUM_SWITCHES - NUM_FUNCTIONS_SWITCHES][LEN_SWITCH_NAME]; \
|
char switchNames[STORAGE_NUM_SWITCHES - FUNCTION_SWITCHES][LEN_SWITCH_NAME]; \
|
||||||
char anaNames[NUM_STICKS+STORAGE_NUM_POTS+STORAGE_NUM_SLIDERS][LEN_ANA_NAME]; \
|
char anaNames[NUM_STICKS+STORAGE_NUM_POTS+STORAGE_NUM_SLIDERS][LEN_ANA_NAME]; \
|
||||||
MODEL_FILE_NAME_FIELD \
|
MODEL_FILE_NAME_FIELD \
|
||||||
BLUETOOTH_FIELDS
|
BLUETOOTH_FIELDS
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#define FILL_WHITE 0x10
|
#define FILL_WHITE 0x10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NAVIGATION_X7)
|
#if defined(NAVIGATION_X7) || defined(NAVIGATION_HORUS)
|
||||||
#define HEADER_LINE 0
|
#define HEADER_LINE 0
|
||||||
#define HEADER_LINE_COLUMNS
|
#define HEADER_LINE_COLUMNS
|
||||||
#else
|
#else
|
||||||
|
@ -156,9 +156,15 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
|
||||||
#define CURSOR_ON_LINE() (0)
|
#define CURSOR_ON_LINE() (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(NAVIGATION_HORUS)
|
||||||
|
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);
|
||||||
|
#else
|
||||||
void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow);
|
void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow);
|
||||||
void check_simple(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
void check_simple(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
||||||
void check_submenu_simple(event_t event, uint8_t maxrow);
|
void check_submenu_simple(event_t event, uint8_t maxrow);
|
||||||
|
#endif
|
||||||
|
|
||||||
void title(const char * s);
|
void title(const char * s);
|
||||||
|
|
||||||
|
@ -274,6 +280,8 @@ void menuChannelsViewCommon(event_t event);
|
||||||
#define REPEAT_LAST_CURSOR_MOVE() repeatLastCursorMove(event)
|
#define REPEAT_LAST_CURSOR_MOVE() repeatLastCursorMove(event)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0)
|
||||||
|
|
||||||
// TODO enum
|
// TODO enum
|
||||||
#if defined(PCBX7) || defined(PCBX9LITE)
|
#if defined(PCBX7) || defined(PCBX9LITE)
|
||||||
#define EDIT_MODE_INIT 0
|
#define EDIT_MODE_INIT 0
|
||||||
|
|
|
@ -37,7 +37,7 @@ uint8_t g_moduleIdx;
|
||||||
uint8_t getSwitchWarningsCount()
|
uint8_t getSwitchWarningsCount()
|
||||||
{
|
{
|
||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
for (int i=0; i<NUM_SWITCHES - NUM_FUNCTIONS_SWITCHES; ++i) {
|
for (int i=0; i<NUM_SWITCHES - FUNCTION_SWITCHES; ++i) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
@ -63,14 +63,16 @@ enum MenuModelSetupItems {
|
||||||
ITEM_MODEL_SETUP_TIMER3_PERSISTENT,
|
ITEM_MODEL_SETUP_TIMER3_PERSISTENT,
|
||||||
ITEM_MODEL_SETUP_TIMER3_MINUTE_BEEP,
|
ITEM_MODEL_SETUP_TIMER3_MINUTE_BEEP,
|
||||||
ITEM_MODEL_SETUP_TIMER3_COUNTDOWN_BEEP,
|
ITEM_MODEL_SETUP_TIMER3_COUNTDOWN_BEEP,
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if FUNCTION_SWITCHES > 0
|
||||||
ITEM_MODEL_SETUP_LABEL,
|
ITEM_MODEL_SETUP_LABEL,
|
||||||
ITEM_MODEL_SETUP_SW1,
|
ITEM_MODEL_SETUP_SW1,
|
||||||
ITEM_MODEL_SETUP_SW2,
|
ITEM_MODEL_SETUP_SW2,
|
||||||
ITEM_MODEL_SETUP_SW3,
|
ITEM_MODEL_SETUP_SW3,
|
||||||
ITEM_MODEL_SETUP_SW4,
|
ITEM_MODEL_SETUP_SW4,
|
||||||
|
#if FUNCTION_SWITCHES >= 6
|
||||||
ITEM_MODEL_SETUP_SW5,
|
ITEM_MODEL_SETUP_SW5,
|
||||||
ITEM_MODEL_SETUP_SW6,
|
ITEM_MODEL_SETUP_SW6,
|
||||||
|
#endif
|
||||||
ITEM_MODEL_SETUP_FS_STARTUP,
|
ITEM_MODEL_SETUP_FS_STARTUP,
|
||||||
#endif
|
#endif
|
||||||
ITEM_MODEL_SETUP_EXTENDED_LIMITS,
|
ITEM_MODEL_SETUP_EXTENDED_LIMITS,
|
||||||
|
@ -279,8 +281,10 @@ inline uint8_t MODULE_SUBTYPE_ROWS(int moduleIdx)
|
||||||
#define EXTRA_MODULE_ROWS
|
#define EXTRA_MODULE_ROWS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if FUNCTION_SWITCHES == 6
|
||||||
#define FUNCTION_SWITCHES_ROWS READONLY_ROW, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|(NUM_FUNCTIONS_SWITCHES-1),
|
#define FUNCTION_SWITCHES_ROWS READONLY_ROW, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|(FUNCTION_SWITCHES-1),
|
||||||
|
#elif FUNCTION_SWITCHES == 4
|
||||||
|
#define FUNCTION_SWITCHES_ROWS READONLY_ROW, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|3, NAVIGATION_LINE_BY_LINE|(FUNCTION_SWITCHES-1),
|
||||||
#else
|
#else
|
||||||
#define FUNCTION_SWITCHES_ROWS
|
#define FUNCTION_SWITCHES_ROWS
|
||||||
#endif
|
#endif
|
||||||
|
@ -609,8 +613,7 @@ void menuModelSetup(event_t event)
|
||||||
timer->persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer->persistent, 0, 2, attr, event);
|
timer->persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer->persistent, 0, 2, attr, event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if FUNCTION_SWITCHES > 0
|
||||||
|
|
||||||
case ITEM_MODEL_SETUP_LABEL:
|
case ITEM_MODEL_SETUP_LABEL:
|
||||||
lcdDrawTextAlignedLeft(y, "Function Switches");
|
lcdDrawTextAlignedLeft(y, "Function Switches");
|
||||||
break;
|
break;
|
||||||
|
@ -619,12 +622,14 @@ void menuModelSetup(event_t event)
|
||||||
case ITEM_MODEL_SETUP_SW2:
|
case ITEM_MODEL_SETUP_SW2:
|
||||||
case ITEM_MODEL_SETUP_SW3:
|
case ITEM_MODEL_SETUP_SW3:
|
||||||
case ITEM_MODEL_SETUP_SW4:
|
case ITEM_MODEL_SETUP_SW4:
|
||||||
|
#if FUNCTION_SWITCHES >= 6
|
||||||
case ITEM_MODEL_SETUP_SW5:
|
case ITEM_MODEL_SETUP_SW5:
|
||||||
case ITEM_MODEL_SETUP_SW6:
|
case ITEM_MODEL_SETUP_SW6:
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
int index = k - ITEM_MODEL_SETUP_SW1;
|
int index = k - ITEM_MODEL_SETUP_SW1;
|
||||||
int config = FSWITCH_CONFIG(index);
|
int config = FSWITCH_CONFIG(index);
|
||||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH + NUM_REGULAR_SWITCHES - MIXSRC_Rud + index + 1, menuHorizontalPosition < 0 ? attr : 0);
|
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH + NUM_SWITCHES - MIXSRC_Rud + index + 1, menuHorizontalPosition < 0 ? attr : 0);
|
||||||
if (ZEXIST(g_model.switchNames[index]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
|
if (ZEXIST(g_model.switchNames[index]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
|
||||||
editName(35, y, g_model.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0);
|
editName(35, y, g_model.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0);
|
||||||
else
|
else
|
||||||
|
@ -646,8 +651,8 @@ void menuModelSetup(event_t event)
|
||||||
uint8_t groupeAlwaysOn = IS_FSWITCH_GROUP_ON(config);
|
uint8_t groupeAlwaysOn = IS_FSWITCH_GROUP_ON(config);
|
||||||
groupeAlwaysOn = editCheckBox(groupeAlwaysOn, 30 + 15 * FW, y, "", menuHorizontalPosition == 3 ? attr : 0, event);
|
groupeAlwaysOn = editCheckBox(groupeAlwaysOn, 30 + 15 * FW, y, "", menuHorizontalPosition == 3 ? attr : 0, event);
|
||||||
if (attr && checkIncDec_Ret && menuHorizontalPosition == 3) {
|
if (attr && checkIncDec_Ret && menuHorizontalPosition == 3) {
|
||||||
swconfig_t mask = (swconfig_t) 0x01 << (2 * NUM_FUNCTIONS_SWITCHES + config);
|
swconfig_t mask = (swconfig_t) 0x01 << (2 * FUNCTION_SWITCHES + config);
|
||||||
g_model.functionSwitchGroup = (g_model.functionSwitchGroup & ~mask) | (groupeAlwaysOn << (2 * NUM_FUNCTIONS_SWITCHES + config));
|
g_model.functionSwitchGroup = (g_model.functionSwitchGroup & ~mask) | (groupeAlwaysOn << (2 * FUNCTION_SWITCHES + config));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (attr && menuHorizontalPosition == 3) { // Non visible checkbox
|
else if (attr && menuHorizontalPosition == 3) { // Non visible checkbox
|
||||||
|
@ -660,7 +665,7 @@ void menuModelSetup(event_t event)
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
lcdDrawText(0, y, INDENT "Start", menuHorizontalPosition < 0 ? attr : 0);
|
lcdDrawText(0, y, INDENT "Start", menuHorizontalPosition < 0 ? attr : 0);
|
||||||
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
for (uint8_t i = 0; i < FUNCTION_SWITCHES; i++) {
|
||||||
uint8_t startPos = (g_model.functionSwitchStartConfig >> 2 * i) & 0x03;
|
uint8_t startPos = (g_model.functionSwitchStartConfig >> 2 * i) & 0x03;
|
||||||
c = "\300\301="[(g_model.functionSwitchStartConfig >> 2 * i) & 0x03];
|
c = "\300\301="[(g_model.functionSwitchStartConfig >> 2 * i) & 0x03];
|
||||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN - (2 + FW) + i * 2 * FW, y, i + 1, 0);
|
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN - (2 + FW) + i * 2 * FW, y, i + 1, 0);
|
||||||
|
@ -807,7 +812,7 @@ void menuModelSetup(event_t event)
|
||||||
}
|
}
|
||||||
|
|
||||||
int current = 0;
|
int current = 0;
|
||||||
for (int i = 0; i < NUM_SWITCHES - NUM_FUNCTIONS_SWITCHES; i++) {
|
for (int i = 0; i < NUM_SWITCHES - FUNCTION_SWITCHES; i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
div_t qr = div(current, MAX_SWITCH_PER_LINE);
|
div_t qr = div(current, MAX_SWITCH_PER_LINE);
|
||||||
if (!READ_ONLY() && event==EVT_KEY_BREAK(KEY_ENTER) && attr && l_posHorz == current && old_posHorz >= 0) {
|
if (!READ_ONLY() && event==EVT_KEY_BREAK(KEY_ENTER) && attr && l_posHorz == current && old_posHorz >= 0) {
|
||||||
|
|
|
@ -66,8 +66,8 @@ void menuRadioDiagKeys(event_t event)
|
||||||
drawSwitch(8*FW, y, i+1, 0);
|
drawSwitch(8*FW, y, i+1, 0);
|
||||||
displaySwitchState(11*FW+2, y, i);
|
displaySwitchState(11*FW+2, y, i);
|
||||||
}
|
}
|
||||||
#elif (NUM_SWITCHES > 6)
|
#elif STORAGE_NUM_SWITCHES > 6
|
||||||
if (i < NUM_SWITCHES) {
|
if (i < STORAGE_NUM_SWITCHES) {
|
||||||
if (SWITCH_EXISTS(i)) {
|
if (SWITCH_EXISTS(i)) {
|
||||||
y = (i > 4) ? FH*(i-4) : MENU_HEADER_HEIGHT + FH*i;
|
y = (i > 4) ? FH*(i-4) : MENU_HEADER_HEIGHT + FH*i;
|
||||||
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH+i);
|
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH+i);
|
||||||
|
@ -76,9 +76,9 @@ void menuRadioDiagKeys(event_t event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (i < NUM_SWITCHES) {
|
if (i < STORAGE_NUM_SWITCHES) {
|
||||||
if (SWITCH_EXISTS(i)) {
|
if (SWITCH_EXISTS(i)) {
|
||||||
y = (NUM_SWITCHES - NUM_FUNCTIONS_SWITCHES > 6 ? 0 : MENU_HEADER_HEIGHT) + FH*i;
|
y = (STORAGE_NUM_SWITCHES > 6 ? 0 : MENU_HEADER_HEIGHT) + FH*i;
|
||||||
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH+i);
|
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH+i);
|
||||||
getvalue_t sw = ((val < 0) ? 3*i+1 : ((val == 0) ? 3*i+2 : 3*i+3));
|
getvalue_t sw = ((val < 0) ? 3*i+1 : ((val == 0) ? 3*i+2 : 3*i+3));
|
||||||
drawSwitch(8*FW+4, y, sw, 0);
|
drawSwitch(8*FW+4, y, sw, 0);
|
||||||
|
@ -87,19 +87,13 @@ void menuRadioDiagKeys(event_t event)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES) && defined(DEBUG)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
lcdDrawText(LCD_W / 2 , LCD_H - 2 * FH, "Phys");
|
lcdDrawText(0, LCD_H - FH + 1, STR_ROTARY_ENCODER);
|
||||||
lcdDrawText(LCD_W / 2 , LCD_H - 1 * FH, "Log");
|
lcdDrawNumber(5*FW+FWNUM+2, LCD_H - FH + 1, rotencValue / ROTARY_ENCODER_GRANULARITY, RIGHT);
|
||||||
|
|
||||||
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
|
||||||
lcdDrawNumber(LCD_W / 2 + 20 + (i + 1) * FW , LCD_H - 2 * FH, getFSPhysicalState(i));
|
|
||||||
lcdDrawNumber(LCD_W / 2 + 20 + (i + 1) * FW , LCD_H - 1 * FH, getFSLogicalState(i));
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if FUNCTION_SWITCHES > 0
|
||||||
coord_t y = LCD_H - FH - 1;
|
lcdDrawText(LCD_W / 2, LCD_H - FH + 1, "FS");
|
||||||
lcdDrawText(0, y, STR_ROTARY_ENCODER);
|
lcdDrawNumber(LCD_W / 2 + 2 * FW , LCD_H - FH + 1, getFunctionSwitchesStates());
|
||||||
lcdDrawNumber(5*FW+FWNUM+2, y, rotencValue / ROTARY_ENCODER_GRANULARITY, RIGHT);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,10 +42,11 @@ enum AboutScreens {
|
||||||
#define ABOUT_X 2
|
#define ABOUT_X 2
|
||||||
#define ABOUT_INDENT 4
|
#define ABOUT_INDENT 4
|
||||||
|
|
||||||
#if defined(KEYS_GPIO_REG_PAGEDN)
|
// TODO duplicated code here
|
||||||
|
#if defined(HARDWARE_KEY_PAGEUP)
|
||||||
#define EVT_KEY_PREVIOUS_VIEW EVT_KEY_BREAK(KEY_PAGEUP)
|
#define EVT_KEY_PREVIOUS_VIEW EVT_KEY_BREAK(KEY_PAGEUP)
|
||||||
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_PAGEDN)
|
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_PAGEDN)
|
||||||
#elif defined(NAVIGATION_X7)
|
#elif defined(HARDWARE_KEY_PAGE)
|
||||||
#define EVT_KEY_PREVIOUS_VIEW EVT_KEY_LONG(KEY_PAGE)
|
#define EVT_KEY_PREVIOUS_VIEW EVT_KEY_LONG(KEY_PAGE)
|
||||||
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_PAGE)
|
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_PAGE)
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -315,8 +315,8 @@ void displayVoltageOrAlarm()
|
||||||
#define EVT_KEY_NEXT_PAGE EVT_ROTARY_RIGHT
|
#define EVT_KEY_NEXT_PAGE EVT_ROTARY_RIGHT
|
||||||
#define EVT_KEY_PREVIOUS_PAGE EVT_ROTARY_LEFT
|
#define EVT_KEY_PREVIOUS_PAGE EVT_ROTARY_LEFT
|
||||||
#define EVT_KEY_MODEL_MENU EVT_KEY_BREAK(KEY_MODEL)
|
#define EVT_KEY_MODEL_MENU EVT_KEY_BREAK(KEY_MODEL)
|
||||||
#define EVT_KEY_GENERAL_MENU EVT_KEY_LONG(KEY_SYS)
|
#define EVT_KEY_GENERAL_MENU EVT_KEY_BREAK(KEY_SYS)
|
||||||
#define EVT_KEY_TELEMETRY EVT_KEY_LONG(KEY_PAGE)
|
#define EVT_KEY_TELEMETRY EVT_KEY_BREAK(KEY_TELE)
|
||||||
#elif defined(NAVIGATION_X7)
|
#elif defined(NAVIGATION_X7)
|
||||||
#define EVT_KEY_CONTEXT_MENU EVT_KEY_LONG(KEY_ENTER)
|
#define EVT_KEY_CONTEXT_MENU EVT_KEY_LONG(KEY_ENTER)
|
||||||
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_PAGE)
|
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_PAGE)
|
||||||
|
|
|
@ -41,18 +41,16 @@ void menuStatisticsView(event_t event)
|
||||||
chainMenu(menuStatisticsDebug);
|
chainMenu(menuStatisticsDebug);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_FIRST(KEY_DOWN):
|
// TODO case EVT_KEY_PREVIOUS_VIEW:
|
||||||
#if defined(KEYS_GPIO_REG_PAGEUP)
|
#if defined(HARDWARE_KEY_PAGEUP)
|
||||||
case EVT_KEY_BREAK(KEY_PAGEUP):
|
case EVT_KEY_BREAK(KEY_PAGEUP):
|
||||||
killEvents(event);
|
#elif defined(HARDWARE_KEY_PAGE)
|
||||||
chainMenu(menuStatisticsDebug2);
|
|
||||||
#elif defined(NAVIGATION_X7)
|
|
||||||
case EVT_KEY_LONG(KEY_PAGE):
|
case EVT_KEY_LONG(KEY_PAGE):
|
||||||
|
#else
|
||||||
|
case EVT_KEY_FIRST(KEY_DOWN):
|
||||||
|
#endif
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
chainMenu(menuStatisticsDebug2);
|
chainMenu(menuStatisticsDebug2);
|
||||||
#else
|
|
||||||
chainMenu(menuStatisticsDebug);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if !defined(PCBTARANIS)
|
#if !defined(PCBTARANIS)
|
||||||
|
@ -153,11 +151,13 @@ void menuStatisticsDebug(event_t event)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case EVT_KEY_FIRST(KEY_DOWN):
|
// TODO case EVT_KEY_PREVIOUS_VIEW:
|
||||||
#if defined(KEYS_GPIO_REG_PAGEUP)
|
#if defined(HARDWARE_KEY_PAGEUP)
|
||||||
case EVT_KEY_BREAK(KEY_PAGEUP):
|
case EVT_KEY_BREAK(KEY_PAGEUP):
|
||||||
#elif defined(NAVIGATION_X7)
|
#elif defined(HARDWARE_KEY_PAGE)
|
||||||
case EVT_KEY_LONG(KEY_PAGE):
|
case EVT_KEY_LONG(KEY_PAGE):
|
||||||
|
#else
|
||||||
|
case EVT_KEY_FIRST(KEY_DOWN):
|
||||||
#endif
|
#endif
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
disableVBatBridge();
|
disableVBatBridge();
|
||||||
|
@ -285,20 +285,23 @@ void menuStatisticsDebug2(event_t event)
|
||||||
telemetryErrors = 0;
|
telemetryErrors = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_FIRST(KEY_UP):
|
// TODO EVT_KEY_PREVIOUS_VIEW
|
||||||
#if defined(KEYS_GPIO_REG_PAGEDN)
|
#if defined(HARDWARE_KEY_PAGEDN)
|
||||||
case EVT_KEY_BREAK(KEY_PAGEDN):
|
case EVT_KEY_BREAK(KEY_PAGEDN):
|
||||||
#elif defined(NAVIGATION_X7)
|
#elif defined(HARDWARE_KEY_PAGE)
|
||||||
case EVT_KEY_BREAK(KEY_PAGE):
|
case EVT_KEY_BREAK(KEY_PAGE):
|
||||||
|
#else
|
||||||
|
case EVT_KEY_FIRST(KEY_UP):
|
||||||
#endif
|
#endif
|
||||||
chainMenu(menuStatisticsView);
|
chainMenu(menuStatisticsView);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case EVT_KEY_FIRST(KEY_DOWN):
|
#if defined(HARDWARE_KEY_PAGEUP)
|
||||||
#if defined(KEYS_GPIO_REG_PAGEUP)
|
|
||||||
case EVT_KEY_BREAK(KEY_PAGEUP):
|
case EVT_KEY_BREAK(KEY_PAGEUP):
|
||||||
#elif defined(NAVIGATION_X7)
|
#elif defined(HARDWARE_KEY_PAGE)
|
||||||
case EVT_KEY_LONG(KEY_PAGE):
|
case EVT_KEY_LONG(KEY_PAGE):
|
||||||
|
#else
|
||||||
|
case EVT_KEY_FIRST(KEY_DOWN):
|
||||||
#endif
|
#endif
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
chainMenu(menuStatisticsDebug);
|
chainMenu(menuStatisticsDebug);
|
||||||
|
|
|
@ -229,8 +229,6 @@ enum {
|
||||||
|
|
||||||
#if defined(PCBX9E)
|
#if defined(PCBX9E)
|
||||||
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||||
#elif defined(RADIO_TPRO)
|
|
||||||
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
|
||||||
#elif defined(RADIO_T12)
|
#elif defined(RADIO_T12)
|
||||||
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|HIDDEN_ROW, NAVIGATION_LINE_BY_LINE|HIDDEN_ROW
|
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|HIDDEN_ROW, NAVIGATION_LINE_BY_LINE|HIDDEN_ROW
|
||||||
#elif NUM_SWITCHES == 9
|
#elif NUM_SWITCHES == 9
|
||||||
|
@ -529,6 +527,14 @@ void menuRadioHardware(event_t event)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int index = k - ITEM_RADIO_HARDWARE_SA;
|
int index = k - ITEM_RADIO_HARDWARE_SA;
|
||||||
|
#if defined(STORAGE_SWITCH_E) && !defined(HARDWARE_SWITCH_E)
|
||||||
|
if (index >= SW_SE)
|
||||||
|
index++;
|
||||||
|
#endif
|
||||||
|
#if defined(STORAGE_SWITCH_G) && !defined(HARDWARE_SWITCH_G)
|
||||||
|
if (index >= SW_SG)
|
||||||
|
index++;
|
||||||
|
#endif
|
||||||
int config = SWITCH_CONFIG(index);
|
int config = SWITCH_CONFIG(index);
|
||||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH - MIXSRC_Rud + index + 1, menuHorizontalPosition < 0 ? attr : 0);
|
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH - MIXSRC_Rud + index + 1, menuHorizontalPosition < 0 ? attr : 0);
|
||||||
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
|
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
|
||||||
|
|
|
@ -299,15 +299,15 @@ void menuRadioSdManager(event_t _event)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_event == EVT_ENTRY) {
|
if (_event == EVT_ENTRY) {
|
||||||
f_chdir(ROOT_PATH);
|
f_chdir(ROOT_PATH);
|
||||||
#if LCD_W >= 212
|
#if LCD_W >= 212
|
||||||
lastPos = -1;
|
lastPos = -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_event == EVT_ENTRY || _event == EVT_ENTRY_UP) {
|
if (_event == EVT_ENTRY || _event == EVT_ENTRY_UP) {
|
||||||
memclear(&reusableBuffer.sdManager, sizeof(reusableBuffer.sdManager));
|
memclear(&reusableBuffer.sdManager, sizeof(reusableBuffer.sdManager));
|
||||||
REFRESH_FILES();
|
REFRESH_FILES();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PXX2)
|
#if defined(PXX2)
|
||||||
|
|
|
@ -21,10 +21,15 @@
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||||
uint8_t switchToMix(uint8_t source)
|
uint8_t switchToMix(uint8_t swsrc)
|
||||||
{
|
{
|
||||||
div_t qr = div(source-1, 3);
|
#if FUNCTION_SWITCHES > 0
|
||||||
return qr.quot+MIXSRC_FIRST_SWITCH;
|
if (swsrc >= SWSRC_FIRST_FUNCTION_SWITCH) {
|
||||||
|
return MIXSRC_FIRST_FS_SWITCH + swsrc - SWSRC_FIRST_FUNCTION_SWITCH;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
div_t qr = div(swsrc - 1, 3);
|
||||||
|
return MIXSRC_FIRST_SWITCH + qr.quot;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
uint8_t switchToMix(uint8_t source)
|
uint8_t switchToMix(uint8_t source)
|
||||||
|
@ -317,10 +322,6 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_SWITCH_FS(swinfo.quot) && context == GeneralCustomFunctionsContext) {
|
|
||||||
return false; // FS are defined at model level, and cannot be in global functions
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IS_CONFIG_3POS(swinfo.quot)) {
|
if (!IS_CONFIG_3POS(swinfo.quot)) {
|
||||||
if (negative) {
|
if (negative) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -102,21 +102,21 @@ void onSourceLongEnterPress(const char * result)
|
||||||
#if defined(NAVIGATION_HORUS)
|
#if defined(NAVIGATION_HORUS)
|
||||||
bool check_simple(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, int rowcount)
|
bool check_simple(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, int rowcount)
|
||||||
{
|
{
|
||||||
return check(event, curr, menuTab, menuTabSize, NULL, 0, rowcount);
|
return check(event, curr, menuTab, menuTabSize, nullptr, 0, rowcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check_submenu_simple(event_t event, uint8_t rowcount)
|
bool check_submenu_simple(event_t event, uint8_t rowcount)
|
||||||
{
|
{
|
||||||
return check_simple(event, 0, NULL, 0, rowcount);
|
return check_simple(event, 0, nullptr, 0, rowcount);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
void check_simple(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t rowcount)
|
||||||
|
{
|
||||||
|
check(event, curr, menuTab, menuTabSize, nullptr, 0, rowcount);
|
||||||
|
}
|
||||||
|
|
||||||
void check_submenu_simple(event_t event, uint8_t rowcount)
|
void check_submenu_simple(event_t event, uint8_t rowcount)
|
||||||
{
|
{
|
||||||
check_simple(event, 0, nullptr, 0, rowcount);
|
check_simple(event, 0, nullptr, 0, rowcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_simple(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t rowcount)
|
|
||||||
{
|
|
||||||
check(event, curr, menuTab, menuTabSize, 0, 0, rowcount);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
|
@ -20,9 +20,9 @@
|
||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
int menuVerticalOffset;
|
vertpos_t menuVerticalOffset;
|
||||||
int menuVerticalPosition;
|
vertpos_t menuVerticalPosition;
|
||||||
int menuHorizontalPosition;
|
horzpos_t menuHorizontalPosition;
|
||||||
int8_t s_editMode;
|
int8_t s_editMode;
|
||||||
uint8_t noHighlightCounter;
|
uint8_t noHighlightCounter;
|
||||||
uint8_t menuCalibrationState; // TODO rename this variable
|
uint8_t menuCalibrationState; // TODO rename this variable
|
||||||
|
@ -303,23 +303,260 @@ int8_t navigate(event_t event, int count, int rows, int columns, bool loop)
|
||||||
return (prevPosHorz != menuHorizontalPosition || prevPosVert != menuVerticalPosition) ? result : 0;
|
return (prevPosHorz != menuHorizontalPosition || prevPosVert != menuVerticalPosition) ? result : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
uint32_t menuEntryTime;
|
||||||
|
bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const uint8_t * horTab, uint8_t horTabMax, int rowcount, uint8_t flags)
|
||||||
|
{
|
||||||
|
vertpos_t l_posVert = menuVerticalPosition;
|
||||||
|
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||||
|
|
||||||
|
uint8_t maxcol = MAXCOL(l_posVert);
|
||||||
|
|
||||||
|
if (menuTab) {
|
||||||
|
int cc = curr;
|
||||||
|
switch (event) {
|
||||||
|
#if defined(HARDWARE_KEY_PAGEDN)
|
||||||
|
case EVT_KEY_FIRST(KEY_PAGEDN):
|
||||||
|
#else
|
||||||
|
case EVT_KEY_BREAK(KEY_PAGE):
|
||||||
|
#endif
|
||||||
|
if (s_editMode>0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (curr < (menuTabSize-1))
|
||||||
|
cc = curr + 1;
|
||||||
|
else
|
||||||
|
cc = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#if defined(HARDWARE_KEY_PAGEUP)
|
||||||
|
case EVT_KEY_FIRST(KEY_PAGEUP):
|
||||||
|
#else
|
||||||
|
case EVT_KEY_LONG(KEY_PAGE):
|
||||||
|
#endif
|
||||||
|
if (s_editMode>0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (curr > 0)
|
||||||
|
cc = curr - 1;
|
||||||
|
else
|
||||||
|
cc = menuTabSize-1;
|
||||||
|
killEvents(event);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!menuCalibrationState && cc != curr) {
|
||||||
|
chainMenu(menuTab[cc]);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawScreenIndex(curr, menuTabSize, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (event) {
|
||||||
|
case EVT_ENTRY:
|
||||||
|
menuEntryTime = get_tmr10ms();
|
||||||
|
s_editMode = EDIT_MODE_INIT;
|
||||||
|
l_posVert = MENU_FIRST_LINE_EDIT(horTab, horTabMax);
|
||||||
|
l_posHorz = POS_HORZ_INIT(l_posVert);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVT_ENTRY_UP:
|
||||||
|
menuEntryTime = get_tmr10ms();
|
||||||
|
s_editMode = 0;
|
||||||
|
l_posHorz = POS_HORZ_INIT(l_posVert);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVT_ROTARY_BREAK:
|
||||||
|
if (s_editMode > 1)
|
||||||
|
break;
|
||||||
|
if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
|
||||||
|
l_posHorz = 0;
|
||||||
|
AUDIO_KEY_PRESS();
|
||||||
|
}
|
||||||
|
else if (READ_ONLY_UNLOCKED()) {
|
||||||
|
s_editMode = (s_editMode<=0);
|
||||||
|
AUDIO_KEY_PRESS();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVT_KEY_LONG(KEY_EXIT):
|
||||||
|
s_editMode = 0; // TODO needed? we call ENTRY_UP after which does the same
|
||||||
|
popMenu();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVT_KEY_BREAK(KEY_EXIT):
|
||||||
|
if (s_editMode > 0) {
|
||||||
|
s_editMode = 0;
|
||||||
|
AUDIO_KEY_PRESS();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l_posHorz >= 0 && (COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE)) {
|
||||||
|
l_posHorz = -1;
|
||||||
|
AUDIO_KEY_PRESS();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
uint8_t posVertInit = MENU_FIRST_LINE_EDIT(horTab, horTabMax);
|
||||||
|
if (menuVerticalOffset != 0 || l_posVert != posVertInit) {
|
||||||
|
menuVerticalOffset = 0;
|
||||||
|
l_posVert = posVertInit;
|
||||||
|
l_posHorz = POS_HORZ_INIT(l_posVert);
|
||||||
|
AUDIO_KEY_PRESS();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
popMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
|
case EVT_ROTARY_RIGHT:
|
||||||
|
AUDIO_KEY_PRESS();
|
||||||
|
// no break
|
||||||
|
#else
|
||||||
|
case EVT_KEY_FIRST(KEY_DOWN):
|
||||||
|
case EVT_KEY_REPT(KEY_DOWN):
|
||||||
|
#endif
|
||||||
|
if (s_editMode > 0) break; // TODO it was !=
|
||||||
|
if ((COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE)) {
|
||||||
|
if (l_posHorz >= 0) {
|
||||||
|
INC(l_posHorz, 0, maxcol);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (l_posHorz < maxcol) {
|
||||||
|
l_posHorz++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
l_posHorz = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
INC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount-1);
|
||||||
|
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
||||||
|
|
||||||
|
s_editMode = 0; // if we go down, we must be in this mode
|
||||||
|
|
||||||
|
l_posHorz = POS_HORZ_INIT(l_posVert);
|
||||||
|
break;
|
||||||
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
|
case EVT_ROTARY_LEFT:
|
||||||
|
AUDIO_KEY_PRESS();
|
||||||
|
// no break
|
||||||
|
#else
|
||||||
|
case EVT_KEY_FIRST(KEY_UP):
|
||||||
|
case EVT_KEY_REPT(KEY_UP):
|
||||||
|
#endif
|
||||||
|
if (s_editMode > 0) break; // TODO it was !=
|
||||||
|
if ((COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE)) {
|
||||||
|
if (l_posHorz >= 0) {
|
||||||
|
DEC(l_posHorz, 0, maxcol);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (l_posHorz > 0) {
|
||||||
|
l_posHorz--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
l_posHorz = 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
DEC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount-1);
|
||||||
|
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
||||||
|
|
||||||
|
s_editMode = 0; // if we go up, we must be in this mode
|
||||||
|
|
||||||
|
if ((COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE))
|
||||||
|
l_posHorz = -1;
|
||||||
|
else
|
||||||
|
l_posHorz = min((uint8_t)l_posHorz, MAXCOL(l_posVert));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
int linesCount = rowcount;
|
||||||
|
|
||||||
|
if (l_posVert == 0 || (l_posVert==1 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW) || (l_posVert==2 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW && MAXCOL(vertpos_t(1)) >= HIDDEN_ROW)) {
|
||||||
|
menuVerticalOffset = 0;
|
||||||
|
if (horTab) {
|
||||||
|
linesCount = 0;
|
||||||
|
for (int i=0; i<rowcount; i++) {
|
||||||
|
if (i>horTabMax || horTab[i] != HIDDEN_ROW) {
|
||||||
|
linesCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (horTab) {
|
||||||
|
if (rowcount > NUM_BODY_LINES) {
|
||||||
|
while (1) {
|
||||||
|
vertpos_t firstLine = 0;
|
||||||
|
for (int numLines=0; firstLine<rowcount && numLines<menuVerticalOffset; firstLine++) {
|
||||||
|
if (firstLine>=horTabMax || horTab[firstLine] != HIDDEN_ROW) {
|
||||||
|
numLines++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (l_posVert < firstLine) {
|
||||||
|
menuVerticalOffset--;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vertpos_t lastLine = firstLine;
|
||||||
|
for (int numLines=0; lastLine<rowcount && numLines<NUM_BODY_LINES; lastLine++) {
|
||||||
|
if (lastLine>=horTabMax || horTab[lastLine] != HIDDEN_ROW) {
|
||||||
|
numLines++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (l_posVert >= lastLine) {
|
||||||
|
menuVerticalOffset++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
linesCount = menuVerticalOffset + NUM_BODY_LINES;
|
||||||
|
for (int i=lastLine; i<rowcount; i++) {
|
||||||
|
if (i>horTabMax || horTab[i] != HIDDEN_ROW) {
|
||||||
|
linesCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (l_posVert>=NUM_BODY_LINES+menuVerticalOffset) {
|
||||||
|
menuVerticalOffset = l_posVert-NUM_BODY_LINES+1;
|
||||||
|
}
|
||||||
|
else if (l_posVert<menuVerticalOffset) {
|
||||||
|
menuVerticalOffset = l_posVert;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
menuVerticalPosition = l_posVert;
|
||||||
|
menuHorizontalPosition = l_posHorz;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#else
|
||||||
bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const uint8_t * horTab, uint8_t horTabMax, int rowcount, uint8_t flags)
|
bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const uint8_t * horTab, uint8_t horTabMax, int rowcount, uint8_t flags)
|
||||||
{
|
{
|
||||||
uint8_t maxcol = MAXCOL(menuVerticalPosition);
|
uint8_t maxcol = MAXCOL(menuVerticalPosition);
|
||||||
|
|
||||||
if (menuTab == menuTabModel && event == EVT_KEY_FIRST(KEY_MODEL)) {
|
if (menuTab == menuTabModel && event == EVT_KEY_FIRST(KEY_MODEL)) {
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
pushMenu(menuTabMonitors[lastMonitorPage]);
|
// TODO pushMenu(menuTabMonitors[lastMonitorPage]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menuTab && !menuCalibrationState) {
|
if (menuTab && !menuCalibrationState) {
|
||||||
int cc = curr;
|
int cc = curr;
|
||||||
switch (event) {
|
switch (event) {
|
||||||
#if defined(KEYS_GPIO_REG_PGUP)
|
#if defined(HARDWARE_KEY_PAGEDN)
|
||||||
case EVT_KEY_FIRST(KEY_PGDN):
|
case EVT_KEY_FIRST(KEY_PAGEDN):
|
||||||
#else
|
#else
|
||||||
case EVT_KEY_BREAK(KEY_PGDN):
|
case EVT_KEY_BREAK(KEY_PAGE):
|
||||||
#endif
|
#endif
|
||||||
if (s_editMode>0)
|
if (s_editMode>0)
|
||||||
break;
|
break;
|
||||||
|
@ -328,10 +565,10 @@ bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
|
||||||
cc = 0;
|
cc = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(KEYS_GPIO_REG_PGUP)
|
#if defined(HARDWARE_KEY_PAGEUP)
|
||||||
case EVT_KEY_FIRST(KEY_PGUP):
|
case EVT_KEY_FIRST(KEY_PAGEUP):
|
||||||
#else
|
#else
|
||||||
case EVT_KEY_LONG(KEY_PGDN):
|
case EVT_KEY_LONG(KEY_PAGE):
|
||||||
#endif
|
#endif
|
||||||
if (s_editMode>0)
|
if (s_editMode>0)
|
||||||
break;
|
break;
|
||||||
|
@ -364,7 +601,8 @@ bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVT_ROTARY_BREAK:
|
case EVT_ROTARY_BREAK:
|
||||||
if (s_editMode > 1) break;
|
if (s_editMode > 1)
|
||||||
|
break;
|
||||||
if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
|
if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
|
||||||
menuHorizontalPosition = 0;
|
menuHorizontalPosition = 0;
|
||||||
AUDIO_KEY_PRESS();
|
AUDIO_KEY_PRESS();
|
||||||
|
@ -496,10 +734,13 @@ bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
|
||||||
numLines++;
|
numLines++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if defined(ORPHAN_ROW)
|
||||||
if (menuVerticalPosition >= lastLine || HORTAB(firstLine) == ORPHAN_ROW) {
|
if (menuVerticalPosition >= lastLine || HORTAB(firstLine) == ORPHAN_ROW) {
|
||||||
menuVerticalOffset++;
|
menuVerticalOffset++;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
linesCount = menuVerticalOffset + linesDisplayed;
|
linesCount = menuVerticalOffset + linesDisplayed;
|
||||||
for (int i=lastLine; i<rowcount; i++) {
|
for (int i=lastLine; i<rowcount; i++) {
|
||||||
if (HORTAB(i) != HIDDEN_ROW) {
|
if (HORTAB(i) != HIDDEN_ROW) {
|
||||||
|
@ -523,3 +764,4 @@ bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -21,24 +21,19 @@
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
vertpos_t menuVerticalOffset;
|
vertpos_t menuVerticalOffset;
|
||||||
|
vertpos_t menuVerticalPosition;
|
||||||
|
horzpos_t menuHorizontalPosition;
|
||||||
int8_t s_editMode;
|
int8_t s_editMode;
|
||||||
uint8_t noHighlightCounter;
|
uint8_t noHighlightCounter;
|
||||||
uint8_t menuCalibrationState;
|
uint8_t menuCalibrationState;
|
||||||
vertpos_t menuVerticalPosition;
|
|
||||||
horzpos_t menuHorizontalPosition;
|
|
||||||
int8_t checkIncDec_Ret;
|
|
||||||
|
|
||||||
#define DBLKEYS_PRESSED_RGT_LFT(in) (false)
|
int8_t checkIncDec_Ret;
|
||||||
#define DBLKEYS_PRESSED_UP_DWN(in) (false)
|
extern int checkIncDecSelection;
|
||||||
#define DBLKEYS_PRESSED_RGT_UP(in) (false)
|
|
||||||
#define DBLKEYS_PRESSED_LFT_DWN(in) (false)
|
|
||||||
|
|
||||||
INIT_STOPS(stops100, 3, -100, 0, 100)
|
INIT_STOPS(stops100, 3, -100, 0, 100)
|
||||||
INIT_STOPS(stops1000, 3, -1000, 0, 1000)
|
INIT_STOPS(stops1000, 3, -1000, 0, 1000)
|
||||||
INIT_STOPS(stopsSwitch, 15, SWSRC_FIRST, CATEGORY_END(-SWSRC_FIRST_LOGICAL_SWITCH), CATEGORY_END(-SWSRC_FIRST_TRIM), CATEGORY_END(-SWSRC_LAST_SWITCH+1), 0, CATEGORY_END(SWSRC_LAST_SWITCH), CATEGORY_END(SWSRC_FIRST_TRIM-1), CATEGORY_END(SWSRC_FIRST_LOGICAL_SWITCH-1), SWSRC_LAST)
|
INIT_STOPS(stopsSwitch, 15, SWSRC_FIRST, CATEGORY_END(-SWSRC_FIRST_LOGICAL_SWITCH), CATEGORY_END(-SWSRC_FIRST_TRIM), CATEGORY_END(-SWSRC_LAST_SWITCH+1), 0, CATEGORY_END(SWSRC_LAST_SWITCH), CATEGORY_END(SWSRC_FIRST_TRIM-1), CATEGORY_END(SWSRC_FIRST_LOGICAL_SWITCH-1), SWSRC_LAST)
|
||||||
|
|
||||||
extern int checkIncDecSelection;
|
|
||||||
|
|
||||||
void onSwitchLongEnterPress(const char * result)
|
void onSwitchLongEnterPress(const char * result)
|
||||||
{
|
{
|
||||||
if (result == STR_MENU_SWITCHES)
|
if (result == STR_MENU_SWITCHES)
|
||||||
|
@ -53,6 +48,11 @@ void onSwitchLongEnterPress(const char * result)
|
||||||
checkIncDecSelection = SWSRC_INVERT;
|
checkIncDecSelection = SWSRC_INVERT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DBLKEYS_PRESSED_RGT_LFT(in) (false)
|
||||||
|
#define DBLKEYS_PRESSED_UP_DWN(in) (false)
|
||||||
|
#define DBLKEYS_PRESSED_RGT_UP(in) (false)
|
||||||
|
#define DBLKEYS_PRESSED_LFT_DWN(in) (false)
|
||||||
|
|
||||||
int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_flags, IsValueAvailable isValueAvailable, const CheckIncDecStops &stops)
|
int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_flags, IsValueAvailable isValueAvailable, const CheckIncDecStops &stops)
|
||||||
{
|
{
|
||||||
int newval = val;
|
int newval = val;
|
||||||
|
@ -214,7 +214,6 @@ tmr10ms_t menuEntryTime;
|
||||||
#define MAXCOL_RAW(row) (horTab ? *(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
|
#define MAXCOL_RAW(row) (horTab ? *(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
|
||||||
#define MAXCOL(row) (MAXCOL_RAW(row) >= HIDDEN_ROW ? MAXCOL_RAW(row) : (const uint8_t)(MAXCOL_RAW(row) & (~NAVIGATION_LINE_BY_LINE)))
|
#define MAXCOL(row) (MAXCOL_RAW(row) >= HIDDEN_ROW ? MAXCOL_RAW(row) : (const uint8_t)(MAXCOL_RAW(row) & (~NAVIGATION_LINE_BY_LINE)))
|
||||||
#define COLATTR(row) (MAXCOL_RAW(row) == (uint8_t)-1 ? (const uint8_t)0 : (const uint8_t)(MAXCOL_RAW(row) & NAVIGATION_LINE_BY_LINE))
|
#define COLATTR(row) (MAXCOL_RAW(row) == (uint8_t)-1 ? (const uint8_t)0 : (const uint8_t)(MAXCOL_RAW(row) & NAVIGATION_LINE_BY_LINE))
|
||||||
#define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0)
|
|
||||||
|
|
||||||
void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const uint8_t * horTab, uint8_t horTabMax, vertpos_t rowcount)
|
void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const uint8_t * horTab, uint8_t horTabMax, vertpos_t rowcount)
|
||||||
{
|
{
|
||||||
|
@ -226,7 +225,21 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
|
||||||
if (menuTab) {
|
if (menuTab) {
|
||||||
int cc = curr;
|
int cc = curr;
|
||||||
switch (event) {
|
switch (event) {
|
||||||
#if defined(KEYS_GPIO_REG_PAGEUP)
|
#if defined(HARDWARE_KEY_PAGEDN)
|
||||||
|
case EVT_KEY_FIRST(KEY_PAGEDN):
|
||||||
|
#else
|
||||||
|
case EVT_KEY_BREAK(KEY_PAGE):
|
||||||
|
#endif
|
||||||
|
if (s_editMode>0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (curr < (menuTabSize-1))
|
||||||
|
cc = curr + 1;
|
||||||
|
else
|
||||||
|
cc = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#if defined(HARDWARE_KEY_PAGEUP)
|
||||||
case EVT_KEY_FIRST(KEY_PAGEUP):
|
case EVT_KEY_FIRST(KEY_PAGEUP):
|
||||||
#else
|
#else
|
||||||
case EVT_KEY_LONG(KEY_PAGE):
|
case EVT_KEY_LONG(KEY_PAGE):
|
||||||
|
@ -240,20 +253,6 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
|
||||||
cc = menuTabSize-1;
|
cc = menuTabSize-1;
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(KEYS_GPIO_REG_PAGEDN)
|
|
||||||
case EVT_KEY_FIRST(KEY_PAGEDN):
|
|
||||||
#else
|
|
||||||
case EVT_KEY_BREAK(KEY_PAGE):
|
|
||||||
#endif
|
|
||||||
if (s_editMode>0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (curr < (menuTabSize-1))
|
|
||||||
cc = curr + 1;
|
|
||||||
else
|
|
||||||
cc = 0;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!menuCalibrationState && cc != curr) {
|
if (!menuCalibrationState && cc != curr) {
|
||||||
|
|
|
@ -2136,12 +2136,12 @@ const luaR_value_entry opentxConstants[] = {
|
||||||
{ "EVT_VIRTUAL_ENTER_LONG", EVT_KEY_LONG(KEY_ENTER) },
|
{ "EVT_VIRTUAL_ENTER_LONG", EVT_KEY_LONG(KEY_ENTER) },
|
||||||
{ "EVT_VIRTUAL_EXIT", EVT_KEY_BREAK(KEY_EXIT) },
|
{ "EVT_VIRTUAL_EXIT", EVT_KEY_BREAK(KEY_EXIT) },
|
||||||
#elif defined(NAVIGATION_HORUS)
|
#elif defined(NAVIGATION_HORUS)
|
||||||
#if defined(KEYS_GPIO_REG_PGUP)
|
#if defined(HARDWARE_KEY_PAGEUP)
|
||||||
{ "EVT_VIRTUAL_PREV_PAGE", EVT_KEY_BREAK(KEY_PGUP) },
|
{ "EVT_VIRTUAL_PREV_PAGE", EVT_KEY_BREAK(KEY_PGUP) },
|
||||||
{ "EVT_VIRTUAL_NEXT_PAGE", EVT_KEY_BREAK(KEY_PGDN) },
|
{ "EVT_VIRTUAL_NEXT_PAGE", EVT_KEY_BREAK(KEY_PGDN) },
|
||||||
#else
|
#else
|
||||||
{ "EVT_VIRTUAL_PREV_PAGE", EVT_KEY_LONG(KEY_PGDN) },
|
{ "EVT_VIRTUAL_PREV_PAGE", EVT_KEY_LONG(KEY_PAGE) },
|
||||||
{ "EVT_VIRTUAL_NEXT_PAGE", EVT_KEY_BREAK(KEY_PGDN) },
|
{ "EVT_VIRTUAL_NEXT_PAGE", EVT_KEY_BREAK(KEY_PAGE) },
|
||||||
#endif
|
#endif
|
||||||
{ "EVT_VIRTUAL_MENU", EVT_KEY_BREAK(KEY_MODEL) },
|
{ "EVT_VIRTUAL_MENU", EVT_KEY_BREAK(KEY_MODEL) },
|
||||||
{ "EVT_VIRTUAL_MENU_LONG", EVT_KEY_LONG(KEY_MODEL) },
|
{ "EVT_VIRTUAL_MENU_LONG", EVT_KEY_LONG(KEY_MODEL) },
|
||||||
|
|
|
@ -349,20 +349,6 @@ getvalue_t getValue(mixsrc_t i)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||||
#if defined(FUNCTION_SWITCHES)
|
|
||||||
else if (i >= MIXSRC_FIRST_SWITCH && i <= MIXSRC_LAST_REGULAR_SWITCH) {
|
|
||||||
mixsrc_t sw = i - MIXSRC_FIRST_SWITCH;
|
|
||||||
if (SWITCH_EXISTS(sw)) {
|
|
||||||
return (switchState(3*sw) ? -1024 : (IS_CONFIG_3POS(sw) && switchState(3*sw+1) ? 0 : 1024));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (i >= MIXSRC_FIRST_FS_SWITCH && i <= MIXSRC_LAST_SWITCH) {
|
|
||||||
return getFSLogicalState(i - MIXSRC_FIRST_SWITCH - NUM_REGULAR_SWITCHES) ? +1024 : -1024;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
else if (i >= MIXSRC_FIRST_SWITCH && i <= MIXSRC_LAST_SWITCH) {
|
else if (i >= MIXSRC_FIRST_SWITCH && i <= MIXSRC_LAST_SWITCH) {
|
||||||
mixsrc_t sw = i - MIXSRC_FIRST_SWITCH;
|
mixsrc_t sw = i - MIXSRC_FIRST_SWITCH;
|
||||||
if (SWITCH_EXISTS(sw)) {
|
if (SWITCH_EXISTS(sw)) {
|
||||||
|
@ -372,7 +358,6 @@ getvalue_t getValue(mixsrc_t i)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
else if (i == MIXSRC_3POS) {
|
else if (i == MIXSRC_3POS) {
|
||||||
return (getSwitch(SW_ID0+1) ? -1024 : (getSwitch(SW_ID1+1) ? 0 : 1024));
|
return (getSwitch(SW_ID0+1) ? -1024 : (getSwitch(SW_ID1+1) ? 0 : 1024));
|
||||||
|
@ -383,6 +368,12 @@ getvalue_t getValue(mixsrc_t i)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if FUNCTION_SWITCHES > 0
|
||||||
|
else if (i >= MIXSRC_FIRST_FS_SWITCH && i <= MIXSRC_LAST_FS_SWITCH) {
|
||||||
|
return getFSLogicalState(i - MIXSRC_FIRST_FS_SWITCH) ? +1024 : -1024;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
else if (i <= MIXSRC_LAST_LOGICAL_SWITCH) {
|
else if (i <= MIXSRC_LAST_LOGICAL_SWITCH) {
|
||||||
return getSwitch(SWSRC_FIRST_LOGICAL_SWITCH + i - MIXSRC_FIRST_LOGICAL_SWITCH) ? 1024 : -1024;
|
return getSwitch(SWSRC_FIRST_LOGICAL_SWITCH + i - MIXSRC_FIRST_LOGICAL_SWITCH) ? 1024 : -1024;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,23 +78,18 @@
|
||||||
#define MODEL_GVAR_MIN(idx) (CFN_GVAR_CST_MIN + g_model.gvars[idx].min)
|
#define MODEL_GVAR_MIN(idx) (CFN_GVAR_CST_MIN + g_model.gvars[idx].min)
|
||||||
#define MODEL_GVAR_MAX(idx) (CFN_GVAR_CST_MAX - g_model.gvars[idx].max)
|
#define MODEL_GVAR_MAX(idx) (CFN_GVAR_CST_MAX - g_model.gvars[idx].max)
|
||||||
|
|
||||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
#if FUNCTION_SWITCHES > 0
|
||||||
#define SWITCH_CONFIG(x) (bfGet<swconfig_t>(g_eeGeneral.switchConfig, 2*(x), 2))
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
|
||||||
#define FSWITCH_CONFIG(x) (bfGet<swconfig_t>(g_model.functionSwitchConfig, 2*(x), 2))
|
#define FSWITCH_CONFIG(x) (bfGet<swconfig_t>(g_model.functionSwitchConfig, 2*(x), 2))
|
||||||
#define FSWITCH_GROUP(x) (bfGet<swconfig_t>(g_model.functionSwitchGroup, 2*(x), 2))
|
#define FSWITCH_GROUP(x) (bfGet<swconfig_t>(g_model.functionSwitchGroup, 2*(x), 2))
|
||||||
#define IS_FSWITCH_GROUP_ON(x) (bfGet<swconfig_t>(g_model.functionSwitchGroup, 2 * NUM_FUNCTIONS_SWITCHES + x, 1))
|
#define IS_FSWITCH_GROUP_ON(x) (bfGet<swconfig_t>(g_model.functionSwitchGroup, 2 * FUNCTION_SWITCHES + x, 1))
|
||||||
#define IS_SWITCH_FS(x) (x >= NUM_REGULAR_SWITCHES)
|
#endif
|
||||||
#define SWITCH_EXISTS(x) (IS_SWITCH_FS(x) ? true : (SWITCH_CONFIG(x) != SWITCH_NONE))
|
|
||||||
#define IS_CONFIG_3POS(x) (IS_SWITCH_FS(x) ? (FSWITCH_CONFIG(x - NUM_REGULAR_SWITCHES) == SWITCH_3POS) : (SWITCH_CONFIG(x) == SWITCH_3POS))
|
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||||
#define IS_CONFIG_TOGGLE(x) (IS_SWITCH_FS(x) ? (FSWITCH_CONFIG(x - NUM_REGULAR_SWITCHES) == SWITCH_TOGGLE) : (SWITCH_CONFIG(x) == SWITCH_TOGGLE))
|
#define SWITCH_CONFIG(x) (bfGet<swconfig_t>(g_eeGeneral.switchConfig, 2*(x), 2))
|
||||||
#else
|
|
||||||
#define SWITCH_EXISTS(x) (SWITCH_CONFIG(x) != SWITCH_NONE)
|
#define SWITCH_EXISTS(x) (SWITCH_CONFIG(x) != SWITCH_NONE)
|
||||||
#define IS_CONFIG_3POS(x) (SWITCH_CONFIG(x) == SWITCH_3POS)
|
#define IS_CONFIG_3POS(x) (SWITCH_CONFIG(x) == SWITCH_3POS)
|
||||||
#define IS_CONFIG_TOGGLE(x) (SWITCH_CONFIG(x) == SWITCH_TOGGLE)
|
#define IS_CONFIG_TOGGLE(x) (SWITCH_CONFIG(x) == SWITCH_TOGGLE)
|
||||||
#define IS_SWITCH_FS(x) (false)
|
#define SWITCH_WARNING_ALLOWED(x) (SWITCH_EXISTS(x) && !(IS_CONFIG_TOGGLE(x)))
|
||||||
#endif
|
|
||||||
#define SWITCH_WARNING_ALLOWED(x) (SWITCH_EXISTS(x) && !(IS_CONFIG_TOGGLE(x) || IS_SWITCH_FS(x)))
|
|
||||||
#else
|
#else
|
||||||
#define IS_CONFIG_3POS(x) IS_3POS(x)
|
#define IS_CONFIG_3POS(x) IS_3POS(x)
|
||||||
#define IS_CONFIG_TOGGLE(x) IS_TOGGLE(x)
|
#define IS_CONFIG_TOGGLE(x) IS_TOGGLE(x)
|
||||||
|
|
|
@ -169,7 +169,7 @@ void per10ms()
|
||||||
|
|
||||||
readKeysAndTrims();
|
readKeysAndTrims();
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if FUNCTION_SWITCHES > 0
|
||||||
evalFunctionSwitches();
|
evalFunctionSwitches();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ void applyDefaultTemplate()
|
||||||
{
|
{
|
||||||
defaultInputs(); // calls storageDirty internally
|
defaultInputs(); // calls storageDirty internally
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if FUNCTION_SWITCHES > 0
|
||||||
g_model.functionSwitchConfig = DEFAULT_FS_CONFIG;
|
g_model.functionSwitchConfig = DEFAULT_FS_CONFIG;
|
||||||
g_model.functionSwitchGroup = DEFAULT_FS_GROUPS;
|
g_model.functionSwitchGroup = DEFAULT_FS_GROUPS;
|
||||||
g_model.functionSwitchStartConfig = DEFAULT_FS_STARTUP_CONFIG;
|
g_model.functionSwitchStartConfig = DEFAULT_FS_STARTUP_CONFIG;
|
||||||
|
@ -765,17 +765,29 @@ ls_telemetry_value_t maxTelemValue(source_t channel)
|
||||||
bool inputsMoved()
|
bool inputsMoved()
|
||||||
{
|
{
|
||||||
uint8_t sum = 0;
|
uint8_t sum = 0;
|
||||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++)
|
|
||||||
|
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) {
|
||||||
#if defined(RADIO_FAMILY_TBS)
|
#if defined(RADIO_FAMILY_TBS)
|
||||||
sum += ((int16_t)anaIn(i) + 4096) >> INAC_STICKS_SHIFT;
|
sum += ((int16_t)anaIn(i) + 4096) >> INAC_STICKS_SHIFT;
|
||||||
#else
|
#else
|
||||||
sum += anaIn(i) >> INAC_STICKS_SHIFT;
|
sum += anaIn(i) >> INAC_STICKS_SHIFT;
|
||||||
#endif
|
#endif
|
||||||
for (uint8_t i=0; i<NUM_SWITCHES; i++)
|
}
|
||||||
|
|
||||||
|
for (uint8_t i=0; i<STORAGE_NUM_SWITCHES; i++) {
|
||||||
sum += getValue(MIXSRC_FIRST_SWITCH+i) >> INAC_SWITCHES_SHIFT;
|
sum += getValue(MIXSRC_FIRST_SWITCH+i) >> INAC_SWITCHES_SHIFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if FUNCTION_SWITCHES > 0
|
||||||
|
for (uint8_t i=0; i<FUNCTION_SWITCHES; i++) {
|
||||||
|
sum += getValue(MIXSRC_FIRST_FS_SWITCH+i) >> INAC_SWITCHES_SHIFT;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(GYRO)
|
#if defined(GYRO)
|
||||||
for (uint8_t i=0; i<2; i++)
|
for (uint8_t i=0; i<2; i++) {
|
||||||
sum += getValue(MIXSRC_GYRO1+i) >> INAC_STICKS_SHIFT;
|
sum += getValue(MIXSRC_GYRO1+i) >> INAC_STICKS_SHIFT;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (abs((int8_t)(sum-inactivity.sum)) > 1) {
|
if (abs((int8_t)(sum-inactivity.sum)) > 1) {
|
||||||
|
@ -1710,7 +1722,7 @@ void opentxStart(const uint8_t startOptions = OPENTX_START_DEFAULT_ARGS)
|
||||||
ALERT(STR_TEST_WARNING, TR_TEST_NOTSAFE, AU_ERROR);
|
ALERT(STR_TEST_WARNING, TR_TEST_NOTSAFE, AU_ERROR);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if FUNCTION_SWITCHES > 0
|
||||||
if (!UNEXPECTED_SHUTDOWN()) {
|
if (!UNEXPECTED_SHUTDOWN()) {
|
||||||
setFSStartupPosition();
|
setFSStartupPosition();
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,6 +291,13 @@ void OpenTxSim::updateKeysAndSwitches(bool start)
|
||||||
KEY_BackSpace, KEY_EXIT,
|
KEY_BackSpace, KEY_EXIT,
|
||||||
KEY_Up, KEY_PLUS,
|
KEY_Up, KEY_PLUS,
|
||||||
KEY_Down, KEY_MINUS,
|
KEY_Down, KEY_MINUS,
|
||||||
|
#elif defined(RADIO_V10)
|
||||||
|
KEY_Page_Down, KEY_PAGE,
|
||||||
|
KEY_Return, KEY_ENTER,
|
||||||
|
KEY_Up, KEY_UP,
|
||||||
|
KEY_Down, KEY_DOWN,
|
||||||
|
KEY_Right, KEY_RIGHT,
|
||||||
|
KEY_Left, KEY_LEFT,
|
||||||
#elif defined(PCBTARANIS)
|
#elif defined(PCBTARANIS)
|
||||||
KEY_Page_Up, KEY_MENU,
|
KEY_Page_Up, KEY_MENU,
|
||||||
#if defined(HARDWARE_KEY_PAGE)
|
#if defined(HARDWARE_KEY_PAGE)
|
||||||
|
|
|
@ -260,6 +260,9 @@ bool eeLoadGeneral(bool allowFixes)
|
||||||
{
|
{
|
||||||
eeLoadGeneralSettingsData();
|
eeLoadGeneralSettingsData();
|
||||||
|
|
||||||
|
// to force default settings
|
||||||
|
// return false;
|
||||||
|
|
||||||
if (g_eeGeneral.version != EEPROM_VER) {
|
if (g_eeGeneral.version != EEPROM_VER) {
|
||||||
TRACE("EEPROM version %d instead of %d", g_eeGeneral.version, EEPROM_VER);
|
TRACE("EEPROM version %d instead of %d", g_eeGeneral.version, EEPROM_VER);
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
|
|
|
@ -767,6 +767,9 @@ bool eeLoadGeneral(bool allowFixes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to force default settings
|
||||||
|
// return false;
|
||||||
|
|
||||||
#if defined(PCBX7)
|
#if defined(PCBX7)
|
||||||
if (g_eeGeneral.variant == 0) {
|
if (g_eeGeneral.variant == 0) {
|
||||||
TRACE("Pre release EEPROM detected, variant %d instead of %d for X7 radio. Loading anyway", g_eeGeneral.variant, EEPROM_VARIANT);
|
TRACE("Pre release EEPROM detected, variant %d instead of %d for X7 radio. Loading anyway", g_eeGeneral.variant, EEPROM_VARIANT);
|
||||||
|
|
|
@ -297,7 +297,7 @@ char * getSwitchName(char * dest, swsrc_t idx)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*dest++ = 'A' + swinfo.quot;
|
*dest++ = 'A' + swinfo.quot;
|
||||||
#elif defined(PCBX7) && !defined(RADIO_TX12) && !defined(RADIO_ZORRO) && !defined(RADIO_FAMILY_TBS) && !defined(RADIO_V10)
|
#elif defined(PCBX7) && !defined(RADIO_TX12) && !defined(RADIO_ZORRO) && !defined(RADIO_FAMILY_TBS)
|
||||||
if (swinfo.quot >= 5)
|
if (swinfo.quot >= 5)
|
||||||
*dest++ = 'H' + swinfo.quot - 5;
|
*dest++ = 'H' + swinfo.quot - 5;
|
||||||
else if (swinfo.quot == 4)
|
else if (swinfo.quot == 4)
|
||||||
|
@ -348,6 +348,19 @@ char * getSwitchPositionName(char * dest, swsrc_t idx)
|
||||||
}
|
}
|
||||||
#endif // PCBSKY9X
|
#endif // PCBSKY9X
|
||||||
|
|
||||||
|
#if FUNCTION_SWITCHES > 0
|
||||||
|
else if (idx <= SWSRC_LAST_FUNCTION_SWITCH) {
|
||||||
|
idx -= SWSRC_FIRST_FUNCTION_SWITCH;
|
||||||
|
if (ZEXIST(g_model.switchNames[idx])) {
|
||||||
|
zchar2str(dest, g_model.switchNames[idx], LEN_SWITCH_NAME);
|
||||||
|
dest[LEN_SWITCH_NAME] = '\0';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
getStringAtIndex(dest, STR_VSRCRAW, idx + MIXSRC_FIRST_FS_SWITCH - MIXSRC_Rud + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if NUM_XPOTS > 0
|
#if NUM_XPOTS > 0
|
||||||
else if (idx <= SWSRC_LAST_MULTIPOS_SWITCH) {
|
else if (idx <= SWSRC_LAST_MULTIPOS_SWITCH) {
|
||||||
div_t swinfo = div(int(idx - SWSRC_FIRST_MULTIPOS_SWITCH), XPOTS_MULTIPOS_COUNT);
|
div_t swinfo = div(int(idx - SWSRC_FIRST_MULTIPOS_SWITCH), XPOTS_MULTIPOS_COUNT);
|
||||||
|
|
|
@ -67,7 +67,7 @@ uint8_t potsPos[NUM_XPOTS];
|
||||||
#define SWITCH_POSITION(sw) (switchesPos & ((MASK_CFN_TYPE)1<<(sw)))
|
#define SWITCH_POSITION(sw) (switchesPos & ((MASK_CFN_TYPE)1<<(sw)))
|
||||||
#define POT_POSITION(sw) ((potsPos[(sw)/XPOTS_MULTIPOS_COUNT] & 0x0f) == ((sw) % XPOTS_MULTIPOS_COUNT))
|
#define POT_POSITION(sw) ((potsPos[(sw)/XPOTS_MULTIPOS_COUNT] & 0x0f) == ((sw) % XPOTS_MULTIPOS_COUNT))
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if FUNCTION_SWITCHES > 0
|
||||||
// Non pushed : SWSRC_Sx0 = -1024 = Sx(up) = state 0
|
// Non pushed : SWSRC_Sx0 = -1024 = Sx(up) = state 0
|
||||||
// Pushed : SWSRC_Sx2 = +1024 = Sx(down) = state 1
|
// Pushed : SWSRC_Sx2 = +1024 = Sx(down) = state 1
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ uint8_t fsPreviousState = 0;
|
||||||
|
|
||||||
void setFSStartupPosition()
|
void setFSStartupPosition()
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
for (uint8_t i = 0; i < FUNCTION_SWITCHES; i++) {
|
||||||
uint8_t startPos = (g_model.functionSwitchStartConfig >> 2 * i) & 0x03;
|
uint8_t startPos = (g_model.functionSwitchStartConfig >> 2 * i) & 0x03;
|
||||||
switch(startPos) {
|
switch(startPos) {
|
||||||
case FS_START_DOWN:
|
case FS_START_DOWN:
|
||||||
|
@ -99,27 +99,29 @@ uint8_t getFSLogicalState(uint8_t index)
|
||||||
return (uint8_t )(bfSingleBitGet(g_model.functionSwitchLogicalState, index) >> (index));
|
return (uint8_t )(bfSingleBitGet(g_model.functionSwitchLogicalState, index) >> (index));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t getFSPhysicalState(uint8_t index)
|
// uint8_t getFSPhysicalState(uint8_t index)
|
||||||
{
|
// {
|
||||||
return switchState(((index + NUM_REGULAR_SWITCHES) * 3) + 2) ? 1 : 0;
|
// return switchState(((index + NUM_REGULAR_SWITCHES) * 3) + 2) ? 1 : 0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
uint8_t getFSPreviousPhysicalState(uint8_t index)
|
bool getFSPreviousPhysicalState(uint8_t index)
|
||||||
{
|
{
|
||||||
return (uint8_t )(bfSingleBitGet(fsPreviousState, index) >> (index));
|
return bfSingleBitGet(fsPreviousState, index) >> index;
|
||||||
}
|
}
|
||||||
|
|
||||||
void evalFunctionSwitches()
|
void evalFunctionSwitches()
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
uint8_t ledsMask = 0;
|
||||||
|
uint8_t keysStates = getFunctionSwitchesStates();
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < FUNCTION_SWITCHES; i++) {
|
||||||
if (FSWITCH_CONFIG(i) == SWITCH_NONE) {
|
if (FSWITCH_CONFIG(i) == SWITCH_NONE) {
|
||||||
fsLedOff(i);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t physicalState = getFSPhysicalState(i);
|
auto physicalState = bool(keysStates & (1 << i));
|
||||||
if (physicalState != getFSPreviousPhysicalState(i)) { // FS was moved
|
if (physicalState != getFSPreviousPhysicalState(i)) { // FS was moved
|
||||||
if ((FSWITCH_CONFIG(i) == SWITCH_2POS && physicalState == 1) || (FSWITCH_CONFIG(i) == SWITCH_TOGGLE)) {
|
if ((FSWITCH_CONFIG(i) == SWITCH_2POS && physicalState) || (FSWITCH_CONFIG(i) == SWITCH_TOGGLE)) {
|
||||||
if (IS_FSWITCH_GROUP_ON(FSWITCH_GROUP(i)) != 0) { // In an always on group
|
if (IS_FSWITCH_GROUP_ON(FSWITCH_GROUP(i)) != 0) { // In an always on group
|
||||||
g_model.functionSwitchLogicalState |= 1 << i; // Set bit
|
g_model.functionSwitchLogicalState |= 1 << i; // Set bit
|
||||||
}
|
}
|
||||||
|
@ -129,7 +131,7 @@ void evalFunctionSwitches()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FSWITCH_GROUP(i) && physicalState == 1) { // switch is in a group, other in group need to be turned off
|
if (FSWITCH_GROUP(i) && physicalState == 1) { // switch is in a group, other in group need to be turned off
|
||||||
for (uint8_t j = 0; j < NUM_FUNCTIONS_SWITCHES; j++) {
|
for (uint8_t j = 0; j < FUNCTION_SWITCHES; j++) {
|
||||||
if (i == j)
|
if (i == j)
|
||||||
continue;
|
continue;
|
||||||
if (FSWITCH_GROUP(j) == FSWITCH_GROUP(i)) {
|
if (FSWITCH_GROUP(j) == FSWITCH_GROUP(i)) {
|
||||||
|
@ -142,11 +144,12 @@ void evalFunctionSwitches()
|
||||||
storageDirty(EE_MODEL);
|
storageDirty(EE_MODEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getFSLogicalState(i))
|
if (getFSLogicalState(i)) {
|
||||||
fsLedOn(i);
|
ledsMask |= 1 << i;
|
||||||
else
|
}
|
||||||
fsLedOff(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writeFunctionLeds(ledsMask);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -562,7 +565,7 @@ bool getSwitch(swsrc_t swtch, uint8_t flags)
|
||||||
result = latencyToggleSwitch;
|
result = latencyToggleSwitch;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (cs_idx <= (SWSRC_LAST_SWITCH - 3 * NUM_FUNCTIONS_SWITCHES)) {
|
else if (cs_idx <= SWSRC_LAST_SWITCH) {
|
||||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||||
if (flags & GETSWITCH_MIDPOS_DELAY)
|
if (flags & GETSWITCH_MIDPOS_DELAY)
|
||||||
result = SWITCH_POSITION(cs_idx-SWSRC_FIRST_SWITCH);
|
result = SWITCH_POSITION(cs_idx-SWSRC_FIRST_SWITCH);
|
||||||
|
@ -573,16 +576,14 @@ bool getSwitch(swsrc_t swtch, uint8_t flags)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if FUNCTION_SWITCHES > 0
|
||||||
else if (cs_idx <= SWSRC_LAST_SWITCH) {
|
else if (cs_idx <= SWSRC_LAST_FUNCTION_SWITCH) {
|
||||||
div_t qr = div(cs_idx - 3 * NUM_FUNCTIONS_SWITCHES, 3);
|
result = getFSLogicalState(cs_idx - SWSRC_FIRST_FUNCTION_SWITCH);
|
||||||
auto value = getFSLogicalState(qr.quot + 1);
|
|
||||||
result = qr.rem == -2 ? 1 - value : value;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if NUM_XPOTS > 0
|
#if NUM_XPOTS > 0
|
||||||
else if (cs_idx <= SWSRC_LAST_MULTIPOS_SWITCH) {
|
else if (cs_idx <= SWSRC_LAST_MULTIPOS_SWITCH) {
|
||||||
result = POT_POSITION(cs_idx-SWSRC_FIRST_MULTIPOS_SWITCH);
|
result = POT_POSITION(cs_idx - SWSRC_FIRST_MULTIPOS_SWITCH);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (cs_idx <= SWSRC_LAST_TRIM) {
|
else if (cs_idx <= SWSRC_LAST_TRIM) {
|
||||||
|
@ -647,26 +648,26 @@ swsrc_t getMovedSwitch()
|
||||||
|
|
||||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||||
// Switches
|
// Switches
|
||||||
for (int i = 0; i < NUM_SWITCHES - NUM_FUNCTIONS_SWITCHES; i++) {
|
for (int i = 0; i < NUM_SWITCHES; i++) {
|
||||||
if (SWITCH_EXISTS(i)) {
|
if (SWITCH_EXISTS(i)) {
|
||||||
swarnstate_t mask = ((swarnstate_t) 0x03 << (i * 2));
|
swarnstate_t mask = ((swarnstate_t) 0x03 << (i * 2));
|
||||||
uint8_t prev = (switches_states & mask) >> (i * 2);
|
uint8_t prev = (switches_states & mask) >> (i * 2);
|
||||||
uint8_t next = (1024 + getValue(MIXSRC_SA + i)) / 1024;
|
uint8_t next = (1024 + getValue(MIXSRC_SA + i)) / 1024;
|
||||||
if (prev != next) {
|
if (prev != next) {
|
||||||
switches_states = (switches_states & (~mask)) | ((swarnstate_t) next << (i * 2));
|
switches_states = (switches_states & (~mask)) | ((swarnstate_t) next << (i * 2));
|
||||||
result = 1 + (3 * i) + next;
|
result = SWSRC_FIRST_SWITCH + (3 * i) + next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if FUNCTION_SWITCHES > 0
|
||||||
for (int i = 0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
for (int i = 0; i < FUNCTION_SWITCHES; i++) {
|
||||||
if (FSWITCH_CONFIG(i) != SWITCH_NONE) {
|
if (FSWITCH_CONFIG(i) != SWITCH_NONE) {
|
||||||
auto prev = (uint8_t )(bfSingleBitGet(fsswitches_states, i) >> (i));
|
auto prev = uint8_t(bfSingleBitGet(fsswitches_states, i)) >> i;
|
||||||
uint8_t next = getFSLogicalState(i);
|
uint8_t next = getFSLogicalState(i);
|
||||||
if (prev != next) {
|
if (prev != next) {
|
||||||
fsswitches_states ^= (-next ^ fsswitches_states) & (1 << i);
|
fsswitches_states ^= (1 << i);
|
||||||
result = 2 + (3 * (i + NUM_REGULAR_SWITCHES)) + next;
|
result = SWSRC_FIRST_FUNCTION_SWITCH + i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -681,7 +682,7 @@ swsrc_t getMovedSwitch()
|
||||||
uint8_t prev = potsPos[i] & 0x0F;
|
uint8_t prev = potsPos[i] & 0x0F;
|
||||||
uint8_t next = anaIn(POT1 + i) / (2 * RESX / calib->count);
|
uint8_t next = anaIn(POT1 + i) / (2 * RESX / calib->count);
|
||||||
if (prev != next) {
|
if (prev != next) {
|
||||||
result = SWSRC_LAST_SWITCH + i * XPOTS_MULTIPOS_COUNT + next + 1;
|
result = SWSRC_FIRST_MULTIPOS_SWITCH + (i * XPOTS_MULTIPOS_COUNT) + next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -768,7 +769,7 @@ void checkSwitches()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(PCBTARANIS)
|
#elif defined(PCBTARANIS)
|
||||||
for (int i=0; i < (NUM_SWITCHES - NUM_FUNCTIONS_SWITCHES); i++) {
|
for (int i=0; i < (NUM_SWITCHES - FUNCTION_SWITCHES); i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i) && !(g_model.switchWarningEnable & (1<<i))) {
|
if (SWITCH_WARNING_ALLOWED(i) && !(g_model.switchWarningEnable & (1<<i))) {
|
||||||
swarnstate_t mask = ((swarnstate_t)0x03 << (i*2));
|
swarnstate_t mask = ((swarnstate_t)0x03 << (i*2));
|
||||||
if (!((states & mask) == (switches_states & mask))) {
|
if (!((states & mask) == (switches_states & mask))) {
|
||||||
|
@ -824,7 +825,7 @@ void checkSwitches()
|
||||||
lcdNextPos = SWITCH_WARNING_LIST_X;
|
lcdNextPos = SWITCH_WARNING_LIST_X;
|
||||||
#endif
|
#endif
|
||||||
int numWarnings = 0;
|
int numWarnings = 0;
|
||||||
for (int i=0; i < (NUM_SWITCHES - NUM_FUNCTIONS_SWITCHES); ++i) {
|
for (int i=0; i < (NUM_SWITCHES - FUNCTION_SWITCHES); ++i) {
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
unsigned int state = ((g_model.switchWarningState >> (3*i)) & 0x07);
|
unsigned int state = ((g_model.switchWarningState >> (3*i)) & 0x07);
|
||||||
|
|
|
@ -277,16 +277,16 @@ uint32_t readTrims()
|
||||||
|
|
||||||
uint8_t getFunctionSwitchesStates()
|
uint8_t getFunctionSwitchesStates()
|
||||||
{
|
{
|
||||||
//uint32_t value2 = inputValues[1];
|
uint32_t value1 = inputValues[0];
|
||||||
uint8_t result = 0;
|
uint8_t result = 0;
|
||||||
/*if (!(value2 & (1 << INPUT2_FS_1)))
|
if (!(value1 & (1 << INPUT1_FS_1)))
|
||||||
result |= 1u << 0u;
|
result |= 1u << 0u;
|
||||||
if (!(value2 & (1 << INPUT2_FS_2)))
|
if (!(value1 & (1 << INPUT1_FS_2)))
|
||||||
result |= 1u << 1u;
|
result |= 1u << 1u;
|
||||||
if (!(value2 & (1 << INPUT2_FS_3)))
|
if (!(value1 & (1 << INPUT1_FS_3)))
|
||||||
result |= 1u << 2u;
|
result |= 1u << 2u;
|
||||||
if (!(value2 & (1 << INPUT2_FS_4)))
|
if (!(value1 & (1 << INPUT1_FS_4)))
|
||||||
result |= 1u << 3u;*/
|
result |= 1u << 3u;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -292,10 +292,6 @@ enum EnumSwitchesPositions
|
||||||
|
|
||||||
#define STORAGE_NUM_SWITCHES_POSITIONS (STORAGE_NUM_SWITCHES * 3)
|
#define STORAGE_NUM_SWITCHES_POSITIONS (STORAGE_NUM_SWITCHES * 3)
|
||||||
|
|
||||||
#if !defined(NUM_FUNCTIONS_SWITCHES)
|
|
||||||
#define NUM_FUNCTIONS_SWITCHES 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void keysInit();
|
void keysInit();
|
||||||
uint32_t switchState(uint8_t index);
|
uint32_t switchState(uint8_t index);
|
||||||
uint32_t readKeys();
|
uint32_t readKeys();
|
||||||
|
|
|
@ -514,6 +514,10 @@ void boardInit()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nca9555Read()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
display_t simuLcdBackupBuf[DISPLAY_BUFFER_SIZE];
|
display_t simuLcdBackupBuf[DISPLAY_BUFFER_SIZE];
|
||||||
void lcdStoreBackupBuffer()
|
void lcdStoreBackupBuffer()
|
||||||
{
|
{
|
||||||
|
@ -782,6 +786,11 @@ void boardOff()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t getFunctionSwitchesStates()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(RADIO_FAMILY_TBS)
|
#if defined(RADIO_FAMILY_TBS)
|
||||||
void intmoduleStop()
|
void intmoduleStop()
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,10 +54,6 @@ void rotaryEncoderEnd();
|
||||||
#define STORAGE_NUM_SWITCHES NUM_SWITCHES
|
#define STORAGE_NUM_SWITCHES NUM_SWITCHES
|
||||||
#define NUM_SWITCHES_POSITIONS 9
|
#define NUM_SWITCHES_POSITIONS 9
|
||||||
|
|
||||||
#if !defined(NUM_FUNCTIONS_SWITCHES)
|
|
||||||
#define NUM_FUNCTIONS_SWITCHES 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum EnumKeys
|
enum EnumKeys
|
||||||
{
|
{
|
||||||
KEY_MENU,
|
KEY_MENU,
|
||||||
|
|
|
@ -147,7 +147,7 @@ elseif(PCB STREQUAL X7)
|
||||||
set(CPU_TYPE_FULL STM32F205xE) # for size report
|
set(CPU_TYPE_FULL STM32F205xE) # for size report
|
||||||
set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld)
|
set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld)
|
||||||
set(LUA_EXPORT lua_export_tpro)
|
set(LUA_EXPORT lua_export_tpro)
|
||||||
add_definitions(-DFUNCTION_SWITCHES)
|
add_definitions(-DFUNCTION_SWITCHES=6)
|
||||||
add_definitions(-DRADIO_TPRO)
|
add_definitions(-DRADIO_TPRO)
|
||||||
add_definitions(-DEEPROM_VARIANT=0x4005)
|
add_definitions(-DEEPROM_VARIANT=0x4005)
|
||||||
add_definitions(-DMANUFACTURER_JUMPER)
|
add_definitions(-DMANUFACTURER_JUMPER)
|
||||||
|
@ -247,7 +247,7 @@ elseif(PCB STREQUAL X7)
|
||||||
option(INTERNAL_MODULE_PXX1 "Support for PXX1 internal module" OFF)
|
option(INTERNAL_MODULE_PXX1 "Support for PXX1 internal module" OFF)
|
||||||
option(INTERNAL_MODULE_PXX2 "Support for PXX2 internal module" ON)
|
option(INTERNAL_MODULE_PXX2 "Support for PXX2 internal module" ON)
|
||||||
set(FLAVOUR v10)
|
set(FLAVOUR v10)
|
||||||
set(NAVIGATION_TYPE x7)
|
set(NAVIGATION_TYPE horus)
|
||||||
set(CPU_TYPE STM32F4)
|
set(CPU_TYPE STM32F4)
|
||||||
set(CPU_TYPE_FULL STM32F407xE) # for size report
|
set(CPU_TYPE_FULL STM32F407xE) # for size report
|
||||||
set(LINKER_SCRIPT targets/taranis/stm32f4_flash.ld)
|
set(LINKER_SCRIPT targets/taranis/stm32f4_flash.ld)
|
||||||
|
@ -264,6 +264,7 @@ elseif(PCB STREQUAL X7)
|
||||||
)
|
)
|
||||||
add_definitions(-DSTM32F40_41xxx)
|
add_definitions(-DSTM32F40_41xxx)
|
||||||
add_definitions(-DHARDWARE_POWER_MANAGEMENT_UNIT)
|
add_definitions(-DHARDWARE_POWER_MANAGEMENT_UNIT)
|
||||||
|
add_definitions(-DFUNCTION_SWITCHES=4)
|
||||||
set(PXX2 ON)
|
set(PXX2 ON)
|
||||||
set(PXX_FREQUENCY "HIGH")
|
set(PXX_FREQUENCY "HIGH")
|
||||||
set(BLUETOOTH NO)
|
set(BLUETOOTH NO)
|
||||||
|
@ -516,9 +517,13 @@ set(TARGET_SRC
|
||||||
../common/arm/stm32/adc_driver.cpp
|
../common/arm/stm32/adc_driver.cpp
|
||||||
../common/arm/stm32/heartbeat_driver.cpp
|
../common/arm/stm32/heartbeat_driver.cpp
|
||||||
../common/arm/stm32/mixer_scheduler_driver.cpp
|
../common/arm/stm32/mixer_scheduler_driver.cpp
|
||||||
../common/arm/stm32/sdio_sd.c
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(FIRMWARE_TARGET_SRC
|
||||||
|
${FIRMWARE_TARGET_SRC}
|
||||||
|
../common/arm/stm32/sdio_sd.c
|
||||||
|
)
|
||||||
|
|
||||||
if(PCB STREQUAL XLITE OR PCB STREQUAL XLITES)
|
if(PCB STREQUAL XLITE OR PCB STREQUAL XLITES)
|
||||||
set(TARGET_SRC
|
set(TARGET_SRC
|
||||||
${TARGET_SRC}
|
${TARGET_SRC}
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#ifndef _BOARD_H_
|
#ifndef _BOARD_H_
|
||||||
#define _BOARD_H_
|
#define _BOARD_H_
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
#include "opentx_constants.h"
|
#include "opentx_constants.h"
|
||||||
#include "board_common.h"
|
#include "board_common.h"
|
||||||
|
@ -234,7 +233,7 @@ int sbusGetByte(uint8_t * byte);
|
||||||
// Keys driver
|
// Keys driver
|
||||||
enum EnumKeys
|
enum EnumKeys
|
||||||
{
|
{
|
||||||
#if defined(KEYS_GPIO_REG_SHIFT)
|
#if defined(HARDWARE_KEY_SHIFT)
|
||||||
KEY_SHIFT,
|
KEY_SHIFT,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -242,19 +241,22 @@ enum EnumKeys
|
||||||
KEY_MENU,
|
KEY_MENU,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HARDWARE_KEY_EXIT)
|
||||||
KEY_EXIT,
|
KEY_EXIT,
|
||||||
KEY_ENTER,
|
#endif
|
||||||
|
|
||||||
#if defined(KEYS_GPIO_REG_DOWN)
|
#if defined(HARDWARE_KEY_DOWN)
|
||||||
KEY_DOWN,
|
KEY_DOWN,
|
||||||
KEY_UP,
|
KEY_UP,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(KEYS_GPIO_REG_RIGHT) || defined(RADIO_V10)
|
#if defined(HARDWARE_KEY_RIGHT)
|
||||||
KEY_RIGHT,
|
KEY_RIGHT,
|
||||||
KEY_LEFT,
|
KEY_LEFT,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
KEY_ENTER,
|
||||||
|
|
||||||
#if defined(HARDWARE_KEY_PAGE)
|
#if defined(HARDWARE_KEY_PAGE)
|
||||||
KEY_PAGE,
|
KEY_PAGE,
|
||||||
#endif
|
#endif
|
||||||
|
@ -322,6 +324,11 @@ enum EnumKeys
|
||||||
#define KEY_MENU KEY_ENTER
|
#define KEY_MENU KEY_ENTER
|
||||||
#define KEY_MINUS KEY_DOWN
|
#define KEY_MINUS KEY_DOWN
|
||||||
#define KEY_PLUS KEY_UP
|
#define KEY_PLUS KEY_UP
|
||||||
|
#elif defined(NAVIGATION_HORUS)
|
||||||
|
#define KEY_MODEL KEY_UP
|
||||||
|
#define KEY_SYS KEY_LEFT
|
||||||
|
#define KEY_TELE KEY_RIGHT
|
||||||
|
#define KEY_EXIT KEY_DOWN
|
||||||
#else
|
#else
|
||||||
#define KEY_UP KEY_PLUS
|
#define KEY_UP KEY_PLUS
|
||||||
#define KEY_DOWN KEY_MINUS
|
#define KEY_DOWN KEY_MINUS
|
||||||
|
@ -347,9 +354,13 @@ enum EnumSwitches
|
||||||
SW_SB,
|
SW_SB,
|
||||||
SW_SC,
|
SW_SC,
|
||||||
SW_SD,
|
SW_SD,
|
||||||
|
#if defined(STORAGE_SWITCH_E)
|
||||||
SW_SE,
|
SW_SE,
|
||||||
|
#endif
|
||||||
SW_SF,
|
SW_SF,
|
||||||
|
#if defined(STORAGE_SWITCH_G)
|
||||||
SW_SG,
|
SW_SG,
|
||||||
|
#endif
|
||||||
SW_SH,
|
SW_SH,
|
||||||
SW_SI,
|
SW_SI,
|
||||||
SW_SJ,
|
SW_SJ,
|
||||||
|
@ -382,50 +393,37 @@ enum EnumSwitchesPositions
|
||||||
SW_SD0,
|
SW_SD0,
|
||||||
SW_SD1,
|
SW_SD1,
|
||||||
SW_SD2,
|
SW_SD2,
|
||||||
#if defined(PCBX9) || defined(PCBXLITES) || defined(PCBX9LITES) || defined(RADIO_TX12) || defined(RADIO_ZORRO) || defined(RADIO_TPRO)
|
#if defined(STORAGE_SWITCH_E)
|
||||||
SW_SE0,
|
SW_SE0,
|
||||||
SW_SE1,
|
SW_SE1,
|
||||||
SW_SE2,
|
SW_SE2,
|
||||||
#endif
|
#endif
|
||||||
#if defined(PCBX9D) || defined(PCBX9DP) || defined(PCBX9E) || defined(PCBX7) || defined(PCBXLITES) || defined(PCBX9LITES) || defined(RADIO_T8) || defined(RADIO_ZORRO) || defined(RADIO_TPRO)
|
#if defined(STORAGE_SWITCH_F)
|
||||||
SW_SF0,
|
SW_SF0,
|
||||||
SW_SF1,
|
SW_SF1,
|
||||||
SW_SF2,
|
SW_SF2,
|
||||||
#endif
|
#endif
|
||||||
#if defined(PCBX9D) || defined(PCBX9DP) || defined(PCBX9E) || defined(PCBX9LITES) || defined(RADIO_ZORRO) || defined(RADIO_TPRO)
|
#if defined(STORAGE_SWITCH_G)
|
||||||
SW_SG0,
|
SW_SG0,
|
||||||
SW_SG1,
|
SW_SG1,
|
||||||
SW_SG2,
|
SW_SG2,
|
||||||
#endif
|
#endif
|
||||||
#if defined(PCBX9D) || defined(PCBX9DP) || defined(PCBX9E) || (defined(PCBX7) && !defined(RADIO_TX12)) || defined(RADIO_T8) || defined(RADIO_ZORRO) || defined(RADIO_TPRO)
|
#if defined(STORAGE_SWITCH_H)
|
||||||
SW_SH0,
|
SW_SH0,
|
||||||
SW_SH1,
|
SW_SH1,
|
||||||
SW_SH2,
|
SW_SH2,
|
||||||
#endif
|
#endif
|
||||||
#if defined(RADIO_X9DP2019)
|
#if defined(STORAGE_SWITCH_I)
|
||||||
SW_SI0,
|
SW_SI0,
|
||||||
SW_SI1,
|
SW_SI1,
|
||||||
SW_SI2,
|
SW_SI2,
|
||||||
#endif
|
#endif
|
||||||
#if defined(RADIO_X7ACCESS)
|
#if defined(STORAGE_SWITCH_J)
|
||||||
SW_SI0,
|
|
||||||
SW_SI1,
|
|
||||||
SW_SI2,
|
|
||||||
#elif defined(PCBX7) && !defined(RADIO_ZORRO)
|
|
||||||
SW_SI0,
|
|
||||||
SW_SI1,
|
|
||||||
SW_SI2,
|
|
||||||
SW_SJ0,
|
SW_SJ0,
|
||||||
SW_SJ1,
|
SW_SJ1,
|
||||||
SW_SJ2,
|
SW_SJ2,
|
||||||
#endif
|
#endif
|
||||||
#if defined(PCBX9E)
|
#if defined(PCBX9E)
|
||||||
SW_SI0,
|
|
||||||
SW_SI1,
|
|
||||||
SW_SI2,
|
|
||||||
SW_SJ0,
|
|
||||||
SW_SJ1,
|
|
||||||
SW_SJ2,
|
|
||||||
SW_SK0,
|
SW_SK0,
|
||||||
SW_SK1,
|
SW_SK1,
|
||||||
SW_SK2,
|
SW_SK2,
|
||||||
|
@ -470,14 +468,13 @@ enum EnumSwitchesPositions
|
||||||
#define DEFAULT_SWITCH_CONFIG (SWITCH_2POS << 6) + (SWITCH_2POS << 4) + (SWITCH_3POS << 2) + (SWITCH_3POS << 0);
|
#define DEFAULT_SWITCH_CONFIG (SWITCH_2POS << 6) + (SWITCH_2POS << 4) + (SWITCH_3POS << 2) + (SWITCH_3POS << 0);
|
||||||
#define DEFAULT_POTS_CONFIG (0)
|
#define DEFAULT_POTS_CONFIG (0)
|
||||||
#elif defined(RADIO_TPRO)
|
#elif defined(RADIO_TPRO)
|
||||||
#define NUM_SWITCHES 10
|
#define NUM_SWITCHES 4
|
||||||
#define NUM_FUNCTIONS_SWITCHES 6
|
#define FUNCTION_SWITCHES 6
|
||||||
#define NUM_REGULAR_SWITCHES (NUM_SWITCHES - NUM_FUNCTIONS_SWITCHES)
|
#define STORAGE_NUM_SWITCHES 6
|
||||||
#define STORAGE_NUM_SWITCHES 10
|
|
||||||
#define DEFAULT_SWITCH_CONFIG (SWITCH_TOGGLE << 6) + (SWITCH_TOGGLE << 4) + (SWITCH_3POS << 2) + (SWITCH_3POS << 0);
|
#define DEFAULT_SWITCH_CONFIG (SWITCH_TOGGLE << 6) + (SWITCH_TOGGLE << 4) + (SWITCH_3POS << 2) + (SWITCH_3POS << 0);
|
||||||
#define DEFAULT_FS_CONFIG (SWITCH_2POS << 10) + (SWITCH_2POS << 8) + (SWITCH_2POS << 6) + (SWITCH_2POS << 4) + (SWITCH_2POS << 2) + (SWITCH_2POS << 0)
|
#define DEFAULT_FS_CONFIG (SWITCH_2POS << 10) + (SWITCH_2POS << 8) + (SWITCH_2POS << 6) + (SWITCH_2POS << 4) + (SWITCH_2POS << 2) + (SWITCH_2POS << 0)
|
||||||
#define DEFAULT_FS_GROUPS (1 << 10) + (1 << 8) + (1 << 6) + (1 << 4) + (1 << 2) + (1 << 0) // Set all FS to group 1 to act like a 6pos
|
#define DEFAULT_FS_GROUPS (1 << 10) + (1 << 8) + (1 << 6) + (1 << 4) + (1 << 2) + (1 << 0) // Set all FS to group 1 to act like a 6pos
|
||||||
#define DEFAULT_FS_STARTUP_CONFIG ((FS_START_PREVIOUS << 10) + (FS_START_PREVIOUS << 8) + (FS_START_PREVIOUS << 6) + (FS_START_PREVIOUS << 4) + (FS_START_PREVIOUS << 2) + FS_START_PREVIOUS << 0) // keep last state by default
|
#define DEFAULT_FS_STARTUP_CONFIG ((FS_START_PREVIOUS << 10) + (FS_START_PREVIOUS << 8) + (FS_START_PREVIOUS << 6) + (FS_START_PREVIOUS << 4) + (FS_START_PREVIOUS << 2) + (FS_START_PREVIOUS << 0)) // keep last state by default
|
||||||
#define DEFAULT_POTS_CONFIG (POT_WITHOUT_DETENT << 0) + (POT_WITH_DETENT << 2); // S1 = pot without detent, S2 = pot with detent
|
#define DEFAULT_POTS_CONFIG (POT_WITHOUT_DETENT << 0) + (POT_WITH_DETENT << 2); // S1 = pot without detent, S2 = pot with detent
|
||||||
#elif defined(RADIO_FAMILY_JUMPER_T12)
|
#elif defined(RADIO_FAMILY_JUMPER_T12)
|
||||||
#define NUM_SWITCHES 8
|
#define NUM_SWITCHES 8
|
||||||
|
@ -506,9 +503,13 @@ enum EnumSwitchesPositions
|
||||||
#define DEFAULT_POTS_CONFIG (POT_WITHOUT_DETENT << 0) + (POT_WITH_DETENT << 2) // S1 = pot without detent, S2 = pot with detent
|
#define DEFAULT_POTS_CONFIG (POT_WITHOUT_DETENT << 0) + (POT_WITH_DETENT << 2) // S1 = pot without detent, S2 = pot with detent
|
||||||
#elif defined(RADIO_V10)
|
#elif defined(RADIO_V10)
|
||||||
#define NUM_SWITCHES 8
|
#define NUM_SWITCHES 8
|
||||||
#define STORAGE_NUM_SWITCHES 10
|
#define STORAGE_NUM_SWITCHES NUM_SWITCHES
|
||||||
#define DEFAULT_SWITCH_CONFIG (SWITCH_TOGGLE << 18) + (SWITCH_TOGGLE << 16) + (SWITCH_TOGGLE << 14) + (SWITCH_2POS << 10) + (SWITCH_3POS << 6) + (SWITCH_3POS << 4) + (SWITCH_3POS << 2) + (SWITCH_3POS << 0)
|
#define DEFAULT_SWITCH_CONFIG (SWITCH_TOGGLE << 14) + (SWITCH_TOGGLE << 12) + (SWITCH_TOGGLE << 10) + (SWITCH_2POS << 8) + (SWITCH_3POS << 6) + (SWITCH_3POS << 4) + (SWITCH_3POS << 2) + (SWITCH_3POS << 0)
|
||||||
#define DEFAULT_POTS_CONFIG (POT_WITH_DETENT << 0) + (POT_WITH_DETENT << 2) + (SLIDER_WITH_DETENT << 8) + (SLIDER_WITH_DETENT << 10) // S1 = pot with detent, S2 = pot with detent, LS & RS = sliders with detent
|
#define DEFAULT_POTS_CONFIG (POT_WITH_DETENT << 0) + (POT_WITH_DETENT << 2) + (SLIDER_WITH_DETENT << 8) + (SLIDER_WITH_DETENT << 10) // S1 = pot with detent, S2 = pot with detent, LS & RS = sliders with detent
|
||||||
|
#define FUNCTION_SWITCHES 4
|
||||||
|
#define DEFAULT_FS_CONFIG (SWITCH_2POS << 6) + (SWITCH_2POS << 4) + (SWITCH_2POS << 2) + (SWITCH_2POS << 0)
|
||||||
|
#define DEFAULT_FS_GROUPS (1 << 6) + (1 << 4) + (1 << 2) + (1 << 0) // Set all FS to group 1 to act like a 6pos
|
||||||
|
#define DEFAULT_FS_STARTUP_CONFIG ((FS_START_PREVIOUS << 6) + (FS_START_PREVIOUS << 4) + (FS_START_PREVIOUS << 2) + (FS_START_PREVIOUS << 0)) // keep last state by default
|
||||||
#elif defined(PCBX7)
|
#elif defined(PCBX7)
|
||||||
#define NUM_SWITCHES 8
|
#define NUM_SWITCHES 8
|
||||||
#define STORAGE_NUM_SWITCHES NUM_SWITCHES
|
#define STORAGE_NUM_SWITCHES NUM_SWITCHES
|
||||||
|
@ -544,8 +545,8 @@ enum EnumSwitchesPositions
|
||||||
#define DEFAULT_SLIDERS_CONFIG (SLIDER_WITH_DETENT << 1) + (SLIDER_WITH_DETENT << 0)
|
#define DEFAULT_SLIDERS_CONFIG (SLIDER_WITH_DETENT << 1) + (SLIDER_WITH_DETENT << 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(NUM_FUNCTIONS_SWITCHES)
|
#if !defined(FUNCTION_SWITCHES)
|
||||||
#define NUM_FUNCTIONS_SWITCHES 0
|
#define FUNCTION_SWITCHES 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STORAGE_NUM_SWITCHES_POSITIONS (STORAGE_NUM_SWITCHES * 3)
|
#define STORAGE_NUM_SWITCHES_POSITIONS (STORAGE_NUM_SWITCHES * 3)
|
||||||
|
@ -574,8 +575,10 @@ static const uint8_t switchPosition[][2] = {{0,0}, {0,1}, {0,2}, {1,0}, {1,1}, {
|
||||||
#endif
|
#endif
|
||||||
uint32_t readKeys();
|
uint32_t readKeys();
|
||||||
uint32_t readTrims();
|
uint32_t readTrims();
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if FUNCTION_SWITCHES > 0
|
||||||
extern uint8_t fsPreviousState;
|
extern uint8_t fsPreviousState;
|
||||||
|
uint8_t getFunctionSwitchesStates();
|
||||||
|
void writeFunctionLeds(uint8_t mask);
|
||||||
void evalFunctionSwitches();
|
void evalFunctionSwitches();
|
||||||
void setFSStartupPosition();
|
void setFSStartupPosition();
|
||||||
uint8_t getFSLogicalState(uint8_t index);
|
uint8_t getFSLogicalState(uint8_t index);
|
||||||
|
@ -1026,7 +1029,7 @@ void ledOff();
|
||||||
void ledRed();
|
void ledRed();
|
||||||
void ledGreen();
|
void ledGreen();
|
||||||
void ledBlue();
|
void ledBlue();
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if FUNCTION_SWITCHES > 0
|
||||||
void fsLedOff(uint8_t);
|
void fsLedOff(uint8_t);
|
||||||
void fsLedOn(uint8_t);
|
void fsLedOn(uint8_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -102,10 +102,10 @@
|
||||||
#elif defined(RADIO_V10)
|
#elif defined(RADIO_V10)
|
||||||
// PAGE / MENU / EXIT moved to NCA9555
|
// PAGE / MENU / EXIT moved to NCA9555
|
||||||
#define HARDWARE_KEY_PAGE
|
#define HARDWARE_KEY_PAGE
|
||||||
#define HARDWARE_KEY_SYS
|
#define HARDWARE_KEY_UP
|
||||||
#define HARDWARE_KEY_MODEL
|
#define HARDWARE_KEY_DOWN
|
||||||
#define HARDWARE_KEY_TELE
|
#define HARDWARE_KEY_RIGHT
|
||||||
#define HARDWARE_KEY_EXIT
|
#define HARDWARE_KEY_LEFT
|
||||||
#define KEYS_GPIO_REG_ENTER GPIOE->IDR
|
#define KEYS_GPIO_REG_ENTER GPIOE->IDR
|
||||||
#define KEYS_GPIO_PIN_ENTER GPIO_Pin_10 // PE.10
|
#define KEYS_GPIO_PIN_ENTER GPIO_Pin_10 // PE.10
|
||||||
#elif defined(PCBX7)
|
#elif defined(PCBX7)
|
||||||
|
@ -640,7 +640,7 @@
|
||||||
#define SWITCHES_GPIO_REG_E GPIOG->IDR
|
#define SWITCHES_GPIO_REG_E GPIOG->IDR
|
||||||
#define SWITCHES_GPIO_PIN_E GPIO_Pin_7 // PG.07
|
#define SWITCHES_GPIO_PIN_E GPIO_Pin_7 // PG.07
|
||||||
#elif defined(RADIO_V10)
|
#elif defined(RADIO_V10)
|
||||||
#define STORAGE_SWITCH_E
|
// #define STORAGE_SWITCH_E
|
||||||
// no SWE
|
// no SWE
|
||||||
#elif defined(PCBX7)
|
#elif defined(PCBX7)
|
||||||
// no SWE
|
// no SWE
|
||||||
|
@ -734,7 +734,8 @@
|
||||||
#define SWITCHES_GPIO_REG_G GPIOG->IDR
|
#define SWITCHES_GPIO_REG_G GPIOG->IDR
|
||||||
#define SWITCHES_GPIO_PIN_G GPIO_Pin_5 // PG.05
|
#define SWITCHES_GPIO_PIN_G GPIO_Pin_5 // PG.05
|
||||||
#elif defined(RADIO_V10)
|
#elif defined(RADIO_V10)
|
||||||
#define STORAGE_SWITCH_G
|
// #define STORAGE_SWITCH_G
|
||||||
|
// no SWG
|
||||||
#elif defined(PCBX7) || defined(PCBXLITE) || defined(PCBX9LITE) || defined(RADIO_T8)
|
#elif defined(PCBX7) || defined(PCBXLITE) || defined(PCBX9LITE) || defined(RADIO_T8)
|
||||||
// no SWG
|
// no SWG
|
||||||
#else
|
#else
|
||||||
|
@ -1433,19 +1434,21 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(RADIO_V10)
|
#if defined(RADIO_V10)
|
||||||
#define FUNCTION_LED1_GPIO GPIOC
|
#define FUNCTION_LED4_GPIO GPIOC
|
||||||
#define FUNCTION_LED1_GPIO_PIN LL_GPIO_PIN_4 // PC.04
|
#define FUNCTION_LED4_GPIO_PIN GPIO_Pin_4 // PC.04
|
||||||
#define FUNCTION_LED2_GPIO GPIOA
|
#define FUNCTION_LED3_GPIO GPIOA
|
||||||
#define FUNCTION_LED2_GPIO_PIN LL_GPIO_PIN_7 // PA.07
|
#define FUNCTION_LED3_GPIO_PIN GPIO_Pin_7 // PA.07
|
||||||
#define FUNCTION_LED3_GPIO GPIOE
|
#define FUNCTION_LED2_GPIO GPIOE
|
||||||
#define FUNCTION_LED3_GPIO_PIN LL_GPIO_PIN_15 // PE.01
|
#define FUNCTION_LED2_GPIO_PIN GPIO_Pin_1 // PE.01
|
||||||
#define FUNCTION_LED4_GPIO GPIOA
|
#define FUNCTION_LED1_GPIO GPIOA
|
||||||
#define FUNCTION_LED4_GPIO_PIN LL_GPIO_PIN_15 // PA.15
|
#define FUNCTION_LED1_GPIO_PIN GPIO_Pin_15 // PA.15
|
||||||
|
#define RESET_FUNCTION_LED(gpio, pin) GPIO_SetBits(gpio, pin)
|
||||||
|
#define SET_FUNCTION_LED(gpio, pin) GPIO_ResetBits(gpio, pin)
|
||||||
#elif defined(RADIO_TPRO)
|
#elif defined(RADIO_TPRO)
|
||||||
#define FS_RCC_AHB1Periph RCC_AHB1Periph_GPIOF
|
#define FS_RCC_AHB1Periph RCC_AHB1Periph_GPIOF
|
||||||
#define GPIO_FSLED_GPIO_ON GPIO_SetBits
|
#define RESET_FUNCTION_LED(gpio, pin) GPIO_SetBits(gpio, pin)
|
||||||
#define GPIO_FSLED_GPIO_OFF GPIO_ResetBits
|
#define SET_FUNCTION_LED(gpio, pin) GPIO_ResetBits(gpio, pin)
|
||||||
#define FSLED_GPIO GPIOF
|
#define FSLED_GPIO GPIOF
|
||||||
#define FUNCTION_LED1_GPIO_PIN GPIO_Pin_5
|
#define FUNCTION_LED1_GPIO_PIN GPIO_Pin_5
|
||||||
#define FUNCTION_LED2_GPIO_PIN GPIO_Pin_4
|
#define FUNCTION_LED2_GPIO_PIN GPIO_Pin_4
|
||||||
#define FUNCTION_LED3_GPIO_PIN GPIO_Pin_3
|
#define FUNCTION_LED3_GPIO_PIN GPIO_Pin_3
|
||||||
|
|
|
@ -52,6 +52,26 @@ uint32_t readKeys()
|
||||||
result |= 1 << KEY_SYS;
|
result |= 1 << KEY_SYS;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HARDWARE_KEY_LEFT)
|
||||||
|
if (IS_KEY_PRESSED(LEFT))
|
||||||
|
result |= 1 << KEY_LEFT;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(HARDWARE_KEY_RIGHT)
|
||||||
|
if (IS_KEY_PRESSED(RIGHT))
|
||||||
|
result |= 1 << KEY_RIGHT;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(HARDWARE_KEY_UP)
|
||||||
|
if (IS_KEY_PRESSED(UP))
|
||||||
|
result |= 1 << KEY_UP;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(HARDWARE_KEY_DOWN)
|
||||||
|
if (IS_KEY_PRESSED(DOWN))
|
||||||
|
result |= 1 << KEY_DOWN;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(HARDWARE_KEY_MODEL)
|
#if defined(HARDWARE_KEY_MODEL)
|
||||||
if (IS_KEY_PRESSED(MODEL))
|
if (IS_KEY_PRESSED(MODEL))
|
||||||
result |= 1 << KEY_MODEL;
|
result |= 1 << KEY_MODEL;
|
||||||
|
|
|
@ -43,28 +43,42 @@ void ledInit()
|
||||||
GPIO_Init(LED_BLUE_GPIO, &GPIO_InitStructure);
|
GPIO_Init(LED_BLUE_GPIO, &GPIO_InitStructure);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if FUNCTION_SWITCHES > 0
|
||||||
RCC_AHB1PeriphClockCmd(FS_RCC_AHB1Periph, ENABLE);
|
// TODO RCC_AHB1PeriphClockCmd(FS_RCC_AHB1Periph, ENABLE);
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||||
GPIO_InitStructure.GPIO_Pin = FUNCTION_LED1_GPIO_PIN | FUNCTION_LED2_GPIO_PIN | FUNCTION_LED3_GPIO_PIN | FUNCTION_LED4_GPIO_PIN | FUNCTION_LED5_GPIO_PIN | FUNCTION_LED6_GPIO_PIN;
|
// GPIO_InitStructure.GPIO_Pin = FUNCTION_LED1_GPIO_PIN | FUNCTION_LED2_GPIO_PIN | FUNCTION_LED3_GPIO_PIN | FUNCTION_LED4_GPIO_PIN | FUNCTION_LED5_GPIO_PIN | FUNCTION_LED6_GPIO_PIN;
|
||||||
GPIO_Init(FSLED_GPIO, &GPIO_InitStructure);
|
// GPIO_Init(FSLED_GPIO, &GPIO_InitStructure);
|
||||||
|
GPIO_InitStructure.GPIO_Pin = FUNCTION_LED1_GPIO_PIN;
|
||||||
|
GPIO_Init(FUNCTION_LED1_GPIO, &GPIO_InitStructure);
|
||||||
|
GPIO_InitStructure.GPIO_Pin = FUNCTION_LED2_GPIO_PIN;
|
||||||
|
GPIO_Init(FUNCTION_LED2_GPIO, &GPIO_InitStructure);
|
||||||
|
GPIO_InitStructure.GPIO_Pin = FUNCTION_LED3_GPIO_PIN;
|
||||||
|
GPIO_Init(FUNCTION_LED3_GPIO, &GPIO_InitStructure);
|
||||||
|
GPIO_InitStructure.GPIO_Pin = FUNCTION_LED4_GPIO_PIN;
|
||||||
|
GPIO_Init(FUNCTION_LED4_GPIO, &GPIO_InitStructure);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if FUNCTION_SWITCHES > 0
|
||||||
constexpr uint32_t fsLeds[] = {FUNCTION_LED1_GPIO_PIN, FUNCTION_LED2_GPIO_PIN, FUNCTION_LED3_GPIO_PIN, FUNCTION_LED4_GPIO_PIN, FUNCTION_LED5_GPIO_PIN, FUNCTION_LED6_GPIO_PIN};
|
void writeFunctionLeds(uint8_t mask)
|
||||||
|
{
|
||||||
|
(mask & 0x01) ? SET_FUNCTION_LED(FUNCTION_LED1_GPIO, FUNCTION_LED1_GPIO_PIN) : RESET_FUNCTION_LED(FUNCTION_LED1_GPIO, FUNCTION_LED1_GPIO_PIN);
|
||||||
|
(mask & 0x02) ? SET_FUNCTION_LED(FUNCTION_LED2_GPIO, FUNCTION_LED2_GPIO_PIN) : RESET_FUNCTION_LED(FUNCTION_LED2_GPIO, FUNCTION_LED2_GPIO_PIN);
|
||||||
|
(mask & 0x04) ? SET_FUNCTION_LED(FUNCTION_LED3_GPIO, FUNCTION_LED3_GPIO_PIN) : RESET_FUNCTION_LED(FUNCTION_LED3_GPIO, FUNCTION_LED3_GPIO_PIN);
|
||||||
|
(mask & 0x08) ? SET_FUNCTION_LED(FUNCTION_LED4_GPIO, FUNCTION_LED4_GPIO_PIN) : RESET_FUNCTION_LED(FUNCTION_LED4_GPIO, FUNCTION_LED4_GPIO_PIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
// constexpr uint32_t fsLeds[] = {FUNCTION_LED1_GPIO_PIN, FUNCTION_LED2_GPIO_PIN, FUNCTION_LED3_GPIO_PIN, FUNCTION_LED4_GPIO_PIN, FUNCTION_LED5_GPIO_PIN, FUNCTION_LED6_GPIO_PIN};
|
||||||
|
|
||||||
void fsLedOff(uint8_t index)
|
void fsLedOff(uint8_t index)
|
||||||
{
|
{
|
||||||
GPIO_FSLED_GPIO_OFF(FSLED_GPIO, fsLeds[index]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsLedOn(uint8_t index)
|
void fsLedOn(uint8_t index)
|
||||||
{
|
{
|
||||||
GPIO_FSLED_GPIO_ON(FSLED_GPIO, fsLeds[index]);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -332,10 +332,6 @@ enum Analogs {
|
||||||
#define STICKS_PWM_ENABLED() false
|
#define STICKS_PWM_ENABLED() false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(NUM_FUNCTIONS_SWITCHES)
|
|
||||||
#define NUM_FUNCTIONS_SWITCHES 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
uint8_t pcbrev:4;
|
uint8_t pcbrev:4;
|
||||||
uint8_t sticksPwmDisabled:1;
|
uint8_t sticksPwmDisabled:1;
|
||||||
|
|
|
@ -313,6 +313,9 @@
|
||||||
#elif defined(RADIO_T8)
|
#elif defined(RADIO_T8)
|
||||||
#define LEN_VKEYS "\005"
|
#define LEN_VKEYS "\005"
|
||||||
#define TR_VKEYS "RTN\0 ""ENTER""PGUP\0""PGDN\0""SYS\0 ""MDL\0 ""UP\0 ""DOWN\0"
|
#define TR_VKEYS "RTN\0 ""ENTER""PGUP\0""PGDN\0""SYS\0 ""MDL\0 ""UP\0 ""DOWN\0"
|
||||||
|
#elif defined(RADIO_V10)
|
||||||
|
#define LEN_VKEYS "\005"
|
||||||
|
#define TR_VKEYS "RTN\0 ""MDL\0 ""TELE\0""SYS\0 ""ENTER""PAGE\0"
|
||||||
#elif defined(PCBTARANIS)
|
#elif defined(PCBTARANIS)
|
||||||
#define LEN_VKEYS "\005"
|
#define LEN_VKEYS "\005"
|
||||||
#define TR_VKEYS "Menu\0""Exit\0""Enter""Page\0""Plus\0""Minus"
|
#define TR_VKEYS "Menu\0""Exit\0""Enter""Page\0""Plus\0""Minus"
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
#define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SE\0""\312SF\0""\312SI\0""\312SJ\0"
|
#define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SE\0""\312SF\0""\312SI\0""\312SJ\0"
|
||||||
#elif defined(RADIO_V10)
|
#elif defined(RADIO_V10)
|
||||||
#define TR_POTS_VSRCRAW "\310S1\0""\310S2\0""\310EX1""\310EX2""\311LS\0""\311RS\0"
|
#define TR_POTS_VSRCRAW "\310S1\0""\310S2\0""\310EX1""\310EX2""\311LS\0""\311RS\0"
|
||||||
#define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SF\0""\312SH\0""\312SI\0""\312SJ\0"
|
#define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SF\0""\312SH\0""\312SI\0""\312SJ\0""\312SW1""\312SW2""\312SW3""\312SW4"
|
||||||
#elif defined(PCBX7)
|
#elif defined(PCBX7)
|
||||||
#define TR_POTS_VSRCRAW "\310S1\0""\310S2\0"
|
#define TR_POTS_VSRCRAW "\310S1\0""\310S2\0"
|
||||||
#define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SF\0""\312SH\0""\312SI\0""\312SJ\0"
|
#define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SF\0""\312SH\0""\312SI\0""\312SJ\0"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue