feat(color): Add OneBit option to color radios (and Companion!!) (#1994)
* Added OneBit option also to color radios * Try to work around GH repo owner issue Original by @raphaelcoeffic in https://github.com/EdgeTX/edgetx/commit/bf4b5d8c0c1e386d5a4852a80d459540bab98ed3 * Add Companion support for radios with external module * Companion housekeeping - do not display unnecessary hardware section headings * fix: Rebase cleanup * fix: LVGL changes * feat: Move sample mode to a new Ext RF block Co-authored-by: elecpower <neilh713@tpg.com.au> Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
co-authored by
elecpower
Peter Feerick
parent
54aaf5b9d9
commit
2ee75033bb
@@ -497,6 +497,9 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
|
||||
case HasInternalModuleSupport:
|
||||
return (IS_STM32(board) && !IS_TARANIS_X9(board));
|
||||
|
||||
case HasExternalModuleSupport:
|
||||
return (IS_STM32(board) && !IS_RADIOMASTER_T8(board));
|
||||
|
||||
case SportMaxBaudRate:
|
||||
if (IS_FAMILY_T16(board) || IS_FLYSKY_NV14(board) || IS_TARANIS_X7_ACCESS(board) ||
|
||||
(IS_TARANIS(board) && !IS_TARANIS_XLITE(board) && !IS_TARANIS_X7(board) && !IS_TARANIS_X9LITE(board)))
|
||||
|
||||
@@ -150,6 +150,7 @@ namespace Board {
|
||||
HasColorLcd,
|
||||
HasSDCard,
|
||||
HasInternalModuleSupport,
|
||||
HasExternalModuleSupport,
|
||||
SportMaxBaudRate
|
||||
};
|
||||
|
||||
|
||||
@@ -606,6 +606,38 @@ AbstractStaticItemModel * GeneralSettings::stickDeadZoneItemModel()
|
||||
return mdl;
|
||||
}
|
||||
|
||||
QString GeneralSettings::uartSampleModeToString() const
|
||||
{
|
||||
return uartSampleModeToString(uartSampleMode);
|
||||
}
|
||||
|
||||
// static
|
||||
QString GeneralSettings::uartSampleModeToString(int value)
|
||||
{
|
||||
switch(value) {
|
||||
case UART_SAMPLE_MODE_NORMAL:
|
||||
return tr("Normal");
|
||||
case UART_SAMPLE_MODE_ONEBIT:
|
||||
return tr("OneBit");
|
||||
default:
|
||||
return CPN_STR_UNKNOWN_ITEM;
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
AbstractStaticItemModel * GeneralSettings::uartSampleModeItemModel()
|
||||
{
|
||||
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||
mdl->setName(AIM_GS_UARTSAMPLEMODE);
|
||||
|
||||
for (int i = 0; i < UART_SAMPLE_MODE_COUNT; i++) {
|
||||
mdl->appendToItemList(uartSampleModeToString(i), i);
|
||||
}
|
||||
|
||||
mdl->loadItemList();
|
||||
return mdl;
|
||||
}
|
||||
|
||||
/*
|
||||
TrainerMix
|
||||
*/
|
||||
|
||||
@@ -41,6 +41,7 @@ constexpr char AIM_GS_BLUETOOTHMODE[] {"gs.bluetoothmode"};
|
||||
constexpr char AIM_GS_SERIALMODE[] {"gs.serialmode%1"};
|
||||
constexpr char AIM_GS_INTMODULEBAUDRATE[] {"gs.intmodulebaudrate"};
|
||||
constexpr char AIM_GS_STICKDEADZONE[] {"gs.stickdeadzone"};
|
||||
constexpr char AIM_GS_UARTSAMPLEMODE[] {"gs.uartsamplemode"};
|
||||
constexpr char AIM_TRAINERMIX_MODE[] {"trainermix.mode"};
|
||||
constexpr char AIM_TRAINERMIX_SRC[] {"trainermix.src"};
|
||||
|
||||
@@ -153,6 +154,12 @@ class GeneralSettings {
|
||||
SP_COUNT,
|
||||
};
|
||||
|
||||
enum UartSampleMode {
|
||||
UART_SAMPLE_MODE_NORMAL,
|
||||
UART_SAMPLE_MODE_ONEBIT,
|
||||
UART_SAMPLE_MODE_COUNT
|
||||
};
|
||||
|
||||
GeneralSettings() { clear(); }
|
||||
void clear();
|
||||
void init();
|
||||
@@ -274,6 +281,7 @@ class GeneralSettings {
|
||||
QString bluetoothModeToString() const;
|
||||
QString serialPortModeToString(int port_nr) const;
|
||||
QString internalModuleBaudrateToString() const;
|
||||
QString uartSampleModeToString() const;
|
||||
|
||||
static QString antennaModeToString(int value);
|
||||
static QString bluetoothModeToString(int value);
|
||||
@@ -281,9 +289,12 @@ class GeneralSettings {
|
||||
static QString moduleBaudrateToString(int value);
|
||||
static FieldRange getPPM_MultiplierRange();
|
||||
static FieldRange getTxCurrentCalibration();
|
||||
static QString uartSampleModeToString(int value);
|
||||
|
||||
static AbstractStaticItemModel * antennaModeItemModel();
|
||||
static AbstractStaticItemModel * bluetoothModeItemModel();
|
||||
static AbstractStaticItemModel * serialModeItemModel(int port_nr);
|
||||
static AbstractStaticItemModel * internalModuleBaudrateItemModel();
|
||||
static AbstractStaticItemModel * stickDeadZoneItemModel();
|
||||
static AbstractStaticItemModel * uartSampleModeItemModel();
|
||||
};
|
||||
|
||||
@@ -98,6 +98,7 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
|
||||
int auxmodelid = editorItemModels->registerItemModel(GeneralSettings::serialModeItemModel(GeneralSettings::SP_AUX1));
|
||||
int vcpmodelid = editorItemModels->registerItemModel(GeneralSettings::serialModeItemModel(GeneralSettings::SP_VCP));
|
||||
int baudmodelid = editorItemModels->registerItemModel(GeneralSettings::internalModuleBaudrateItemModel());
|
||||
int uartmodelid = editorItemModels->registerItemModel(GeneralSettings::uartSampleModeItemModel());
|
||||
|
||||
id = editorItemModels->registerItemModel(ModuleData::internalModuleItemModel());
|
||||
tabFilteredModels->registerItemModel(new FilteredItemModel(editorItemModels->getItemModel(id)), FIM_INTERNALMODULES);
|
||||
@@ -123,29 +124,26 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
|
||||
addParams(row, spnStickDeadZone);
|
||||
}
|
||||
|
||||
addSection(tr("Pots"), row);
|
||||
|
||||
count = Boards::getCapability(board, Board::Pots);
|
||||
count -= firmware->getCapability(HasFlySkyGimbals) ? 2 : 0;
|
||||
if (count > 0) {
|
||||
addSection(tr("Pots"), row);
|
||||
for (int i = 0; i < count; i++) {
|
||||
addPot(i, row);
|
||||
}
|
||||
}
|
||||
|
||||
addSection(tr("Sliders"), row);
|
||||
|
||||
count = Boards::getCapability(board, Board::Sliders);
|
||||
if (count) {
|
||||
addSection(tr("Sliders"), row);
|
||||
for (int i = 0; i < count; i++) {
|
||||
addSlider(i, row);
|
||||
}
|
||||
}
|
||||
|
||||
addSection(tr("Switches"), row);
|
||||
|
||||
count = Boards::getCapability(board, Board::Switches);
|
||||
if (count) {
|
||||
addSection(tr("Switches"), row);
|
||||
for (int i = 0; i < count; i++) {
|
||||
addSwitch(i, row);
|
||||
}
|
||||
@@ -216,11 +214,20 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
|
||||
row++;
|
||||
}
|
||||
|
||||
if (Boards::getCapability(board, Board::HasExternalModuleSupport)) {
|
||||
addLabel(tr("Sample Mode"), row, 0);
|
||||
AutoComboBox *uartSampleMode = new AutoComboBox(this);
|
||||
uartSampleMode->setModel(editorItemModels->getItemModel(uartmodelid));
|
||||
uartSampleMode->setField(generalSettings.uartSampleMode);
|
||||
addParams(row, uartSampleMode);
|
||||
}
|
||||
|
||||
// All values except 0 are mutually exclusive
|
||||
ExclusiveComboGroup *exclGroup = new ExclusiveComboGroup(
|
||||
this, [=](const QVariant &value) { return value == 0; });
|
||||
|
||||
addSection(tr("Serial port"), row);
|
||||
if (firmware->getCapability(HasAuxSerialMode) || firmware->getCapability(HasAux2SerialMode) || firmware->getCapability(HasVCPSerialMode))
|
||||
addSection(tr("Serial ports"), row);
|
||||
|
||||
if (firmware->getCapability(HasAuxSerialMode)) {
|
||||
QString lbl = "AUX1";
|
||||
|
||||
Reference in New Issue
Block a user