mirror of
https://github.com/opentx/opentx.git
synced 2025-07-18 22:05:10 +03:00
Fixes #2299
This commit is contained in:
parent
22f4c11bd9
commit
0c01f66272
15 changed files with 122 additions and 168 deletions
|
@ -423,7 +423,7 @@ QString RotaryEncoderString(int index)
|
||||||
return CHECK_IN_ARRAY(rotary, index);
|
return CHECK_IN_ARRAY(rotary, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RawSource::toString(const ModelData * model)
|
QString RawSource::toString(const ModelData * model) const
|
||||||
{
|
{
|
||||||
static const QString trims[] = {
|
static const QString trims[] = {
|
||||||
QObject::tr("TrmR"), QObject::tr("TrmE"), QObject::tr("TrmT"), QObject::tr("TrmA")
|
QObject::tr("TrmR"), QObject::tr("TrmE"), QObject::tr("TrmT"), QObject::tr("TrmA")
|
||||||
|
|
|
@ -316,7 +316,7 @@ class RawSource {
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
RawSource(int value):
|
explicit RawSource(int value):
|
||||||
type(RawSourceType(abs(value)/65536)),
|
type(RawSourceType(abs(value)/65536)),
|
||||||
index(value >= 0 ? abs(value)%65536 : -(abs(value)%65536))
|
index(value >= 0 ? abs(value)%65536 : -(abs(value)%65536))
|
||||||
{
|
{
|
||||||
|
@ -333,7 +333,7 @@ class RawSource {
|
||||||
return index >= 0 ? (type * 65536 + index) : -(type * 65536 - index);
|
return index >= 0 ? (type * 65536 + index) : -(type * 65536 - index);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString toString(const ModelData * model = NULL);
|
QString toString(const ModelData * model = NULL) const;
|
||||||
|
|
||||||
RawSourceRange getRange(const ModelData * model, const GeneralSettings & settings, unsigned int flags=0) const;
|
RawSourceRange getRange(const ModelData * model, const GeneralSettings & settings, unsigned int flags=0) const;
|
||||||
|
|
||||||
|
@ -692,13 +692,13 @@ class FrSkyChannelData {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FrSkyBarData {
|
struct FrSkyBarData {
|
||||||
unsigned int source;
|
RawSource source;
|
||||||
unsigned int barMin; // minimum for bar display
|
unsigned int barMin; // minimum for bar display
|
||||||
unsigned int barMax; // ditto for max display (would usually = ratio)
|
unsigned int barMax; // ditto for max display (would usually = ratio)
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FrSkyLineData {
|
struct FrSkyLineData {
|
||||||
unsigned int source[3];
|
RawSource source[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TelemetryScriptData {
|
struct TelemetryScriptData {
|
||||||
|
@ -716,7 +716,7 @@ class FrSkyScreenData {
|
||||||
public:
|
public:
|
||||||
FrSkyScreenData() { clear(); }
|
FrSkyScreenData() { clear(); }
|
||||||
|
|
||||||
typedef union {
|
typedef struct {
|
||||||
FrSkyBarData bars[4];
|
FrSkyBarData bars[4];
|
||||||
FrSkyLineData lines[4];
|
FrSkyLineData lines[4];
|
||||||
TelemetryScriptData script;
|
TelemetryScriptData script;
|
||||||
|
|
|
@ -502,13 +502,6 @@ t_Open9xGruvin9xModelData_v207::operator ModelData ()
|
||||||
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
||||||
c9x.thrTraceSrc = thrTraceSrc;
|
c9x.thrTraceSrc = thrTraceSrc;
|
||||||
c9x.moduleData[0].modelId = modelId;
|
c9x.moduleData[0].modelId = modelId;
|
||||||
for (int line=0; line<4; line++) {
|
|
||||||
for (int col=0; col<2; col++) {
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] = (col==0 ? (frskyLines[line] & 0x0f) : ((frskyLines[line] & 0xf0) / 16));
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] += (((frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,16 +581,9 @@ t_Open9xGruvin9xModelData_v208::operator ModelData ()
|
||||||
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
||||||
c9x.thrTraceSrc = thrTraceSrc;
|
c9x.thrTraceSrc = thrTraceSrc;
|
||||||
c9x.moduleData[0].modelId = modelId;
|
c9x.moduleData[0].modelId = modelId;
|
||||||
for (int line=0; line<4; line++) {
|
|
||||||
for (int col=0; col<2; col++) {
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] = (col==0 ? (frskyLines[line] & 0x0f) : ((frskyLines[line] & 0xf0) / 16));
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] += (((frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i=0; i<16; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
c9x.limitData[i].ppmCenter = servoCenter[i];
|
c9x.limitData[i].ppmCenter = servoCenter[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,16 +664,9 @@ t_Open9xGruvin9xModelData_v209::operator ModelData ()
|
||||||
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
||||||
c9x.thrTraceSrc = thrTraceSrc;
|
c9x.thrTraceSrc = thrTraceSrc;
|
||||||
c9x.moduleData[0].modelId = modelId;
|
c9x.moduleData[0].modelId = modelId;
|
||||||
for (int line=0; line<4; line++) {
|
|
||||||
for (int col=0; col<2; col++) {
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] = (col==0 ? (frskyLines[line] & 0x0f) : ((frskyLines[line] & 0xf0) / 16));
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] += (((frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i=0; i<16; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
c9x.limitData[i].ppmCenter = servoCenter[i];
|
c9x.limitData[i].ppmCenter = servoCenter[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -683,21 +683,8 @@ t_Open9xArmFrSkyData_v210::operator FrSkyData ()
|
||||||
c9x.blades = blades+2;
|
c9x.blades = blades+2;
|
||||||
c9x.currentSource=currentSource;
|
c9x.currentSource=currentSource;
|
||||||
c9x.screens[0].type = 1;
|
c9x.screens[0].type = 1;
|
||||||
for (int i=0; i<4; i++) {
|
|
||||||
c9x.screens[0].body.bars[i].source = bars[i].source;
|
|
||||||
c9x.screens[0].body.bars[i].barMin = bars[i].barMin;
|
|
||||||
c9x.screens[0].body.bars[i].barMax = bars[i].barMax;
|
|
||||||
}
|
|
||||||
c9x.rssiAlarms[0] = rssiAlarms[0].get(0);
|
c9x.rssiAlarms[0] = rssiAlarms[0].get(0);
|
||||||
c9x.rssiAlarms[1] = rssiAlarms[1].get(1);
|
c9x.rssiAlarms[1] = rssiAlarms[1].get(1);
|
||||||
|
|
||||||
for (int line=0; line<4; line++) {
|
|
||||||
for (int col=0; col<2; col++) {
|
|
||||||
int i=line*2+col;
|
|
||||||
c9x.screens[1].body.lines[line].source[col] = lines[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -711,21 +698,8 @@ t_Open9xArmFrSkyData_v211::operator FrSkyData ()
|
||||||
c9x.blades = blades+2;
|
c9x.blades = blades+2;
|
||||||
c9x.currentSource=currentSource;
|
c9x.currentSource=currentSource;
|
||||||
c9x.screens[0].type = 1;
|
c9x.screens[0].type = 1;
|
||||||
for (int i=0; i<4; i++) {
|
|
||||||
c9x.screens[0].body.bars[i].source = bars[i].source;
|
|
||||||
c9x.screens[0].body.bars[i].barMin = bars[i].barMin;
|
|
||||||
c9x.screens[0].body.bars[i].barMax = bars[i].barMax;
|
|
||||||
}
|
|
||||||
c9x.rssiAlarms[0] = rssiAlarms[0].get(0);
|
c9x.rssiAlarms[0] = rssiAlarms[0].get(0);
|
||||||
c9x.rssiAlarms[1] = rssiAlarms[1].get(1);
|
c9x.rssiAlarms[1] = rssiAlarms[1].get(1);
|
||||||
|
|
||||||
for (int line=0; line<4; line++) {
|
|
||||||
for (int col=0; col<2; col++) {
|
|
||||||
int i=line*2+col;
|
|
||||||
c9x.screens[1].body.lines[line].source[col] = lines[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
c9x.varioSource = varioSource;
|
c9x.varioSource = varioSource;
|
||||||
c9x.varioCenterMax = varioSpeedUpMin;
|
c9x.varioCenterMax = varioSpeedUpMin;
|
||||||
c9x.varioCenterMin = varioSpeedDownMin;
|
c9x.varioCenterMin = varioSpeedDownMin;
|
||||||
|
@ -809,12 +783,6 @@ t_Open9xArmModelData_v208::operator ModelData ()
|
||||||
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
||||||
c9x.thrTraceSrc = thrTraceSrc;
|
c9x.thrTraceSrc = thrTraceSrc;
|
||||||
c9x.moduleData[0].modelId = modelId;
|
c9x.moduleData[0].modelId = modelId;
|
||||||
for (int line=0; line<4; line++) {
|
|
||||||
for (int col=0; col<2; col++) {
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] = (col==0 ? (frskyLines[line] & 0x0f) : ((frskyLines[line] & 0xf0) / 16));
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] += (((frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i=0; i<16; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
c9x.limitData[i].ppmCenter = servoCenter[i];
|
c9x.limitData[i].ppmCenter = servoCenter[i];
|
||||||
}
|
}
|
||||||
|
@ -899,12 +867,6 @@ t_Open9xArmModelData_v209::operator ModelData ()
|
||||||
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
||||||
c9x.thrTraceSrc = thrTraceSrc;
|
c9x.thrTraceSrc = thrTraceSrc;
|
||||||
c9x.moduleData[0].modelId = modelId;
|
c9x.moduleData[0].modelId = modelId;
|
||||||
for (int line=0; line<4; line++) {
|
|
||||||
for (int col=0; col<2; col++) {
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] = (col==0 ? (frskyLines[line] & 0x0f) : ((frskyLines[line] & 0xf0) / 16));
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] += (((frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i=0; i<16; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
c9x.limitData[i].ppmCenter = servoCenter[i];
|
c9x.limitData[i].ppmCenter = servoCenter[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@ int8_t char2idx(char c)
|
||||||
if (c>='0' && c<='9') return 27+c-'0';
|
if (c>='0' && c<='9') return 27+c-'0';
|
||||||
for (int8_t i=0;;i++) {
|
for (int8_t i=0;;i++) {
|
||||||
char cc = specialCharsTab[i];
|
char cc = specialCharsTab[i];
|
||||||
if(cc==0) return 0;
|
if (cc==0) return 0;
|
||||||
if(cc==c) return 37+i;
|
if (cc==c) return 37+i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -828,7 +828,7 @@ t_Open9xFrSkyData_v203::operator FrSkyData ()
|
||||||
t_Open9xFrSkyBarData_v204::operator FrSkyBarData ()
|
t_Open9xFrSkyBarData_v204::operator FrSkyBarData ()
|
||||||
{
|
{
|
||||||
FrSkyBarData c9x;
|
FrSkyBarData c9x;
|
||||||
c9x.source = source;
|
c9x.source = RawSource(SOURCE_TYPE_TELEMETRY, source);
|
||||||
c9x.barMin = barMin;
|
c9x.barMin = barMin;
|
||||||
c9x.barMax = barMax;
|
c9x.barMax = barMax;
|
||||||
return c9x;
|
return c9x;
|
||||||
|
@ -899,12 +899,6 @@ t_Open9xFrSkyData_v210::operator FrSkyData ()
|
||||||
}
|
}
|
||||||
|
|
||||||
c9x.screens[lines_screen_index].type = 0;
|
c9x.screens[lines_screen_index].type = 0;
|
||||||
for (int line=0; line<4; line++) {
|
|
||||||
for (int col=0; col<2; col++) {
|
|
||||||
c9x.screens[lines_screen_index].body.lines[line].source[col] = (col==0 ? (lines[line] & 0x0f) : ((lines[line] & 0xf0) / 16));
|
|
||||||
c9x.screens[lines_screen_index].body.lines[line].source[col] += (((linesXtra >> (4*line+2*col)) & 0x03) * 16);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
c9x.rssiAlarms[0] = rssiAlarms[0].get(0);
|
c9x.rssiAlarms[0] = rssiAlarms[0].get(0);
|
||||||
c9x.rssiAlarms[1] = rssiAlarms[1].get(1);
|
c9x.rssiAlarms[1] = rssiAlarms[1].get(1);
|
||||||
|
@ -1289,13 +1283,6 @@ t_Open9xModelData_v205::operator ModelData ()
|
||||||
c9x.thrTraceSrc = thrTraceSrc;
|
c9x.thrTraceSrc = thrTraceSrc;
|
||||||
c9x.moduleData[0]. modelId = modelId;
|
c9x.moduleData[0]. modelId = modelId;
|
||||||
c9x.frsky.screens[1].type = 0;
|
c9x.frsky.screens[1].type = 0;
|
||||||
for (int line=0; line<4; line++) {
|
|
||||||
for (int col=0; col<2; col++) {
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] = (col==0 ? (frskyLines[line] & 0x0f) : ((frskyLines[line] & 0xf0) / 16));
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] += (((frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1379,16 +1366,9 @@ t_Open9xModelData_v208::operator ModelData ()
|
||||||
c9x.thrTraceSrc = thrTraceSrc;
|
c9x.thrTraceSrc = thrTraceSrc;
|
||||||
c9x.moduleData[0].modelId = modelId;
|
c9x.moduleData[0].modelId = modelId;
|
||||||
c9x.frsky.screens[1].type = 0;
|
c9x.frsky.screens[1].type = 0;
|
||||||
for (int line=0; line<4; line++) {
|
|
||||||
for (int col=0; col<2; col++) {
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] = (col==0 ? (frskyLines[line] & 0x0f) : ((frskyLines[line] & 0xf0) / 16));
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] += (((frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i=0; i<16; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
c9x.limitData[i].ppmCenter = servoCenter[i];
|
c9x.limitData[i].ppmCenter = servoCenter[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1473,16 +1453,9 @@ t_Open9xModelData_v209::operator ModelData ()
|
||||||
c9x.thrTraceSrc = thrTraceSrc;
|
c9x.thrTraceSrc = thrTraceSrc;
|
||||||
c9x.moduleData[0].modelId = modelId;
|
c9x.moduleData[0].modelId = modelId;
|
||||||
c9x.frsky.screens[1].type = 0;
|
c9x.frsky.screens[1].type = 0;
|
||||||
for (int line=0; line<4; line++) {
|
|
||||||
for (int col=0; col<2; col++) {
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] = (col==0 ? (frskyLines[line] & 0x0f) : ((frskyLines[line] & 0xf0) / 16));
|
|
||||||
c9x.frsky.screens[1].body.lines[line].source[col] += (((frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i=0; i<16; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
c9x.limitData[i].ppmCenter = servoCenter[i];
|
c9x.limitData[i].ppmCenter = servoCenter[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -277,8 +277,9 @@ class SourcesConversionTable: public ConversionTable {
|
||||||
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 2), val++); // Timer1
|
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 2), val++); // Timer1
|
||||||
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 3), val++); // Timer2
|
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 3), val++); // Timer2
|
||||||
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 4), val++); // Timer3
|
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 4), val++); // Timer3
|
||||||
for (int i=0; i<C9X_MAX_SENSORS*3; ++i)
|
for (int i=0; i<C9X_MAX_SENSORS*3; ++i) {
|
||||||
addConversion(RawSource(SOURCE_TYPE_TELEMETRY, i), val++);
|
addConversion(RawSource(SOURCE_TYPE_TELEMETRY, i), val++);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (afterrelease21March2013) {
|
if (afterrelease21March2013) {
|
||||||
|
@ -407,6 +408,10 @@ class SwitchField: public ConversionField< SignedField<N> > {
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual ~SwitchField()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
virtual void beforeExport()
|
virtual void beforeExport()
|
||||||
{
|
{
|
||||||
_switch = sw.toValue();
|
_switch = sw.toValue();
|
||||||
|
@ -517,20 +522,38 @@ class TelemetrySourcesConversionTable: public ConversionTable {
|
||||||
template <int N>
|
template <int N>
|
||||||
class TelemetrySourceField: public ConversionField< UnsignedField<N> > {
|
class TelemetrySourceField: public ConversionField< UnsignedField<N> > {
|
||||||
public:
|
public:
|
||||||
TelemetrySourceField(unsigned int & source, BoardEnum board, unsigned int version):
|
TelemetrySourceField(RawSource & source, BoardEnum board, unsigned int version):
|
||||||
ConversionField< UnsignedField<N> >(source, &conversionTable, "Telemetry source"),
|
ConversionField< UnsignedField<N> >(_source, &conversionTable, "Telemetry source"),
|
||||||
conversionTable(board, version),
|
conversionTable(board, version),
|
||||||
source(source),
|
source(source),
|
||||||
board(board),
|
board(board),
|
||||||
version(version)
|
version(version),
|
||||||
|
_source(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual ~TelemetrySourceField()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void beforeExport()
|
||||||
|
{
|
||||||
|
_source = (source.type == SOURCE_TYPE_TELEMETRY ? source.index+1 : 0);
|
||||||
|
ConversionField< UnsignedField<N> >::beforeExport();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void afterImport()
|
||||||
|
{
|
||||||
|
ConversionField< UnsignedField<N> >::afterImport();
|
||||||
|
source = (_source == 0 ? RawSource(0) : RawSource(SOURCE_TYPE_TELEMETRY, _source-1));
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TelemetrySourcesConversionTable conversionTable;
|
TelemetrySourcesConversionTable conversionTable;
|
||||||
unsigned int & source;
|
RawSource & source;
|
||||||
BoardEnum board;
|
BoardEnum board;
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
|
unsigned int _source;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <int N>
|
template <int N>
|
||||||
|
@ -538,14 +561,19 @@ class SourceField: public ConversionField< UnsignedField<N> > {
|
||||||
public:
|
public:
|
||||||
SourceField(RawSource & source, BoardEnum board, unsigned int version, unsigned int variant, unsigned long flags=0):
|
SourceField(RawSource & source, BoardEnum board, unsigned int version, unsigned int variant, unsigned long flags=0):
|
||||||
ConversionField< UnsignedField<N> >(_source, SourcesConversionTable::getInstance(board, version, variant, flags),
|
ConversionField< UnsignedField<N> >(_source, SourcesConversionTable::getInstance(board, version, variant, flags),
|
||||||
"Source", "Source "+ source.toString()+" cannot be exported on this board!"),
|
"Source", QObject::tr("Source %1 cannot be exported on this board!").arg(source.toString())),
|
||||||
source(source),
|
source(source),
|
||||||
_source(0)
|
_source(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual ~SourceField()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
virtual void beforeExport()
|
virtual void beforeExport()
|
||||||
{
|
{
|
||||||
|
if (source.type == SOURCE_TYPE_TELEMETRY) qDebug() << source.type << source.index;
|
||||||
_source = source.toValue();
|
_source = source.toValue();
|
||||||
ConversionField< UnsignedField<N> >::beforeExport();
|
ConversionField< UnsignedField<N> >::beforeExport();
|
||||||
}
|
}
|
||||||
|
@ -2203,6 +2231,7 @@ class AvrCustomFunctionField: public TransformedField {
|
||||||
functionsConversionTable(board, version),
|
functionsConversionTable(board, version),
|
||||||
sourcesConversionTable(SourcesConversionTable::getInstance(board, version, variant, version >= 216 ? 0 : FLAG_NONONE)),
|
sourcesConversionTable(SourcesConversionTable::getInstance(board, version, variant, version >= 216 ? 0 : FLAG_NONONE)),
|
||||||
_param(0),
|
_param(0),
|
||||||
|
_mode(0),
|
||||||
_union_param(0),
|
_union_param(0),
|
||||||
_active(0)
|
_active(0)
|
||||||
{
|
{
|
||||||
|
@ -2380,7 +2409,7 @@ class AvrCustomFunctionField: public TransformedField {
|
||||||
|
|
||||||
class FrskyScreenField: public DataField {
|
class FrskyScreenField: public DataField {
|
||||||
public:
|
public:
|
||||||
FrskyScreenField(FrSkyScreenData & screen, BoardEnum board, unsigned int version):
|
FrskyScreenField(FrSkyScreenData & screen, BoardEnum board, unsigned int version, unsigned int variant):
|
||||||
DataField("Frsky Screen"),
|
DataField("Frsky Screen"),
|
||||||
screen(screen),
|
screen(screen),
|
||||||
board(board),
|
board(board),
|
||||||
|
@ -2389,9 +2418,9 @@ class FrskyScreenField: public DataField {
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
if (IS_ARM(board) && version >= 217) {
|
if (IS_ARM(board) && version >= 217) {
|
||||||
if (IS_TARANIS(board))
|
if (IS_TARANIS(board))
|
||||||
bars.Append(new TelemetrySourceField<16>(screen.body.bars[i].source, board, version));
|
bars.Append(new SourceField<16>(screen.body.bars[i].source, board, version, variant));
|
||||||
else
|
else
|
||||||
bars.Append(new TelemetrySourceField<8>(screen.body.bars[i].source, board, version));
|
bars.Append(new SourceField<8>(screen.body.bars[i].source, board, version, variant));
|
||||||
bars.Append(new UnsignedField<16>(screen.body.bars[i].barMin));
|
bars.Append(new UnsignedField<16>(screen.body.bars[i].barMin));
|
||||||
bars.Append(new UnsignedField<16>(screen.body.bars[i].barMax));
|
bars.Append(new UnsignedField<16>(screen.body.bars[i].barMax));
|
||||||
}
|
}
|
||||||
|
@ -2406,7 +2435,9 @@ class FrskyScreenField: public DataField {
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
for (int j=0; j<columns; j++) {
|
for (int j=0; j<columns; j++) {
|
||||||
if (IS_TARANIS(board) && version >= 217)
|
if (IS_TARANIS(board) && version >= 217)
|
||||||
numbers.Append(new TelemetrySourceField<16>(screen.body.lines[i].source[j], board, version));
|
numbers.Append(new SourceField<16>(screen.body.lines[i].source[j], board, version, variant));
|
||||||
|
else if (IS_ARM(board) && version >= 217)
|
||||||
|
numbers.Append(new SourceField<8>(screen.body.lines[i].source[j], board, version, variant));
|
||||||
else
|
else
|
||||||
numbers.Append(new TelemetrySourceField<8>(screen.body.lines[i].source[j], board, version));
|
numbers.Append(new TelemetrySourceField<8>(screen.body.lines[i].source[j], board, version));
|
||||||
}
|
}
|
||||||
|
@ -2419,12 +2450,12 @@ class FrskyScreenField: public DataField {
|
||||||
numbers.Append(new SpareBitsField<4*8>());
|
numbers.Append(new SpareBitsField<4*8>());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version >= 217) {
|
if (IS_TARANIS(board))
|
||||||
if (IS_TARANIS(board))
|
none.Append(new SpareBitsField<24*8>());
|
||||||
none.Append(new SpareBitsField<24*8>());
|
else if (IS_ARM(board))
|
||||||
else
|
none.Append(new SpareBitsField<20*8>());
|
||||||
none.Append(new SpareBitsField<20*8>());
|
else
|
||||||
}
|
none.Append(new SpareBitsField<12*8>());
|
||||||
|
|
||||||
if (IS_TARANIS(board) && version >= 217) {
|
if (IS_TARANIS(board) && version >= 217) {
|
||||||
script.Append(new CharField<8>(screen.body.script.filename));
|
script.Append(new CharField<8>(screen.body.script.filename));
|
||||||
|
@ -2532,6 +2563,20 @@ class TelemetryVoltsSourceConversionTable: public ConversionTable
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ScreenTypesConversionTable: public ConversionTable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScreenTypesConversionTable(BoardEnum board, unsigned int version)
|
||||||
|
{
|
||||||
|
int val = 0;
|
||||||
|
if (IS_ARM(board)) {
|
||||||
|
addConversion(TELEMETRY_SCREEN_NONE, val++);
|
||||||
|
}
|
||||||
|
addConversion(TELEMETRY_SCREEN_NUMBERS, val++);
|
||||||
|
addConversion(TELEMETRY_SCREEN_BARS, val++);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class TelemetryCurrentSourceConversionTable: public ConversionTable
|
class TelemetryCurrentSourceConversionTable: public ConversionTable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -2551,9 +2596,10 @@ class TelemetryCurrentSourceConversionTable: public ConversionTable
|
||||||
|
|
||||||
class FrskyField: public StructField {
|
class FrskyField: public StructField {
|
||||||
public:
|
public:
|
||||||
FrskyField(FrSkyData & frsky, BoardEnum board, unsigned int version):
|
FrskyField(FrSkyData & frsky, BoardEnum board, unsigned int version, unsigned int variant):
|
||||||
StructField("FrSky"),
|
StructField("FrSky"),
|
||||||
telemetryVarioSourceConversionTable(board, version),
|
telemetryVarioSourceConversionTable(board, version),
|
||||||
|
screenTypesConversionTable(board, version),
|
||||||
telemetryVoltsSourceConversionTable(board, version),
|
telemetryVoltsSourceConversionTable(board, version),
|
||||||
telemetryCurrentSourceConversionTable(board, version)
|
telemetryCurrentSourceConversionTable(board, version)
|
||||||
{
|
{
|
||||||
|
@ -2596,7 +2642,7 @@ class FrskyField: public StructField {
|
||||||
Append(new UnsignedField<2>(frsky.screens[i].type));
|
Append(new UnsignedField<2>(frsky.screens[i].type));
|
||||||
}
|
}
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
Append(new FrskyScreenField(frsky.screens[i], board, version));
|
Append(new FrskyScreenField(frsky.screens[i], board, version, variant));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2605,7 +2651,7 @@ class FrskyField: public StructField {
|
||||||
Append(new UnsignedField<1>(frsky.screens[2].type));
|
Append(new UnsignedField<1>(frsky.screens[2].type));
|
||||||
Append(new SpareBitsField<5>());
|
Append(new SpareBitsField<5>());
|
||||||
for (int i=0; i<3; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
Append(new FrskyScreenField(frsky.screens[i], board, version));
|
Append(new FrskyScreenField(frsky.screens[i], board, version, variant));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2639,8 +2685,9 @@ class FrskyField: public StructField {
|
||||||
}
|
}
|
||||||
Append(new UnsignedField<2>(frsky.usrProto, "USR Proto"));
|
Append(new UnsignedField<2>(frsky.usrProto, "USR Proto"));
|
||||||
Append(new ConversionField< UnsignedField<2> >((unsigned int &)frsky.blades, -2));
|
Append(new ConversionField< UnsignedField<2> >((unsigned int &)frsky.blades, -2));
|
||||||
Append(new UnsignedField<1>(frsky.screens[0].type));
|
for (int i=0; i<2; i++) {
|
||||||
Append(new UnsignedField<1>(frsky.screens[1].type));
|
Append(new ConversionField< UnsignedField<1> >(frsky.screens[i].type, &screenTypesConversionTable, "Screen Type"));
|
||||||
|
}
|
||||||
Append(new ConversionField< UnsignedField<2> >(frsky.voltsSource, &telemetryVoltsSourceConversionTable, "Volts Source"));
|
Append(new ConversionField< UnsignedField<2> >(frsky.voltsSource, &telemetryVoltsSourceConversionTable, "Volts Source"));
|
||||||
Append(new SignedField<4>(frsky.varioMin, "Vario Min"));
|
Append(new SignedField<4>(frsky.varioMin, "Vario Min"));
|
||||||
Append(new SignedField<4>(frsky.varioMax));
|
Append(new SignedField<4>(frsky.varioMax));
|
||||||
|
@ -2649,7 +2696,7 @@ class FrskyField: public StructField {
|
||||||
Append(new ConversionField< SignedField<6> >(frsky.rssiAlarms[i].value, -45+i*3, 0, 0, 100, "RSSI value"));
|
Append(new ConversionField< SignedField<6> >(frsky.rssiAlarms[i].value, -45+i*3, 0, 0, 100, "RSSI value"));
|
||||||
}
|
}
|
||||||
for (int i=0; i<2; i++) {
|
for (int i=0; i<2; i++) {
|
||||||
Append(new FrskyScreenField(frsky.screens[i], board, version));
|
Append(new FrskyScreenField(frsky.screens[i], board, version, variant));
|
||||||
}
|
}
|
||||||
Append(new UnsignedField<3>(frsky.varioSource));
|
Append(new UnsignedField<3>(frsky.varioSource));
|
||||||
Append(new SignedField<5>(frsky.varioCenterMin));
|
Append(new SignedField<5>(frsky.varioCenterMin));
|
||||||
|
@ -2664,6 +2711,7 @@ class FrskyField: public StructField {
|
||||||
protected:
|
protected:
|
||||||
RSSIConversionTable rssiConversionTable[2];
|
RSSIConversionTable rssiConversionTable[2];
|
||||||
TelemetryVarioSourceConversionTable telemetryVarioSourceConversionTable;
|
TelemetryVarioSourceConversionTable telemetryVarioSourceConversionTable;
|
||||||
|
ScreenTypesConversionTable screenTypesConversionTable;
|
||||||
TelemetryVoltsSourceConversionTable telemetryVoltsSourceConversionTable;
|
TelemetryVoltsSourceConversionTable telemetryVoltsSourceConversionTable;
|
||||||
TelemetryCurrentSourceConversionTable telemetryCurrentSourceConversionTable;
|
TelemetryCurrentSourceConversionTable telemetryCurrentSourceConversionTable;
|
||||||
};
|
};
|
||||||
|
@ -2940,7 +2988,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((board != BOARD_STOCK && (board != BOARD_M128 || version < 215)) || (variant & FRSKY_VARIANT)) {
|
if ((board != BOARD_STOCK && (board != BOARD_M128 || version < 215)) || (variant & FRSKY_VARIANT)) {
|
||||||
internalField.Append(new FrskyField(modelData.frsky, board, version));
|
internalField.Append(new FrskyField(modelData.frsky, board, version, variant));
|
||||||
}
|
}
|
||||||
else if ((board == BOARD_STOCK || board == BOARD_M128) && (variant & MAVLINK_VARIANT)) {
|
else if ((board == BOARD_STOCK || board == BOARD_M128) && (variant & MAVLINK_VARIANT)) {
|
||||||
internalField.Append(new MavlinkField(modelData.mavlink, board, version));
|
internalField.Append(new MavlinkField(modelData.mavlink, board, version));
|
||||||
|
|
|
@ -534,7 +534,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
||||||
|
|
||||||
b->clear();
|
b->clear();
|
||||||
|
|
||||||
if (flags & POPULATE_SOURCES) {
|
if (flags & POPULATE_NONE) {
|
||||||
item = RawSource(SOURCE_TYPE_NONE);
|
item = RawSource(SOURCE_TYPE_NONE);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||||
|
@ -639,6 +639,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
||||||
for (int j=0; j<3; ++j) {
|
for (int j=0; j<3; ++j) {
|
||||||
item = RawSource(SOURCE_TYPE_TELEMETRY, 3*i+j);
|
item = RawSource(SOURCE_TYPE_TELEMETRY, 3*i+j);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
|
// qDebug() << item.toString(model) << source.toString(model);
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,14 +101,15 @@ void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
||||||
QString getProtocolStr(const int proto);
|
QString getProtocolStr(const int proto);
|
||||||
QString getPhasesStr(unsigned int phases, ModelData * model);
|
QString getPhasesStr(unsigned int phases, ModelData * model);
|
||||||
|
|
||||||
#define POPULATE_SOURCES (1<<0)
|
#define POPULATE_NONE (1<<0)
|
||||||
#define POPULATE_TRIMS (1<<1)
|
#define POPULATE_SOURCES (1<<1)
|
||||||
#define POPULATE_SWITCHES (1<<2)
|
#define POPULATE_TRIMS (1<<2)
|
||||||
#define POPULATE_GVARS (1<<3)
|
#define POPULATE_SWITCHES (1<<3)
|
||||||
#define POPULATE_TELEMETRY (1<<4)
|
#define POPULATE_GVARS (1<<4)
|
||||||
#define POPULATE_TELEMETRYEXT (1<<5)
|
#define POPULATE_TELEMETRY (1<<5)
|
||||||
#define POPULATE_VIRTUAL_INPUTS (1<<6)
|
#define POPULATE_TELEMETRYEXT (1<<6)
|
||||||
#define POPULATE_SCRIPT_OUTPUTS (1<<7)
|
#define POPULATE_VIRTUAL_INPUTS (1<<7)
|
||||||
|
#define POPULATE_SCRIPT_OUTPUTS (1<<8)
|
||||||
|
|
||||||
#define GVARS_VARIANT 0x0001
|
#define GVARS_VARIANT 0x0001
|
||||||
#define FRSKY_VARIANT 0x0002
|
#define FRSKY_VARIANT 0x0002
|
||||||
|
|
|
@ -715,15 +715,15 @@ void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, uint function, unsi
|
||||||
b->setCurrentIndex(value);
|
b->setCurrentIndex(value);
|
||||||
}
|
}
|
||||||
else if (function==FuncVolume) {
|
else if (function==FuncVolume) {
|
||||||
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_TRIMS);
|
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_TRIMS);
|
||||||
}
|
}
|
||||||
else if (function==FuncPlayValue) {
|
else if (function==FuncPlayValue) {
|
||||||
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_SWITCHES|POPULATE_GVARS|POPULATE_TRIMS|POPULATE_TELEMETRYEXT);
|
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_SWITCHES|POPULATE_GVARS|POPULATE_TRIMS|POPULATE_TELEMETRYEXT);
|
||||||
}
|
}
|
||||||
else if (function>=FuncAdjustGV1 && function<=FuncAdjustGVLast) {
|
else if (function>=FuncAdjustGV1 && function<=FuncAdjustGVLast) {
|
||||||
switch (adjustmode) {
|
switch (adjustmode) {
|
||||||
case 1:
|
case 1:
|
||||||
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_TRIMS|POPULATE_SWITCHES);
|
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_TRIMS|POPULATE_SWITCHES);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_GVARS);
|
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_GVARS);
|
||||||
|
|
|
@ -60,7 +60,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||||
|
|
||||||
if (firmware->getCapability(VirtualInputs)) {
|
if (firmware->getCapability(VirtualInputs)) {
|
||||||
ui->inputName->setMaxLength(4);
|
ui->inputName->setMaxLength(4);
|
||||||
populateSourceCB(ui->sourceCB, ed->srcRaw, generalSettings, &model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
|
populateSourceCB(ui->sourceCB, ed->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
|
||||||
ui->sourceCB->removeItem(0);
|
ui->sourceCB->removeItem(0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -70,11 +70,11 @@ void HeliPanel::edited()
|
||||||
{
|
{
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
model->swashRingData.type = ui->swashType->currentIndex();
|
model->swashRingData.type = ui->swashType->currentIndex();
|
||||||
model->swashRingData.collectiveSource = ui->swashCollectiveSource->itemData(ui->swashCollectiveSource->currentIndex()).toInt();
|
model->swashRingData.collectiveSource = RawSource(ui->swashCollectiveSource->itemData(ui->swashCollectiveSource->currentIndex()).toInt());
|
||||||
model->swashRingData.value = ui->swashRingVal->value();
|
model->swashRingData.value = ui->swashRingVal->value();
|
||||||
if (firmware->getCapability(VirtualInputs)) {
|
if (firmware->getCapability(VirtualInputs)) {
|
||||||
model->swashRingData.elevatorSource = ui->swashElevatorSource->itemData(ui->swashElevatorSource->currentIndex()).toInt();
|
model->swashRingData.elevatorSource = RawSource(ui->swashElevatorSource->itemData(ui->swashElevatorSource->currentIndex()).toInt());
|
||||||
model->swashRingData.aileronSource = ui->swashAileronSource->itemData(ui->swashAileronSource->currentIndex()).toInt();
|
model->swashRingData.aileronSource = RawSource(ui->swashAileronSource->itemData(ui->swashAileronSource->currentIndex()).toInt());
|
||||||
model->swashRingData.elevatorWeight = ui->swashElevatorWeight->value();
|
model->swashRingData.elevatorWeight = ui->swashElevatorWeight->value();
|
||||||
model->swashRingData.aileronWeight = ui->swashAileronWeight->value();
|
model->swashRingData.aileronWeight = ui->swashAileronWeight->value();
|
||||||
model->swashRingData.collectiveWeight = ui->swashCollectiveWeight->value();
|
model->swashRingData.collectiveWeight = ui->swashCollectiveWeight->value();
|
||||||
|
|
|
@ -301,7 +301,7 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||||
{
|
{
|
||||||
case LS_FAMILY_VOFS:
|
case LS_FAMILY_VOFS:
|
||||||
mask |= SOURCE1_VISIBLE;
|
mask |= SOURCE1_VISIBLE;
|
||||||
populateSourceCB(cswitchSource1[i], source, generalSettings, model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
populateSourceCB(cswitchSource1[i], source, generalSettings, model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||||
cswitchOffset[i]->setDecimals(range.decimals);
|
cswitchOffset[i]->setDecimals(range.decimals);
|
||||||
cswitchOffset[i]->setSingleStep(range.step);
|
cswitchOffset[i]->setSingleStep(range.step);
|
||||||
if (source.isTimeBased()) {
|
if (source.isTimeBased()) {
|
||||||
|
@ -346,8 +346,8 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||||
break;
|
break;
|
||||||
case LS_FAMILY_VCOMP:
|
case LS_FAMILY_VCOMP:
|
||||||
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
|
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
|
||||||
populateSourceCB(cswitchSource1[i], RawSource(model->logicalSw[i].val1), generalSettings, model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
populateSourceCB(cswitchSource1[i], RawSource(model->logicalSw[i].val1), generalSettings, model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||||
populateSourceCB(cswitchSource2[i], RawSource(model->logicalSw[i].val2), generalSettings, model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
populateSourceCB(cswitchSource2[i], RawSource(model->logicalSw[i].val2), generalSettings, model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||||
break;
|
break;
|
||||||
case LS_FAMILY_TIMER:
|
case LS_FAMILY_TIMER:
|
||||||
mask |= VALUE1_VISIBLE | VALUE2_VISIBLE;
|
mask |= VALUE1_VISIBLE | VALUE2_VISIBLE;
|
||||||
|
|
|
@ -19,7 +19,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
|
||||||
|
|
||||||
this->setWindowTitle(tr("DEST -> CH%1").arg(md->destCh));
|
this->setWindowTitle(tr("DEST -> CH%1").arg(md->destCh));
|
||||||
|
|
||||||
populateSourceCB(ui->sourceCB, md->srcRaw, generalSettings, &model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
populateSourceCB(ui->sourceCB, md->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||||
ui->sourceCB->removeItem(0);
|
ui->sourceCB->removeItem(0);
|
||||||
|
|
||||||
int limit = firmware->getCapability(OffsetWeight);
|
int limit = firmware->getCapability(OffsetWeight);
|
||||||
|
|
|
@ -333,28 +333,13 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TelemetryCustomScreen::populateTelemetrySourceCB(QComboBox *b, unsigned int value, bool last, int hubproto)
|
void TelemetryCustomScreen::populateTelemetrySourceCB(QComboBox * b, RawSource & source, bool last)
|
||||||
{
|
{
|
||||||
b->clear();
|
|
||||||
|
|
||||||
if (IS_ARM(firmware->getBoard())) {
|
if (IS_ARM(firmware->getBoard())) {
|
||||||
// TODO
|
populateSourceCB(b, source, generalSettings, model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
b->addItem(RawSource(SOURCE_TYPE_NONE, 0).toString(model));
|
populateSourceCB(b, source, generalSettings, model, POPULATE_NONE | (last ? POPULATE_TELEMETRYEXT : POPULATE_TELEMETRY));
|
||||||
|
|
||||||
for (unsigned int i = 0; i < (last ? TELEMETRY_SOURCES_STATUS_COUNT : TELEMETRY_SOURCES_DISPLAY_COUNT); i++) {
|
|
||||||
b->addItem(RawSource(SOURCE_TYPE_TELEMETRY, i).toString(model));
|
|
||||||
if (!firmware->isTelemetrySourceAvailable(i)) {
|
|
||||||
// disable item
|
|
||||||
QModelIndex index = b->model()->index(i+1, 0);
|
|
||||||
QVariant v(0);
|
|
||||||
b->model()->setData(index, v, Qt::UserRole - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
b->setCurrentIndex(value);
|
|
||||||
b->setMaxVisibleItems(10);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,12 +358,12 @@ void TelemetryCustomScreen::update()
|
||||||
|
|
||||||
for (int l=0; l<4; l++) {
|
for (int l=0; l<4; l++) {
|
||||||
for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
|
for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
|
||||||
populateTelemetrySourceCB(fieldsCB[l][c], screen.body.lines[l].source[c], l==3, model->frsky.usrProto);
|
populateTelemetrySourceCB(fieldsCB[l][c], screen.body.lines[l].source[c], l==3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int l=0; l<4; l++) {
|
for (int l=0; l<4; l++) {
|
||||||
populateTelemetrySourceCB(barsCB[l], screen.body.bars[l].source, false, model->frsky.usrProto);
|
populateTelemetrySourceCB(barsCB[l], screen.body.bars[l].source);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (screen.type == TELEMETRY_SCREEN_BARS) {
|
if (screen.type == TELEMETRY_SCREEN_BARS) {
|
||||||
|
@ -394,6 +379,7 @@ void TelemetryCustomScreen::updateBar(int line)
|
||||||
{
|
{
|
||||||
lock = true;
|
lock = true;
|
||||||
|
|
||||||
|
#if 0
|
||||||
int index = screen.body.bars[line].source;
|
int index = screen.body.bars[line].source;
|
||||||
barsCB[line]->setCurrentIndex(index);
|
barsCB[line]->setCurrentIndex(index);
|
||||||
if (index) {
|
if (index) {
|
||||||
|
@ -419,6 +405,7 @@ void TelemetryCustomScreen::updateBar(int line)
|
||||||
minSB[line]->setDisabled(true);
|
minSB[line]->setDisabled(true);
|
||||||
maxSB[line]->setDisabled(true);
|
maxSB[line]->setDisabled(true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
@ -437,20 +424,20 @@ void TelemetryCustomScreen::customFieldChanged(int value)
|
||||||
{
|
{
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
int index = sender()->property("index").toInt();
|
int index = sender()->property("index").toInt();
|
||||||
screen.body.lines[index/256].source[index%256] = value;
|
screen.body.lines[index/256].source[index%256] = RawSource(((QComboBox *)sender())->itemData(value).toInt());
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TelemetryCustomScreen::barSourceChanged(int index)
|
void TelemetryCustomScreen::barSourceChanged(int value)
|
||||||
{
|
{
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
QComboBox * cb = qobject_cast<QComboBox*>(sender());
|
QComboBox * cb = qobject_cast<QComboBox*>(sender());
|
||||||
int line = cb->property("index").toInt();
|
int index = cb->property("index").toInt();
|
||||||
screen.body.bars[line].source = index;
|
screen.body.bars[index].source = RawSource(((QComboBox *)sender())->itemData(value).toInt());
|
||||||
screen.body.bars[line].barMin = 0;
|
screen.body.bars[index].barMin = 0;
|
||||||
screen.body.bars[line].barMax = 0;
|
screen.body.bars[index].barMax = 0;
|
||||||
updateBar(line);
|
updateBar(index);
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -745,6 +732,9 @@ void TelemetryPanel::update()
|
||||||
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
|
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
|
||||||
sensorPanels[i]->update();
|
sensorPanels[i]->update();
|
||||||
}
|
}
|
||||||
|
for (int i=0; i<firmware->getCapability(TelemetryCustomScreens); i++) {
|
||||||
|
telemetryCustomScreens[i]->update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ class TelemetryCustomScreen: public ModelPanel
|
||||||
void barMaxChanged(double value);
|
void barMaxChanged(double value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void populateTelemetrySourceCB(QComboBox *b, unsigned int value, bool last, int hubproto);
|
void populateTelemetrySourceCB(QComboBox * b, RawSource & source, bool last=false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateBar(int line);
|
void updateBar(int line);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue