chore: Companion - port of OpenTX function switches management (#1694)

* TPro - Port of OpenTX function switches management (https://github.com/opentx/opentx/pull/8847)

* cleanup

* Corrections

* Fix YAML generation and adjusted switches to match TPRO firmware

Co-authored-by: Batam <batam@macbook-pro.home>
This commit is contained in:
Batambatam
2022-03-21 10:43:27 +10:00
committed by GitHub
co-authored by Batam
parent 1d7c153979
commit ab15a5a514
22 changed files with 434 additions and 186 deletions
+18
View File
@@ -305,6 +305,24 @@ void Helpers::exportAppSettings(QWidget * dlgParent)
exportAppSettings(dlgParent);
}
unsigned int Helpers::getBitmappedValue(const unsigned int & field, const unsigned int index, const unsigned int numbits, const unsigned int offset)
{
int mask = -1;
mask = mask << numbits;
mask = ~mask;
return (field >> (numbits * index + offset)) & (unsigned int)mask;
}
void Helpers::setBitmappedValue(unsigned int & field, unsigned int value, unsigned int index, unsigned int numbits, unsigned int offset)
{
int mask = -1;
mask = mask << numbits;
mask = ~mask;
unsigned int fieldmask = ((unsigned int)mask << (numbits * index + offset));
field = (field & ~fieldmask) | (value << (numbits * index + offset));
}
void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
{
QString fwId = SimulatorLoader::findSimulatorByFirmwareName(getCurrentFirmware()->getId());