feat: add support for RadioMaster TX16S MK3 (#7017)
Co-authored-by: philmoz <phil.a.mitchell@gmail.com> Co-authored-by: 3djc <3djc@gh.com> Co-authored-by: Peter Feerick <5500713+pfeerick@users.noreply.github.com>
This commit is contained in:
co-authored by
philmoz
3djc
Peter Feerick
parent
5394e84871
commit
be496b66b6
@@ -42,13 +42,7 @@ class SourceChoiceMenuToolbar : public MenuToolbar
|
||||
addButton(CHAR_LUA, MIXSRC_FIRST_LUA, MIXSRC_LAST_LUA, nullptr,
|
||||
STR_MENU_LUA);
|
||||
#endif
|
||||
#if defined(PCBHORUS)
|
||||
auto lastSource = MIXSRC_LAST_SPACEMOUSE;
|
||||
#elif defined(IMU)
|
||||
auto lastSource = MIXSRC_TILT_Y;
|
||||
#else
|
||||
auto lastSource = MIXSRC_LAST_STICK;
|
||||
#endif
|
||||
auto lastSource = MIXSRC_MIN - 1;
|
||||
addButton(
|
||||
CHAR_STICK, MIXSRC_FIRST_STICK, lastSource,
|
||||
[=](int16_t index) {
|
||||
@@ -62,6 +56,9 @@ class SourceChoiceMenuToolbar : public MenuToolbar
|
||||
addButton(
|
||||
CHAR_FUNCTION, MIXSRC_MIN, MIXSRC_LAST_TIMER,
|
||||
[=](int16_t index) {
|
||||
#if defined(LUMINOSITY_SENSOR)
|
||||
if (index == MIXSRC_LIGHT) return true;
|
||||
#endif
|
||||
return (index >= MIXSRC_MIN && index <= MIXSRC_MAX) ||
|
||||
(index >= MIXSRC_TX_VOLTAGE && index <= MIXSRC_LAST_TIMER);
|
||||
},
|
||||
|
||||
@@ -251,18 +251,22 @@ InputMixGroupBase::InputMixGroupBase(Window* parent, mixsrc_t idx) :
|
||||
etx_font(label, FONT_XS_INDEX, LV_STATE_USER_1);
|
||||
}
|
||||
|
||||
void InputMixGroupBase::adjustHeight()
|
||||
void InputMixGroupBase::_adjustHeight(coord_t y)
|
||||
{
|
||||
if (getLineCount() == 0) setHeight(ListLineButton::BTN_H + PAD_SMALL * 2);
|
||||
|
||||
coord_t y = PAD_OUTLINE;
|
||||
for (auto it = lines.cbegin(); it != lines.cend(); ++it) {
|
||||
auto line = *it;
|
||||
line->updateHeight();
|
||||
line->updatePos(InputMixButtonBase::LN_X, y);
|
||||
y += line->height() + PAD_OUTLINE;
|
||||
}
|
||||
setHeight(y + PAD_BORDER * 2);
|
||||
setHeight(y + PAD_BORDER * 2 + PAD_OUTLINE);
|
||||
}
|
||||
|
||||
void InputMixGroupBase::adjustHeight()
|
||||
{
|
||||
_adjustHeight(0);
|
||||
}
|
||||
|
||||
void InputMixGroupBase::addLine(InputMixButtonBase* line)
|
||||
|
||||
@@ -37,7 +37,7 @@ class ListLineButton : public ButtonBase
|
||||
|
||||
virtual void refresh() = 0;
|
||||
|
||||
static constexpr coord_t BTN_H = EdgeTxStyles::STD_FONT_HEIGHT + PAD_BORDER * 2 + PAD_TINY * 2;
|
||||
static constexpr coord_t BTN_H = EdgeTxStyles::STD_FONT_HEIGHT + PAD_BORDER * 2 + PAD_OUTLINE * 2;
|
||||
static constexpr coord_t GRP_W = LCD_W - PAD_SMALL * 2;
|
||||
|
||||
protected:
|
||||
@@ -72,7 +72,7 @@ class InputMixButtonBase : public ListLineButton
|
||||
#else
|
||||
static LAYOUT_VAL_SCALED(LN_X, 73)
|
||||
#endif
|
||||
static constexpr coord_t BTN_W = ListLineButton::GRP_W - LN_X - PAD_BORDER * 2 - PAD_OUTLINE;
|
||||
static constexpr coord_t BTN_W = ListLineButton::GRP_W - LN_X - PAD_BORDER * 2 - PAD_OUTLINE * 2;
|
||||
static constexpr coord_t WGT_X = PAD_TINY;
|
||||
static constexpr coord_t WGT_Y = PAD_TINY;
|
||||
static LAYOUT_VAL_SCALED(WGT_W, 50)
|
||||
@@ -122,6 +122,8 @@ class InputMixGroupBase : public Window
|
||||
mixsrc_t idx;
|
||||
lv_obj_t* label;
|
||||
std::list<InputMixButtonBase*> lines;
|
||||
|
||||
void _adjustHeight(coord_t y);
|
||||
};
|
||||
|
||||
class InputMixPageBase : public PageGroupItem
|
||||
|
||||
@@ -57,10 +57,17 @@
|
||||
#endif
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
|
||||
#if defined(SIMU)
|
||||
#define LV_MEM_SIZE (4 * 1024U * 1024U) /*[bytes]*/
|
||||
#if defined(SDRAM_32M)
|
||||
#define LV_MEM 8
|
||||
#elif defined(SDRAM_16M)
|
||||
#define LV_MEM 4
|
||||
#else
|
||||
#define LV_MEM_SIZE (2 * 1024U * 1024U) /*[bytes]*/
|
||||
#define LV_MEM 2
|
||||
#endif
|
||||
#if defined(SIMU)
|
||||
#define LV_MEM_SIZE (LV_MEM * 2 * 1024U * 1024U) /*[bytes]*/
|
||||
#else
|
||||
#define LV_MEM_SIZE (LV_MEM * 1024U * 1024U) /*[bytes]*/
|
||||
#endif
|
||||
|
||||
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
|
||||
|
||||
@@ -124,7 +124,11 @@ class CurveDataEdit : public Window
|
||||
}
|
||||
|
||||
static LAYOUT_VAL_SCALED(ROW_HEIGHT, 82)
|
||||
#if WIDE_LAYOUT
|
||||
static LAYOUT_VAL_SCALED(NUM_BTN_WIDTH, 50)
|
||||
#else
|
||||
static LAYOUT_VAL_SCALED(NUM_BTN_WIDTH, 47)
|
||||
#endif
|
||||
static LAYOUT_VAL_SCALED(NUM_HDR_HEIGHT, 15)
|
||||
static LAYOUT_VAL_SCALED(PTNUM_X, 15)
|
||||
static LAYOUT_VAL_SCALED(PTNUM_H, 13)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
#define ETX_STATE_LS_ACTIVE LV_STATE_USER_1
|
||||
#define ETX_STATE_V1_SMALL_FONT LV_STATE_USER_1
|
||||
#define ETX_STATE_V1_SMALL_FONT LV_STATE_USER_2
|
||||
|
||||
static const lv_coord_t col_dsc[] = {LV_GRID_FR(2), LV_GRID_FR(3),
|
||||
LV_GRID_TEMPLATE_LAST};
|
||||
|
||||
@@ -214,14 +214,7 @@ class MixGroup : public InputMixGroupBase
|
||||
|
||||
void adjustHeight() override
|
||||
{
|
||||
coord_t y = monitorVisible ? CHNUM_Y : PAD_OUTLINE;
|
||||
for (auto it = lines.cbegin(); it != lines.cend(); ++it) {
|
||||
auto line = *it;
|
||||
line->updateHeight();
|
||||
line->updatePos(InputMixButtonBase::LN_X, y);
|
||||
y += line->height() + PAD_OUTLINE;
|
||||
}
|
||||
setHeight(y + PAD_BORDER * 2);
|
||||
_adjustHeight(monitorVisible ? CHNUM_Y : 0);
|
||||
}
|
||||
|
||||
static LAYOUT_VAL_SCALED(CHNUM_Y, 17)
|
||||
|
||||
@@ -450,6 +450,11 @@ void drawSourceCustomValue(coord_t x, coord_t y, mixsrc_t source, int32_t value,
|
||||
else if (source == MIXSRC_TX_VOLTAGE) {
|
||||
lcdDrawNumber(x, y, value, flags|PREC1);
|
||||
}
|
||||
#if defined(LUMINOSITY_SENSOR)
|
||||
else if (source == MIXSRC_LIGHT) {
|
||||
lcdDrawNumber(x, y, value, flags);
|
||||
}
|
||||
#endif
|
||||
#if defined(INTERNAL_GPS)
|
||||
else if (source == MIXSRC_TX_GPS) {
|
||||
if (gpsData.fix) {
|
||||
|
||||
@@ -262,6 +262,9 @@ static struct sourceAvailableCheck sourceChecks[] = {
|
||||
#if defined(IMU)
|
||||
{ MIXSRC_TILT_X, MIXSRC_TILT_Y, SRC_TILT, sourceIsAvailable },
|
||||
#endif
|
||||
#if defined(LUMINOSITY_SENSOR)
|
||||
{ MIXSRC_LIGHT, MIXSRC_LIGHT, SRC_LIGHT, sourceIsAvailable },
|
||||
#endif
|
||||
#if defined(PCBHORUS)
|
||||
{ MIXSRC_FIRST_SPACEMOUSE, MIXSRC_LAST_SPACEMOUSE, SRC_SPACEMOUSE, isSourceSpacemouseAvailable },
|
||||
#endif
|
||||
@@ -298,7 +301,7 @@ bool checkSourceAvailable(int source, uint32_t sourceTypes)
|
||||
}
|
||||
|
||||
#define SRC_COMMON \
|
||||
SRC_STICK | SRC_POT | SRC_TILT | SRC_SPACEMOUSE | SRC_MINMAX | SRC_TRIM | \
|
||||
SRC_STICK | SRC_POT | SRC_TILT | SRC_LIGHT | SRC_SPACEMOUSE | SRC_MINMAX | SRC_TRIM | \
|
||||
SRC_SWITCH | SRC_FUNC_SWITCH | SRC_LOGICAL_SWITCH | SRC_TRAINER | SRC_GVAR
|
||||
|
||||
bool isSourceAvailable(int source)
|
||||
@@ -310,7 +313,7 @@ bool isSourceAvailable(int source)
|
||||
|
||||
bool isSourceAvailableForBacklightOrVolume(int source)
|
||||
{
|
||||
return checkSourceAvailable(source, SRC_SWITCH | SRC_POT | SRC_NONE);
|
||||
return checkSourceAvailable(source, SRC_SWITCH | SRC_POT | SRC_LIGHT | SRC_NONE);
|
||||
}
|
||||
|
||||
bool isLogicalSwitchAvailable(int index)
|
||||
|
||||
Reference in New Issue
Block a user