chore: add CPU details to hwdefs files (#7136)
Co-authored-by: elecpower <elecpower@users.noreply.github.com>
This commit is contained in:
@@ -214,6 +214,15 @@ const int BoardJson::getCapability(const Board::Capability capability) const
|
||||
case Board::InputSwitches:
|
||||
return m_inputCnt.switches;
|
||||
|
||||
case Board::IsF4:
|
||||
return m_hardware.cpu_type == "STM32F4";
|
||||
|
||||
case Board::IsH5:
|
||||
return m_hardware.cpu_type == "STM32H5";
|
||||
|
||||
case Board::IsH7:
|
||||
return m_hardware.cpu_type == "STM32H7";
|
||||
|
||||
case Board::JoystickAxes:
|
||||
return m_inputCnt.flexJoystickAxes;
|
||||
|
||||
@@ -1247,6 +1256,8 @@ bool BoardJson::loadFile(Board::Type board, QString hwdefn, InputsTable * inputs
|
||||
hardware.has_int_module_support = o.value("has_int_module_support").toInt();
|
||||
hardware.sport_max_baudrate = o.value("sport_max_baudrate").toInt();
|
||||
hardware.surface = o.value("surface").toInt();
|
||||
hardware.cpu = o.value("cpu").toString().toStdString();
|
||||
hardware.cpu_type = o.value("cpu_type").toString().toStdString();
|
||||
}
|
||||
|
||||
delete json;
|
||||
@@ -1290,3 +1301,15 @@ void BoardJson::setSwitchCounts(const SwitchesTable * switches, SwitchCounts & s
|
||||
switchCounts.func++;
|
||||
}
|
||||
}
|
||||
|
||||
const QString BoardJson::getCapabilityStr(const Board::Capability capability) const
|
||||
{
|
||||
switch (capability) {
|
||||
case Board::CPU:
|
||||
return m_hardware.cpu.c_str();
|
||||
case Board::CPUType:
|
||||
return m_hardware.cpu_type.c_str();
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
@@ -123,6 +123,8 @@ class BoardJson
|
||||
int has_int_module_support = 0;
|
||||
int sport_max_baudrate = 0;
|
||||
int surface = 0;
|
||||
std::string cpu = "";
|
||||
std::string cpu_type = "";
|
||||
};
|
||||
|
||||
typedef std::vector<TrimDefn> TrimsTable;
|
||||
@@ -136,6 +138,7 @@ class BoardJson
|
||||
bool loadDefinition();
|
||||
|
||||
const int getCapability(const Board::Capability capability) const;
|
||||
const QString getCapabilityStr(const Board::Capability capability) const;
|
||||
const int getInputsCalibrated() const;
|
||||
|
||||
const int getInputIndex(const QString val, Board::LookupValueType lvt) const;
|
||||
|
||||
@@ -1182,3 +1182,8 @@ void Boards::tests()
|
||||
{
|
||||
qDebug() << "**** Board checks ****";
|
||||
}
|
||||
|
||||
QString Boards::getCapabilityStr(Board::Type board, Board::Capability capability)
|
||||
{
|
||||
return getBoardJson(board)->getCapabilityStr(capability);
|
||||
}
|
||||
@@ -213,6 +213,8 @@ namespace Board {
|
||||
enum Capability {
|
||||
Air,
|
||||
BacklightLevelMin,
|
||||
CPU,
|
||||
CPUType,
|
||||
FlexInputs,
|
||||
FlexSwitches,
|
||||
FunctionSwitchColors,
|
||||
@@ -241,6 +243,9 @@ namespace Board {
|
||||
HasVCPSerialMode,
|
||||
Inputs,
|
||||
InputSwitches,
|
||||
IsF4,
|
||||
IsH5,
|
||||
IsH7,
|
||||
JoystickAxes,
|
||||
Joysticks,
|
||||
Keys,
|
||||
@@ -401,12 +406,14 @@ class Boards
|
||||
const int getEEpromSize() const { return getEEpromSize(m_boardType); }
|
||||
const int getFlashSize() const { return getFlashSize(m_boardType); }
|
||||
const int getCapability(Board::Capability capability) const { return getCapability(m_boardType, capability); }
|
||||
const QString getCapabilityStr(Board::Capability capability) const { return getCapabilityStr(m_boardType, capability); }
|
||||
const bool isBoardCompatible(Board::Type board2) const { return isBoardCompatible(m_boardType, board2); }
|
||||
|
||||
static uint32_t getFourCC(Board::Type board);
|
||||
static int getEEpromSize(Board::Type board);
|
||||
static int getFlashSize(Board::Type board);
|
||||
static int getCapability(Board::Type board, Board::Capability capability);
|
||||
static QString getCapabilityStr(Board::Type board, Board::Capability capability);
|
||||
static QString getAxisName(int index);
|
||||
static bool isBoardCompatible(Board::Type board1, Board::Type board2);
|
||||
static QString getBoardName(Board::Type board);
|
||||
@@ -816,17 +823,6 @@ inline bool IS_FAMILY_HORUS_OR_T16(Board::Type board)
|
||||
IS_FLYSKY_PA01(board)/*generally*/ || IS_FLYSKY_NB4P(board)/*generally*/;
|
||||
}
|
||||
|
||||
inline bool IS_STM32(Board::Type board)
|
||||
{
|
||||
return IS_TARANIS(board) || IS_FAMILY_HORUS_OR_T16(board) ||
|
||||
IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board) || IS_FAMILY_PL18(board) || IS_FLYSKY_ST16(board);
|
||||
}
|
||||
|
||||
inline bool IS_ARM(Board::Type board)
|
||||
{
|
||||
return IS_STM32(board);
|
||||
}
|
||||
|
||||
inline bool HAS_LARGE_LCD(Board::Type board)
|
||||
{
|
||||
return IS_FAMILY_HORUS_OR_T16(board) || IS_TARANIS_X9(board);
|
||||
@@ -854,27 +850,3 @@ inline bool IS_ACCESS_RADIO(Board::Type board, const QString & id)
|
||||
return IS_ACCESS_RADIO(board) ||
|
||||
(IS_FAMILY_HORUS_OR_T16(board) && id.contains("internalaccess"));
|
||||
}
|
||||
|
||||
inline bool HAS_EEPROM_YAML(Board::Type board)
|
||||
{
|
||||
return IS_FAMILY_HORUS_OR_T16(board);
|
||||
}
|
||||
|
||||
inline bool IS_STM32H5(Board::Type board)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool IS_STM32H7(Board::Type board)
|
||||
{
|
||||
return IS_FLYSKY_PA01(board) ||
|
||||
IS_FLYSKY_ST16(board) ||
|
||||
IS_JUMPER_T15PRO(board) ||
|
||||
IS_RADIOMASTER_TX15(board) ||
|
||||
IS_RADIOMASTER_TX16SMK3(board);
|
||||
}
|
||||
|
||||
inline bool IS_STM32F2F4(Board::Type board)
|
||||
{
|
||||
return (!IS_STM32H5(board) && !IS_STM32H7(board));
|
||||
}
|
||||
|
||||
@@ -1509,7 +1509,7 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
|
||||
}
|
||||
|
||||
// v2.12 CRSF limit external module to 3.75M for older boards
|
||||
if (IS_STM32F2F4(board) &&
|
||||
if (Boards::getCapability((Board::Type)board, Board::IsF4) &&
|
||||
rhs.moduleData[1].protocol == PULSES_CROSSFIRE &&
|
||||
rhs.moduleData[1].crsf.telemetryBaudrate > 4)
|
||||
rhs.moduleData[1].crsf.telemetryBaudrate = 4;
|
||||
|
||||
@@ -611,7 +611,8 @@ AbstractStaticItemModel * ModuleData::telemetryBaudrateItemModel(unsigned int pr
|
||||
for (int i = 0; i < moduleBaudratesList.size(); i++) {
|
||||
// CRSF limit external module to 3.75M for older boards
|
||||
if (protocol == PULSES_CROSSFIRE && moduleIdx == 1 &&
|
||||
IS_STM32F2F4((Board::Type)board) && i > 4) break;
|
||||
Boards::getCapability((Board::Type)board, Board::IsF4) &&
|
||||
i > 4) break;
|
||||
|
||||
if (protocol == PULSES_GHOST && i >= 2) break;
|
||||
mdl->appendToItemList(moduleBaudratesList.at(i), i);
|
||||
|
||||
@@ -76,7 +76,7 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
||||
case GlobalFunctions:
|
||||
return CPN_MAX_SPECIAL_FUNCTIONS;
|
||||
case Gvars:
|
||||
return id.contains("nogvars") ? 0 : (IS_STM32H7(board) || IS_STM32H5(board) ? CPN_MAX_GVARS : 9);
|
||||
return id.contains("nogvars") ? 0 : (Boards::getCapability((Board::Type)board, Board::IsF4) ? 9 : CPN_MAX_GVARS);
|
||||
case GvarsName:
|
||||
return 3;
|
||||
case Haptic: // TODO remove with X9D
|
||||
@@ -189,7 +189,7 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
||||
case SafetyChannelCustomFunction:
|
||||
return id.contains("nooverridech") ? 0 : 1;
|
||||
case Sensors:
|
||||
if (IS_STM32H7(board))
|
||||
if (Boards::getCapability((Board::Type)board, Board::IsH7))
|
||||
return CPN_MAX_SENSORS;
|
||||
else if (IS_FAMILY_HORUS_OR_T16(board) || IS_TARANIS_X9(board))
|
||||
return 60;
|
||||
|
||||
@@ -94,14 +94,7 @@ ui(new Ui::GeneralSetup)
|
||||
ui->gpsFormatCB->setCurrentIndex(generalSettings.gpsFormat);
|
||||
ui->timezoneLE->setTime((generalSettings.timezone * 3600) + (generalSettings.timezoneMinutes/*quarter hours*/ * 15 * 60));
|
||||
ui->adjustRTC->setChecked(generalSettings.adjustRTC);
|
||||
|
||||
if (IS_STM32(board)) {
|
||||
ui->usbModeCB->setCurrentIndex(generalSettings.usbMode);
|
||||
}
|
||||
else {
|
||||
ui->usbModeLabel->hide();
|
||||
ui->usbModeCB->hide();
|
||||
}
|
||||
ui->usbModeCB->setCurrentIndex(generalSettings.usbMode);
|
||||
|
||||
if (IS_FLYSKY_EL18(board) || IS_FLYSKY_NV14(board) || IS_FAMILY_PL18(board)) {
|
||||
ui->hatsModeCB->setModel(panelFilteredModels->getItemModel(FIM_HATSMODE));
|
||||
|
||||
@@ -85,26 +85,22 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_STM32(firmware->getBoard())) {
|
||||
scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/FUNCTIONS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength));
|
||||
for (int i = 0; i < fswCapability; i++) {
|
||||
if (functions[i].func == FuncPlayScript) {
|
||||
QString temp = functions[i].paramarm;
|
||||
if (!temp.isEmpty()) {
|
||||
scriptsSet.insert(temp);
|
||||
}
|
||||
scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/FUNCTIONS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength));
|
||||
for (int i = 0; i < fswCapability; i++) {
|
||||
if (functions[i].func == FuncPlayScript) {
|
||||
QString temp = functions[i].paramarm;
|
||||
if (!temp.isEmpty()) {
|
||||
scriptsSet.insert(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_STM32(firmware->getBoard())) {
|
||||
scriptsSetRGB = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/RGBLED", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength));
|
||||
for (int i = 0; i < fswCapability; i++) {
|
||||
if (functions[i].func == FuncRGBLed) {
|
||||
QString temp = functions[i].paramarm;
|
||||
if (!temp.isEmpty()) {
|
||||
scriptsSetRGB.insert(temp);
|
||||
}
|
||||
scriptsSetRGB = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/RGBLED", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength));
|
||||
for (int i = 0; i < fswCapability; i++) {
|
||||
if (functions[i].func == FuncRGBLed) {
|
||||
QString temp = functions[i].paramarm;
|
||||
if (!temp.isEmpty()) {
|
||||
scriptsSetRGB.insert(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user