Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion companion/src/companion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ int main(int argc, char *argv[])
}

// force the Board definition to load by appending "-xxx"
Firmware::setCurrentVariant(Firmware::getFirmwareForId(g.profile[g.id()].fwType() % "-xxx"));
Firmware::setCurrentVariant(Firmware::getFirmwareForId(g.profile[g.id()].fwVariantId() % "-xxx"));

MainWindow *mainWin = new MainWindow();
mainWin->show();
Expand Down
32 changes: 32 additions & 0 deletions companion/src/firmwares/boardjson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,30 @@ const int BoardJson::getCapability(const Board::Capability capability) const
case Board::Gyros:
return getCapability(Board::GyroAxes) / 2;

case Board::BluetoothAuxPort:
return m_hardware.bluetooth_aux_port;

case Board::BluetoothBuiltin:
return m_hardware.bluetooth_builtin;

case Board::BluetoothOptional:
return m_hardware.bluetooth_optional;

case Board::HasAudioMuteGPIO:
return m_hardware.has_audio_mute;

case Board::HasAuxSerialMode:
return m_hardware.has_aux_serial;

case Board::HasAuxSerialPower:
return m_hardware.has_aux_serial_pwr;

case Board::HasAux2SerialMode:
return m_hardware.has_aux2_serial;

case Board::HasAux2SerialPower:
return m_hardware.has_aux2_serial_pwr;

case Board::HasBacklightColor:
return m_display.backlight_color;

Expand All @@ -223,6 +244,9 @@ const int BoardJson::getCapability(const Board::Capability capability) const
case Board::HasColorLcd:
return m_display.color;

case Board::HasInternalGPS:
return m_hardware.has_internal_gps;

case Board::HasExternalModuleSupport:
return m_hardware.has_ext_module_support;

Expand Down Expand Up @@ -1302,6 +1326,14 @@ bool BoardJson::loadFile(Board::Type board, QString hwdefn, InputsTable * inputs
const QJsonObject &o = obj.value("hardware").toObject();

hardware.has_audio_mute = o.value("has_audio_mute").toBool();
hardware.has_aux_serial = o.value("has_aux_serial").toBool();
hardware.has_aux_serial_pwr = o.value("has_aux_serial_pwr").toBool();
hardware.has_aux2_serial = o.value("has_aux2_serial").toBool();
hardware.has_aux2_serial_pwr = o.value("has_aux2_serial_pwr").toBool();
hardware.has_internal_gps = o.value("has_internal_gps").toBool();
hardware.bluetooth_builtin = o.value("bluetooth").toString() == "builtin";
hardware.bluetooth_optional = o.value("bluetooth").toString() == "optional";
hardware.bluetooth_aux_port = o.value("bluetooth_aux_port").toInt();
hardware.has_ext_module_support = o.value("has_ext_module_support").toBool();
hardware.has_int_module_support = o.value("has_int_module_support").toBool();
hardware.sport_max_baudrate = o.value("sport_max_baudrate").toInt();
Expand Down
8 changes: 8 additions & 0 deletions companion/src/firmwares/boardjson.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ class BoardJson

struct HardwareDefn {
int has_audio_mute = 0;
int has_aux_serial = 0;
int has_aux_serial_pwr = 0;
int has_aux2_serial = 0;
int has_aux2_serial_pwr = 0;
int has_internal_gps = 0;
int bluetooth_builtin = 0;
int bluetooth_optional = 0;
int bluetooth_aux_port = 0;
int has_bling_leds = 0;
int status_led_colors = 0; // bit 0 red, 1 green, 2 blue
int status_led_pwm = 0;
Expand Down
24 changes: 0 additions & 24 deletions companion/src/firmwares/boards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,23 +338,6 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
return 46;
}

case HasAuxSerialMode:
return (IS_FAMILY_HORUS_OR_T16(board) &&
!(IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board) ||
IS_FAMILY_PL18(board) || IS_FLYSKY_ST16(board))) ||
(IS_TARANIS_X9(board) && !IS_TARANIS_X9DP_2019(board)) ||
IS_RADIOMASTER_ZORRO(board) || IS_RADIOMASTER_TX12_MK2(board) ||
IS_RADIOMASTER_MT12(board);

case HasAux2SerialMode:
return IS_FAMILY_T16(board);

case HasBluetooth:
return (IS_FAMILY_HORUS_OR_T16(board) || IS_TARANIS_X7(board) ||
IS_TARANIS_XLITE(board)|| IS_TARANIS_X9E(board) ||
IS_TARANIS_X9DP_2019(board) || IS_FLYSKY_NV14(board) ||
IS_FLYSKY_EL18(board) || IS_FAMILY_PL18(board));

case HasExternalAntenna:
return IS_FAMILY_HORUS(board) || IS_TARANIS_XLITE(board) ||
getCapability(board, HasHardwareAntennaSwitch);
Expand All @@ -366,13 +349,6 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
return (IS_FAMILY_HORUS_OR_T16(board) || IS_TARANIS(board) ||
IS_RADIOMASTER_TX15(board) || IS_RADIOMASTER_GX15(board) || IS_RADIOMASTER_TX16SMK3(board));

case HasInternalGPS:
return ((IS_FAMILY_HORUS_OR_T16(board) && getCapability(board, HasAuxSerialMode)) ||
IS_RADIOMASTER_TX15(board) || IS_RADIOMASTER_TX16SMK3(board));

case HasSoftwareSerialPower:
return IS_RADIOMASTER_TX16S(board);

case HasSwitchableJack:
return IS_TARANIS_XLITES(board);

Expand Down
7 changes: 5 additions & 2 deletions companion/src/firmwares/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ namespace Board {
enum Capability {
Air,
BacklightLevelMin,
BluetoothAuxPort,
BluetoothBuiltin,
BluetoothOptional,
CPU,
CPUType,
FlexInputs,
Expand All @@ -231,12 +234,13 @@ namespace Board {
Gyros,
HasAudioMuteGPIO,
HasAuxSerialMode,
HasAuxSerialPower,
HasAux2SerialMode,
HasAux2SerialPower,
HasBacklightColor,
HasBlingLEDS,
HasStatusLedPwm,
StatusLedColors,
HasBluetooth,
HasColorLcd,
HasExternalAntenna,
HasExternalModuleSupport,
Expand All @@ -247,7 +251,6 @@ namespace Board {
HasIntModuleHeartbeatGPIO,
HasRTC,
HasSDCard,
HasSoftwareSerialPower,
HasSwitchableJack,
HasTrainerModuleCPPM,
HasTrainerModuleSBUS,
Expand Down
4 changes: 4 additions & 0 deletions companion/src/firmwares/eeprominterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ const uint8_t modn12x3[8][4]= {
};

enum Capability {
Aux2SerialAvailable,
AuxSerialAvailable,
BluetoothEnabled,
ChannelsName,
CustomFunctions,
DangerousFunctions,
Expand Down Expand Up @@ -76,6 +79,7 @@ enum Capability {
HasVarioSink,
Heli,
InputsLength,
InternalGPSAvailable,
IsLandscape,
IsNarrowLayout,
IsPortrait,
Expand Down
2 changes: 1 addition & 1 deletion companion/src/firmwares/modeldata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2337,7 +2337,7 @@ void ModelData::initTopBar()
zone.widgetName = "Radio Info";
}

if (zones - 3 >= 0 && Boards::getCapability(getCurrentBoard(), Board::HasInternalGPS)) {
if (zones - 3 >= 0 && getCurrentFirmware()->getCapability(InternalGPSAvailable)) {
ZonePersistentData & zone = topBarData.zones[zones - 3];
zone.widgetName = "Internal GPS";
}
Expand Down
Loading
Loading