XLite support (#5806)
This commit is contained in:
@@ -1607,7 +1607,7 @@ void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlag
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PWR_PRESS_BUTTON)
|
||||
#if defined(PWR_BUTTON_PRESS)
|
||||
void drawShutdownAnimation(uint32_t index, const char * message)
|
||||
{
|
||||
lcdClear();
|
||||
|
||||
@@ -149,9 +149,11 @@ void menuModelDisplay(event_t event)
|
||||
}
|
||||
}
|
||||
}
|
||||
#if !defined(PCBXLITE)
|
||||
else if (attr) {
|
||||
MOVE_CURSOR_FROM_HERE();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -72,11 +72,6 @@ enum ExposFields {
|
||||
|
||||
void menuModelExpoOne(event_t event)
|
||||
{
|
||||
if (event == EVT_KEY_LONG(KEY_MENU)) {
|
||||
// TODO pushMenu(menuChannelsView);
|
||||
killEvents(event);
|
||||
}
|
||||
|
||||
ExpoData * ed = expoAddress(s_currIdx);
|
||||
drawSource(PSIZE(TR_MENUINPUTS)*FW+FW, 0, MIXSRC_FIRST_INPUT+ed->chn, 0);
|
||||
|
||||
|
||||
@@ -85,11 +85,6 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
|
||||
|
||||
void menuModelMixOne(event_t event)
|
||||
{
|
||||
if (event == EVT_KEY_LONG(KEY_MENU)) {
|
||||
// TODO pushMenu(menuChannelsView);
|
||||
killEvents(event);
|
||||
}
|
||||
|
||||
MixData * md2 = mixAddress(s_currIdx) ;
|
||||
putsChn(PSIZE(TR_MIXER)*FW+FW, 0, md2->destCh+1,0);
|
||||
|
||||
|
||||
@@ -119,6 +119,11 @@ enum MenuModelSetupItems {
|
||||
#endif
|
||||
ITEM_MODEL_TRAINER_CHANNELS,
|
||||
ITEM_MODEL_TRAINER_PARAMS,
|
||||
#elif defined(PCBXLITE)
|
||||
ITEM_MODEL_TRAINER_LABEL,
|
||||
ITEM_MODEL_TRAINER_MODE,
|
||||
ITEM_MODEL_TRAINER_BLUETOOTH,
|
||||
ITEM_MODEL_TRAINER_CHANNELS,
|
||||
#endif
|
||||
ITEM_MODEL_SETUP_MAX
|
||||
};
|
||||
@@ -134,9 +139,7 @@ enum MenuModelSetupItems {
|
||||
#define MODEL_SETUP_RANGE_OFS 4*FW+3
|
||||
#define MODEL_SETUP_SET_FAILSAFE_OFS 7*FW-2
|
||||
|
||||
#if defined(PCBXLITE)
|
||||
#define CURRENT_MODULE_EDITED(k) (k>=ITEM_MODEL_EXTERNAL_MODULE_LABEL ? EXTERNAL_MODULE : INTERNAL_MODULE)
|
||||
#elif defined(PCBX7)
|
||||
#if defined(PCBTARANIS)
|
||||
#define CURRENT_MODULE_EDITED(k) (k>=ITEM_MODEL_TRAINER_LABEL ? TRAINER_MODULE : (k>=ITEM_MODEL_EXTERNAL_MODULE_LABEL ? EXTERNAL_MODULE : INTERNAL_MODULE))
|
||||
#elif defined(PCBSKY9X) && !defined(REVA)
|
||||
#define CURRENT_MODULE_EDITED(k) (k>=ITEM_MODEL_EXTRA_MODULE_LABEL ? EXTRA_MODULE : EXTERNAL_MODULE)
|
||||
@@ -186,6 +189,13 @@ enum MenuModelSetupItems {
|
||||
#define TRAINER_CHANNELS_ROW (IS_SLAVE_TRAINER() ? (uint8_t)1 : HIDDEN_ROW)
|
||||
#define TRAINER_PARAMS_ROW (IS_SLAVE_TRAINER() ? (uint8_t)2 : HIDDEN_ROW)
|
||||
#define TRAINER_ROWS LABEL(Trainer), 0, TRAINER_BLUETOOTH_ROW TRAINER_CHANNELS_ROW, TRAINER_PARAMS_ROW
|
||||
#elif defined(PCBXLITE)
|
||||
#define IF_BT_TRAINER_ON(x) (g_eeGeneral.bluetoothMode == BLUETOOTH_TRAINER ? (uint8_t)(x) : HIDDEN_ROW)
|
||||
#define TRAINER_BLUETOOTH_M_ROW ((bluetoothDistantAddr[0] == '\0' || bluetoothState == BLUETOOTH_STATE_CONNECTED) ? (uint8_t)0 : (uint8_t)1)
|
||||
#define TRAINER_BLUETOOTH_S_ROW (bluetoothDistantAddr[0] == '\0' ? HIDDEN_ROW : LABEL())
|
||||
#define TRAINER_BLUETOOTH_ROW (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH ? TRAINER_BLUETOOTH_M_ROW : (g_model.trainerMode == TRAINER_MODE_SLAVE_BLUETOOTH ? TRAINER_BLUETOOTH_S_ROW : HIDDEN_ROW))
|
||||
#define TRAINER_CHANNELS_ROW (IS_SLAVE_TRAINER() ? (uint8_t)1 : HIDDEN_ROW)
|
||||
#define TRAINER_ROWS IF_BT_TRAINER_ON(LABEL(Trainer)), IF_BT_TRAINER_ON(0), IF_BT_TRAINER_ON(TRAINER_BLUETOOTH_ROW), IF_BT_TRAINER_ON(TRAINER_CHANNELS_ROW)
|
||||
#else
|
||||
#define TRAINER_ROWS
|
||||
#endif
|
||||
@@ -261,16 +271,35 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(PCBXLITE)
|
||||
MENU_TAB({ HEADER_LINE_COLUMNS 0, TIMER_ROWS, TIMER_ROWS, TIMER_ROWS, 0, 1, 0, 0, 0, 0, 0, CASE_CPUARM(LABEL(PreflightCheck)) CASE_CPUARM(0) 0, SW_WARN_ROWS, NUM_POTS, NUM_STICKS + NUM_POTS + NUM_SLIDERS + NUM_ROTARY_ENCODERS - 1, 0,
|
||||
LABEL(InternalModule),
|
||||
INTERNAL_MODULE_MODE_ROWS,
|
||||
INTERNAL_MODULE_CHANNELS_ROWS,
|
||||
IF_INTERNAL_MODULE_ON(HAS_RF_PROTOCOL_MODELINDEX(g_model.moduleData[INTERNAL_MODULE].rfProtocol) ? (uint8_t)2 : (uint8_t)1),
|
||||
IF_INTERNAL_MODULE_ON(FAILSAFE_ROWS(INTERNAL_MODULE)),
|
||||
IF_INTERNAL_MODULE_ON(0),
|
||||
LABEL(ExternalModule),
|
||||
EXTERNAL_MODULE_MODE_ROWS,
|
||||
MULTIMODULE_SUBTYPE_ROWS(EXTERNAL_MODULE)
|
||||
MULTIMODULE_STATUS_ROWS
|
||||
EXTERNAL_MODULE_CHANNELS_ROWS,
|
||||
EXTERNAL_MODULE_BIND_ROWS(),
|
||||
OUTPUT_TYPE_ROWS()
|
||||
FAILSAFE_ROWS(EXTERNAL_MODULE),
|
||||
EXTERNAL_MODULE_OPTION_ROW,
|
||||
(IS_MODULE_R9M_LBT(EXTERNAL_MODULE) ? (uint8_t)0 : HIDDEN_ROW),
|
||||
MULTIMODULE_MODULE_ROWS
|
||||
EXTERNAL_MODULE_POWER_ROW,
|
||||
EXTRA_MODULE_ROWS
|
||||
TRAINER_ROWS });
|
||||
#elif defined(PCBTARANIS)
|
||||
MENU_TAB({ HEADER_LINE_COLUMNS 0, TIMER_ROWS, TIMER_ROWS, TIMER_ROWS, 0, 1, 0, 0, 0, 0, 0, CASE_CPUARM(LABEL(PreflightCheck)) CASE_CPUARM(0) 0, SW_WARN_ROWS, NUM_POTS, NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_ROTARY_ENCODERS-1, 0,
|
||||
LABEL(InternalModule),
|
||||
INTERNAL_MODULE_MODE_ROWS,
|
||||
INTERNAL_MODULE_CHANNELS_ROWS,
|
||||
IF_INTERNAL_MODULE_ON(HAS_RF_PROTOCOL_MODELINDEX(g_model.moduleData[INTERNAL_MODULE].rfProtocol) ? (uint8_t)2 : (uint8_t)1),
|
||||
IF_INTERNAL_MODULE_ON(FAILSAFE_ROWS(INTERNAL_MODULE)),
|
||||
#if defined(PCBXLITE)
|
||||
IF_INTERNAL_MODULE_ON(0),
|
||||
#endif
|
||||
LABEL(ExternalModule),
|
||||
EXTERNAL_MODULE_MODE_ROWS,
|
||||
MULTIMODULE_SUBTYPE_ROWS(EXTERNAL_MODULE)
|
||||
@@ -581,10 +610,17 @@ void menuModelSetup(event_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
lcdDrawTextAlignedLeft(y, STR_SWITCHWARNING);
|
||||
swarnstate_t states = g_model.switchWarningState;
|
||||
char c;
|
||||
|
||||
lcdDrawTextAlignedLeft(y, STR_SWITCHWARNING);
|
||||
#if defined(PCBXLITE)
|
||||
lcdDrawText(LCD_W, y, "<]", RIGHT);
|
||||
if (menuHorizontalPosition > NUM_SWITCHES) menuHorizontalPosition = NUM_SWITCHES;
|
||||
if ((attr) && (menuHorizontalPosition == NUM_SWITCHES)) {
|
||||
#else
|
||||
if (attr) {
|
||||
#endif
|
||||
s_editMode = 0;
|
||||
if (!READ_ONLY()) {
|
||||
switch (event) {
|
||||
@@ -592,7 +628,7 @@ void menuModelSetup(event_t event)
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
if (menuHorizontalPosition < 0) {
|
||||
if (menuHorizontalPosition < 0 || menuHorizontalPosition >= NUM_SWITCHES) {
|
||||
START_NO_HIGHLIGHT();
|
||||
getMovedSwitch();
|
||||
g_model.switchWarningState = switches_states;
|
||||
@@ -624,7 +660,7 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
states >>= 2;
|
||||
}
|
||||
if (attr && menuHorizontalPosition < 0) {
|
||||
if (attr && ((menuHorizontalPosition < 0) || menuHorizontalPosition >= NUM_SWITCHES)) {
|
||||
lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, 8*(2*FW+1), 1+FH*((current+4)/5));
|
||||
}
|
||||
#else
|
||||
@@ -907,7 +943,7 @@ void menuModelSetup(event_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBTARANIS)
|
||||
case ITEM_MODEL_TRAINER_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, STR_TRAINER);
|
||||
break;
|
||||
@@ -927,7 +963,7 @@ void menuModelSetup(event_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PCBX7) && defined(BLUETOOTH)
|
||||
#if defined(PCBTARANIS) && defined(BLUETOOTH)
|
||||
case ITEM_MODEL_TRAINER_BLUETOOTH:
|
||||
if (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH) {
|
||||
if (attr) {
|
||||
@@ -976,10 +1012,8 @@ void menuModelSetup(event_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PCBX7)
|
||||
case ITEM_MODEL_TRAINER_CHANNELS:
|
||||
#endif
|
||||
#if defined(PCBTARANIS)
|
||||
case ITEM_MODEL_TRAINER_CHANNELS:
|
||||
case ITEM_MODEL_INTERNAL_MODULE_CHANNELS:
|
||||
#endif
|
||||
#if defined(PCBSKY9X)
|
||||
@@ -1595,6 +1629,6 @@ void menuModelFailsafe(event_t event)
|
||||
if (menuVerticalPosition >= NUM_CHANNELS(g_moduleIdx)) {
|
||||
// Outputs => Failsafe
|
||||
lcdDrawText(CENTER_OFS, LCD_H - (FH + 1), STR_OUTPUTS2FAILSAFE, INVERS);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,16 @@ int8_t p2valdiff;
|
||||
|
||||
int8_t checkIncDec_Ret;
|
||||
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBXLITE)
|
||||
// invert the value
|
||||
#define DBLKEYS_PRESSED_RGT_LFT(in) ((in & ((1<<KEY_SHIFT) + (1<<KEY_UP))) == ((1<<KEY_SHIFT) + (1<<KEY_UP)))
|
||||
// set to 0
|
||||
#define DBLKEYS_PRESSED_UP_DWN(in) ((in & ((1<<KEY_SHIFT) + (1<<KEY_DOWN))) == ((1<<KEY_SHIFT) + (1<<KEY_DOWN)))
|
||||
// set to max
|
||||
#define DBLKEYS_PRESSED_RGT_UP(in) ((in & ((1<<KEY_SHIFT) + (1<<KEY_RIGHT))) == ((1<<KEY_SHIFT) + (1<<KEY_RIGHT)))
|
||||
// set to min
|
||||
#define DBLKEYS_PRESSED_LFT_DWN(in) ((in & ((1<<KEY_SHIFT) + (1<<KEY_LEFT))) == ((1<<KEY_SHIFT) + (1<<KEY_LEFT)))
|
||||
#elif defined(PCBX7)
|
||||
#define DBLKEYS_PRESSED_RGT_LFT(in) (false)
|
||||
#define DBLKEYS_PRESSED_UP_DWN(in) (false)
|
||||
#define DBLKEYS_PRESSED_RGT_UP(in) (false)
|
||||
@@ -54,7 +63,7 @@ INIT_STOPS(stops100, 3, -100, 0, 100)
|
||||
INIT_STOPS(stops1000, 3, -1000, 0, 1000)
|
||||
INIT_STOPS(stopsSwitch, 15, SWSRC_FIRST, CATEGORY_END(-SWSRC_FIRST_LOGICAL_SWITCH), CATEGORY_END(-SWSRC_FIRST_TRIM), CATEGORY_END(-SWSRC_LAST_SWITCH+1), 0, CATEGORY_END(SWSRC_LAST_SWITCH), CATEGORY_END(SWSRC_FIRST_TRIM-1), CATEGORY_END(SWSRC_FIRST_LOGICAL_SWITCH-1), SWSRC_LAST)
|
||||
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBTARANIS)
|
||||
int checkIncDecSelection = 0;
|
||||
|
||||
void onSourceLongEnterPress(const char * result)
|
||||
@@ -107,7 +116,9 @@ void onSwitchLongEnterPress(const char * result)
|
||||
else if (result == STR_MENU_INVERT)
|
||||
checkIncDecSelection = SWSRC_INVERT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBX7)
|
||||
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;
|
||||
@@ -332,33 +343,45 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
|
||||
}
|
||||
#endif
|
||||
|
||||
if (event==EVT_KEY_FIRST(KEY_RIGHT) || event==EVT_KEY_REPT(KEY_RIGHT) || (s_editMode>0 && (IS_ROTARY_RIGHT(event) || event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_UP)))) {
|
||||
do {
|
||||
newval++;
|
||||
} while (isValueAvailable && !isValueAvailable(newval) && newval<=i_max);
|
||||
#if defined(PCBXLITE)
|
||||
if (s_editMode > 0) {
|
||||
if (event==EVT_KEY_FIRST(KEY_RIGHT) || event==EVT_KEY_REPT(KEY_RIGHT)) {
|
||||
#else
|
||||
if (event==EVT_KEY_FIRST(KEY_RIGHT) || event==EVT_KEY_REPT(KEY_RIGHT) || (s_editMode>0 && (IS_ROTARY_RIGHT(event) || event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_UP)))) {
|
||||
#endif
|
||||
do {
|
||||
newval++;
|
||||
} while (isValueAvailable && !isValueAvailable(newval) && newval<=i_max);
|
||||
|
||||
if (newval > i_max) {
|
||||
newval = val;
|
||||
killEvents(event);
|
||||
AUDIO_KEY_ERROR();
|
||||
if (newval > i_max) {
|
||||
newval = val;
|
||||
killEvents(event);
|
||||
AUDIO_KEY_ERROR();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (event==EVT_KEY_FIRST(KEY_LEFT) || event==EVT_KEY_REPT(KEY_LEFT) || (s_editMode>0 && (IS_ROTARY_LEFT(event) || event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_REPT(KEY_DOWN)))) {
|
||||
do {
|
||||
if (IS_KEY_REPT(event) && (i_flags & INCDEC_REP10)) {
|
||||
newval -= min(10, val-i_min);
|
||||
}
|
||||
else {
|
||||
newval--;
|
||||
}
|
||||
} while (isValueAvailable && !isValueAvailable(newval) && newval>=i_min);
|
||||
#if defined(PCBXLITE)
|
||||
else if (event==EVT_KEY_FIRST(KEY_LEFT) || event==EVT_KEY_REPT(KEY_LEFT)) {
|
||||
#else
|
||||
else if (event==EVT_KEY_FIRST(KEY_LEFT) || event==EVT_KEY_REPT(KEY_LEFT) || (s_editMode>0 && (IS_ROTARY_LEFT(event) || event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_REPT(KEY_DOWN)))) {
|
||||
#endif
|
||||
do {
|
||||
if (IS_KEY_REPT(event) && (i_flags & INCDEC_REP10)) {
|
||||
newval -= min(10, val-i_min);
|
||||
}
|
||||
else {
|
||||
newval--;
|
||||
}
|
||||
} while (isValueAvailable && !isValueAvailable(newval) && newval>=i_min);
|
||||
|
||||
if (newval < i_min) {
|
||||
newval = val;
|
||||
killEvents(event);
|
||||
AUDIO_KEY_ERROR();
|
||||
if (newval < i_min) {
|
||||
newval = val;
|
||||
killEvents(event);
|
||||
AUDIO_KEY_ERROR();
|
||||
}
|
||||
}
|
||||
#if defined(PCBXLITE)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!READ_ONLY() && i_min==0 && i_max==1 && (event==EVT_KEY_BREAK(KEY_ENTER) || IS_ROTARY_BREAK(event))) {
|
||||
s_editMode = 0;
|
||||
@@ -407,6 +430,83 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
|
||||
else {
|
||||
checkIncDec_Ret = 0;
|
||||
}
|
||||
|
||||
#if defined(PCBXLITE)
|
||||
if (i_flags & INCDEC_SOURCE) {
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
checkIncDecSelection = MIXSRC_NONE;
|
||||
|
||||
if (i_min <= MIXSRC_FIRST_INPUT && i_max >= MIXSRC_FIRST_INPUT) {
|
||||
if (getFirstAvailable(MIXSRC_FIRST_INPUT, MIXSRC_LAST_INPUT, isInputAvailable) != MIXSRC_NONE) {
|
||||
POPUP_MENU_ADD_ITEM(STR_MENU_INPUTS);
|
||||
}
|
||||
}
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
if (i_min <= MIXSRC_FIRST_LUA && i_max >= MIXSRC_FIRST_LUA) {
|
||||
if (getFirstAvailable(MIXSRC_FIRST_LUA, MIXSRC_LAST_LUA, isSourceAvailable) != MIXSRC_NONE) {
|
||||
POPUP_MENU_ADD_ITEM(STR_MENU_LUA);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (i_min <= MIXSRC_FIRST_STICK && i_max >= MIXSRC_FIRST_STICK) POPUP_MENU_ADD_ITEM(STR_MENU_STICKS);
|
||||
if (i_min <= MIXSRC_FIRST_POT && i_max >= MIXSRC_FIRST_POT) POPUP_MENU_ADD_ITEM(STR_MENU_POTS);
|
||||
if (i_min <= MIXSRC_MAX && i_max >= MIXSRC_MAX) POPUP_MENU_ADD_ITEM(STR_MENU_MAX);
|
||||
#if defined(HELI)
|
||||
if (i_min <= MIXSRC_FIRST_HELI && i_max >= MIXSRC_FIRST_HELI) POPUP_MENU_ADD_ITEM(STR_MENU_HELI);
|
||||
#endif
|
||||
if (i_min <= MIXSRC_FIRST_TRIM && i_max >= MIXSRC_FIRST_TRIM) POPUP_MENU_ADD_ITEM(STR_MENU_TRIMS);
|
||||
if (i_min <= MIXSRC_FIRST_SWITCH && i_max >= MIXSRC_FIRST_SWITCH) POPUP_MENU_ADD_ITEM(STR_MENU_SWITCHES);
|
||||
if (i_min <= MIXSRC_FIRST_TRAINER && i_max >= MIXSRC_FIRST_TRAINER) POPUP_MENU_ADD_ITEM(STR_MENU_TRAINER);
|
||||
if (i_min <= MIXSRC_FIRST_CH && i_max >= MIXSRC_FIRST_CH) POPUP_MENU_ADD_ITEM(STR_MENU_CHANNELS);
|
||||
if (i_min <= MIXSRC_FIRST_GVAR && i_max >= MIXSRC_FIRST_GVAR && isValueAvailable(MIXSRC_FIRST_GVAR)) {
|
||||
POPUP_MENU_ADD_ITEM(STR_MENU_GVARS);
|
||||
}
|
||||
|
||||
if (i_min <= MIXSRC_FIRST_TELEM && i_max >= MIXSRC_FIRST_TELEM) {
|
||||
for (int i = 0; i < MAX_TELEMETRY_SENSORS; i++) {
|
||||
TelemetrySensor * sensor = & g_model.telemetrySensors[i];
|
||||
if (sensor->isAvailable()) {
|
||||
POPUP_MENU_ADD_ITEM(STR_MENU_TELEMETRY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
POPUP_MENU_START(onSourceLongEnterPress);
|
||||
}
|
||||
if (checkIncDecSelection != 0) {
|
||||
newval = checkIncDecSelection;
|
||||
if (checkIncDecSelection != MIXSRC_MAX)
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
checkIncDecSelection = 0;
|
||||
}
|
||||
}
|
||||
else if (i_flags & INCDEC_SWITCH) {
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
checkIncDecSelection = SWSRC_NONE;
|
||||
if (i_min <= SWSRC_FIRST_SWITCH && i_max >= SWSRC_LAST_SWITCH) POPUP_MENU_ADD_ITEM(STR_MENU_SWITCHES);
|
||||
if (i_min <= SWSRC_FIRST_TRIM && i_max >= SWSRC_LAST_TRIM) POPUP_MENU_ADD_ITEM(STR_MENU_TRIMS);
|
||||
if (i_min <= SWSRC_FIRST_LOGICAL_SWITCH && i_max >= SWSRC_LAST_LOGICAL_SWITCH) {
|
||||
for (int i = 0; i < MAX_LOGICAL_SWITCHES; i++) {
|
||||
if (isValueAvailable && isValueAvailable(SWSRC_FIRST_LOGICAL_SWITCH+i)) {
|
||||
POPUP_MENU_ADD_ITEM(STR_MENU_LOGICAL_SWITCHES);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isValueAvailable && isValueAvailable(SWSRC_ON)) POPUP_MENU_ADD_ITEM(STR_MENU_OTHER);
|
||||
if (isValueAvailable && isValueAvailable(-newval)) POPUP_MENU_ADD_ITEM(STR_MENU_INVERT);
|
||||
POPUP_MENU_START(onSwitchLongEnterPress);
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
}
|
||||
if (checkIncDecSelection != 0) {
|
||||
newval = (checkIncDecSelection == SWSRC_INVERT ? -newval : checkIncDecSelection);
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
checkIncDecSelection = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return newval;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -41,13 +41,44 @@ void menuCommonCalib(event_t event)
|
||||
if (IS_POT_WITHOUT_DETENT(i)) {
|
||||
reusableBuffer.calib.midVals[i] = (reusableBuffer.calib.hiVals[i] + reusableBuffer.calib.loVals[i]) / 2;
|
||||
}
|
||||
#if defined(PCBTARANIS)
|
||||
uint8_t idx = i - POT1;
|
||||
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
|
||||
if (IS_POT_MULTIPOS(i) && count <= XPOTS_MULTIPOS_COUNT) {
|
||||
// use raw analog value for multipos calibraton, anaIn() already has multipos decoded value
|
||||
vt = getAnalogValue(i) >> 1;
|
||||
if (reusableBuffer.calib.xpotsCalib[idx].lastCount == 0 || vt < reusableBuffer.calib.xpotsCalib[idx].lastPosition - XPOT_DELTA || vt > reusableBuffer.calib.xpotsCalib[idx].lastPosition + XPOT_DELTA) {
|
||||
reusableBuffer.calib.xpotsCalib[idx].lastPosition = vt;
|
||||
reusableBuffer.calib.xpotsCalib[idx].lastCount = 1;
|
||||
}
|
||||
else {
|
||||
if (reusableBuffer.calib.xpotsCalib[idx].lastCount < 255) reusableBuffer.calib.xpotsCalib[idx].lastCount++;
|
||||
}
|
||||
if (reusableBuffer.calib.xpotsCalib[idx].lastCount == XPOT_DELAY) {
|
||||
int16_t position = reusableBuffer.calib.xpotsCalib[idx].lastPosition;
|
||||
bool found = false;
|
||||
for (int j=0; j<count; j++) {
|
||||
int16_t step = reusableBuffer.calib.xpotsCalib[idx].steps[j];
|
||||
if (position >= step-XPOT_DELTA && position <= step+XPOT_DELTA) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (count < XPOTS_MULTIPOS_COUNT) {
|
||||
reusableBuffer.calib.xpotsCalib[idx].steps[count] = position;
|
||||
}
|
||||
reusableBuffer.calib.xpotsCalib[idx].stepsCount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
menuCalibrationState = reusableBuffer.calib.state; // make sure we don't scroll while calibrating
|
||||
|
||||
switch (event)
|
||||
{
|
||||
switch (event) {
|
||||
case EVT_ENTRY:
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
reusableBuffer.calib.state = CALIB_START;
|
||||
@@ -70,11 +101,18 @@ void menuCommonCalib(event_t event)
|
||||
// SET MIDPOINT
|
||||
lcdDrawText(0*FW, MENU_HEADER_HEIGHT+FH, STR_SETMIDPOINT, INVERS);
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE);
|
||||
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) {
|
||||
reusableBuffer.calib.loVals[i] = 15000;
|
||||
reusableBuffer.calib.hiVals[i] = -15000;
|
||||
#if defined(PCBTARANIS)
|
||||
reusableBuffer.calib.midVals[i] = getAnalogValue(i) >> 1;
|
||||
if (i<NUM_XPOTS) {
|
||||
reusableBuffer.calib.xpotsCalib[i].stepsCount = 0;
|
||||
reusableBuffer.calib.xpotsCalib[i].lastCount = 0;
|
||||
}
|
||||
#else
|
||||
reusableBuffer.calib.midVals[i] = anaIn(i);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -83,7 +121,6 @@ void menuCommonCalib(event_t event)
|
||||
STICK_SCROLL_DISABLE();
|
||||
lcdDrawText(0*FW, MENU_HEADER_HEIGHT+FH, STR_MOVESTICKSPOTS, INVERS);
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE);
|
||||
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) {
|
||||
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i]) > 50) {
|
||||
g_eeGeneral.calib[i].mid = reusableBuffer.calib.midVals[i];
|
||||
@@ -96,6 +133,31 @@ void menuCommonCalib(event_t event)
|
||||
break;
|
||||
|
||||
case CALIB_STORE:
|
||||
#if defined(PCBTARANIS)
|
||||
for (uint8_t i=POT1; i<=POT_LAST; i++) {
|
||||
int idx = i - POT1;
|
||||
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
|
||||
if (IS_POT_MULTIPOS(i)) {
|
||||
if (count > 1 && count <= XPOTS_MULTIPOS_COUNT) {
|
||||
for (int j=0; j<count; j++) {
|
||||
for (int k=j+1; k<count; k++) {
|
||||
if (reusableBuffer.calib.xpotsCalib[idx].steps[k] < reusableBuffer.calib.xpotsCalib[idx].steps[j]) {
|
||||
SWAP(reusableBuffer.calib.xpotsCalib[idx].steps[j], reusableBuffer.calib.xpotsCalib[idx].steps[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[i];
|
||||
calib->count = count - 1;
|
||||
for (int j=0; j<calib->count; j++) {
|
||||
calib->steps[j] = (reusableBuffer.calib.xpotsCalib[idx].steps[j+1] + reusableBuffer.calib.xpotsCalib[idx].steps[j]) >> 5;
|
||||
}
|
||||
}
|
||||
else {
|
||||
g_eeGeneral.potsConfig &= ~(0x03<<(2*idx));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
g_eeGeneral.chkSum = evalChkSum();
|
||||
storageDirty(EE_GENERAL);
|
||||
reusableBuffer.calib.state = CALIB_FINISHED;
|
||||
|
||||
@@ -43,7 +43,7 @@ void menuRadioDiagKeys(event_t event)
|
||||
for (uint8_t i=0; i<9; i++) {
|
||||
coord_t y;
|
||||
|
||||
if (i < 8) {
|
||||
if (i < NUM_TRIMS_KEYS) {
|
||||
y = MENU_HEADER_HEIGHT + FH*3 + FH*(i/2);
|
||||
if (i&1) lcdDraw1bitBitmap(14*FW, y, sticks, i/2, 0);
|
||||
displayKeyState(i&1? 20*FW : 18*FW, y, TRM_BASE+i);
|
||||
@@ -60,7 +60,7 @@ void menuRadioDiagKeys(event_t event)
|
||||
#elif defined(PCBXLITE)
|
||||
y = MENU_HEADER_HEIGHT + FH*i;
|
||||
lcdDrawTextAtIndex(0, y, STR_VKEYS, (TRM_BASE-1-i), 0);
|
||||
displayKeyState(5*FW+2, y, KEY_MENU+(TRM_BASE-1-i));
|
||||
displayKeyState(5*FW+2, y, KEY_SHIFT+(TRM_BASE-1-i));
|
||||
#else
|
||||
y = MENU_HEADER_HEIGHT + FH + FH*i;
|
||||
lcdDrawTextAtIndex(0, y, STR_VKEYS, (TRM_BASE-1-i), 0);
|
||||
|
||||
@@ -134,7 +134,7 @@ enum MenuRadioHardwareItems {
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define BLUETOOTH_ROWS uint8_t(btChipPresent ? 0 : HIDDEN_ROW), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_TELEMETRY ? -1 : HIDDEN_ROW), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : 0),
|
||||
#define BLUETOOTH_ROWS uint8_t(IS_BLUETOOTH_CHIP_PRESENT() ? 0 : HIDDEN_ROW), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_TELEMETRY ? -1 : HIDDEN_ROW), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : 0),
|
||||
#elif defined(BLUETOOTH)
|
||||
#define BLUETOOTH_ROWS 0, uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : 0),
|
||||
#else
|
||||
@@ -151,7 +151,7 @@ enum MenuRadioHardwareItems {
|
||||
|
||||
void menuRadioHardware(event_t event)
|
||||
{
|
||||
MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, HEADER_LINE+ITEM_RADIO_HARDWARE_MAX, { HEADER_LINE_COLUMNS LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, 0, BLUETOOTH_ROWS 0 });
|
||||
MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, HEADER_LINE+ITEM_RADIO_HARDWARE_MAX, { HEADER_LINE_COLUMNS LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, 0/*max bauds*/, BLUETOOTH_ROWS 0/*jitter filter*/ });
|
||||
|
||||
uint8_t sub = menuVerticalPosition - HEADER_LINE;
|
||||
|
||||
@@ -159,7 +159,7 @@ void menuRadioHardware(event_t event)
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j] == HIDDEN_ROW)
|
||||
if (mstate_tab[j+HEADER_LINE] == HIDDEN_ROW)
|
||||
k++;
|
||||
}
|
||||
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
@@ -248,7 +248,7 @@ void menuRadioHardware(event_t event)
|
||||
case ITEM_RADIO_HARDWARE_BLUETOOTH_MODE:
|
||||
lcdDrawTextAlignedLeft(y, STR_BLUETOOTH);
|
||||
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN2, y, STR_BLUETOOTH_MODES, g_eeGeneral.bluetoothMode, attr);
|
||||
if ((g_eeGeneral.bluetoothMode != BLUETOOTH_OFF) && !btChipPresent) {
|
||||
if (g_eeGeneral.bluetoothMode != BLUETOOTH_OFF && !IS_BLUETOOTH_CHIP_PRESENT()) {
|
||||
g_eeGeneral.bluetoothMode = BLUETOOTH_OFF;
|
||||
}
|
||||
if (attr) {
|
||||
@@ -278,11 +278,8 @@ void menuRadioHardware(event_t event)
|
||||
#endif
|
||||
|
||||
case ITEM_RADIO_HARDWARE_JITTER_FILTER:
|
||||
{
|
||||
uint8_t b = 1-g_eeGeneral.jitterFilter;
|
||||
g_eeGeneral.jitterFilter = 1 - editCheckBox(b, HW_SETTINGS_COLUMN2, y, STR_JITTER_FILTER, attr, event);
|
||||
g_eeGeneral.jitterFilter = 1 - editCheckBox(1 - g_eeGeneral.jitterFilter, HW_SETTINGS_COLUMN2, y, STR_JITTER_FILTER, attr, event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,17 @@ void menuRadioVersion(event_t event)
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+6*FH+1, STR_FACTORYRESET);
|
||||
lcdDrawFilledRect(0, MENU_HEADER_HEIGHT+5*FH, LCD_W, 2*FH+1, SOLID);
|
||||
|
||||
#if defined(PCBXLITE)
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(KEY_ENTER);
|
||||
if (IS_SHIFT_PRESSED()) {
|
||||
POPUP_CONFIRMATION(STR_CONFIRMRESET);
|
||||
}
|
||||
else {
|
||||
eepromBackup();
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
eepromBackup();
|
||||
}
|
||||
@@ -55,4 +66,5 @@ void menuRadioVersion(event_t event)
|
||||
POPUP_CONFIRMATION(STR_CONFIRMRESET);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -247,6 +247,16 @@ void displayVoltageOrAlarm()
|
||||
#define EVT_KEY_MODEL_MENU EVT_KEY_BREAK(KEY_MENU)
|
||||
#define EVT_KEY_GENERAL_MENU EVT_KEY_LONG(KEY_MENU)
|
||||
#define EVT_KEY_TELEMETRY EVT_KEY_LONG(KEY_PAGE)
|
||||
#elif defined(PCBXLITE)
|
||||
#define EVT_KEY_CONTEXT_MENU EVT_KEY_LONG(KEY_ENTER)
|
||||
#define EVT_KEY_PREVIOUS_VIEW EVT_KEY_BREAK(KEY_UP)
|
||||
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_DOWN)
|
||||
#define EVT_KEY_NEXT_PAGE EVT_KEY_BREAK(KEY_RIGHT)
|
||||
#define EVT_KEY_PREVIOUS_PAGE EVT_KEY_BREAK(KEY_LEFT)
|
||||
#define EVT_KEY_MODEL_MENU EVT_KEY_LONG(KEY_RIGHT)
|
||||
#define EVT_KEY_GENERAL_MENU EVT_KEY_LONG(KEY_LEFT)
|
||||
#define EVT_KEY_TELEMETRY EVT_KEY_LONG(KEY_DOWN)
|
||||
#define EVT_KEY_STATISTICS EVT_KEY_LONG(KEY_UP)
|
||||
#else
|
||||
#define EVT_KEY_CONTEXT_MENU EVT_KEY_BREAK(KEY_MENU)
|
||||
#define EVT_KEY_PREVIOUS_VIEW EVT_KEY_BREAK(KEY_UP)
|
||||
|
||||
@@ -48,7 +48,9 @@ void menuStatisticsView(event_t event)
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case EVT_KEY_LONG(KEY_MENU): // historical
|
||||
#if !defined(PCBTARANIS)
|
||||
case EVT_KEY_LONG(KEY_MENU): // historical
|
||||
#endif
|
||||
#if !defined(PCBSKY9X)
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
#endif
|
||||
@@ -309,8 +311,10 @@ void menuStatisticsDebug2(event_t event)
|
||||
lcdDrawTextAlignedLeft(MENU_DEBUG_ROW1, "Tlm RX Err");
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW1, telemetryErrors, RIGHT);
|
||||
|
||||
#if defined(PCBX7)
|
||||
lcdDrawTextAlignedLeft(MENU_DEBUG_ROW2, "BT status");
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW2, btChipPresent, RIGHT);
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW2, IS_BLUETOOTH_CHIP_PRESENT(), RIGHT);
|
||||
#endif
|
||||
|
||||
lcdDrawText(4*FW, 7*FH+1, STR_MENUTORESET);
|
||||
lcdInvertLastLine();
|
||||
|
||||
@@ -200,7 +200,7 @@ void menuRadioSdManager(event_t _event)
|
||||
menuVerticalOffset = reusableBuffer.sdmanager.offset;
|
||||
break;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(PCBX9) || defined(PCBX7) // TODO NO_MENU_KEY
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
if (!READ_ONLY() && s_editMode == 0) {
|
||||
killEvents(_event);
|
||||
@@ -237,7 +237,7 @@ void menuRadioSdManager(event_t _event)
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
#if !defined(PCBTARANIS)
|
||||
#if !defined(PCBX9) && !defined(PCBX7) // TODO NO_HEADER_LINE
|
||||
if (menuVerticalPosition < HEADER_LINE) {
|
||||
killEvents(_event);
|
||||
POPUP_MENU_ADD_ITEM(STR_SD_INFO);
|
||||
|
||||
@@ -104,7 +104,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
||||
s_editMode = 0;
|
||||
break;
|
||||
|
||||
#if !defined(PCBTARANIS)
|
||||
#if defined(PCBXLITE) || !defined(PCBTARANIS)
|
||||
case EVT_KEY_BREAK(KEY_LEFT):
|
||||
if (cur>0) cur--;
|
||||
break;
|
||||
@@ -114,7 +114,9 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(PCBXLITE)
|
||||
case EVT_KEY_BREAK(KEY_SHIFT):
|
||||
#elif defined(PCBTARANIS)
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
#else
|
||||
case EVT_KEY_LONG(KEY_LEFT):
|
||||
@@ -122,7 +124,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
||||
#endif
|
||||
|
||||
if (attr & ZCHAR) {
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(PCBTARANIS) && !defined(PCBXLITE)
|
||||
if (v == 0) {
|
||||
s_editMode = 0;
|
||||
killEvents(event);
|
||||
@@ -133,12 +135,15 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
||||
}
|
||||
}
|
||||
else {
|
||||
#if !defined(PCBXLITE)
|
||||
if (v == ' ') {
|
||||
s_editMode = 0;
|
||||
killEvents(event);
|
||||
break;
|
||||
}
|
||||
else if (v >= 'A' && v <= 'Z') {
|
||||
else
|
||||
#endif
|
||||
if (v >= 'A' && v <= 'Z') {
|
||||
v = 'a' + v - 'A'; // toggle case
|
||||
}
|
||||
else if (v >= 'a' && v <= 'z') {
|
||||
|
||||
@@ -594,6 +594,14 @@ bool isTrainerModeAvailable(int mode)
|
||||
else
|
||||
return true;
|
||||
}
|
||||
#elif defined(PCBXLITE)
|
||||
bool isTrainerModeAvailable(int mode)
|
||||
{
|
||||
if (g_eeGeneral.bluetoothMode == BLUETOOTH_TRAINER && (mode == TRAINER_MODE_MASTER_BLUETOOTH || mode == TRAINER_MODE_SLAVE_BLUETOOTH))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool modelHasNotes()
|
||||
|
||||
Reference in New Issue
Block a user