feat: Add initial Jumper T20 support (#3726)
* Jumper T20 * Fix center beeps * Add option to pinch top trim as well to bootloader * chore: Regenerate yaml * chore: Add entry for Buddy * Jumper T20 * Foldable section for fonction swith and fix preflight pot checks * Remove duplicated entry * Rename "function switches" to "customizable switches" * chore: Add translations * chore: Update translations * chore: Update Companion translations/wording
This commit is contained in:
@@ -37,7 +37,7 @@ enum MenuModelFlightModeItems {
|
||||
ITEM_MODEL_FLIGHT_MODE_NAME,
|
||||
ITEM_MODEL_FLIGHT_MODE_SWITCH,
|
||||
ITEM_MODEL_FLIGHT_MODE_TRIMS,
|
||||
#if defined(TRIMS_GPIO_REG_T5L)
|
||||
#if defined(TRIMS_GPIO_REG_T5L) || defined(TRIMS_GPIO_REG_LSD)
|
||||
ITEM_MODEL_FLIGHT_MODE_TRIMS2,
|
||||
#endif
|
||||
ITEM_MODEL_FLIGHT_MODE_FADE_IN,
|
||||
@@ -71,7 +71,7 @@ void menuModelFlightModeOne(event_t event)
|
||||
|
||||
#if defined(GVARS) && !defined(GVARS_IN_CURVES_SCREEN)
|
||||
|
||||
#if defined(TRIMS_GPIO_REG_T5L)
|
||||
#if defined(TRIMS_GPIO_REG_T5L) || defined(TRIMS_GPIO_REG_LSD)
|
||||
#define VERTICAL_SHIFT (ITEM_MODEL_FLIGHT_MODE_FADE_IN-ITEM_MODEL_FLIGHT_MODE_TRIMS2)
|
||||
static const uint8_t mstate_tab_fm1[] = {0, 3, (uint8_t)(keysGetMaxTrims() - 5), 0, 0, (uint8_t)-1, 1, 1, 1, 1, 1, 1};
|
||||
#else
|
||||
@@ -132,7 +132,7 @@ void menuModelFlightModeOne(event_t event)
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(TRIMS_GPIO_REG_T5L)
|
||||
#if defined(TRIMS_GPIO_REG_T5L) || defined(TRIMS_GPIO_REG_LSD)
|
||||
case ITEM_MODEL_FLIGHT_MODE_TRIMS2:
|
||||
{
|
||||
auto trims = keysGetMaxTrims() - 4;
|
||||
|
||||
@@ -230,6 +230,7 @@ PACK(struct ExpandState {
|
||||
uint8_t preflight:1;
|
||||
uint8_t throttle:1;
|
||||
uint8_t viewOpt:1;
|
||||
uint8_t functionSwitches:1;
|
||||
});
|
||||
|
||||
struct ExpandState expandState;
|
||||
@@ -248,6 +249,13 @@ uint8_t THROTTLE_ROW(uint8_t value)
|
||||
return HIDDEN_ROW;
|
||||
}
|
||||
|
||||
uint8_t FS_ROW(uint8_t value)
|
||||
{
|
||||
if (expandState.functionSwitches)
|
||||
return value;
|
||||
return HIDDEN_ROW;
|
||||
}
|
||||
|
||||
uint8_t VIEWOPT_ROW(uint8_t value)
|
||||
{
|
||||
if (expandState.viewOpt)
|
||||
@@ -341,7 +349,14 @@ inline uint8_t TIMER_ROW(uint8_t timer, uint8_t value)
|
||||
#define EXTRA_MODULE_ROWS
|
||||
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
#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 1, \
|
||||
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||
FS_ROW(NAVIGATION_LINE_BY_LINE|(NUM_FUNCTIONS_SWITCHES-1)),
|
||||
#else
|
||||
#define FUNCTION_SWITCHES_ROWS
|
||||
#endif
|
||||
@@ -779,7 +794,7 @@ void menuModelSetup(event_t event)
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
|
||||
case ITEM_MODEL_SETUP_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, "Function Switches");
|
||||
expandState.functionSwitches = expandableSection(y, STR_FUNCTION_SWITCHES, expandState.functionSwitches, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_SETUP_SW1:
|
||||
@@ -1076,9 +1091,14 @@ void menuModelSetup(event_t event)
|
||||
(g_model.potsWarnEnabled & (1 << i))) {
|
||||
flags |= INVERS;
|
||||
}
|
||||
|
||||
lcdDrawText(x, y, getPotLabel(i), flags);
|
||||
x = lcdNextPos+3;
|
||||
if (max_pots > 3) {
|
||||
lcdDrawText(x, y, getAnalogShortLabel(adcGetInputOffset(ADC_INPUT_POT) + i), flags);
|
||||
x = lcdNextPos + 1;
|
||||
}
|
||||
else {
|
||||
lcdDrawText(x, y, getPotLabel(i), flags);
|
||||
x = lcdNextPos + 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1092,7 +1112,7 @@ void menuModelSetup(event_t event)
|
||||
LcdFlags flags = 0;
|
||||
if ((menuHorizontalPosition == i) && attr)
|
||||
flags = BLINK | INVERS;
|
||||
else if (ANALOG_CENTER_BEEP(x) || (attr && CURSOR_ON_LINE()))
|
||||
else if (ANALOG_CENTER_BEEP(i) || (attr && CURSOR_ON_LINE()))
|
||||
flags = INVERS;
|
||||
lcdDrawText(x, y, getAnalogShortLabel(i), flags);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,12 @@ const unsigned char bmp_sleep[] = {
|
||||
#include "sleep.lbm"
|
||||
};
|
||||
|
||||
#if defined(RADIO_T20)
|
||||
constexpr uint8_t steps = NUM_FUNCTIONS_SWITCHES/2;
|
||||
#elif defined(FUNCTION_SWITCHES)
|
||||
constexpr uint8_t steps = NUM_FUNCTIONS_SWITCHES;
|
||||
#endif
|
||||
|
||||
void drawStartupAnimation(uint32_t duration, uint32_t totalDuration)
|
||||
{
|
||||
if (totalDuration == 0)
|
||||
@@ -41,12 +47,16 @@ void drawStartupAnimation(uint32_t duration, uint32_t totalDuration)
|
||||
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
uint8_t index2 = limit<uint8_t>(
|
||||
0, duration / (totalDuration / (NUM_FUNCTIONS_SWITCHES + 1)),
|
||||
NUM_FUNCTIONS_SWITCHES);
|
||||
0, duration / (totalDuration / (steps + 1)),
|
||||
steps);
|
||||
|
||||
for (uint8_t j = 0; j < NUM_FUNCTIONS_SWITCHES; j++) {
|
||||
if (index2 > j)
|
||||
for (uint8_t j = 0; j < steps; j++) {
|
||||
if (index2 > j) {
|
||||
fsLedOn(j);
|
||||
#if defined(RADIO_T20)
|
||||
fsLedOn(j + steps);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -72,14 +82,22 @@ void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration,
|
||||
lcdClear();
|
||||
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
uint8_t index2 = limit<uint8_t>(
|
||||
0, duration / (totalDuration / (NUM_FUNCTIONS_SWITCHES + 1)),
|
||||
NUM_FUNCTIONS_SWITCHES);
|
||||
|
||||
for (uint8_t j = 0; j < NUM_FUNCTIONS_SWITCHES; j++) {
|
||||
uint8_t index2 = limit<uint8_t>(
|
||||
0, duration / (totalDuration / (steps + 1)),
|
||||
steps);
|
||||
|
||||
for (uint8_t j = 0; j < steps; j++) {
|
||||
fsLedOff(j);
|
||||
if (NUM_FUNCTIONS_SWITCHES - index2 > j)
|
||||
#if defined(RADIO_T20)
|
||||
fsLedOff(j + steps);
|
||||
#endif
|
||||
if (steps - index2 > j) {
|
||||
fsLedOn(j);
|
||||
#if defined(RADIO_T20)
|
||||
fsLedOn(j + steps);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -485,7 +485,7 @@ void menuRadioHardware(event_t event)
|
||||
// draw hw name
|
||||
LcdFlags flags = menuHorizontalPosition < 0 ? attr : 0;
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_CHAR_POT, flags);
|
||||
lcdDrawText(lcdNextPos, y, adcGetInputName(ADC_INPUT_POT, idx), flags);
|
||||
lcdDrawText(lcdNextPos, y, adcGetInputLabel(ADC_INPUT_POT, idx), flags);
|
||||
|
||||
// draw custom name
|
||||
if (analogHasCustomLabel(ADC_INPUT_POT, idx) ||
|
||||
|
||||
Reference in New Issue
Block a user