Missing initialization
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "boards.h"
|
#include "boards.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
@@ -432,7 +432,7 @@ class SwitchField: public ConversionField< SignedField<N> > {
|
|||||||
ConversionField< SignedField<N> >::beforeExport();
|
ConversionField< SignedField<N> >::beforeExport();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void afterImport()
|
void afterImport() override
|
||||||
{
|
{
|
||||||
ConversionField< SignedField<N> >::afterImport();
|
ConversionField< SignedField<N> >::afterImport();
|
||||||
sw = RawSwitch(_switch);
|
sw = RawSwitch(_switch);
|
||||||
@@ -466,7 +466,7 @@ class SourceField: public ConversionField< UnsignedField<N> > {
|
|||||||
ConversionField< UnsignedField<N> >::beforeExport();
|
ConversionField< UnsignedField<N> >::beforeExport();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void afterImport()
|
void afterImport() override
|
||||||
{
|
{
|
||||||
ConversionField< UnsignedField<N> >::afterImport();
|
ConversionField< UnsignedField<N> >::afterImport();
|
||||||
source = RawSource(_source);
|
source = RawSource(_source);
|
||||||
@@ -598,7 +598,7 @@ class CurveReferenceField: public TransformedField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void afterImport()
|
void afterImport() override
|
||||||
{
|
{
|
||||||
curve.type = (CurveReference::CurveRefType)_curve_type;
|
curve.type = (CurveReference::CurveRefType)_curve_type;
|
||||||
curve.value = smallGvarExport(_curve_value);
|
curve.value = smallGvarExport(_curve_value);
|
||||||
@@ -730,7 +730,7 @@ class FlightModeField: public TransformedField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void afterImport()
|
void afterImport() override
|
||||||
{
|
{
|
||||||
for (int i=0; i<CPN_MAX_STICKS+MAX_AUX_TRIMS(board); i++) {
|
for (int i=0; i<CPN_MAX_STICKS+MAX_AUX_TRIMS(board); i++) {
|
||||||
if (IS_HORUS_OR_TARANIS(board) || version >= 218) {
|
if (IS_HORUS_OR_TARANIS(board) || version >= 218) {
|
||||||
@@ -855,7 +855,7 @@ class MixField: public TransformedField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void beforeExport() override
|
void beforeExport() override
|
||||||
{
|
{
|
||||||
if (mix.destCh && mix.srcRaw.type != SOURCE_TYPE_NONE) {
|
if (mix.destCh && mix.srcRaw.type != SOURCE_TYPE_NONE) {
|
||||||
_destCh = mix.destCh - 1;
|
_destCh = mix.destCh - 1;
|
||||||
@@ -873,14 +873,14 @@ class MixField: public TransformedField {
|
|||||||
_curveParam = mix.curve.value;
|
_curveParam = mix.curve.value;
|
||||||
}
|
}
|
||||||
else if (mix.curve.type == CurveReference::CURVE_REF_DIFF) {
|
else if (mix.curve.type == CurveReference::CURVE_REF_DIFF) {
|
||||||
_curveMode = 0;
|
_curveMode = false;
|
||||||
_curveParam = smallGvarImport(mix.curve.value);
|
_curveParam = smallGvarImport(mix.curve.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mix.clear();
|
mix.clear();
|
||||||
_destCh = 0;
|
_destCh = 0;
|
||||||
_curveMode = 0;
|
_curveMode = false;
|
||||||
_curveParam = 0;
|
_curveParam = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -919,13 +919,12 @@ class MixField: public TransformedField {
|
|||||||
Board::Type board;
|
Board::Type board;
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
ModelData * model;
|
ModelData * model;
|
||||||
unsigned int _destCh;
|
unsigned int _destCh = 0;
|
||||||
bool _curveMode;
|
bool _curveMode = false;
|
||||||
int _curveParam;
|
int _curveParam = 0;
|
||||||
int _weight;
|
int _weight = 0;
|
||||||
int _offset;
|
int _offset = 0;
|
||||||
unsigned int _weightMode;
|
unsigned int _offsetMode = 0;
|
||||||
unsigned int _offsetMode;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputField: public TransformedField {
|
class InputField: public TransformedField {
|
||||||
@@ -981,7 +980,7 @@ class InputField: public TransformedField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void beforeExport()
|
void beforeExport() override
|
||||||
{
|
{
|
||||||
_weight = smallGvarImport(expo.weight);
|
_weight = smallGvarImport(expo.weight);
|
||||||
|
|
||||||
@@ -1005,7 +1004,7 @@ class InputField: public TransformedField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void afterImport()
|
void afterImport() override
|
||||||
{
|
{
|
||||||
if (!IS_STM32(board) && expo.mode) {
|
if (!IS_STM32(board) && expo.mode) {
|
||||||
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
|
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
|
||||||
@@ -1033,10 +1032,10 @@ class InputField: public TransformedField {
|
|||||||
ExpoData & expo;
|
ExpoData & expo;
|
||||||
Board::Type board;
|
Board::Type board;
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
bool _curveMode;
|
bool _curveMode = false;
|
||||||
int _weight;
|
int _weight = 0;
|
||||||
int _offset;
|
int _offset = 0;
|
||||||
int _curveParam;
|
int _curveParam = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LimitField: public StructField {
|
class LimitField: public StructField {
|
||||||
@@ -1236,8 +1235,8 @@ class CurvesField: public TransformedField {
|
|||||||
unsigned int version;
|
unsigned int version;
|
||||||
int maxCurves;
|
int maxCurves;
|
||||||
int maxPoints;
|
int maxPoints;
|
||||||
int _curves[CPN_MAX_CURVES];
|
int _curves[CPN_MAX_CURVES] = {};
|
||||||
int _points[CPN_MAX_CURVES*CPN_MAX_POINTS*2];
|
int _points[CPN_MAX_CURVES*CPN_MAX_POINTS*2] = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class LogicalSwitchesFunctionsTable: public ConversionTable {
|
class LogicalSwitchesFunctionsTable: public ConversionTable {
|
||||||
@@ -1280,10 +1279,7 @@ class LogicalSwitchField: public TransformedField {
|
|||||||
model(model),
|
model(model),
|
||||||
functionsConversionTable(board, version),
|
functionsConversionTable(board, version),
|
||||||
sourcesConversionTable(SourcesConversionTable::getInstance(board, version, variant, 0)),
|
sourcesConversionTable(SourcesConversionTable::getInstance(board, version, variant, 0)),
|
||||||
switchesConversionTable(SwitchesConversionTable::getInstance(board, version)),
|
switchesConversionTable(SwitchesConversionTable::getInstance(board, version))
|
||||||
v1(0),
|
|
||||||
v2(0),
|
|
||||||
v3(0)
|
|
||||||
{
|
{
|
||||||
if (version >= 218) {
|
if (version >= 218) {
|
||||||
internalField.Append(new ConversionField< UnsignedField<8> >(this, csw.func, &functionsConversionTable, "Function"));
|
internalField.Append(new ConversionField< UnsignedField<8> >(this, csw.func, &functionsConversionTable, "Function"));
|
||||||
@@ -1309,9 +1305,8 @@ class LogicalSwitchField: public TransformedField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~LogicalSwitchField()
|
~LogicalSwitchField() override
|
||||||
{
|
= default;
|
||||||
}
|
|
||||||
|
|
||||||
void beforeExport() override
|
void beforeExport() override
|
||||||
{
|
{
|
||||||
@@ -1375,9 +1370,9 @@ class LogicalSwitchField: public TransformedField {
|
|||||||
LogicalSwitchesFunctionsTable functionsConversionTable;
|
LogicalSwitchesFunctionsTable functionsConversionTable;
|
||||||
SourcesConversionTable * sourcesConversionTable;
|
SourcesConversionTable * sourcesConversionTable;
|
||||||
SwitchesConversionTable * switchesConversionTable;
|
SwitchesConversionTable * switchesConversionTable;
|
||||||
int v1;
|
int v1 = 0;
|
||||||
int v2;
|
int v2 = 0;
|
||||||
int v3;
|
int v3 = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CustomFunctionsConversionTable: public ConversionTable {
|
class CustomFunctionsConversionTable: public ConversionTable {
|
||||||
@@ -1385,7 +1380,7 @@ class CustomFunctionsConversionTable: public ConversionTable {
|
|||||||
public:
|
public:
|
||||||
CustomFunctionsConversionTable(Board::Type board, unsigned int version)
|
CustomFunctionsConversionTable(Board::Type board, unsigned int version)
|
||||||
{
|
{
|
||||||
int val=0;
|
int val = 0;
|
||||||
|
|
||||||
for (int i=0; i<MAX_CHANNELS(board, version); i++) {
|
for (int i=0; i<MAX_CHANNELS(board, version); i++) {
|
||||||
addConversion(i, val);
|
addConversion(i, val);
|
||||||
@@ -1462,7 +1457,7 @@ class SwitchesWarningField: public TransformedField {
|
|||||||
protected:
|
protected:
|
||||||
BaseUnsignedField<uint64_t, N> internalField;
|
BaseUnsignedField<uint64_t, N> internalField;
|
||||||
uint64_t & sw;
|
uint64_t & sw;
|
||||||
uint64_t _sw;
|
uint64_t _sw = 0;
|
||||||
Board::Type board;
|
Board::Type board;
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
};
|
};
|
||||||
@@ -1477,10 +1472,7 @@ class ArmCustomFunctionField: public TransformedField {
|
|||||||
version(version),
|
version(version),
|
||||||
variant(variant),
|
variant(variant),
|
||||||
functionsConversionTable(board, version),
|
functionsConversionTable(board, version),
|
||||||
sourcesConversionTable(SourcesConversionTable::getInstance(board, version, variant, 0)),
|
sourcesConversionTable(SourcesConversionTable::getInstance(board, version, variant, 0))
|
||||||
_func(0),
|
|
||||||
_active(0),
|
|
||||||
_mode(0)
|
|
||||||
{
|
{
|
||||||
memset(_param, 0, sizeof(_param));
|
memset(_param, 0, sizeof(_param));
|
||||||
|
|
||||||
@@ -1506,7 +1498,7 @@ class ArmCustomFunctionField: public TransformedField {
|
|||||||
return (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic);
|
return (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void beforeExport()
|
void beforeExport() override
|
||||||
{
|
{
|
||||||
if (fn.swtch.type != SWITCH_TYPE_NONE) {
|
if (fn.swtch.type != SWITCH_TYPE_NONE) {
|
||||||
_func = fn.func;
|
_func = fn.func;
|
||||||
@@ -1565,7 +1557,7 @@ class ArmCustomFunctionField: public TransformedField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void afterImport()
|
void afterImport() override
|
||||||
{
|
{
|
||||||
fn.func = (AssignFunc)_func;
|
fn.func = (AssignFunc)_func;
|
||||||
|
|
||||||
@@ -1627,10 +1619,9 @@ class ArmCustomFunctionField: public TransformedField {
|
|||||||
unsigned int variant;
|
unsigned int variant;
|
||||||
CustomFunctionsConversionTable functionsConversionTable;
|
CustomFunctionsConversionTable functionsConversionTable;
|
||||||
SourcesConversionTable * sourcesConversionTable;
|
SourcesConversionTable * sourcesConversionTable;
|
||||||
unsigned int _func;
|
unsigned int _func = 0;
|
||||||
char _param[10];
|
char _param[10] = {};
|
||||||
int _active;
|
int _active = 0;
|
||||||
unsigned int _mode;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class FrskyScreenField: public DataField {
|
class FrskyScreenField: public DataField {
|
||||||
@@ -1678,7 +1669,7 @@ class FrskyScreenField: public DataField {
|
|||||||
none.Append(new SpareBitsField<20*8>(this));
|
none.Append(new SpareBitsField<20*8>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void ExportBits(QBitArray & output)
|
void ExportBits(QBitArray & output) override
|
||||||
{
|
{
|
||||||
if (screen.type == TELEMETRY_SCREEN_SCRIPT)
|
if (screen.type == TELEMETRY_SCREEN_SCRIPT)
|
||||||
script.ExportBits(output);
|
script.ExportBits(output);
|
||||||
@@ -1690,7 +1681,7 @@ class FrskyScreenField: public DataField {
|
|||||||
none.ExportBits(output);
|
none.ExportBits(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void ImportBits(const QBitArray & input)
|
void ImportBits(const QBitArray & input) override
|
||||||
{
|
{
|
||||||
qCDebug(eepromImport) << QString("importing %1: type: %2").arg(name).arg(screen.type);
|
qCDebug(eepromImport) << QString("importing %1: type: %2").arg(name).arg(screen.type);
|
||||||
|
|
||||||
@@ -1705,7 +1696,7 @@ class FrskyScreenField: public DataField {
|
|||||||
none.ImportBits(input);
|
none.ImportBits(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual unsigned int size()
|
unsigned int size() override
|
||||||
{
|
{
|
||||||
// NOTA: screen.type should have been imported first!
|
// NOTA: screen.type should have been imported first!
|
||||||
if (screen.type == TELEMETRY_SCREEN_SCRIPT)
|
if (screen.type == TELEMETRY_SCREEN_SCRIPT)
|
||||||
@@ -1731,7 +1722,7 @@ class FrskyScreenField: public DataField {
|
|||||||
class RSSIConversionTable: public ConversionTable
|
class RSSIConversionTable: public ConversionTable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RSSIConversionTable(int index)
|
explicit RSSIConversionTable(int index)
|
||||||
{
|
{
|
||||||
addConversion(0, 2-index);
|
addConversion(0, 2-index);
|
||||||
addConversion(1, 3-index);
|
addConversion(1, 3-index);
|
||||||
@@ -1740,8 +1731,7 @@ class RSSIConversionTable: public ConversionTable
|
|||||||
}
|
}
|
||||||
|
|
||||||
RSSIConversionTable()
|
RSSIConversionTable()
|
||||||
{
|
= default;
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TelemetryVarioSourceConversionTable: public ConversionTable
|
class TelemetryVarioSourceConversionTable: public ConversionTable
|
||||||
@@ -1892,8 +1882,7 @@ class SensorField: public TransformedField {
|
|||||||
internalField(this, "Sensor"),
|
internalField(this, "Sensor"),
|
||||||
sensor(sensor),
|
sensor(sensor),
|
||||||
model(model),
|
model(model),
|
||||||
version(version),
|
version(version)
|
||||||
_param(0)
|
|
||||||
{
|
{
|
||||||
internalField.Append(new UnsignedField<16>(this, _id, "id/persistentValue"));
|
internalField.Append(new UnsignedField<16>(this, _id, "id/persistentValue"));
|
||||||
internalField.Append(new UnsignedField<8>(this, _instance, "instance/formula"));
|
internalField.Append(new UnsignedField<8>(this, _instance, "instance/formula"));
|
||||||
@@ -1948,7 +1937,7 @@ class SensorField: public TransformedField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void afterImport()
|
void afterImport() override
|
||||||
{
|
{
|
||||||
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
|
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
|
||||||
sensor.id = _id;
|
sensor.id = _id;
|
||||||
@@ -1991,11 +1980,11 @@ class SensorField: public TransformedField {
|
|||||||
SensorData & sensor;
|
SensorData & sensor;
|
||||||
const ModelData& model;
|
const ModelData& model;
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
unsigned int _id;
|
unsigned int _id = 0;
|
||||||
unsigned int _subid;
|
unsigned int _subid = 0;
|
||||||
unsigned int _instance;
|
unsigned int _instance = 0;
|
||||||
union {
|
union {
|
||||||
unsigned int _param;
|
unsigned int _param = 0;
|
||||||
uint8_t _sources[4];
|
uint8_t _sources[4];
|
||||||
struct {
|
struct {
|
||||||
uint16_t _ratio;
|
uint16_t _ratio;
|
||||||
@@ -2020,12 +2009,12 @@ class ModuleUnionField: public UnionField<unsigned int> {
|
|||||||
Append(new SignedField<8>(parent, ppm.frameLength));
|
Append(new SignedField<8>(parent, ppm.frameLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool select(const unsigned int& attr) const
|
bool select(const unsigned int & attr) const override
|
||||||
{
|
{
|
||||||
return true; // take what's left
|
return true; // take what's left
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual DataField* getField()
|
DataField * getField() override
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -2048,21 +2037,20 @@ class ModuleUnionField: public UnionField<unsigned int> {
|
|||||||
internalField.Append(new SignedField<8>(this, multi.optionValue));
|
internalField.Append(new SignedField<8>(this, multi.optionValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool select(const unsigned int& attr) const
|
bool select(const unsigned int & attr) const override
|
||||||
{
|
{
|
||||||
return attr==PULSES_MULTIMODULE;
|
return attr == PULSES_MULTIMODULE;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void beforeExport()
|
void beforeExport() override
|
||||||
{
|
{
|
||||||
module.rfProtocol = module.multi.rfProtocol & 0xf;
|
module.rfProtocol = module.multi.rfProtocol & 0xf;
|
||||||
rfProtExtra = (module.multi.rfProtocol >> 4) & 0x03;
|
rfProtExtra = (module.multi.rfProtocol >> 4) & 0x03;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void afterImport()
|
void afterImport() override
|
||||||
{
|
{
|
||||||
module.multi.rfProtocol =
|
module.multi.rfProtocol = (rfProtExtra & 0x3) << 4 | (module.rfProtocol & 0xf);
|
||||||
(rfProtExtra & 0x3) << 4 | (module.rfProtocol & 0xf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -2087,21 +2075,21 @@ class ModuleUnionField: public UnionField<unsigned int> {
|
|||||||
internalField.Append(new BoolField<1>(this, pxx.sport_out));
|
internalField.Append(new BoolField<1>(this, pxx.sport_out));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool select(const unsigned int& attr) const {
|
bool select(const unsigned int& attr) const override {
|
||||||
return attr==PULSES_PXX_XJT_X16 ||
|
return attr==PULSES_PXX_XJT_X16 ||
|
||||||
attr==PULSES_PXX_DJT ||
|
attr==PULSES_PXX_DJT ||
|
||||||
attr==PULSES_PXX_R9M ||
|
attr==PULSES_PXX_R9M ||
|
||||||
attr==PULSES_PXX_R9M_LITE;
|
attr==PULSES_PXX_R9M_LITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void beforeExport()
|
void beforeExport() override
|
||||||
{
|
{
|
||||||
if (module.protocol >= PULSES_PXX_XJT_X16 && module.protocol <= PULSES_PXX_XJT_LR12) {
|
if (module.protocol >= PULSES_PXX_XJT_X16 && module.protocol <= PULSES_PXX_XJT_LR12) {
|
||||||
module.subType = module.protocol - PULSES_PXX_XJT_X16;
|
module.subType = module.protocol - PULSES_PXX_XJT_X16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void afterImport()
|
void afterImport() override
|
||||||
{
|
{
|
||||||
if (module.protocol == PULSES_PXX_XJT_X16) {
|
if (module.protocol == PULSES_PXX_XJT_X16) {
|
||||||
module.protocol += module.subType;
|
module.protocol += module.subType;
|
||||||
@@ -2125,13 +2113,15 @@ class ModuleUnionField: public UnionField<unsigned int> {
|
|||||||
|
|
||||||
for (int i=0; i<PXX2_MAX_RECEIVERS_PER_MODULE; i++)
|
for (int i=0; i<PXX2_MAX_RECEIVERS_PER_MODULE; i++)
|
||||||
internalField.Append(new CharField<8>(this, receiverName[i]));
|
internalField.Append(new CharField<8>(this, receiverName[i]));
|
||||||
|
|
||||||
|
memset(receiverName, 0, sizeof(receiverName));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool select(const unsigned int& attr) const {
|
bool select(const unsigned int& attr) const override {
|
||||||
return attr >= PULSES_ACCESS_ISRM && attr <= PULSES_ACCESS_R9M_LITE_PRO;
|
return attr >= PULSES_ACCESS_ISRM && attr <= PULSES_ACCESS_R9M_LITE_PRO;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void beforeExport()
|
void beforeExport() override
|
||||||
{
|
{
|
||||||
if (module.protocol == PULSES_ACCST_ISRM_D16 ||
|
if (module.protocol == PULSES_ACCST_ISRM_D16 ||
|
||||||
module.protocol == PULSES_ACCESS_ISRM) {
|
module.protocol == PULSES_ACCESS_ISRM) {
|
||||||
@@ -2151,7 +2141,7 @@ class ModuleUnionField: public UnionField<unsigned int> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void afterImport()
|
void afterImport() override
|
||||||
{
|
{
|
||||||
if (module.protocol == PULSES_ACCESS_ISRM) {
|
if (module.protocol == PULSES_ACCESS_ISRM) {
|
||||||
module.protocol += module.subType;
|
module.protocol += module.subType;
|
||||||
@@ -2172,8 +2162,8 @@ class ModuleUnionField: public UnionField<unsigned int> {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
StructField internalField;
|
StructField internalField;
|
||||||
ModuleData& module;
|
ModuleData & module;
|
||||||
char receiverName[PXX2_MAX_RECEIVERS_PER_MODULE][PXX2_LEN_RX_NAME+1];
|
char receiverName[PXX2_MAX_RECEIVERS_PER_MODULE][PXX2_LEN_RX_NAME+1] = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ class SimulatedUIWidget : public QWidget
|
|||||||
unsigned int m_backLight;
|
unsigned int m_backLight;
|
||||||
int m_beepShow;
|
int m_beepShow;
|
||||||
int m_beepVal;
|
int m_beepVal;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -153,19 +153,12 @@ SimulatorMainWindow::SimulatorMainWindow(QWidget *parent, const QString & firmwa
|
|||||||
|
|
||||||
SimulatorMainWindow::~SimulatorMainWindow()
|
SimulatorMainWindow::~SimulatorMainWindow()
|
||||||
{
|
{
|
||||||
if (m_telemetryDockWidget)
|
delete m_telemetryDockWidget;
|
||||||
delete m_telemetryDockWidget;
|
delete m_trainerDockWidget;
|
||||||
if (m_trainerDockWidget)
|
delete m_outputsDockWidget;
|
||||||
delete m_trainerDockWidget;
|
delete m_simulatorDockWidget;
|
||||||
if (m_outputsDockWidget)
|
delete m_simulatorWidget;
|
||||||
delete m_outputsDockWidget;
|
delete m_consoleDockWidget;
|
||||||
if (m_simulatorDockWidget)
|
|
||||||
delete m_simulatorDockWidget;
|
|
||||||
else if (m_simulatorWidget)
|
|
||||||
delete m_simulatorWidget;
|
|
||||||
if (m_consoleDockWidget)
|
|
||||||
delete m_consoleDockWidget;
|
|
||||||
|
|
||||||
delete ui;
|
delete ui;
|
||||||
|
|
||||||
if (m_simulator) {
|
if (m_simulator) {
|
||||||
@@ -293,7 +286,7 @@ void SimulatorMainWindow::createDockWidgets()
|
|||||||
if (!m_telemetryDockWidget) {
|
if (!m_telemetryDockWidget) {
|
||||||
SimulatorIcon icon("telemetry");
|
SimulatorIcon icon("telemetry");
|
||||||
m_telemetryDockWidget = new QDockWidget(tr("Telemetry Simulator"), this);
|
m_telemetryDockWidget = new QDockWidget(tr("Telemetry Simulator"), this);
|
||||||
TelemetrySimulator * telem = new TelemetrySimulator(this, m_simulator);
|
auto * telem = new TelemetrySimulator(this, m_simulator);
|
||||||
m_telemetryDockWidget->setWidget(telem);
|
m_telemetryDockWidget->setWidget(telem);
|
||||||
m_telemetryDockWidget->setObjectName("TELEMETRY_SIMULATOR");
|
m_telemetryDockWidget->setObjectName("TELEMETRY_SIMULATOR");
|
||||||
addTool(m_telemetryDockWidget, Qt::LeftDockWidgetArea, icon, QKeySequence(tr("F4")));
|
addTool(m_telemetryDockWidget, Qt::LeftDockWidgetArea, icon, QKeySequence(tr("F4")));
|
||||||
@@ -302,7 +295,7 @@ void SimulatorMainWindow::createDockWidgets()
|
|||||||
if (!m_trainerDockWidget) {
|
if (!m_trainerDockWidget) {
|
||||||
SimulatorIcon icon("trainer");
|
SimulatorIcon icon("trainer");
|
||||||
m_trainerDockWidget = new QDockWidget(tr("Trainer Simulator"), this);
|
m_trainerDockWidget = new QDockWidget(tr("Trainer Simulator"), this);
|
||||||
TrainerSimulator * trainer = new TrainerSimulator(this, m_simulator);
|
auto * trainer = new TrainerSimulator(this, m_simulator);
|
||||||
m_trainerDockWidget->setWidget(trainer);
|
m_trainerDockWidget->setWidget(trainer);
|
||||||
m_trainerDockWidget->setObjectName("TRAINER_SIMULATOR");
|
m_trainerDockWidget->setObjectName("TRAINER_SIMULATOR");
|
||||||
addTool(m_trainerDockWidget, Qt::TopDockWidgetArea, icon, QKeySequence(tr("F5")));
|
addTool(m_trainerDockWidget, Qt::TopDockWidgetArea, icon, QKeySequence(tr("F5")));
|
||||||
|
|||||||
@@ -50,17 +50,8 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
|
|||||||
simulator(simulator),
|
simulator(simulator),
|
||||||
firmware(getCurrentFirmware()),
|
firmware(getCurrentFirmware()),
|
||||||
radioSettings(GeneralSettings()),
|
radioSettings(GeneralSettings()),
|
||||||
radioUiWidget(NULL),
|
|
||||||
vJoyLeft(NULL),
|
|
||||||
vJoyRight(NULL),
|
|
||||||
m_board(getCurrentBoard()),
|
m_board(getCurrentBoard()),
|
||||||
flags(flags),
|
flags(flags)
|
||||||
startupFromFile(false),
|
|
||||||
deleteTempRadioData(false),
|
|
||||||
saveTempRadioData(false)
|
|
||||||
#ifdef JOYSTICKS
|
|
||||||
, joystick(NULL)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
@@ -154,21 +145,16 @@ SimulatorWidget::~SimulatorWidget()
|
|||||||
{
|
{
|
||||||
shutdown();
|
shutdown();
|
||||||
|
|
||||||
if (radioUiWidget)
|
delete radioUiWidget;
|
||||||
delete radioUiWidget;
|
delete vJoyLeft;
|
||||||
if (vJoyLeft)
|
delete vJoyRight;
|
||||||
delete vJoyLeft;
|
|
||||||
if (vJoyRight)
|
|
||||||
delete vJoyRight;
|
|
||||||
#ifdef JOYSTICKS
|
#ifdef JOYSTICKS
|
||||||
if (joystick)
|
delete joystick;
|
||||||
delete joystick;
|
|
||||||
#endif
|
#endif
|
||||||
firmware = NULL;
|
firmware = nullptr;
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Public slots/setters
|
* Public slots/setters
|
||||||
*/
|
*/
|
||||||
@@ -570,7 +556,7 @@ void SimulatorWidget::setupRadioWidgets()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
swcfg = Board::SwitchType(radioSettings.switchConfig[i]);
|
swcfg = Board::SwitchType(radioSettings.switchConfig[i]);
|
||||||
wname = RawSource(RawSourceType::SOURCE_TYPE_SWITCH, i).toString(NULL, &radioSettings);
|
wname = RawSource(RawSourceType::SOURCE_TYPE_SWITCH, i).toString(nullptr, &radioSettings);
|
||||||
RadioSwitchWidget * sw = new RadioSwitchWidget(swcfg, wname, -1, ui->radioWidgetsHT);
|
RadioSwitchWidget * sw = new RadioSwitchWidget(swcfg, wname, -1, ui->radioWidgetsHT);
|
||||||
sw->setIndex(i);
|
sw->setIndex(i);
|
||||||
ui->radioWidgetsHTLayout->addWidget(sw);
|
ui->radioWidgetsHTLayout->addWidget(sw);
|
||||||
@@ -585,7 +571,7 @@ void SimulatorWidget::setupRadioWidgets()
|
|||||||
if (!radioSettings.isPotAvailable(i))
|
if (!radioSettings.isPotAvailable(i))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
wname = RawSource(RawSourceType::SOURCE_TYPE_STICK, ttlSticks + i).toString(NULL, &radioSettings);
|
wname = RawSource(RawSourceType::SOURCE_TYPE_STICK, ttlSticks + i).toString(nullptr, &radioSettings);
|
||||||
RadioKnobWidget * pot = new RadioKnobWidget(Board::PotType(radioSettings.potConfig[i]), wname, 0, ui->radioWidgetsHT);
|
RadioKnobWidget * pot = new RadioKnobWidget(Board::PotType(radioSettings.potConfig[i]), wname, 0, ui->radioWidgetsHT);
|
||||||
pot->setIndex(i);
|
pot->setIndex(i);
|
||||||
ui->radioWidgetsHTLayout->insertWidget(midpos++, pot);
|
ui->radioWidgetsHTLayout->insertWidget(midpos++, pot);
|
||||||
@@ -599,7 +585,7 @@ void SimulatorWidget::setupRadioWidgets()
|
|||||||
if (!radioSettings.isSliderAvailable(i))
|
if (!radioSettings.isSliderAvailable(i))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
wname = RawSource(RawSourceType::SOURCE_TYPE_STICK, ttlSticks + ttlKnobs + i).toString(NULL, &radioSettings);
|
wname = RawSource(RawSourceType::SOURCE_TYPE_STICK, ttlSticks + ttlKnobs + i).toString(nullptr, &radioSettings);
|
||||||
RadioFaderWidget * sl = new RadioFaderWidget(wname, 0, ui->radioWidgetsVC);
|
RadioFaderWidget * sl = new RadioFaderWidget(wname, 0, ui->radioWidgetsVC);
|
||||||
sl->setIndex(i);
|
sl->setIndex(i);
|
||||||
ui->VCGridLayout->addWidget(sl, 0, c++, 1, 1);
|
ui->VCGridLayout->addWidget(sl, 0, c++, 1, 1);
|
||||||
@@ -613,7 +599,7 @@ void SimulatorWidget::setupRadioWidgets()
|
|||||||
for (i = extraTrims; i > 0; --i) {
|
for (i = extraTrims; i > 0; --i) {
|
||||||
trswidx -= 2;
|
trswidx -= 2;
|
||||||
--tridx;
|
--tridx;
|
||||||
wname = RawSource(RawSourceType::SOURCE_TYPE_TRIM, tridx).toString(NULL, &radioSettings);
|
wname = RawSource(RawSourceType::SOURCE_TYPE_TRIM, tridx).toString(nullptr, &radioSettings);
|
||||||
wname = wname.left(1) % wname.right(1);
|
wname = wname.left(1) % wname.right(1);
|
||||||
RadioTrimWidget * tw = new RadioTrimWidget(Qt::Vertical, ui->radioWidgetsVC);
|
RadioTrimWidget * tw = new RadioTrimWidget(Qt::Vertical, ui->radioWidgetsVC);
|
||||||
tw->setIndices(tridx, trswidx, trswidx + 1);
|
tw->setIndices(tridx, trswidx, trswidx + 1);
|
||||||
@@ -672,7 +658,7 @@ void SimulatorWidget::setupJoysticks()
|
|||||||
if (vJoyRight)
|
if (vJoyRight)
|
||||||
disconnect(this, 0, vJoyRight, 0);
|
disconnect(this, 0, vJoyRight, 0);
|
||||||
joystick->deleteLater();
|
joystick->deleteLater();
|
||||||
joystick = NULL;
|
joystick = nullptr;
|
||||||
}
|
}
|
||||||
if (vJoyRight)
|
if (vJoyRight)
|
||||||
vJoyRight->setStickConstraint((VirtualJoystickWidget::HOLD_X | VirtualJoystickWidget::HOLD_Y), joysticksEnabled);
|
vJoyRight->setStickConstraint((VirtualJoystickWidget::HOLD_X | VirtualJoystickWidget::HOLD_Y), joysticksEnabled);
|
||||||
|
|||||||
@@ -33,8 +33,6 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
void traceCb(const char * text);
|
|
||||||
|
|
||||||
class Firmware;
|
class Firmware;
|
||||||
class SimulatorInterface;
|
class SimulatorInterface;
|
||||||
class SimulatedUIWidget;
|
class SimulatedUIWidget;
|
||||||
@@ -130,9 +128,9 @@ class SimulatorWidget : public QWidget
|
|||||||
QVector<Simulator::keymapHelp_t> keymapHelp;
|
QVector<Simulator::keymapHelp_t> keymapHelp;
|
||||||
QElapsedTimer m_heartbeatTimer;
|
QElapsedTimer m_heartbeatTimer;
|
||||||
|
|
||||||
SimulatedUIWidget * radioUiWidget;
|
SimulatedUIWidget * radioUiWidget = nullptr;
|
||||||
VirtualJoystickWidget * vJoyLeft;
|
VirtualJoystickWidget * vJoyLeft = nullptr;
|
||||||
VirtualJoystickWidget * vJoyRight;
|
VirtualJoystickWidget * vJoyRight = nullptr;
|
||||||
QVector<RadioWidget *> m_radioWidgets;
|
QVector<RadioWidget *> m_radioWidgets;
|
||||||
|
|
||||||
QString sdCardPath;
|
QString sdCardPath;
|
||||||
@@ -141,14 +139,13 @@ class SimulatorWidget : public QWidget
|
|||||||
Board::Type m_board;
|
Board::Type m_board;
|
||||||
quint8 flags;
|
quint8 flags;
|
||||||
int radioProfileId;
|
int radioProfileId;
|
||||||
bool startupFromFile;
|
bool startupFromFile = false;
|
||||||
bool deleteTempRadioData;
|
bool deleteTempRadioData = false;
|
||||||
bool saveTempRadioData;
|
bool saveTempRadioData = false;
|
||||||
|
|
||||||
#ifdef JOYSTICKS
|
#ifdef JOYSTICKS
|
||||||
Joystick *joystick;
|
Joystick * joystick = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SIMULATORWIDGET_H_
|
#endif // _SIMULATORWIDGET_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user