1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 14:25:11 +03:00

Merge remote-tracking branch 'origin/next' into

bsongis/Issue554_trims_relative_default

Conflicts:
	companion/src/eeprominterface.h
	companion/src/firmwares/er9x/er9xinterface.cpp
	companion/src/firmwares/ersky9x/ersky9xinterface.cpp
This commit is contained in:
Bertrand Songis 2014-01-31 22:15:23 +01:00
commit 582b14e919
28 changed files with 774 additions and 2205 deletions

View file

@ -302,3 +302,8 @@ Dan Neelands
Yashiro Masayuki Yashiro Masayuki
Isaac Sloan Isaac Sloan
Harold Baird Harold Baird
Roy Bender
Bradley Murchie
Maximilian Süß
Dean Jansa
Ronald Donker

View file

@ -1260,6 +1260,7 @@ void compareDialog::printFrSky()
color=getColor1(fd1->rssiAlarms[1].value,fd2->rssiAlarms[1].value); color=getColor1(fd1->rssiAlarms[1].value,fd2->rssiAlarms[1].value);
str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd1->rssiAlarms[1].value,10)+"</td>"); str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd1->rssiAlarms[1].value,10)+"</td>");
str.append("</table>"); str.append("</table>");
#if 0
if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) { if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) {
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields); int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2; if (cols==0) cols=2;
@ -1300,13 +1301,13 @@ void compareDialog::printFrSky()
if (fd1->screens[0].type==fd2->screens[0].type) if (fd1->screens[0].type==fd2->screens[0].type)
color=getColor1(fd1->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].source); color=getColor1(fd1->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].source);
str.append("<td align=\"Center\"><font color="+color+">"+getFrSkySrc(fd1->screens[0].body.bars[i].source)+"</font></td>"); str.append("<td align=\"Center\"><font color="+color+">"+getFrSkySrc(fd1->screens[0].body.bars[i].source)+"</font></td>");
value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMin,fd1); // TODO value1 = getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMin,fd1);
value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMin,fd2); // TODO value2 = getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMin,fd2);
if (fd1->screens[0].type==fd2->screens[0].type) if (fd1->screens[0].type==fd2->screens[0].type)
color=getColor1(value1,value2); color=getColor1(value1,value2);
str.append("<td align=\"Right\"><font color="+color+">"+QString::number(value1)+"</td>"); str.append("<td align=\"Right\"><font color="+color+">"+QString::number(value1)+"</td>");
value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMax,fd1); // TODO value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMax,fd1);
value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMax,fd2); // TODO value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMax,fd2);
if (fd1->screens[0].type==fd2->screens[0].type) if (fd1->screens[0].type==fd2->screens[0].type)
color=getColor1(value1,value2); color=getColor1(value1,value2);
str.append("<td align=\"Right\"><font color="+color+">"+QString::number(value1)+"</td></tr>"); str.append("<td align=\"Right\"><font color="+color+">"+QString::number(value1)+"</td></tr>");
@ -1315,6 +1316,7 @@ void compareDialog::printFrSky()
} }
} }
} }
#endif
str.append("</td><td width=\"50%\">"); str.append("</td><td width=\"50%\">");
str.append("<table border=1 cellspacing=0 cellpadding=1 width=\"100%\">"); str.append("<table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
@ -1377,7 +1379,7 @@ void compareDialog::printFrSky()
color=getColor2(fd1->rssiAlarms[1].value,fd2->rssiAlarms[1].value); color=getColor2(fd1->rssiAlarms[1].value,fd2->rssiAlarms[1].value);
str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd2->rssiAlarms[1].value,10)+"</td>"); str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd2->rssiAlarms[1].value,10)+"</td>");
str.append("</table></br>"); str.append("</table></br>");
#if 0
if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) { if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) {
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields); int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2; if (cols==0) cols=2;
@ -1418,13 +1420,13 @@ void compareDialog::printFrSky()
if (fd1->screens[0].type==fd2->screens[0].type) if (fd1->screens[0].type==fd2->screens[0].type)
color=getColor2(fd1->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].source); color=getColor2(fd1->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].source);
str.append("<td align=\"Center\"><font color="+color+">"+getFrSkySrc(fd2->screens[0].body.bars[i].source)+"</font></td>"); str.append("<td align=\"Center\"><font color="+color+">"+getFrSkySrc(fd2->screens[0].body.bars[i].source)+"</font></td>");
value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMin,fd1); // TODO value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMin,fd1);
value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMin,fd2); // TODO value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMin,fd2);
if (fd1->screens[0].type==fd2->screens[0].type) if (fd1->screens[0].type==fd2->screens[0].type)
color=getColor2(value1,value2); color=getColor2(value1,value2);
str.append("<td align=\"Right\"><font color="+color+">"+QString::number(value2)+"</font></td>"); str.append("<td align=\"Right\"><font color="+color+">"+QString::number(value2)+"</font></td>");
value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMax,fd1); // TODO value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMax,fd1);
value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMax,fd2); // TODO value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMax,fd2);
if (fd1->screens[0].type==fd2->screens[0].type) if (fd1->screens[0].type==fd2->screens[0].type)
color=getColor2(value1,value2); color=getColor2(value1,value2);
str.append("<td align=\"Right\"><font color="+color+">"+QString::number(value2)+"</font></td></tr>"); str.append("<td align=\"Right\"><font color="+color+">"+QString::number(value2)+"</font></td></tr>");
@ -1433,6 +1435,7 @@ void compareDialog::printFrSky()
} }
} }
} }
#endif
str.append("</td></tr></table>"); str.append("</td></tr></table>");
te->append(str); te->append(str);
} }

View file

@ -37,215 +37,117 @@ void getEEPROMString(char *dst, const char *src, int size)
} }
} }
int RawSource::getDecimals(const ModelData & Model) RawSourceRange RawSource::getRange(bool singleprec)
{ {
if(type==SOURCE_TYPE_TELEMETRY) { RawSourceRange result;
switch (index) {
case TELEMETRY_SOURCE_A1: int board = GetEepromInterface()->getBoard();
case TELEMETRY_SOURCE_A2:
return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].type==0 ? 2: 0); if (!singleprec && !IS_TARANIS(board)) {
case TELEMETRY_SOURCE_CELL: singleprec = true;
return 2; }
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_VFAS:
case TELEMETRY_SOURCE_CURRENT:
return 1;
default:
return 0;
}
}
return 0;
}
double RawSource::getMin(const ModelData & Model)
{
switch (type) { switch (type) {
case SOURCE_TYPE_TELEMETRY: case SOURCE_TYPE_TELEMETRY:
switch (index) { switch (index) {
/*case TELEMETRY_SOURCE_NONE:
case TELEMETRY_SOURCE_TX_BATT: case TELEMETRY_SOURCE_TX_BATT:
case TELEMETRY_SOURCE_TIMER1: result.step = 0.1;
case TELEMETRY_SOURCE_TIMER2: result.decimals = 1;
return 0; */ result.max = 25.5;
case TELEMETRY_SOURCE_A1:
case TELEMETRY_SOURCE_A2:
if (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].type==0) {
return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].offset*Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio)/2550.0;
}
else {
return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].offset*Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio)/255.0;
}
case TELEMETRY_SOURCE_ALT:
case TELEMETRY_SOURCE_GPS_ALT:
return -500;
case TELEMETRY_SOURCE_T1:
case TELEMETRY_SOURCE_T2:
return -30;
default:
return 0;
}
break; break;
default:
return (Model.extendedLimits ? -125 :-100);
}
}
double RawSource::getMax(const ModelData & Model)
{
switch (type) {
case SOURCE_TYPE_TELEMETRY:
switch (index) {
case TELEMETRY_SOURCE_TIMER1: case TELEMETRY_SOURCE_TIMER1:
case TELEMETRY_SOURCE_TIMER2: case TELEMETRY_SOURCE_TIMER2:
return 765; result.step = singleprec ? 3 : 1;
result.max = singleprec ? 765 : 7200;
break;
case TELEMETRY_SOURCE_RSSI_TX: case TELEMETRY_SOURCE_RSSI_TX:
case TELEMETRY_SOURCE_RSSI_RX: case TELEMETRY_SOURCE_RSSI_RX:
return 100; result.max = 100;
break;
case TELEMETRY_SOURCE_A1: case TELEMETRY_SOURCE_A1:
case TELEMETRY_SOURCE_A2: case TELEMETRY_SOURCE_A2:
if (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].type==0) { if (model) {
return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio-(Model.frsky.channels[index-TELEMETRY_SOURCE_A1].offset*Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio)/255.0)/10; FrSkyChannelData channel = model->frsky.channels[index-TELEMETRY_SOURCE_A1]; // TODO const &
} else { float ratio = channel.getRatio();
return Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio-(Model.frsky.channels[index-TELEMETRY_SOURCE_A1].offset*Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio)/255.0; if (channel.type==0 || channel.type==1 || channel.type==2)
} result.decimals = 2;
case TELEMETRY_SOURCE_ALT: else
case TELEMETRY_SOURCE_GPS_ALT: result.decimals = 0;
return 1540; result.step = ratio / 255;
case TELEMETRY_SOURCE_RPM: result.min = channel.offset * result.step;
return 12750; result.max = ratio + result.min;
case TELEMETRY_SOURCE_FUEL:
return 100;
case TELEMETRY_SOURCE_T1:
case TELEMETRY_SOURCE_T2:
return 225;
case TELEMETRY_SOURCE_SPEED:
return 944;
case TELEMETRY_SOURCE_DIST:
return 2040;
case TELEMETRY_SOURCE_CELL:
return 5.1;
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_VFAS:
return 25.5;
case TELEMETRY_SOURCE_CURRENT:
return 127.5;
case TELEMETRY_SOURCE_CONSUMPTION:
return 5100;
case TELEMETRY_SOURCE_POWER:
return 1275;
default:
return 125;
} }
break; break;
default:
return (Model.extendedLimits ? 125 :100);
}
}
double RawSource::getOffset(const ModelData & Model)
{
if (type==SOURCE_TYPE_TELEMETRY) {
switch (index) {
case TELEMETRY_SOURCE_A1:
case TELEMETRY_SOURCE_A2:
if (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].type==0) {
return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].offset*Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio)/2550.0;
}
else {
return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].offset*Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio)/255.0;
}
case TELEMETRY_SOURCE_ALT: case TELEMETRY_SOURCE_ALT:
case TELEMETRY_SOURCE_GPS_ALT: case TELEMETRY_SOURCE_GPS_ALT:
return 524; result.step = singleprec ? 8 : 1;
case TELEMETRY_SOURCE_RPM: result.min = -500;
return 6400; result.max = singleprec ? 1540 : 3000;
case TELEMETRY_SOURCE_FUEL: break;
return 0;
case TELEMETRY_SOURCE_T1: case TELEMETRY_SOURCE_T1:
case TELEMETRY_SOURCE_T2: case TELEMETRY_SOURCE_T2:
return 98; result.min = -30;
case TELEMETRY_SOURCE_SPEED: result.max = 225;
return 474; break;
case TELEMETRY_SOURCE_DIST:
return 1024;
case TELEMETRY_SOURCE_CELL:
return 2.56;
default:
return 0;
}
}
return 0;
}
int RawSource::getRawOffset(const ModelData & Model)
{
switch (type) {
case SOURCE_TYPE_TELEMETRY:
switch (index) {
case TELEMETRY_SOURCE_TIMER1:
case TELEMETRY_SOURCE_TIMER2:
case TELEMETRY_SOURCE_RSSI_TX:
case TELEMETRY_SOURCE_RSSI_RX:
case TELEMETRY_SOURCE_A1:
case TELEMETRY_SOURCE_A2:
case TELEMETRY_SOURCE_FUEL:
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_VFAS:
case TELEMETRY_SOURCE_CURRENT:
case TELEMETRY_SOURCE_CONSUMPTION:
case TELEMETRY_SOURCE_POWER:
return 128;
default:
return 0;
}
default:
return 0;
}
}
double RawSource::getStep(const ModelData & Model)
{
switch (type) {
case SOURCE_TYPE_TELEMETRY:
switch (index) {
case TELEMETRY_SOURCE_TIMER1:
case TELEMETRY_SOURCE_TIMER2:
return 3;
case TELEMETRY_SOURCE_A1:
case TELEMETRY_SOURCE_A2:
if (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].type==0) {
return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio/2550.0);
}
else {
return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio/255.0);
}
case TELEMETRY_SOURCE_ALT:
case TELEMETRY_SOURCE_GPS_ALT:
return 8;
case TELEMETRY_SOURCE_RPM: case TELEMETRY_SOURCE_RPM:
return 50; result.step = singleprec ? 50 : 1;
result.max = singleprec ? 12750 : 20000;
break;
case TELEMETRY_SOURCE_FUEL:
result.max = 100;
break;
case TELEMETRY_SOURCE_SPEED: case TELEMETRY_SOURCE_SPEED:
return 4; result.step = singleprec ? 4 : 1;
case TELEMETRY_SOURCE_DIST: result.max = singleprec ? 944 : 2000;
return 8; if (model && !model->frsky.imperial) {
case TELEMETRY_SOURCE_CELL: result.step *= 1.852;
return 0.02; result.max *= 1.852;
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_VFAS:
return 0.1;
case TELEMETRY_SOURCE_CURRENT:
return 0.5;
case TELEMETRY_SOURCE_CONSUMPTION:
return 20;
case TELEMETRY_SOURCE_POWER:
return 5;
default:
return 1;
} }
break; break;
case TELEMETRY_SOURCE_DIST:
result.step = singleprec ? 8 : 1;
result.max = singleprec ? 2040 : 10000;
break;
case TELEMETRY_SOURCE_CELL:
result.step = singleprec ? 0.02 : 0.01;
result.max = 5.1;
result.decimals = 2;
break;
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_VFAS:
result.step = 0.1;
result.max = 25.5;
result.decimals = 1;
break;
case TELEMETRY_SOURCE_CURRENT:
result.step = singleprec ? 0.5 : 0.1;
result.max = singleprec ? 127.5 : 200.0;
result.decimals = 1;
break;
case TELEMETRY_SOURCE_CONSUMPTION:
result.step = singleprec ? 20 : 1;
result.max = singleprec ? 5100 : 10000;
break;
case TELEMETRY_SOURCE_POWER:
result.step = singleprec ? 5 : 1;
result.max = singleprec ? 1275 : 2000;
break;
default: default:
return 1; result.max = 125;
break;
} }
if (singleprec) {
result.offset = result.max - (127*result.step);
}
break;
default:
result.max = (model && model->extendedLimits ? 125 : 100);
result.min = - result.max;
break;
}
return result;
} }
QString AnalogString(int index) QString AnalogString(int index)

View file

@ -283,6 +283,30 @@ class ModelData;
QString AnalogString(int index); QString AnalogString(int index);
QString RotaryEncoderString(int index); QString RotaryEncoderString(int index);
class RawSourceRange
{
public:
RawSourceRange():
decimals(0),
min(0.0),
max(0.0),
step(1.0),
offset(0.0)
{
}
float getValue(int value) {
return min + float(value) * step;
}
int decimals;
double min;
double max;
double step;
double offset;
};
class RawSource { class RawSource {
public: public:
RawSource(): RawSource():
@ -313,17 +337,16 @@ class RawSource {
QString toString(); QString toString();
int getDecimals(const ModelData & Model); RawSourceRange getRange(bool singleprec=false);
double getMin(const ModelData & Model);
double getMax(const ModelData & Model);
double getStep(const ModelData & Model);
double getOffset(const ModelData & Model);
int getRawOffset(const ModelData & Model);
bool operator== ( const RawSource& other) { bool operator == ( const RawSource & other) {
return (this->type == other.type) && (this->index == other.index); return (this->type == other.type) && (this->index == other.index);
} }
bool operator != ( const RawSource & other) {
return (this->type != other.type) || (this->index != other.index);
}
RawSourceType type; RawSourceType type;
int index; int index;
const ModelData * model; const ModelData * model;
@ -664,7 +687,7 @@ class PhaseData {
unsigned int fadeOut; unsigned int fadeOut;
int rotaryEncoders[2]; int rotaryEncoders[2];
int gvars[C9X_MAX_GVARS]; int gvars[C9X_MAX_GVARS];
void clear() { memset(this, 0, sizeof(PhaseData));} void clear() { memset(this, 0, sizeof(PhaseData)); }
}; };
class SwashRingData { // Swash Ring data class SwashRingData { // Swash Ring data
@ -715,6 +738,14 @@ class FrSkyChannelData {
unsigned int multiplier; unsigned int multiplier;
FrSkyAlarmData alarms[2]; FrSkyAlarmData alarms[2];
float getRatio()
{
if (type==0 || type==1 || type==2)
return float(ratio << multiplier) / 10.0;
else
return ratio << multiplier;
}
void clear() { memset(this, 0, sizeof(FrSkyChannelData)); } void clear() { memset(this, 0, sizeof(FrSkyChannelData)); }
}; };
@ -983,11 +1014,10 @@ enum Capability {
GvarsInCS, GvarsInCS,
GvarsAreNamed, GvarsAreNamed,
GvarsFlightPhases, GvarsFlightPhases,
GvarsAsSources,
GvarsName, GvarsName,
NoTelemetryProtocol, NoTelemetryProtocol,
TelemetryCSFields, TelemetryCustomScreens,
TelemetryColsCSFields, TelemetryCustomScreensFieldsPerLine,
TelemetryRSSIModel, TelemetryRSSIModel,
TelemetryAlarm, TelemetryAlarm,
TelemetryInternalAlarm, TelemetryInternalAlarm,

View file

@ -281,8 +281,6 @@ int Er9xInterface::getCapability(const Capability capability)
case ModelVoice: case ModelVoice:
case Gvars: case Gvars:
return 7; return 7;
case GvarsAsSources:
return 1;
case GetThrSwitch: case GetThrSwitch:
return DSW_THR; return DSW_THR;
default: default:

View file

@ -317,8 +317,6 @@ int Ersky9xInterface::getCapability(const Capability capability)
return 125; return 125;
case MaxVolume: case MaxVolume:
return 23; return 23;
case GvarsAsSources:
return 1;
case TelemetryMaxMultiplier: case TelemetryMaxMultiplier:
return 2; return 2;
case LCDWidth: case LCDWidth:

View file

@ -201,7 +201,7 @@ class SourcesConversionTable: public ConversionTable {
if (!(flags & FLAG_NOTELEMETRY)) { if (!(flags & FLAG_NOTELEMETRY)) {
if (release21March2013) { if (release21March2013) {
if ((board != BOARD_STOCK && (board!=BOARD_M128 || version<215)) || (variant & GVARS_VARIANT)) { if ((board != BOARD_STOCK && (board!=BOARD_M128 || version<215)) || (variant & GVARS_VARIANT)) {
for (int i=0; i<5; i++) for (int i=0; i<MAX_GVARS(board, version); i++)
addConversion(RawSource(SOURCE_TYPE_GVAR, i), val++); addConversion(RawSource(SOURCE_TYPE_GVAR, i), val++);
} }
} }

View file

@ -610,24 +610,12 @@ int Open9xInterface::getCapability(const Capability capability)
return TM_HASTELEMETRY|TM_HASOFFSET|TM_HASWSHH; return TM_HASTELEMETRY|TM_HASOFFSET|TM_HASWSHH;
case TelemetryBars: case TelemetryBars:
return 1; return 1;
case TelemetryCSFields: case TelemetryCustomScreens:
if (IS_TARANIS(board)) { return IS_TARANIS(board) ? 3 : 2;
return 36; case TelemetryCustomScreensFieldsPerLine:
} else { return IS_TARANIS(board) ? 3 : 2;
return IS_ARM(board) ? 24 : 16;
}
case TelemetryColsCSFields:
if (IS_TARANIS(board)) {
return 3;
} else {
return 2;
}
case NoTelemetryProtocol: case NoTelemetryProtocol:
if (IS_TARANIS(board)) { return IS_TARANIS(board) ? 1 : 0;
return 1;
} else {
return 0;
}
case TelemetryUnits: case TelemetryUnits:
return 0; return 0;
case TelemetryBlades: case TelemetryBlades:

View file

@ -175,6 +175,7 @@ QString getFuncName(unsigned int val)
} }
} }
// TODO should be a toString() method in CustoSwData ...
QString getCustomSwitchStr(CustomSwData * customSw, const ModelData & model) QString getCustomSwitchStr(CustomSwData * customSw, const ModelData & model)
{ {
QString result = ""; QString result = "";
@ -189,7 +190,8 @@ QString getCustomSwitchStr(CustomSwData * customSw, const ModelData & model)
result = QString("TIM(%1 , %2)").arg(ValToTim(customSw->val1)).arg(ValToTim(customSw->val2)); result = QString("TIM(%1 , %2)").arg(ValToTim(customSw->val1)).arg(ValToTim(customSw->val2));
break; break;
case CS_FAMILY_VOFS: { case CS_FAMILY_VOFS: {
RawSource source = RawSource(customSw->val1); RawSource source = RawSource(customSw->val1, &model);
RawSourceRange range = source.getRange();
if (customSw->val1) if (customSw->val1)
result += source.toString(); result += source.toString();
else else
@ -204,7 +206,7 @@ QString getCustomSwitchStr(CustomSwData * customSw, const ModelData & model)
result += " &gt; "; result += " &gt; ";
else if (customSw->func == CS_FN_ANEG || customSw->func == CS_FN_VNEG) else if (customSw->func == CS_FN_ANEG || customSw->func == CS_FN_VNEG)
result += " &lt; "; result += " &lt; ";
result += QString::number(source.getStep(model) * (customSw->val2 + source.getRawOffset(model)) + source.getOffset(model)); result += QString::number(range.step * (customSw->val2 /*TODO+ source.getRawOffset(model)*/) + range.offset);
break; break;
} }
case CS_FAMILY_VBOOL: case CS_FAMILY_VBOOL:
@ -1300,109 +1302,6 @@ QString getFrSkySrc(int index)
return RawSource(SOURCE_TYPE_TELEMETRY, index-1).toString(); return RawSource(SOURCE_TYPE_TELEMETRY, index-1).toString();
} }
/*
1,2) Timer1/Timer2 0:765
3,4) TX/RX
5) A1 range
6) A2 range
7) ALT 0-1020
8)RPM 0-12750
9FUEL 0-100%
10) T1 -30-225
11) T2 -30-225
12) spd 0-510
13) dist 0-2040
14)GAlt 0-1020
15) cell 0-5.1
16) Cels 0 25.5
17) Vfas 0 25.5
18) Curr 0 127.5
19) Cnsp 0 5100
20) Powr 0 1275
21) AccX 0 2.55
22) AccY 0 2.55
23) AccZ 0 2.55
24) Hdg 0 255
25) VSpd 0 2.55
26) A1- A1 range
27) A2- A2 range
28) Alt- 0 255
29) Alt+ 0 255
30) Rpm+ 0 255
31) T1+ 0 255 (s????)
32) T2+ 0 255 (e????)
33) Spd+ 0 255 (ILG???)
34) Dst+ 0 255 (v ????)
35) Cur+ 0 25.5 (A)
1.852
*/
float getBarValue(int barId, int value, FrSkyData *fd)
{
switch (barId-1) {
case TELEMETRY_SOURCE_TX_BATT:
return value/10.0;
case TELEMETRY_SOURCE_TIMER1:
case TELEMETRY_SOURCE_TIMER2:
return (3*value);
case TELEMETRY_SOURCE_RSSI_TX:
case TELEMETRY_SOURCE_RSSI_RX:
case TELEMETRY_SOURCE_FUEL:
return std::min(100, value);
case TELEMETRY_SOURCE_A1:
case TELEMETRY_SOURCE_A1_MIN:
if (fd->channels[0].type==0)
return ((fd->channels[0].ratio*value/255.0)+fd->channels[0].offset)/10;
else
return ((fd->channels[0].ratio*value/255.0)+fd->channels[0].offset);
case TELEMETRY_SOURCE_A2:
case TELEMETRY_SOURCE_A2_MIN:
if (fd->channels[1].type==0)
return ((fd->channels[1].ratio*value/255.0)+fd->channels[1].offset)/10;
else
return ((fd->channels[1].ratio*value/255.0)+fd->channels[1].offset);
case TELEMETRY_SOURCE_ALT:
case TELEMETRY_SOURCE_GPS_ALT:
case TELEMETRY_SOURCE_ALT_MAX:
case TELEMETRY_SOURCE_ALT_MIN:
return (8*value)-500;
case TELEMETRY_SOURCE_RPM:
case TELEMETRY_SOURCE_RPM_MAX:
return value * 50;
case TELEMETRY_SOURCE_T1:
case TELEMETRY_SOURCE_T2:
case TELEMETRY_SOURCE_T1_MAX:
case TELEMETRY_SOURCE_T2_MAX:
return value - 30.0;
case TELEMETRY_SOURCE_CELL:
return value*2.0/100;
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_VFAS:
return value/10.0;
case TELEMETRY_SOURCE_HDG:
return std::min(359, value*2);
case TELEMETRY_SOURCE_DIST_MAX:
case TELEMETRY_SOURCE_DIST:
return value * 8;
case TELEMETRY_SOURCE_CURRENT_MAX:
case TELEMETRY_SOURCE_CURRENT:
return value/2.0;
case TELEMETRY_SOURCE_POWER:
return value*5;
case TELEMETRY_SOURCE_CONSUMPTION:
return value * 20;
case TELEMETRY_SOURCE_SPEED:
case TELEMETRY_SOURCE_SPEED_MAX:
if (fd->imperial==1)
return value;
else
return value*1.852;
default:
return value;
}
}
QString getTrimInc(ModelData * g_model) QString getTrimInc(ModelData * g_model)
{ {
switch (g_model->trimInc) { switch (g_model->trimInc) {

View file

@ -136,7 +136,7 @@ QString getFrSkyUnits(int units);
QString getFrSkyProtocol(int protocol); QString getFrSkyProtocol(int protocol);
QString getFrSkyMeasure(int units); QString getFrSkyMeasure(int units);
QString getFrSkySrc(int index); QString getFrSkySrc(int index);
float getBarValue(int barId, int value, FrSkyData *fd);
float c9xexpou(float point, float coeff); float c9xexpou(float point, float coeff);
float ValToTim(int value); float ValToTim(int value);
int TimToVal(float value); int TimToVal(float value);

View file

@ -42,6 +42,7 @@ set(modeledit_UIS
setup_module.ui setup_module.ui
flightmode.ui flightmode.ui
telemetry_analog.ui telemetry_analog.ui
telemetry_customscreen.ui
) )
foreach(name ${modeledit_NAMES}) foreach(name ${modeledit_NAMES})

View file

@ -146,36 +146,43 @@ void CustomSwitchesPanel::edited()
{ {
case (CS_FAMILY_VOFS): case (CS_FAMILY_VOFS):
if (model.customSw[i].val1 != cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt()) { if (model.customSw[i].val1 != cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt()) {
source=RawSource(model.customSw[i].val1); source = RawSource(model.customSw[i].val1, &model);
model.customSw[i].val1 = cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt(); model.customSw[i].val1 = cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt();
RawSource newSource = RawSource(model.customSw[i].val1); RawSource newSource = RawSource(model.customSw[i].val1, &model);
if (newSource.type == SOURCE_TYPE_TELEMETRY) { if (newSource.type == SOURCE_TYPE_TELEMETRY) {
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) { if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
model.customSw[i].val2 = 0; model.customSw[i].val2 = 0;
} else { }
else {
model.customSw[i].val2 = -128; model.customSw[i].val2 = -128;
} }
} else { }
else {
RawSourceRange range = source.getRange();
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) { if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
model.customSw[i].val2 = (cswitchOffset[i]->value()/source.getStep(model)); model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
} else { }
model.customSw[i].val2 = ((cswitchOffset[i]->value()-source.getOffset(model))/source.getStep(model))-source.getRawOffset(model); else {
model.customSw[i].val2 = (cswitchOffset[i]->value() - range.offset) / range.step/* TODO - source.getRawOffset(model)*/;
} }
} }
setSwitchWidgetVisibility(i); setSwitchWidgetVisibility(i);
} else { }
source=RawSource(model.customSw[i].val1); else {
source = RawSource(model.customSw[i].val1, &model);
RawSourceRange range = source.getRange();
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) { if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
model.customSw[i].val2 = (cswitchOffset[i]->value()/source.getStep(model)); model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
cswitchOffset[i]->setValue(model.customSw[i].val2*source.getStep(model)); cswitchOffset[i]->setValue(model.customSw[i].val2*range.step);
} else { }
model.customSw[i].val2 = ((cswitchOffset[i]->value()-source.getOffset(model))/source.getStep(model))-source.getRawOffset(model); else {
cswitchOffset[i]->setValue((model.customSw[i].val2 +source.getRawOffset(model))*source.getStep(model)+source.getOffset(model)); model.customSw[i].val2 = ((cswitchOffset[i]->value()-range.offset)/range.step)/* TODO - source.getRawOffset(model)*/;
cswitchOffset[i]->setValue((model.customSw[i].val2 /* + TODO source.getRawOffset(model)*/)*range.step+range.offset);
} }
} }
break; break;
case (CS_FAMILY_TIMERS): { case (CS_FAMILY_TIMERS): {
value=cswitchOffset[i]->value(); value = cswitchOffset[i]->value();
newval=TimToVal(value); newval=TimToVal(value);
if (newval>model.customSw[i].val2) { if (newval>model.customSw[i].val2) {
if (value >=60) { if (value >=60) {
@ -246,7 +253,9 @@ void CustomSwitchesPanel::edited()
void CustomSwitchesPanel::setSwitchWidgetVisibility(int i) void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
{ {
RawSource source = RawSource(model.customSw[i].val1); RawSource source = RawSource(model.customSw[i].val1, &model);
RawSourceRange range = source.getRange();
switch (getCSFunctionFamily(model.customSw[i].func)) switch (getCSFunctionFamily(model.customSw[i].func))
{ {
case CS_FAMILY_VOFS: case CS_FAMILY_VOFS:
@ -255,16 +264,16 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
cswitchValue[i]->setVisible(false); cswitchValue[i]->setVisible(false);
cswitchOffset[i]->setVisible(true); cswitchOffset[i]->setVisible(true);
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0)); populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
cswitchOffset[i]->setDecimals(source.getDecimals(model)); cswitchOffset[i]->setDecimals(range.decimals);
cswitchOffset[i]->setSingleStep(source.getStep(model)); cswitchOffset[i]->setSingleStep(range.step);
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) { if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
cswitchOffset[i]->setMinimum(source.getStep(model)*-127); cswitchOffset[i]->setMinimum(range.step*-127);
cswitchOffset[i]->setMaximum(source.getStep(model)*127); cswitchOffset[i]->setMaximum(range.step*127);
cswitchOffset[i]->setValue(source.getStep(model)*model.customSw[i].val2); cswitchOffset[i]->setValue(range.step*model.customSw[i].val2);
} else { } else {
cswitchOffset[i]->setMinimum(source.getMin(model)); cswitchOffset[i]->setMinimum(range.min);
cswitchOffset[i]->setMaximum(source.getMax(model)); cswitchOffset[i]->setMaximum(range.max);
cswitchOffset[i]->setValue(source.getStep(model)*(model.customSw[i].val2+source.getRawOffset(model))+source.getOffset(model)); cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
} }
break; break;
case CS_FAMILY_VBOOL: case CS_FAMILY_VBOOL:

View file

@ -48,7 +48,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
ui->sideLabel->hide(); ui->sideLabel->hide();
ui->sideCB->hide(); ui->sideCB->hide();
ui->inputName->setMaxLength(4); ui->inputName->setMaxLength(4);
populateSourceCB(ui->sourceCB, ed->srcRaw, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | (GetEepromInterface()->getCapability(GvarsAsSources) ? POPULATE_GVARS : 0)); populateSourceCB(ui->sourceCB, ed->srcRaw, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
ui->sourceCB->removeItem(0); ui->sourceCB->removeItem(0);
} }
else { else {
@ -56,8 +56,6 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
ui->inputName->hide(); ui->inputName->hide();
ui->sourceLabel->hide(); ui->sourceLabel->hide();
ui->sourceCB->hide(); ui->sourceCB->hide();
ui->scaleLabel->hide();
ui->scaleSB->hide();
ui->trimLabel->hide(); ui->trimLabel->hide();
ui->trimCB->hide(); ui->trimCB->hide();
} }
@ -83,13 +81,15 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
ui->lineName->setValidator(new QRegExpValidator(rx, this)); ui->lineName->setValidator(new QRegExpValidator(rx, this));
ui->lineName->setText(ed->name); ui->lineName->setText(ed->name);
updateScale();
valuesChanged(); valuesChanged();
connect(ui->lineName,SIGNAL(editingFinished()), this, SLOT(valuesChanged())); connect(ui->lineName, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
connect(ui->sourceCB,SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged())); connect(ui->sourceCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
connect(ui->trimCB,SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged())); connect(ui->scale, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
connect(ui->switchesCB,SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged())); connect(ui->trimCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
connect(ui->sideCB,SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged())); connect(ui->switchesCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
connect(ui->sideCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
for (int i=0; i<9; i++) { for (int i=0; i<9; i++) {
connect(cb_fp[i], SIGNAL(toggled(bool)), this, SLOT(valuesChanged())); connect(cb_fp[i], SIGNAL(toggled(bool)), this, SLOT(valuesChanged()));
} }
@ -103,15 +103,20 @@ ExpoDialog::~ExpoDialog()
delete ui; delete ui;
} }
void ExpoDialog::changeEvent(QEvent *e) void ExpoDialog::updateScale()
{ {
QDialog::changeEvent(e); if (GetEepromInterface()->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) {
switch (e->type()) { RawSourceRange range = ed->srcRaw.getRange();
case QEvent::LanguageChange: ui->scaleLabel->show();
ui->retranslateUi(this); ui->scale->show();
break; ui->scale->setDecimals(range.decimals);
default: ui->scale->setMinimum(range.min);
break; ui->scale->setMaximum(range.max);
ui->scale->setValue(round(range.step * ed->scale));
}
else {
ui->scaleLabel->hide();
ui->scale->hide();
} }
} }
@ -119,7 +124,14 @@ void ExpoDialog::valuesChanged()
{ {
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 }; QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
ed->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt()); RawSource srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
if (ed->srcRaw != srcRaw) {
ed->srcRaw = srcRaw;
updateScale();
}
RawSourceRange range = srcRaw.getRange();
ed->scale = round(float(ui->scale->value()) / range.step);
ed->carryTrim = 1 - ui->trimCB->currentIndex(); ed->carryTrim = 1 - ui->trimCB->currentIndex();
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt()); ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
ed->mode = ui->sideCB->currentIndex() + 1; ed->mode = ui->sideCB->currentIndex() + 1;
@ -173,5 +185,5 @@ void ExpoDialog::valuesChanged()
void ExpoDialog::shrink() void ExpoDialog::shrink()
{ {
resize(0,0); resize(0, 0);
} }

View file

@ -18,7 +18,7 @@ class ExpoDialog : public QDialog {
~ExpoDialog(); ~ExpoDialog();
protected: protected:
void changeEvent(QEvent *e); void updateScale();
private slots: private slots:
void valuesChanged(); void valuesChanged();

View file

@ -330,7 +330,7 @@ If blank then the input is considered to be &quot;ON&quot; all the time.</string
</spacer> </spacer>
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QDoubleSpinBox" name="scaleSB"> <widget class="QDoubleSpinBox" name="scale">
<property name="whatsThis"> <property name="whatsThis">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
@ -441,6 +441,32 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>inputName</tabstop>
<tabstop>lineName</tabstop>
<tabstop>sourceCB</tabstop>
<tabstop>scale</tabstop>
<tabstop>trimCB</tabstop>
<tabstop>weightGV</tabstop>
<tabstop>weightSB</tabstop>
<tabstop>weightCB</tabstop>
<tabstop>curveTypeCB</tabstop>
<tabstop>curveGVarCB</tabstop>
<tabstop>curveValueCB</tabstop>
<tabstop>curveValueSB</tabstop>
<tabstop>cb_FP0</tabstop>
<tabstop>cb_FP1</tabstop>
<tabstop>cb_FP2</tabstop>
<tabstop>cb_FP3</tabstop>
<tabstop>cb_FP4</tabstop>
<tabstop>cb_FP5</tabstop>
<tabstop>cb_FP6</tabstop>
<tabstop>cb_FP7</tabstop>
<tabstop>cb_FP8</tabstop>
<tabstop>switchesCB</tabstop>
<tabstop>sideCB</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../companion.qrc"/> <include location="../companion.qrc"/>
</resources> </resources>

View file

@ -20,7 +20,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, i
else else
this->setWindowTitle(tr("DEST -> CH%1%2").arg(md->destCh/10).arg(md->destCh%10)); this->setWindowTitle(tr("DEST -> CH%1%2").arg(md->destCh/10).arg(md->destCh%10));
populateSourceCB(ui->sourceCB, md->srcRaw, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS | (GetEepromInterface()->getCapability(GvarsAsSources) ? POPULATE_GVARS : 0)); populateSourceCB(ui->sourceCB, md->srcRaw, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
ui->sourceCB->removeItem(0); ui->sourceCB->removeItem(0);
int limit = GetEepromInterface()->getCapability(OffsetWeight); int limit = GetEepromInterface()->getCapability(OffsetWeight);

View file

@ -1,6 +1,7 @@
#include "telemetry.h" #include "telemetry.h"
#include "ui_telemetry.h" #include "ui_telemetry.h"
#include "ui_telemetry_analog.h" #include "ui_telemetry_analog.h"
#include "ui_telemetry_customscreen.h"
#include "helpers.h" #include "helpers.h"
TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog): TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
@ -11,15 +12,13 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
{ {
ui->setupUi(this); ui->setupUi(this);
float ratio; float ratio = analog.getRatio();
if (analog.type==0 || analog.type==1 || analog.type==2) { if (analog.type==0 || analog.type==1 || analog.type==2) {
ratio = (analog.ratio<<analog.multiplier)/10.0;
ui->RatioSB->setDecimals(1); ui->RatioSB->setDecimals(1);
ui->RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier)); ui->RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
} }
else { else {
ratio = analog.ratio<<analog.multiplier;
ui->RatioSB->setDecimals(0); ui->RatioSB->setDecimals(0);
ui->RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier)); ui->RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
} }
@ -44,69 +43,44 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
void TelemetryAnalog::update() void TelemetryAnalog::update()
{ {
float ratio, alarm1value, alarm2value; float ratio = analog.getRatio();
if (analog.ratio==0) { float step = ratio / 255;
ui->alarm1ValueSB->setMinimum(0); float mini = (ratio * analog.offset) / 255;
ui->alarm1ValueSB->setMaximum(0); float maxi = mini + ratio;
ui->alarm2ValueSB->setMinimum(0);
ui->alarm2ValueSB->setMaximum(0);
ui->CalibSB->setMinimum(0);
ui->CalibSB->setMaximum(0);
ui->CalibSB->setValue(0);
ui->alarm1ValueSB->setValue(0);
ui->alarm2ValueSB->setValue(0);
return;
}
if (analog.type==0 || analog.type==1 || analog.type==2) {
ratio=(analog.ratio<<analog.multiplier)/10.0;
ui->alarm1ValueSB->setDecimals(2); ui->alarm1ValueSB->setDecimals(2);
ui->alarm1ValueSB->setSingleStep(ratio/255.0); ui->alarm1ValueSB->setSingleStep(step);
ui->alarm1ValueSB->setMinimum(mini);
ui->alarm1ValueSB->setMaximum(maxi);
ui->alarm1ValueSB->setValue(mini + step*analog.alarms[0].value);
ui->alarm2ValueSB->setDecimals(2); ui->alarm2ValueSB->setDecimals(2);
ui->alarm2ValueSB->setSingleStep(ratio/255.0); ui->alarm2ValueSB->setSingleStep(step);
ui->alarm1ValueSB->setMinimum((analog.ratio*1.0*analog.offset)/2550.0); ui->alarm2ValueSB->setMinimum(mini);
ui->alarm1ValueSB->setMaximum(ratio+(analog.ratio*1.0*analog.offset)/2550.0); ui->alarm2ValueSB->setMaximum(maxi);
ui->alarm2ValueSB->setMinimum((analog.offset*1.0*analog.ratio)/2550.0); ui->alarm2ValueSB->setValue(mini + step*analog.alarms[1].value);
ui->alarm2ValueSB->setMaximum(ratio+(analog.offset*1.0*analog.ratio)/2550.0);
}
else {
ratio=analog.ratio<<analog.multiplier;
ui->alarm1ValueSB->setDecimals(2);
ui->alarm1ValueSB->setSingleStep(ratio/255.0);
ui->alarm2ValueSB->setDecimals(2);
ui->alarm2ValueSB->setSingleStep(ratio/255.0);
ui->alarm1ValueSB->setMinimum((analog.offset*1.0*analog.ratio)/255.0);
ui->alarm1ValueSB->setMaximum(ratio+(analog.offset*1.0*analog.ratio)/255.0);
ui->alarm2ValueSB->setMinimum((analog.offset*1.0*analog.ratio)/255.0);
ui->alarm2ValueSB->setMaximum(ratio+(analog.offset*1.0*analog.ratio)/255.0);
}
ui->CalibSB->setDecimals(2); ui->CalibSB->setDecimals(2);
ui->CalibSB->setMaximum((ratio*127)/255.0); ui->CalibSB->setMaximum(step*127);
ui->CalibSB->setMinimum((-ratio*128)/255.0); ui->CalibSB->setMinimum(-step*128);
ui->CalibSB->setSingleStep(ratio/255.0); ui->CalibSB->setSingleStep(step);
ui->CalibSB->setValue((analog.offset*ratio)/255); ui->CalibSB->setValue(mini);
alarm1value=ratio*(analog.alarms[0].value/255.0+analog.offset/255.0);
alarm2value=ratio*(analog.alarms[1].value/255.0+analog.offset/255.0);;
ui->alarm1ValueSB->setValue(alarm1value);
ui->alarm2ValueSB->setValue(alarm2value);
} }
void TelemetryAnalog::on_UnitCB_currentIndexChanged(int index) void TelemetryAnalog::on_UnitCB_currentIndexChanged(int index)
{ {
float ratio; float ratio = analog.getRatio();
analog.type=index; analog.type = index;
switch (index) { switch (index) {
case 0: case 0:
case 1: case 1:
case 2: case 2:
ui->RatioSB->setDecimals(1); ui->RatioSB->setDecimals(1);
ui->RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier)); ui->RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
ratio=(analog.ratio<<analog.multiplier)/10.0;
break; break;
default: default:
ui->RatioSB->setDecimals(0); ui->RatioSB->setDecimals(0);
ui->RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier)); ui->RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
ratio=(analog.ratio<<analog.multiplier);
break; break;
} }
ui->RatioSB->setValue(ratio); ui->RatioSB->setValue(ratio);
@ -127,7 +101,7 @@ void TelemetryAnalog::on_RatioSB_valueChanged()
} }
else { else {
analog.multiplier = findmult(ui->RatioSB->value(), 255); analog.multiplier = findmult(ui->RatioSB->value(), 255);
float singlestep =(1<<analog.multiplier); float singlestep = (1<<analog.multiplier);
lock = true; lock = true;
ui->RatioSB->setSingleStep(singlestep); ui->RatioSB->setSingleStep(singlestep);
ui->RatioSB->setValue(round(ui->RatioSB->value()/singlestep)*singlestep); ui->RatioSB->setValue(round(ui->RatioSB->value()/singlestep)*singlestep);
@ -139,15 +113,17 @@ void TelemetryAnalog::on_RatioSB_valueChanged()
void TelemetryAnalog::on_RatioSB_editingFinished() void TelemetryAnalog::on_RatioSB_editingFinished()
{ {
if (!lock) {
float ratio, calib, alarm1value,alarm2value; float ratio, calib, alarm1value,alarm2value;
if (lock) return;
if (analog.type==0 || analog.type==1 || analog.type==2) { if (analog.type==0 || analog.type==1 || analog.type==2) {
analog.multiplier = findmult(ui->RatioSB->value(), 25.5); analog.multiplier = findmult(ui->RatioSB->value(), 25.5);
ui->CalibSB->setSingleStep((1<<analog.multiplier)/10.0); ui->CalibSB->setSingleStep((1<<analog.multiplier)/10.0);
ui->alarm1ValueSB->setSingleStep((1<<analog.multiplier)/10.0); ui->alarm1ValueSB->setSingleStep((1<<analog.multiplier)/10.0);
ui->alarm2ValueSB->setSingleStep((1<<analog.multiplier)/10.0); ui->alarm2ValueSB->setSingleStep((1<<analog.multiplier)/10.0);
analog.ratio = ((int)(round(ui->RatioSB->value()*10))/(1 <<analog.multiplier)); analog.ratio = ((int)(round(ui->RatioSB->value()*10))/(1 <<analog.multiplier));
} else { }
else {
analog.multiplier = findmult(ui->RatioSB->value(), 255); analog.multiplier = findmult(ui->RatioSB->value(), 255);
ui->CalibSB->setSingleStep(1<<analog.multiplier); ui->CalibSB->setSingleStep(1<<analog.multiplier);
ui->alarm1ValueSB->setSingleStep(1<<analog.multiplier); ui->alarm1ValueSB->setSingleStep(1<<analog.multiplier);
@ -171,7 +147,8 @@ void TelemetryAnalog::on_RatioSB_editingFinished()
if (calib>0) { if (calib>0) {
if (calib>((ratio*127)/255)) { if (calib>((ratio*127)/255)) {
analog.offset=127; analog.offset=127;
} else { }
else {
analog.offset=round(calib*255/ratio); analog.offset=round(calib*255/ratio);
} }
} }
@ -185,18 +162,15 @@ void TelemetryAnalog::on_RatioSB_editingFinished()
analog.alarms[0].value=round((alarm1value*255-analog.offset*(analog.ratio<<analog.multiplier))/(analog.ratio<<analog.multiplier)); analog.alarms[0].value=round((alarm1value*255-analog.offset*(analog.ratio<<analog.multiplier))/(analog.ratio<<analog.multiplier));
analog.alarms[1].value=round((alarm2value*255-analog.offset*(analog.ratio<<analog.multiplier))/(analog.ratio<<analog.multiplier)); analog.alarms[1].value=round((alarm2value*255-analog.offset*(analog.ratio<<analog.multiplier))/(analog.ratio<<analog.multiplier));
update(); update();
// TODO ? telBarUpdate();
emit modified(); emit modified();
}
} }
void TelemetryAnalog::on_CalibSB_editingFinished() void TelemetryAnalog::on_CalibSB_editingFinished()
{ {
float ratio,calib,alarm1value,alarm2value; float ratio = analog.getRatio();
if (analog.type==0 || analog.type==1 || analog.type==2) { float calib,alarm1value,alarm2value;
ratio=(analog.ratio<<analog.multiplier)/10.0;
} else {
ratio=analog.ratio<<analog.multiplier;
}
if (ratio!=0) { if (ratio!=0) {
analog.offset = round((255*ui->CalibSB->value()/ratio)); analog.offset = round((255*ui->CalibSB->value()/ratio));
calib=ratio*analog.offset/255.0; calib=ratio*analog.offset/255.0;
@ -204,7 +178,8 @@ void TelemetryAnalog::on_CalibSB_editingFinished()
alarm2value=ui->alarm2ValueSB->value(); alarm2value=ui->alarm2ValueSB->value();
if (alarm1value<calib) { if (alarm1value<calib) {
alarm1value=calib; alarm1value=calib;
} else if (alarm1value>(ratio+calib)) { }
else if (alarm1value>(ratio+calib)) {
alarm1value=ratio+calib; alarm1value=ratio+calib;
} }
if (alarm2value<calib) { if (alarm2value<calib) {
@ -220,7 +195,6 @@ void TelemetryAnalog::on_CalibSB_editingFinished()
analog.alarms[1].value=0; analog.alarms[1].value=0;
} }
update(); update();
// TODO ? telBarUpdate();
emit modified(); emit modified();
} }
@ -239,18 +213,19 @@ void TelemetryAnalog::on_alarm1GreaterCB_currentIndexChanged(int index)
void TelemetryAnalog::on_alarm1ValueSB_editingFinished() void TelemetryAnalog::on_alarm1ValueSB_editingFinished()
{ {
float ratio, calib, alarm1value; float ratio = analog.getRatio();
ratio=analog.ratio<<analog.multiplier; float calib, alarm1value;
calib=analog.offset; calib=analog.offset;
alarm1value=ui->alarm1ValueSB->value(); alarm1value=ui->alarm1ValueSB->value();
if (analog.type==0) {
ratio/=10;
}
if (alarm1value<((calib*ratio)/255)) { if (alarm1value<((calib*ratio)/255)) {
analog.alarms[0].value=0; analog.alarms[0].value=0;
} else if (alarm1value>(ratio+(calib*ratio)/255)) { }
else if (alarm1value>(ratio+(calib*ratio)/255)) {
analog.alarms[0].value=255; analog.alarms[0].value=255;
} else { }
else {
analog.alarms[0].value = round((alarm1value-((calib*ratio)/255))/ratio*255); analog.alarms[0].value = round((alarm1value-((calib*ratio)/255))/ratio*255);
} }
update(); update();
@ -271,16 +246,14 @@ void TelemetryAnalog::on_alarm2GreaterCB_currentIndexChanged(int index)
void TelemetryAnalog::on_alarm2ValueSB_editingFinished() void TelemetryAnalog::on_alarm2ValueSB_editingFinished()
{ {
float ratio, calib, alarm2value; float calib, alarm2value;
ratio = analog.ratio<<analog.multiplier; float ratio = analog.getRatio();
calib = analog.offset; calib = analog.offset;
alarm2value = ui->alarm2ValueSB->value(); alarm2value = ui->alarm2ValueSB->value();
if (analog.type==0) {
ratio/=10;
}
if (alarm2value<((calib*ratio)/255)) { if (alarm2value<((calib*ratio)/255)) {
analog.alarms[1].value=0; analog.alarms[1].value=0;
} else if (alarm2value>(ratio+(calib*ratio)/255)) { }
else if (alarm2value>(ratio+(calib*ratio)/255)) {
analog.alarms[1].value=255; analog.alarms[1].value=255;
} else { } else {
analog.alarms[1].value = round((alarm2value-((calib*ratio)/255))/ratio*255); analog.alarms[1].value = round((alarm2value-((calib*ratio)/255))/ratio*255);
@ -296,41 +269,182 @@ TelemetryAnalog::~TelemetryAnalog()
/******************************************************/ /******************************************************/
TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen):
ModelPanel(parent, model),
ui(new Ui::TelemetryCustomScreen),
screen(screen)
{
ui->setupUi(this);
for (int l=0; l<4; l++) {
for (int c=0; c<GetEepromInterface()->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
fieldsCB[l][c] = new QComboBox(this);
fieldsCB[l][c]->setProperty("index", c + (l<<8));
populateCustomScreenFieldCB(fieldsCB[l][c], screen.body.lines[l].source[c], (l<4), model.frsky.usrProto);
ui->screenNumsLayout->addWidget(fieldsCB[l][c], l, c, 1, 1);
connect(fieldsCB[l][c], SIGNAL(currentIndexChanged(int)), this, SLOT(customFieldChanged(int)));
}
}
for (int l=0; l<4; l++) {
barsCB[l] = new QComboBox(this);
barsCB[l]->setProperty("index", l);
populateCustomScreenFieldCB(barsCB[l], screen.body.bars[l].source, false, model.frsky.usrProto);
connect(barsCB[l], SIGNAL(currentIndexChanged(int)), this, SLOT(barSourceChanged(int)));
ui->screenBarsLayout->addWidget(barsCB[l], l, 0, 1, 1);
minSB[l] = new QDoubleSpinBox(this);
minSB[l]->setProperty("index", l);
connect(minSB[l], SIGNAL(valueChanged(double)), this, SLOT(barMinChanged(double)));
ui->screenBarsLayout->addWidget(minSB[l], l, 1, 1, 1);
QLabel * label = new QLabel(this);
label->setAutoFillBackground(false);
label->setStyleSheet(QString::fromUtf8("Background:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 128, 255), stop:0.339795 rgba(0, 0, 128, 255), stop:0.339799 rgba(255, 255, 255, 255), stop:0.662444 rgba(255, 255, 255, 255),)\n"""));
label->setFrameShape(QFrame::Panel);
label->setFrameShadow(QFrame::Raised);
label->setAlignment(Qt::AlignCenter);
ui->screenBarsLayout->addWidget(label, l, 2, 1, 1);
maxSB[l] = new QDoubleSpinBox(this);
maxSB[l]->setProperty("index", l);
connect(maxSB[l], SIGNAL(valueChanged(double)), this, SLOT(barMaxChanged(double)));
ui->screenBarsLayout->addWidget(maxSB[l], l, 3, 1, 1);
}
update();
}
TelemetryCustomScreen::~TelemetryCustomScreen()
{
delete ui;
}
void TelemetryCustomScreen::update()
{
lock = true;
ui->screenType->setCurrentIndex(screen.type);
ui->screenNums->setVisible(screen.type == 0);
ui->screenBars->setVisible(screen.type != 0);
if (screen.type == 0) {
for (int l=0; l<4; l++) {
for (int c=0; c<GetEepromInterface()->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
fieldsCB[l][c]->setCurrentIndex(screen.body.lines[l].source[c]);
}
}
}
else {
for (int i=0; i<4; i++) {
updateBar(i);
}
}
lock = false;
}
void TelemetryCustomScreen::updateBar(int line)
{
int index = screen.body.bars[line].source;
barsCB[line]->setCurrentIndex(index);
if (index) {
RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1, &model);
RawSourceRange range = source.getRange(true);
int max = round((range.max - range.min) / range.step);
if (255-screen.body.bars[line].barMax > max)
screen.body.bars[line].barMax = 255 - max;
minSB[line]->setEnabled(true);
minSB[line]->setDecimals(range.decimals);
minSB[line]->setMinimum(range.min);
minSB[line]->setMaximum(range.max);
minSB[line]->setSingleStep(range.step);
minSB[line]->setValue(range.getValue(screen.body.bars[line].barMin));
maxSB[line]->setEnabled(true);
maxSB[line]->setDecimals(range.decimals);
maxSB[line]->setMinimum(range.min);
maxSB[line]->setMaximum(range.max);
maxSB[line]->setSingleStep(range.step);
maxSB[line]->setValue(range.getValue(255 - screen.body.bars[line].barMax));
}
else {
minSB[line]->setDisabled(true);
maxSB[line]->setDisabled(true);
}
}
void TelemetryCustomScreen::on_screenType_currentIndexChanged(int index)
{
if (!lock) {
memset(&screen.body, 0, sizeof(screen.body));
screen.type = index;
update();
emit modified();
}
}
void TelemetryCustomScreen::customFieldChanged(int value)
{
int index = sender()->property("index").toInt();
screen.body.lines[index/256].source[index%256] = value;
emit modified();
}
void TelemetryCustomScreen::barSourceChanged(int index)
{
QComboBox * cb = qobject_cast<QComboBox*>(sender());
int line = cb->property("index").toInt();
screen.body.bars[line].source = index;
screen.body.bars[line].barMin = 0;
screen.body.bars[line].barMax = 0;
updateBar(line);
emit modified();
}
void TelemetryCustomScreen::barMinChanged(double value)
{
if (!lock) {
int line = sender()->property("index").toInt();
screen.body.bars[line].barMin = round((value-minSB[line]->minimum()) / minSB[line]->singleStep());
// TODO set min (maxSB)
emit modified();
}
}
void TelemetryCustomScreen::barMaxChanged(double value)
{
if (!lock) {
int line = sender()->property("index").toInt();
screen.body.bars[line].barMax = 255 - round((value-minSB[line]->minimum()) / maxSB[line]->singleStep());
// TODO set max (minSB)
emit modified();
}
}
/******************************************************/
TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model): TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model):
ModelPanel(parent, model), ModelPanel(parent, model),
ui(new Ui::Telemetry) ui(new Ui::Telemetry)
{ {
ui->setupUi(this); ui->setupUi(this);
if (GetEepromInterface()->getCapability(NoTelemetryProtocol)) {
model.frsky.usrProto = 1;
}
analogs[0] = new TelemetryAnalog(this, model.frsky.channels[0]); analogs[0] = new TelemetryAnalog(this, model.frsky.channels[0]);
ui->A1Layout->addWidget(analogs[0]); ui->A1Layout->addWidget(analogs[0]);
connect(analogs[0], SIGNAL(modified()), this, SLOT(onAnalogModified())); connect(analogs[0], SIGNAL(modified()), this, SLOT(onAnalogModified()));
analogs[1] = new TelemetryAnalog(this, model.frsky.channels[1]); analogs[1] = new TelemetryAnalog(this, model.frsky.channels[1]);
ui->A2Layout->addWidget(analogs[1]); ui->A2Layout->addWidget(analogs[1]);
connect(analogs[1], SIGNAL(modified()), this, SLOT(onAnalogModified())); connect(analogs[1], SIGNAL(modified()), this, SLOT(onAnalogModified()));
QGroupBox* barsgb[3] = { ui->CS1Bars, ui->CS2Bars, ui->CS3Bars }; for (int i=0; i<GetEepromInterface()->getCapability(TelemetryCustomScreens); i++) {
QGroupBox* numsgb[3] = { ui->CS1Nums, ui->CS2Nums, ui->CS3Nums }; TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i]);
ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1));
QComboBox* barscb[12] = { ui->telBarCS1B1_CB, ui->telBarCS1B2_CB, ui->telBarCS1B3_CB, ui->telBarCS1B4_CB, }
ui->telBarCS2B1_CB, ui->telBarCS2B2_CB, ui->telBarCS2B3_CB, ui->telBarCS2B4_CB,
ui->telBarCS3B1_CB, ui->telBarCS3B2_CB, ui->telBarCS3B3_CB, ui->telBarCS3B4_CB};
QDoubleSpinBox* minSB[12] = { ui->telMinCS1SB1, ui->telMinCS1SB2, ui->telMinCS1SB3, ui->telMinCS1SB4,
ui->telMinCS2SB1, ui->telMinCS2SB2, ui->telMinCS2SB3, ui->telMinCS2SB4,
ui->telMinCS3SB1, ui->telMinCS3SB2, ui->telMinCS3SB3, ui->telMinCS3SB4};
QDoubleSpinBox* maxSB[12] = { ui->telMaxCS1SB1, ui->telMaxCS1SB2, ui->telMaxCS1SB3, ui->telMaxCS1SB4,
ui->telMaxCS2SB1, ui->telMaxCS2SB2, ui->telMaxCS2SB3, ui->telMaxCS2SB4,
ui->telMaxCS3SB1, ui->telMaxCS3SB2, ui->telMaxCS3SB3, ui->telMaxCS3SB4};
QComboBox* tmp[36] = { ui->telemetryCS1F1_CB, ui->telemetryCS1F2_CB, ui->telemetryCS1F3_CB, ui->telemetryCS1F4_CB, ui->telemetryCS1F5_CB, ui->telemetryCS1F6_CB, ui->telemetryCS1F7_CB, ui->telemetryCS1F8_CB, ui->telemetryCS1F9_CB, ui->telemetryCS1F10_CB, ui->telemetryCS1F11_CB, ui->telemetryCS1F12_CB,
ui->telemetryCS2F1_CB, ui->telemetryCS2F2_CB, ui->telemetryCS2F3_CB, ui->telemetryCS2F4_CB, ui->telemetryCS2F5_CB, ui->telemetryCS2F6_CB, ui->telemetryCS2F7_CB, ui->telemetryCS2F8_CB, ui->telemetryCS2F9_CB, ui->telemetryCS2F10_CB, ui->telemetryCS2F11_CB, ui->telemetryCS2F12_CB,
ui->telemetryCS3F1_CB, ui->telemetryCS3F2_CB, ui->telemetryCS3F3_CB, ui->telemetryCS3F4_CB, ui->telemetryCS3F5_CB, ui->telemetryCS3F6_CB, ui->telemetryCS3F7_CB, ui->telemetryCS3F8_CB, ui->telemetryCS3F9_CB, ui->telemetryCS3F10_CB, ui->telemetryCS3F11_CB, ui->telemetryCS3F12_CB};
memcpy(barsGB, barsgb, sizeof(barsGB));
memcpy(numsGB, numsgb, sizeof(numsGB));
memcpy(barsCB, barscb, sizeof(barsCB));
memcpy(this->maxSB, maxSB, sizeof(this->maxSB));
memcpy(this->minSB, minSB, sizeof(this->minSB));
memcpy(csf, tmp, sizeof(csf));
setup(); setup();
} }
@ -346,19 +460,6 @@ void TelemetryPanel::setup()
QString firmware_id = settings.value("firmware", default_firmware_variant.id).toString(); QString firmware_id = settings.value("firmware", default_firmware_variant.id).toString();
lock=true; lock=true;
ui->telemetryCSType1->setCurrentIndex(model.frsky.screens[0].type);
ui->telemetryCSType2->setCurrentIndex(model.frsky.screens[1].type);
ui->telemetryCSType3->setCurrentIndex(model.frsky.screens[2].type);
for (int i=0; i<3; i++) {
bool isNum = (model.frsky.screens[i].type==0);
barsGB[i]->setVisible(!isNum);
numsGB[i]->setVisible(isNum);
}
connect(ui->telemetryCSType1,SIGNAL(currentIndexChanged(int)),this,SLOT(ScreenTypeCBcurrentIndexChanged(int)));
connect(ui->telemetryCSType2,SIGNAL(currentIndexChanged(int)),this,SLOT(ScreenTypeCBcurrentIndexChanged(int)));
connect(ui->telemetryCSType3,SIGNAL(currentIndexChanged(int)),this,SLOT(ScreenTypeCBcurrentIndexChanged(int)));
//frsky Settings //frsky Settings
if (!GetEepromInterface()->getCapability(TelemetryRSSIModel) ) { if (!GetEepromInterface()->getCapability(TelemetryRSSIModel) ) {
@ -397,7 +498,8 @@ void TelemetryPanel::setup()
ui->VarioLabel_4->hide(); ui->VarioLabel_4->hide();
ui->varioSourceCB->hide(); ui->varioSourceCB->hide();
ui->varioSource_label->hide(); ui->varioSource_label->hide();
} else { }
else {
if (!GetEepromInterface()->getCapability(HasVarioSink)) { if (!GetEepromInterface()->getCapability(HasVarioSink)) {
ui->varioLimitMinOff_ChkB->hide(); ui->varioLimitMinOff_ChkB->hide();
ui->varioLimitMin_DSB->hide(); ui->varioLimitMin_DSB->hide();
@ -431,44 +533,12 @@ void TelemetryPanel::setup()
if (!(GetEepromInterface()->getCapability(HasAltitudeSel)||GetEepromInterface()->getCapability(HasVario))) { if (!(GetEepromInterface()->getCapability(HasAltitudeSel)||GetEepromInterface()->getCapability(HasVario))) {
ui->altimetryGB->hide(); ui->altimetryGB->hide();
} }
if (GetEepromInterface()->getCapability(NoTelemetryProtocol)) {
model.frsky.usrProto=1;
ui->frskyProtoCB->setDisabled(true);
} else {
ui->frskyProtoCB->setEnabled(true);
}
if (GetEepromInterface()->getCapability(TelemetryCSFields)==0) { if (GetEepromInterface()->getCapability(NoTelemetryProtocol)) {
ui->groupBox_5->hide(); ui->frskyProtoCB->setDisabled(true);
} else {
if (GetEepromInterface()->getCapability(TelemetryCSFields)==8) {
ui->tabCsView->removeTab(1);
ui->tabCsView->removeTab(2);
}
if (GetEepromInterface()->getCapability(TelemetryCSFields)==16) {
ui->tabCsView->removeTab(2);
}
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2;
for (int screen=0; screen<(GetEepromInterface()->getCapability(TelemetryCSFields)/(4*cols)); screen++) {
for (int c=0; c<cols; c++) {
for (int r=0; r<4; r++) {
int index=screen*12+c*4+r;
if (model.frsky.screens[screen].type==0) {
populateCustomScreenFieldCB(csf[index], model.frsky.screens[screen].body.lines[r].source[c], (r<4), model.frsky.usrProto);
} else {
populateCustomScreenFieldCB(csf[index], 0, (r<4), model.frsky.usrProto);
}
connect(csf[index], SIGNAL(currentIndexChanged(int)), this, SLOT(customFieldEdited()));
}
}
for (int c=cols; c<3; c++) {
for (int r=0; r<4; r++) {
int index=screen*12+c*4+r;
csf[index]->hide();
}
}
} }
else {
ui->frskyProtoCB->setEnabled(true);
} }
if (!GetEepromInterface()->getCapability(TelemetryUnits)) { if (!GetEepromInterface()->getCapability(TelemetryUnits)) {
@ -479,9 +549,11 @@ void TelemetryPanel::setup()
} }
ui->frskyUnitsCB->setCurrentIndex(index); ui->frskyUnitsCB->setCurrentIndex(index);
} }
if ((GetEepromInterface()->getCapability(Telemetry)&TM_HASWSHH)) { if ((GetEepromInterface()->getCapability(Telemetry)&TM_HASWSHH)) {
ui->frskyProtoCB->addItem(tr("Winged Shadow How High")); ui->frskyProtoCB->addItem(tr("Winged Shadow How High"));
} else { }
else {
ui->frskyProtoCB->addItem(tr("Winged Shadow How High (not supported)")); ui->frskyProtoCB->addItem(tr("Winged Shadow How High (not supported)"));
} }
@ -517,57 +589,6 @@ void TelemetryPanel::setup()
ui->frskyCurrentCB->setCurrentIndex(model.frsky.currentSource); ui->frskyCurrentCB->setCurrentIndex(model.frsky.currentSource);
ui->frskyVoltCB->setCurrentIndex(model.frsky.voltsSource); ui->frskyVoltCB->setCurrentIndex(model.frsky.voltsSource);
for (int screen=0; screen<2;screen++) {
for (int rows=0; rows<4; rows++) {
for (int cols=0; cols<3; cols++) {
int index=screen*12+cols*4+rows;
populateCustomScreenFieldCB(csf[index], model.frsky.screens[screen].body.lines[rows].source[cols], (rows<4), model.frsky.usrProto);
}
}
}
for (int j=0; j<12; j++) {
int screen = j/4;
int field = j%4;
populateCustomScreenFieldCB(barsCB[j], model.frsky.screens[screen].body.bars[field].source, false, model.frsky.usrProto);
switch (model.frsky.screens[screen].body.bars[field].source-1) {
case TELEMETRY_SOURCE_TX_BATT:
case TELEMETRY_SOURCE_A1:
case TELEMETRY_SOURCE_A1_MIN:
case TELEMETRY_SOURCE_A2:
case TELEMETRY_SOURCE_A2_MIN:
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_VFAS:
case TELEMETRY_SOURCE_CURRENT_MAX:
case TELEMETRY_SOURCE_CURRENT:
minSB[j]->setDecimals(1);
maxSB[j]->setDecimals(1);
break;
case TELEMETRY_SOURCE_CELL:
minSB[j]->setDecimals(2);
maxSB[j]->setDecimals(2);
break;
default:
minSB[j]->setDecimals(0);
maxSB[j]->setDecimals(0);
}
minSB[j]->setMinimum(getBarValue(model.frsky.screens[screen].body.bars[field].source, 0, &model.frsky));
minSB[j]->setMaximum(getBarValue(model.frsky.screens[screen].body.bars[field].source, 255, &model.frsky));
minSB[j]->setSingleStep(getBarStep(model.frsky.screens[screen].body.bars[field].source));
minSB[j]->setValue(getBarValue(model.frsky.screens[screen].body.bars[field].source, model.frsky.screens[screen].body.bars[field].barMin, &model.frsky));
maxSB[j]->setMinimum(getBarValue(model.frsky.screens[screen].body.bars[field].source, 0, &model.frsky));
maxSB[j]->setMaximum(getBarValue(model.frsky.screens[screen].body.bars[field].source, 255, &model.frsky));
maxSB[j]->setSingleStep(getBarStep(model.frsky.screens[screen].body.bars[field].source));
maxSB[j]->setValue(getBarValue(model.frsky.screens[screen].body.bars[field].source, (255-model.frsky.screens[screen].body.bars[field].barMax), &model.frsky));
if (model.frsky.screens[screen].body.bars[field].source==0 || model.frsky.screens[screen].type==0) {
minSB[j]->setDisabled(true);
maxSB[j]->setDisabled(true);
}
connect(barsCB[j],SIGNAL(currentIndexChanged(int)),this,SLOT(telBarCBcurrentIndexChanged(int)));
connect(maxSB[j],SIGNAL(editingFinished()),this,SLOT(telMaxSBeditingFinished()));
connect(minSB[j],SIGNAL(editingFinished()),this,SLOT(telMinSBeditingFinished()));
}
lock=false; lock=false;
} }
@ -602,80 +623,36 @@ void TelemetryPanel::on_frskyVoltCB_currentIndexChanged(int index)
void TelemetryPanel::on_frskyProtoCB_currentIndexChanged(int index) void TelemetryPanel::on_frskyProtoCB_currentIndexChanged(int index)
{ {
if (lock) return; model.frsky.usrProto = index;
int bindex[12];
lock=true;
for (int i=0; i<12; i++) {
bindex[i]=barsCB[i]->currentIndex();
model.frsky.usrProto=index;
populateCustomScreenFieldCB(barsCB[i], bindex[i], false, model.frsky.usrProto);
}
if (!GetEepromInterface()->getCapability(TelemetryCSFields)) {
ui->groupBox_5->hide();
} else {
for (int screen=0; screen<2;screen++) {
for (int rows=0; rows<4; rows++) {
for (int cols=0; cols<3; cols++) {
int index=screen*12+cols*4+rows;
populateCustomScreenFieldCB(csf[index], model.frsky.screens[screen].body.lines[rows].source[cols], (rows<4), model.frsky.usrProto);
}
}
}
}
lock=false;
if (index==0) {
for (int i=0; i<12; i++) {
if (bindex[i]>2) {
barsCB[i]->setCurrentIndex(0);
} else {
barsCB[i]->setCurrentIndex(bindex[i]);
}
}
} else if (index==2) {
for (int i=0; i<12; i++) {
if (bindex[i]>3) {
barsCB[i]->setCurrentIndex(0);
} else {
barsCB[i]->setCurrentIndex(bindex[i]);
}
}
} else {
for (int i=0; i<12; i++) {
barsCB[i]->setCurrentIndex(bindex[i]);
}
}
emit modified(); emit modified();
} }
void TelemetryPanel::on_rssiAlarm1CB_currentIndexChanged(int index) { void TelemetryPanel::on_rssiAlarm1CB_currentIndexChanged(int index)
if (lock) return; {
model.frsky.rssiAlarms[0].level=index; model.frsky.rssiAlarms[0].level = index;
emit modified(); emit modified();
} }
void TelemetryPanel::on_rssiAlarm2CB_currentIndexChanged(int index) { void TelemetryPanel::on_rssiAlarm2CB_currentIndexChanged(int index)
if (lock) return; {
model.frsky.rssiAlarms[1].level=index; model.frsky.rssiAlarms[1].level = index;
emit modified(); emit modified();
} }
void TelemetryPanel::on_rssiAlarm1SB_editingFinished() void TelemetryPanel::on_rssiAlarm1SB_editingFinished()
{ {
if (lock) return; model.frsky.rssiAlarms[0].value = ui->rssiAlarm1SB->value();
model.frsky.rssiAlarms[0].value=(ui->rssiAlarm1SB->value());
emit modified(); emit modified();
} }
void TelemetryPanel::on_rssiAlarm2SB_editingFinished() void TelemetryPanel::on_rssiAlarm2SB_editingFinished()
{ {
if (lock) return; model.frsky.rssiAlarms[1].value = ui->rssiAlarm2SB->value();
model.frsky.rssiAlarms[1].value=(ui->rssiAlarm2SB->value());
emit modified(); emit modified();
} }
void TelemetryPanel::on_AltitudeGPS_ChkB_toggled(bool checked) void TelemetryPanel::on_AltitudeGPS_ChkB_toggled(bool checked)
{ {
if (lock) return;
model.frsky.FrSkyGpsAlt = checked; model.frsky.FrSkyGpsAlt = checked;
emit modified(); emit modified();
} }
@ -688,64 +665,65 @@ void TelemetryPanel::on_AltitudeToolbar_ChkB_toggled(bool checked)
void TelemetryPanel::on_varioSourceCB_currentIndexChanged(int index) void TelemetryPanel::on_varioSourceCB_currentIndexChanged(int index)
{ {
if (lock) return;
model.frsky.varioSource = index; model.frsky.varioSource = index;
emit modified(); emit modified();
} }
void TelemetryPanel::on_varioLimitMin_DSB_editingFinished() void TelemetryPanel::on_varioLimitMin_DSB_editingFinished()
{ {
if (lock) return; model.frsky.varioMin = round(ui->varioLimitMin_DSB->value()+10);
model.frsky.varioMin= round(ui->varioLimitMin_DSB->value()+10);
emit modified(); emit modified();
} }
void TelemetryPanel::on_varioLimitMax_DSB_editingFinished() void TelemetryPanel::on_varioLimitMax_DSB_editingFinished()
{ {
if (lock) return; model.frsky.varioMax = round(ui->varioLimitMax_DSB->value()-10);
model.frsky.varioMax= round(ui->varioLimitMax_DSB->value()-10);
emit modified(); emit modified();
} }
void TelemetryPanel::on_varioLimitCenterMin_DSB_editingFinished() void TelemetryPanel::on_varioLimitCenterMin_DSB_editingFinished()
{ {
if (lock) return; if (!lock) {
if (ui->varioLimitCenterMin_DSB->value()>ui->varioLimitCenterMax_DSB->value()) { if (ui->varioLimitCenterMin_DSB->value()>ui->varioLimitCenterMax_DSB->value()) {
ui->varioLimitCenterMax_DSB->setValue(ui->varioLimitCenterMin_DSB->value()); ui->varioLimitCenterMax_DSB->setValue(ui->varioLimitCenterMin_DSB->value());
} }
model.frsky.varioCenterMin= round((ui->varioLimitCenterMin_DSB->value()+0.5)*10); model.frsky.varioCenterMin = round((ui->varioLimitCenterMin_DSB->value()+0.5)*10);
emit modified(); emit modified();
}
} }
void TelemetryPanel::on_varioLimitMinOff_ChkB_toggled(bool checked) void TelemetryPanel::on_varioLimitMinOff_ChkB_toggled(bool checked)
{ {
if (lock) return; if (!lock) {
model.frsky.varioCenterMin = -16; model.frsky.varioCenterMin = -16;
if (!checked) { if (!checked) {
lock=true; lock=true;
ui->varioLimitCenterMin_DSB->setValue(-2.0); ui->varioLimitCenterMin_DSB->setValue(-2.0);
ui->varioLimitCenterMin_DSB->setEnabled(true); ui->varioLimitCenterMin_DSB->setEnabled(true);
lock=false; lock=false;
} else { }
else {
ui->varioLimitCenterMin_DSB->setValue(-2.0); ui->varioLimitCenterMin_DSB->setValue(-2.0);
ui->varioLimitCenterMin_DSB->setDisabled(true); ui->varioLimitCenterMin_DSB->setDisabled(true);
} }
emit modified(); emit modified();
}
} }
void TelemetryPanel::on_varioLimitCenterMax_DSB_editingFinished() void TelemetryPanel::on_varioLimitCenterMax_DSB_editingFinished()
{ {
if (lock) return; if (!lock) {
if (ui->varioLimitCenterMin_DSB->value()>ui->varioLimitCenterMax_DSB->value()) { if (ui->varioLimitCenterMin_DSB->value()>ui->varioLimitCenterMax_DSB->value()) {
ui->varioLimitCenterMax_DSB->setValue(ui->varioLimitCenterMin_DSB->value()); ui->varioLimitCenterMax_DSB->setValue(ui->varioLimitCenterMin_DSB->value());
} }
model.frsky.varioCenterMax= round((ui->varioLimitCenterMax_DSB->value()-0.5)*10); model.frsky.varioCenterMax = round((ui->varioLimitCenterMax_DSB->value()-0.5)*10);
emit modified(); emit modified();
}
} }
void TelemetryPanel::on_fasOffset_DSB_editingFinished() void TelemetryPanel::on_fasOffset_DSB_editingFinished()
{ {
model.frsky.fasOffset = ui->fasOffset_DSB->value()*10; model.frsky.fasOffset = ui->fasOffset_DSB->value() * 10;
emit modified(); emit modified();
} }
@ -761,226 +739,3 @@ void TelemetryPanel::on_mahCount_ChkB_toggled(bool checked)
ui->mahCount_SB->setDisabled(!checked); ui->mahCount_SB->setDisabled(!checked);
emit modified(); emit modified();
} }
void TelemetryPanel::telBarUpdate()
{
int index;
lock=true;
for (int i=0; i<12; i++) {
int screen=i/4;
index=barsCB[i]->currentIndex();
if (index==TELEMETRY_SOURCE_A1 || index==TELEMETRY_SOURCE_A1 || index==TELEMETRY_SOURCE_A1_MIN || index==TELEMETRY_SOURCE_A2_MIN) {
minSB[i]->setMinimum(getBarValue(index, 0, &model.frsky));
minSB[i]->setMaximum(getBarValue(index, 255, &model.frsky));
minSB[i]->setSingleStep(getBarStep(index));
maxSB[i]->setMinimum(getBarValue(index, 0, &model.frsky));
maxSB[i]->setMaximum(getBarValue(index, 255, &model.frsky));
maxSB[i]->setSingleStep(getBarStep(index));
minSB[i]->setValue(getBarValue(index, model.frsky.screens[screen].body.bars[i%4].barMin, &model.frsky));
maxSB[i]->setValue(getBarValue(index, 255-model.frsky.screens[screen].body.bars[i%4].barMax, &model.frsky));
}
}
lock=false;
}
void TelemetryPanel::ScreenTypeCBcurrentIndexChanged(int index)
{
if (lock) return;
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
int screen = comboBox->objectName().right(1).toInt() -1;
lock=true;
model.frsky.screens[screen].type=index;
for (int i=0; i<3; i++) {
bool isNum = (model.frsky.screens[i].type==0);
barsGB[i]->setVisible(!isNum);
numsGB[i]->setVisible(isNum);
}
lock=false;
emit modified();
}
void TelemetryPanel::telBarCBcurrentIndexChanged(int index)
{
if (lock) return;
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
int screenId = comboBox->objectName().mid(8,1).toInt() - 1;
int barId = comboBox->objectName().mid(10,1).toInt() - 1;
int bar=barId+screenId*4;
model.frsky.screens[screenId].body.bars[barId].source=index;
lock=true;
if (index==0) {
model.frsky.screens[screenId].body.bars[barId].barMin=0;
model.frsky.screens[screenId].body.bars[barId].barMax=0;
minSB[bar]->setDisabled(true);
maxSB[bar]->setDisabled(true);
} else {
minSB[bar]->setEnabled(true);
maxSB[bar]->setEnabled(true);
}
switch (index-1) {
case TELEMETRY_SOURCE_TX_BATT:
case TELEMETRY_SOURCE_A1:
case TELEMETRY_SOURCE_A1_MIN:
case TELEMETRY_SOURCE_A2:
case TELEMETRY_SOURCE_A2_MIN:
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_VFAS:
case TELEMETRY_SOURCE_CURRENT_MAX:
case TELEMETRY_SOURCE_CURRENT:
minSB[bar]->setDecimals(1);
maxSB[bar]->setDecimals(1);
break;
case TELEMETRY_SOURCE_CELL:
minSB[bar]->setDecimals(2);
maxSB[bar]->setDecimals(2);
break;
default:
minSB[bar]->setDecimals(0);
maxSB[bar]->setDecimals(0);
}
minSB[bar]->setMinimum(getBarValue(index, 0, &model.frsky));
minSB[bar]->setMaximum(getBarValue(index, 255, &model.frsky));
minSB[bar]->setSingleStep(getBarStep(index));
maxSB[bar]->setMinimum(getBarValue(index, 0, &model.frsky));
maxSB[bar]->setMaximum(getBarValue(index, 255, &model.frsky));
maxSB[bar]->setSingleStep(getBarStep(index));
minSB[bar]->setValue(getBarValue(index, model.frsky.screens[screenId].body.bars[barId].barMin, &model.frsky));
maxSB[bar]->setValue(getBarValue(index, 255-model.frsky.screens[screenId].body.bars[barId].barMax, &model.frsky));
lock=false;
emit modified();
}
void TelemetryPanel::telMinSBeditingFinished()
{
if (lock) return;
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
int screenId = spinBox->objectName().mid(8,1).toInt() - 1;
int barId = spinBox->objectName().right(1).toInt() - 1;
int minId = barId+screenId*4;
lock=true;
if (model.frsky.screens[screenId].body.bars[barId].source==TELEMETRY_SOURCE_A1 || model.frsky.screens[screenId].body.bars[barId].source==TELEMETRY_SOURCE_A1_MIN) {
model.frsky.screens[screenId].body.bars[barId].barMin=round((minSB[minId]->value()-analogs[0]->ui->CalibSB->value())/getBarStep(model.frsky.screens[screenId].body.bars[barId].source));
} else if (model.frsky.screens[screenId].body.bars[minId].source==TELEMETRY_SOURCE_A2 || model.frsky.screens[screenId].body.bars[minId].source==TELEMETRY_SOURCE_A2_MIN) {
model.frsky.screens[screenId].body.bars[barId].barMin=round((minSB[minId]->value()-analogs[1]->ui->CalibSB->value())/getBarStep(model.frsky.screens[screenId].body.bars[barId].source));
} else {
model.frsky.screens[screenId].body.bars[barId].barMin=round((minSB[minId]->value()-getBarValue(model.frsky.screens[screenId].body.bars[barId].source, 0, &model.frsky))/getBarStep(model.frsky.screens[screenId].body.bars[barId].source));
}
spinBox->setValue(getBarValue(model.frsky.screens[screenId].body.bars[barId].source, model.frsky.screens[screenId].body.bars[barId].barMin, &model.frsky));
if (maxSB[minId]->value()<minSB[minId]->value()) {
model.frsky.screens[screenId].body.bars[minId].barMax=(255-model.frsky.screens[screenId].body.bars[barId].barMin+1);
maxSB[minId]->setValue(getBarValue(model.frsky.screens[screenId].body.bars[barId].source, 255-model.frsky.screens[screenId].body.bars[barId].barMax, &model.frsky));
}
maxSB[minId]->setMinimum(getBarValue(model.frsky.screens[screenId].body.bars[barId].source, (model.frsky.screens[screenId].body.bars[barId].barMin+1), &model.frsky));
lock=false;
emit modified();
}
void TelemetryPanel::telMaxSBeditingFinished()
{
if (lock) return;
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
int screenId = spinBox->objectName().mid(8,1).toInt() - 1;
int barId = spinBox->objectName().right(1).toInt() - 1;
lock=true;
if (model.frsky.screens[screenId].body.bars[barId].source==5) {
model.frsky.screens[screenId].body.bars[barId].barMax = (255-round((spinBox->value()-analogs[0]->ui->CalibSB->value())/getBarStep(model.frsky.screens[screenId].body.bars[barId].source)));
} else if (model.frsky.screens[screenId].body.bars[barId].source==6) {
model.frsky.screens[screenId].body.bars[barId].barMax = (255-round((spinBox->value()-analogs[1]->ui->CalibSB->value())/getBarStep(model.frsky.screens[screenId].body.bars[barId].source)));
} else {
model.frsky.screens[screenId].body.bars[barId].barMax = (255-round((spinBox->value()-getBarValue(model.frsky.screens[screenId].body.bars[barId].source, 0, &model.frsky))/getBarStep(model.frsky.screens[screenId].body.bars[barId].source) ));
}
spinBox->setValue(getBarValue(model.frsky.screens[screenId].body.bars[barId].source, (255-model.frsky.screens[screenId].body.bars[barId].barMax), &model.frsky));
lock=false;
emit modified();
}
void TelemetryPanel::customFieldEdited()
{
if (!lock) {
lock = true;
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2;
for (int i=0; i<GetEepromInterface()->getCapability(TelemetryCSFields); i++) {
int screen=i/(4*cols);
int r=((i%(4*cols))%4);
int c=((i%(4*cols))/4);
if (model.frsky.screens[screen].type==0) {
model.frsky.screens[screen].body.lines[r].source[c]=csf[i]->currentIndex();
}
}
emit modified();
lock = false;
}
}
float TelemetryPanel::getBarStep(int barId)
{
switch (barId-1) {
case TELEMETRY_SOURCE_TX_BATT:
return 0.1;
break;
case TELEMETRY_SOURCE_TIMER1:
case TELEMETRY_SOURCE_TIMER2:
return 3;
break;
case TELEMETRY_SOURCE_A1:
case TELEMETRY_SOURCE_A1_MIN:
return (analogs[0]->ui->RatioSB->value()/255);
break;
case TELEMETRY_SOURCE_A2:
case TELEMETRY_SOURCE_A2_MIN:
return (analogs[1]->ui->RatioSB->value()/255);
break;
case TELEMETRY_SOURCE_ALT:
case TELEMETRY_SOURCE_GPS_ALT:
case TELEMETRY_SOURCE_ALT_MAX:
case TELEMETRY_SOURCE_ALT_MIN:
return 8;
break;
case TELEMETRY_SOURCE_RPM:
case TELEMETRY_SOURCE_RPM_MAX:
return 50;
break;
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_VFAS:
return 0.1;
break;
case TELEMETRY_SOURCE_CELL:
return 0.02;
break;
case TELEMETRY_SOURCE_HDG:
return 2;
break;
case TELEMETRY_SOURCE_DIST:
case TELEMETRY_SOURCE_DIST_MAX:
return 8;
break;
case TELEMETRY_SOURCE_CURRENT_MAX:
case TELEMETRY_SOURCE_CURRENT:
return 0.5;
break;
case TELEMETRY_SOURCE_POWER:
return 5;
break;
case TELEMETRY_SOURCE_CONSUMPTION:
return 20;
break;
case TELEMETRY_SOURCE_SPEED:
case TELEMETRY_SOURCE_SPEED_MAX:
if (model.frsky.imperial==1) {
return 1;
} else {
return 1.852;
}
break;
default:
return 1;
break;
}
}

View file

@ -8,6 +8,7 @@
namespace Ui { namespace Ui {
class TelemetryAnalog; class TelemetryAnalog;
class TelemetryCustomScreen;
class Telemetry; class Telemetry;
} }
@ -44,6 +45,32 @@ class TelemetryAnalog : public QWidget
void update(); void update();
}; };
class TelemetryCustomScreen : public ModelPanel
{
Q_OBJECT
public:
TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen);
~TelemetryCustomScreen();
void update();
private slots:
void on_screenType_currentIndexChanged(int index);
void customFieldChanged(int index);
void barSourceChanged(int index);
void barMinChanged(double value);
void barMaxChanged(double value);
private:
void updateBar(int line);
Ui::TelemetryCustomScreen * ui;
FrSkyScreenData & screen;
QComboBox * fieldsCB[4][3];
QComboBox * barsCB[4];
QDoubleSpinBox * minSB[4];
QDoubleSpinBox * maxSB[4];
};
class TelemetryPanel : public ModelPanel class TelemetryPanel : public ModelPanel
{ {
Q_OBJECT Q_OBJECT
@ -77,24 +104,12 @@ class TelemetryPanel : public ModelPanel
void on_fasOffset_DSB_editingFinished(); void on_fasOffset_DSB_editingFinished();
void on_mahCount_SB_editingFinished(); void on_mahCount_SB_editingFinished();
void on_mahCount_ChkB_toggled(bool checked); void on_mahCount_ChkB_toggled(bool checked);
void telBarCBcurrentIndexChanged(int index);
void ScreenTypeCBcurrentIndexChanged(int index);
void telMaxSBeditingFinished();
void telMinSBeditingFinished();
void customFieldEdited();
private: private:
Ui::Telemetry *ui; Ui::Telemetry *ui;
TelemetryAnalog * analogs[2]; TelemetryAnalog * analogs[2];
QGroupBox* barsGB[3];
QGroupBox* numsGB[3];
QComboBox* barsCB[12];
QDoubleSpinBox* minSB[12];
QDoubleSpinBox* maxSB[12];
QComboBox* csf[36];
void setup(); void setup();
float getBarStep(int barId);
void telBarUpdate(); void telBarUpdate();
}; };

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TelemetryCustomScreen</class>
<widget class="QWidget" name="TelemetryCustomScreen">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>650</width>
<height>393</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,0,1">
<item>
<widget class="QLabel" name="screenTypeLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Custom Screen Type</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="screenType">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<item>
<property name="text">
<string>Nums</string>
</property>
</item>
<item>
<property name="text">
<string>Bars</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_16">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QGroupBox" name="screenNums">
<layout class="QGridLayout" name="screenNumsLayout"/>
</widget>
</item>
<item>
<widget class="QGroupBox" name="screenBars">
<layout class="QGridLayout" name="screenBarsLayout" columnstretch="1,0,1,0">
<item row="0" column="1">
<widget class="QLabel" name="label_266">
<property name="text">
<string>Min</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_265">
<property name="text">
<string>Source</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_267">
<property name="text">
<string>Gauge</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_268">
<property name="text">
<string>Max</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -796,7 +796,7 @@ void printDialog::printFrSky()
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("System of units")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyMeasure(fd->imperial)+"</td></tr>"); str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("System of units")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyMeasure(fd->imperial)+"</td></tr>");
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Propeller blades")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyBlades(fd->blades)+"</td></tr>"); str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Propeller blades")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyBlades(fd->blades)+"</td></tr>");
str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr></table>"); str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr></table>");
#if 0
if (GetEepromInterface()->getCapability(TelemetryBars) || (GetEepromInterface()->getCapability(TelemetryCSFields))) { if (GetEepromInterface()->getCapability(TelemetryBars) || (GetEepromInterface()->getCapability(TelemetryCSFields))) {
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields); int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2; if (cols==0) cols=2;
@ -834,12 +834,13 @@ void printDialog::printFrSky()
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
if (fd->screens[j].body.bars[i].source!=0) if (fd->screens[j].body.bars[i].source!=0)
tc++; tc++;
str.append("<tr><td align=\"Center\"><b>"+QString::number(i+1,10)+"</b></td><td align=\"Center\"><b>"+getFrSkySrc(fd->screens[j].body.bars[i].source)+"</b></td><td align=\"Right\"><b>"+(fd->screens[j].body.bars[i].source>0 ? QString::number(getBarValue(fd->screens[j].body.bars[i].source, fd->screens[j].body.bars[i].barMin,fd)):"----")+"</b></td><td align=\"Right\"><b>"+(fd->screens[j].body.bars[i].source>0 ? QString::number(getBarValue(fd->screens[j].body.bars[i].source,(255-fd->screens[j].body.bars[i].barMax),fd)) :"----")+"</b></td></tr>"); // TODO str.append("<tr><td align=\"Center\"><b>"+QString::number(i+1,10)+"</b></td><td align=\"Center\"><b>"+getFrSkySrc(fd->screens[j].body.bars[i].source)+"</b></td><td align=\"Right\"><b>"+(fd->screens[j].body.bars[i].source>0 ? QString::number(getBarValue(fd->screens[j].body.bars[i].source, fd->screens[j].body.bars[i].barMin,fd)):"----")+"</b></td><td align=\"Right\"><b>"+(fd->screens[j].body.bars[i].source>0 ? QString::number(getBarValue(fd->screens[j].body.bars[i].source,(255-fd->screens[j].body.bars[i].barMax),fd)) :"----")+"</b></td></tr>");
} }
str.append("</table>"); str.append("</table>");
} }
} }
} }
#endif
if (tc>0) if (tc>0)
te->append(str); te->append(str);
} }

View file

@ -1110,50 +1110,42 @@ taranis-stamp:
translations/cz.h: translations/cz.h.txt translations/cz.h: translations/cz.h.txt
@echo @echo
@echo "Create language specific header files" @echo "Create Czech language specific header files"
@echo "Czech"
$(TRANSLATE) translations/cz.h.txt translations/cz.h cz $(TRANSLATE) translations/cz.h.txt translations/cz.h cz
translations/de.h: translations/de.h.txt translations/de.h: translations/de.h.txt
@echo @echo
@echo "Create language specific header files" @echo "Create German language specific header files"
@echo "German"
$(TRANSLATE) translations/de.h.txt translations/de.h de $(TRANSLATE) translations/de.h.txt translations/de.h de
translations/es.h: translations/es.h.txt translations/es.h: translations/es.h.txt
@echo @echo
@echo "Create language specific header files" @echo "Create Spanish language specific header files"
@echo "Spanish"
$(TRANSLATE) translations/es.h.txt translations/es.h es $(TRANSLATE) translations/es.h.txt translations/es.h es
translations/fr.h: translations/fr.h.txt translations/fr.h: translations/fr.h.txt
@echo @echo
@echo "Create language specific header files" @echo "Create French language specific header files"
@echo "French"
$(TRANSLATE) translations/fr.h.txt translations/fr.h fr $(TRANSLATE) translations/fr.h.txt translations/fr.h fr
translations/it.h: translations/it.h.txt translations/it.h: translations/it.h.txt
@echo @echo
@echo "Create language specific header files" @echo "Create Italian language specific header files"
@echo "Italian"
$(TRANSLATE) translations/it.h.txt translations/it.h it $(TRANSLATE) translations/it.h.txt translations/it.h it
translations/pl.h: translations/pl.h.txt translations/pl.h: translations/pl.h.txt
@echo @echo
@echo "Create language specific header files" @echo "Create Polish language specific header files"
@echo "Polish"
$(TRANSLATE) translations/pl.h.txt translations/pl.h pl $(TRANSLATE) translations/pl.h.txt translations/pl.h pl
translations/pt.h: translations/pt.h.txt translations/pt.h: translations/pt.h.txt
@echo @echo
@echo "Create language specific header files" @echo "Create Portugese language specific header files"
@echo "Portugese"
$(TRANSLATE) translations/pt.h.txt translations/pt.h pt $(TRANSLATE) translations/pt.h.txt translations/pt.h pt
translations/se.h: translations/se.h.txt translations/se.h: translations/se.h.txt
@echo @echo
@echo "Create language specific header files" @echo "Create Swedish language specific header files"
@echo "Swedish"
$(TRANSLATE) translations/se.h.txt translations/se.h se $(TRANSLATE) translations/se.h.txt translations/se.h se
.PHONY: fonts .PHONY: fonts

View file

@ -5536,18 +5536,14 @@ void menuModelTelemetry(uint8_t event)
lineIndex = k-ITEM_TELEMETRY_SCREEN_LINE5; lineIndex = k-ITEM_TELEMETRY_SCREEN_LINE5;
} }
#if 0
putsStrIdx(0, y, PSTR(INDENT"Line"), lineIndex+1, m_posHorz<0 ? attr : 0);
#endif
#if defined(GAUGES) #if defined(GAUGES)
if (IS_BARS_SCREEN(screenIndex)) { if (IS_BARS_SCREEN(screenIndex)) {
FrSkyBarData & bar = g_model.frsky.screens[screenIndex].bars[lineIndex]; FrSkyBarData & bar = g_model.frsky.screens[screenIndex].bars[lineIndex];
uint8_t barSource = bar.source; uint8_t barSource = bar.source;
lcd_putsiAtt(TELEM_COL1, y, STR_VTELEMCHNS, barSource, m_posHorz==0 ? attr : 0); lcd_putsiAtt(TELEM_COL1, y, STR_VTELEMCHNS, barSource, m_posHorz==0 ? attr : 0);
if (barSource) { if (barSource) {
putsTelemetryChannel(TELEM_BARS_COLMIN, y, barSource-1, convertTelemValue(barSource, bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT); putsTelemetryChannel(TELEM_BARS_COLMIN, y, barSource-1, convertBarTelemValue(barSource, bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
putsTelemetryChannel(TELEM_BARS_COLMAX, y, barSource-1, convertTelemValue(barSource, 255-bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT); putsTelemetryChannel(TELEM_BARS_COLMAX, y, barSource-1, convertBarTelemValue(barSource, 255-bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
} }
else if (attr) { else if (attr) {
MOVE_CURSOR_FROM_HERE(); MOVE_CURSOR_FROM_HERE();
@ -5558,14 +5554,14 @@ void menuModelTelemetry(uint8_t event)
bar.source = checkIncDecModel(event, barSource, 0, TELEM_DISPLAY_MAX); bar.source = checkIncDecModel(event, barSource, 0, TELEM_DISPLAY_MAX);
if (checkIncDec_Ret) { if (checkIncDec_Ret) {
bar.barMin = 0; bar.barMin = 0;
bar.barMax = 255-maxTelemValue(bar.source); bar.barMax = 255 - maxBarTelemValue(bar.source);
} }
break; break;
case 1: case 1:
bar.barMin = checkIncDec(event, bar.barMin, 0, 254-bar.barMax, EE_MODEL|NO_INCDEC_MARKS); bar.barMin = checkIncDec(event, bar.barMin, 0, 254-bar.barMax, EE_MODEL|NO_INCDEC_MARKS);
break; break;
case 2: case 2:
bar.barMax = 255 - checkIncDec(event, 255-bar.barMax, bar.barMin+1, maxTelemValue(barSource), EE_MODEL|NO_INCDEC_MARKS); bar.barMax = 255 - checkIncDec(event, 255-bar.barMax, bar.barMin+1, maxBarTelemValue(barSource), EE_MODEL|NO_INCDEC_MARKS);
break; break;
} }
} }

View file

@ -214,8 +214,8 @@ void menuTelemetryFrsky(uint8_t event)
for (int8_t i=3; i>=0; i--) { for (int8_t i=3; i>=0; i--) {
FrSkyBarData & bar = screen.bars[i]; FrSkyBarData & bar = screen.bars[i];
uint8_t source = bar.source; uint8_t source = bar.source;
getvalue_t barMin = convertTelemValue(source, bar.barMin); getvalue_t barMin = convertBarTelemValue(source, bar.barMin);
getvalue_t barMax = convertTelemValue(source, 255-bar.barMax); getvalue_t barMax = convertBarTelemValue(source, 255-bar.barMax);
if (source && barMax > barMin) { if (source && barMax > barMin) {
uint8_t y = barHeight+6+i*(barHeight+6); uint8_t y = barHeight+6+i*(barHeight+6);
lcd_putsiAtt(0, y+barHeight-5, STR_VTELEMCHNS, source, 0); lcd_putsiAtt(0, y+barHeight-5, STR_VTELEMCHNS, source, 0);
@ -234,7 +234,7 @@ void menuTelemetryFrsky(uint8_t event)
threshold = g_model.frsky.channels[source-TELEM_A1].alarms_value[0]; threshold = g_model.frsky.channels[source-TELEM_A1].alarms_value[0];
#if defined(FRSKY_HUB) #if defined(FRSKY_HUB)
else else
threshold = convertTelemValue(source, barsThresholds[source-TELEM_ALT]); threshold = convertBarTelemValue(source, barsThresholds[source-TELEM_ALT]);
#endif #endif
if (threshold) { if (threshold) {

View file

@ -1900,7 +1900,7 @@ csw_telemetry_value_t maxTelemValue(uint8_t channel)
#endif #endif
#if defined(CPUARM) #if defined(CPUARM)
getvalue_t convertTelemValue(uint8_t channel, csw_telemetry_value_t value) getvalue_t convert16bitsTelemValue(uint8_t channel, csw_telemetry_value_t value)
{ {
getvalue_t result; getvalue_t result;
switch (channel) { switch (channel) {
@ -1913,8 +1913,14 @@ getvalue_t convertTelemValue(uint8_t channel, csw_telemetry_value_t value)
} }
return result; return result;
} }
#else
getvalue_t convertTelemValue(uint8_t channel, csw_telemetry_value_t value) csw_telemetry_value_t max8bitsTelemValue(uint8_t channel)
{
return min<csw_telemetry_value_t>(255, maxTelemValue(channel));
}
#endif
getvalue_t convert8bitsTelemValue(uint8_t channel, csw_telemetry_value_t value)
{ {
getvalue_t result; getvalue_t result;
switch (channel) { switch (channel) {
@ -1924,6 +1930,10 @@ getvalue_t convertTelemValue(uint8_t channel, csw_telemetry_value_t value)
break; break;
#if defined(FRSKY) #if defined(FRSKY)
case TELEM_ALT: case TELEM_ALT:
#if defined(CPUARM)
result = 100 * (value * 8 - 500);
break;
#endif
case TELEM_GPSALT: case TELEM_GPSALT:
case TELEM_MAX_ALT: case TELEM_MAX_ALT:
case TELEM_MIN_ALT: case TELEM_MIN_ALT:
@ -1961,18 +1971,17 @@ getvalue_t convertTelemValue(uint8_t channel, csw_telemetry_value_t value)
} }
return result; return result;
} }
#endif
getvalue_t convertCswTelemValue(CustomSwData * cs) getvalue_t convertCswTelemValue(CustomSwData * cs)
{ {
getvalue_t val; getvalue_t val;
#if defined(CPUARM) #if defined(CPUARM)
val = convertTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, cs->v2); val = convert16bitsTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, cs->v2);
#else #else
if (cswFamily(cs->func)==CS_VOFS) if (cswFamily(cs->func)==CS_VOFS)
val = convertTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2); val = convert8bitsTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2);
else else
val = convertTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2) - convertTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128); val = convert8bitsTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2) - convert8bitsTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128);
#endif #endif
return val; return val;
} }

View file

@ -1637,9 +1637,24 @@ extern uint8_t barsThresholds[THLD_MAX];
#define maxTelemValue(channel) 255 #define maxTelemValue(channel) 255
#endif #endif
getvalue_t convertTelemValue(uint8_t channel, csw_telemetry_value_t value); #if defined(CPUARM)
getvalue_t convert16bitsTelemValue(uint8_t channel, csw_telemetry_value_t value);
csw_telemetry_value_t max8bitsTelemValue(uint8_t channel);
#endif
getvalue_t convert8bitsTelemValue(uint8_t channel, csw_telemetry_value_t value);
getvalue_t convertCswTelemValue(CustomSwData * cs); getvalue_t convertCswTelemValue(CustomSwData * cs);
#if defined(CPUARM)
#define convertTelemValue(channel, value) convert16bitsTelemValue(channel, value)
#define convertBarTelemValue(channel, value) convert8bitsTelemValue(channel, value)
#define maxBarTelemValue(channel) max8bitsTelemValue(channel)
#else
#define convertTelemValue(channel, value) convert8bitsTelemValue(channel, value)
#define convertBarTelemValue(channel, value) convert8bitsTelemValue(channel, value)
#define maxBarTelemValue(channel) maxTelemValue(channel)
#endif
#if defined(FRSKY) || defined(CPUARM) #if defined(FRSKY) || defined(CPUARM)
lcdint_t applyChannelRatio(uint8_t channel, lcdint_t val); lcdint_t applyChannelRatio(uint8_t channel, lcdint_t val);
#endif #endif

View file

@ -490,8 +490,8 @@ const pm_char STR_VIEW_TEXT[] PROGMEM = "View text";
const pm_char STR_CLEAR[] PROGMEM = "Clear"; const pm_char STR_CLEAR[] PROGMEM = "Clear";
const pm_char STR_RESET[] PROGMEM = "Reset"; const pm_char STR_RESET[] PROGMEM = "Reset";
const pm_char STR_COPY_TRIMS_TO_OFFSET[] = "Copy Trims To Offset"; const pm_char STR_COPY_TRIMS_TO_OFFSET[] = "Copy Trims To Offset";
const pm_char STR_TOP_BAR[] PROGMEM = "Top Bar"; const pm_char STR_TOP_BAR[] PROGMEM = TR_TOP_BAR;
const pm_char STR_ALTITUDE[] PROGMEM = INDENT "Altitude"; const pm_char STR_ALTITUDE[] PROGMEM = TR_ALTITUDE;
const pm_char STR_SCALE[] PROGMEM = "Scale"; const pm_char STR_SCALE[] PROGMEM = "Scale";
const pm_char STR_VIEW_CHANNELS[] PROGMEM = "View Channels"; const pm_char STR_VIEW_CHANNELS[] PROGMEM = "View Channels";
const pm_char STR_VIEW_NOTES[] PROGMEM = "View Notes"; const pm_char STR_VIEW_NOTES[] PROGMEM = "View Notes";

View file

@ -234,7 +234,7 @@
#define TR_VFSWRESET TR("Tmr1""Tmr2""All\0" TR_FSW_RESET_TELEM TR_FSW_RESET_ROTENC, "Timer 1\0 ""Timer 2\0 ""All\0 " TR_FSW_RESET_TELEM TR_FSW_RESET_ROTENC) #define TR_VFSWRESET TR("Tmr1""Tmr2""All\0" TR_FSW_RESET_TELEM TR_FSW_RESET_ROTENC, "Timer 1\0 ""Timer 2\0 ""All\0 " TR_FSW_RESET_TELEM TR_FSW_RESET_ROTENC)
#define LEN_FUNCSOUNDS TR("\004", "\006") #define LEN_FUNCSOUNDS TR("\004", "\006")
#define TR_FUNCSOUNDS TR("Bp1\0""Bp2\0""Bp3\0""Wrn1""Wrn2""Chee""Rata""Tick""Sirn""Ring""SciF""Robt""Chrp""Tada""Crck""Alrm", "Beep1 ""Beep2 ""Beep3 ""Warn1 ""Warn2 ""Cheep ""Ratata""Tick ""Siren ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""AlmClk") #define TR_FUNCSOUNDS TR("Bp1\0""Bp2\0""Bp3\0""Ost1""Ost2""Chee""Rata""Tik\0""Syre""Dzwo""SciF""Robt""Chrp""Tada""Crck""Alrm", "Beep1\0""Beep2\0""Beep3\0""Ostrz1""Ostrz1""Cheep\0""Ratata""Tick\0 ""Syrena""Dzwone""SciFi\0""Robot\0""Chirp\0""Tada\0 ""Krytcz""AlmZeg")
#define LEN_VTELEMCHNS "\004" #define LEN_VTELEMCHNS "\004"
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
@ -244,7 +244,7 @@
#define TR_RSSI_0 "Tx\0 " #define TR_RSSI_0 "Tx\0 "
#define TR_RSSI_1 "Rx\0 " #define TR_RSSI_1 "Rx\0 "
#endif #endif
#define TR_VTELEMCHNS "---\0""Bat\0""Tmr1""Tmr2" TR_RSSI_0 TR_RSSI_1 "A1\0 ""A2\0 ""Alt\0""Rpm\0""Pali""T1\0 ""T2\0 ""Spd\0""Dyst""GAlt""Cell""Cels""Vfas""Curr""Cnsp""Powr""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Cur+""Pwr+""Acc\0""Time" #define TR_VTELEMCHNS "---\0""Bat\0""Tmr1""Tmr2" TR_RSSI_0 TR_RSSI_1 "A1\0 ""A2\0 ""Wys\0""Rpm\0""Pali""T1\0 ""T2\0 ""Spd\0""Dyst""GAlt""Cell""Cels""Vfas""Curr""Cnsp""Moc\0""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Wys-""Wys+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Cur+""Moc+""Acc\0""Time"
#if defined(CPUARM) #if defined(CPUARM)
#define LEN_VUNITSSYSTEM TR("\006", "\012") #define LEN_VUNITSSYSTEM TR("\006", "\012")
@ -284,7 +284,7 @@
#if defined(FRSKY_SPORT) #if defined(FRSKY_SPORT)
#define TR_VARIOSRC "Vario""A1\0 ""A2\0" #define TR_VARIOSRC "Vario""A1\0 ""A2\0"
#else #else
#define TR_VARIOSRC "Alti\0""Alti+""Vario""A1\0 ""A2\0" #define TR_VARIOSRC "Wys.\0""Wys.+""Vario""A1\0 ""A2\0"
#endif #endif
#define LEN_VSCREEN "\006" #define LEN_VSCREEN "\006"
@ -295,13 +295,13 @@
#define LEN2_VTEMPLATES 17 #define LEN2_VTEMPLATES 17
#define LEN_VTEMPLATES "\021" #define LEN_VTEMPLATES "\021"
#define TR_VTEMPLATES "Wyczyść miksery\0 ""Prosty. 4kanal\0 ""Przełącznik-T-Cut""V-Tail \0 ""Elevon-Delta\0 ""eCCPM \0 ""Heli Setup \0 ""Test serwa \0 " #define TR_VTEMPLATES "Wyczyść miksery\0 ""Prosty. 4kanal\0 ""Przełącznik-T-Cut""V-Tail \0 ""Elevon-Delta\0 ""eCCPM \0 ""Ustaw. Heli \0 ""Test serwa \0 "
#define LEN_VSWASHTYPE "\004" #define LEN_VSWASHTYPE "\004"
#define TR_VSWASHTYPE "--- ""120 ""120X""140 ""90\0" #define TR_VSWASHTYPE "--- ""120 ""120X""140 ""90\0"
#define LEN_VKEYS "\005" #define LEN_VKEYS "\005"
#define TR_VKEYS TR(" Menu"" Exit""W dół""Wgórę""Wpraw""Wlewo", " Menu"" Exit""W dół""Wgórę""Wpraw""Wlewo") #define TR_VKEYS TR(" Menu""Wyjdź""W dół""Wgórę""Wpraw""Wlewo", " Menu""Wyjdź""W dół""Wgórę""Wpraw""Wlewo")
#define LEN_VRENCODERS "\003" #define LEN_VRENCODERS "\003"
#define TR_VRENCODERS "REa""REb" #define TR_VRENCODERS "REa""REb"
@ -383,7 +383,7 @@
#define TR_ENTER "[MENU]" #define TR_ENTER "[MENU]"
#endif #endif
#define TR_POPUPS TR_ENTER"\010[EXIT]" #define TR_POPUPS TR_ENTER"\010[WYJŚCIE]"
#define OFS_EXIT sizeof(TR_ENTER) #define OFS_EXIT sizeof(TR_ENTER)
#define TR_MENUWHENDONE CENTER "\007"TR_ENTER" > DALEJ" #define TR_MENUWHENDONE CENTER "\007"TR_ENTER" > DALEJ"
@ -396,9 +396,9 @@
#define TR_MODELNAME "Nazwa modelu" #define TR_MODELNAME "Nazwa modelu"
#define TR_PHASENAME "Nazwa" #define TR_PHASENAME "Nazwa"
#define TR_MIXNAME "Nazwa" #define TR_MIXNAME "Nazwa"
#define TR_INPUTNAME "Input Name" #define TR_INPUTNAME "Wpisz Nazw"
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#define TR_EXPONAME "Line Name" #define TR_EXPONAME "Linia Nazw"
#else #else
#define TR_EXPONAME "Nazwa" #define TR_EXPONAME "Nazwa"
#endif #endif
@ -411,21 +411,21 @@
#define TR_TTRIM TR("Trymer gazu", "Trymer gazu") #define TR_TTRIM TR("Trymer gazu", "Trymer gazu")
#define TR_BEEPCTR "(\043)Pikanie środka" #define TR_BEEPCTR "(\043)Pikanie środka"
#define TR_PROTO INDENT"Protokól" #define TR_PROTO INDENT"Protokól"
#define TR_PPMFRAME "PPM frame" #define TR_PPMFRAME "Ramka PPM"
#define TR_MS "ms" #define TR_MS "ms"
#define TR_SWITCH "Przełącznik" #define TR_SWITCH "Przełącznik"
#define TR_TRIMS "Trymery" #define TR_TRIMS "Trymery"
#define TR_FADEIN "Pojawianie" #define TR_FADEIN "Pojawianie"
#define TR_FADEOUT "Zanikanie" #define TR_FADEOUT "Zanikanie"
#define TR_DEFAULT "(Bazowa)" #define TR_DEFAULT "(Bazowa)"
#define TR_CHECKTRIMS "\006Sprawdź \012 Trymery" #define TR_CHECKTRIMS "\006Spr \012 Trymery"
#define OFS_CHECKTRIMS (9*FW) #define OFS_CHECKTRIMS (9*FW)
#define TR_SWASHTYPE "Typ tarczy" #define TR_SWASHTYPE "Typ tarczy"
#define TR_COLLECTIVE "Kolektyw" #define TR_COLLECTIVE "Kolektyw"
#define TR_SWASHRING "Tarcza" #define TR_SWASHRING "Tarcza"
#define TR_ELEDIRECTION "Ster Wysokości" #define TR_ELEDIRECTION "Ster Wysokości"
#define TR_AILDIRECTION "\012Lotki" #define TR_AILDIRECTION "\012Lotki"
#define TR_COLDIRECTION "\012Kolektwy" #define TR_COLDIRECTION "\012Kolektyw"
#define TR_MODE INDENT"Tryb" #define TR_MODE INDENT"Tryb"
#define TR_NOFREEEXPO "Brak wolnych expo!" #define TR_NOFREEEXPO "Brak wolnych expo!"
#define TR_NOFREEMIXER "Brak wolnych mix!" #define TR_NOFREEMIXER "Brak wolnych mix!"
@ -516,7 +516,7 @@
#define TR_MENUTORESET CENTER TR_ENTER" >> Reset" #define TR_MENUTORESET CENTER TR_ENTER" >> Reset"
#define TR_PPM "PPM" #define TR_PPM "PPM"
#define TR_CH "Kn" #define TR_CH "KN"
#define TR_MODEL "MODEL" #define TR_MODEL "MODEL"
#define TR_FP "FL" #define TR_FP "FL"
#define TR_MIX "MIX" #define TR_MIX "MIX"
@ -556,8 +556,8 @@
#define TR_MENUCURVES "KRZYWE" #define TR_MENUCURVES "KRZYWE"
#define TR_MENUCURVE "KRZYWA" #define TR_MENUCURVE "KRZYWA"
#define TR_MENUCUSTOMSWITCH "PRZEŁĄCZNIK LOGICZNY" #define TR_MENUCUSTOMSWITCH "PRZEŁ. LOGICZNY"
#define TR_MENUCUSTOMSWITCHES "Przełączniki logiczne" #define TR_MENUCUSTOMSWITCHES TR("PRZEŁ. LOG.", "PRZEŁ. LOGICZNE")
#define TR_MENUCUSTOMFUNC "FUNKCJE SPECJALNE" #define TR_MENUCUSTOMFUNC "FUNKCJE SPECJALNE"
#define TR_MENUTELEMETRY "TELEMETRIA" #define TR_MENUTELEMETRY "TELEMETRIA"
#define TR_MENUTEMPLATES "SZABLONY" #define TR_MENUTEMPLATES "SZABLONY"
@ -635,7 +635,7 @@
#define TR_GLOBAL_VARS "Zmienne globalne" #define TR_GLOBAL_VARS "Zmienne globalne"
#define TR_GLOBAL_VAR "Zmienna globalna" #define TR_GLOBAL_VAR "Zmienna globalna"
#define TR_MENUGLOBALVARS "ZMIENNE GLOBALNE" #define TR_MENUGLOBALVARS "ZMIENNE GLOBALNE"
#define TR_OWN " Własność " #define TR_OWN "Własność"
#define TR_DATE "Data" #define TR_DATE "Data"
#define TR_ROTARY_ENCODER "R.Encs" #define TR_ROTARY_ENCODER "R.Encs"
#define TR_CHANNELS_MONITOR "MONITOR KANAŁÓW" #define TR_CHANNELS_MONITOR "MONITOR KANAŁÓW"
@ -666,28 +666,28 @@
#define TR_BUZZER INDENT"Brzęczyk" #define TR_BUZZER INDENT"Brzęczyk"
#define TR_BYTES "[B]" #define TR_BYTES "[B]"
#define TR_MODULE_BIND "[Bind]" #define TR_MODULE_BIND "[Bind]"
#define TR_MODULE_RANGE "[Zasieg]" #define TR_MODULE_RANGE "Zasięg"
#define TR_RESET_BTN "[Reset]" #define TR_RESET_BTN "[Reset]"
#define TR_SET "[Ustaw]" #define TR_SET "[Ustaw]"
#define TR_TRAINER "Trener" #define TR_TRAINER "Trener"
#define TR_ANTENNAPROBLEM CENTER "Problem z anteną TX" #define TR_ANTENNAPROBLEM CENTER "Problem z anteną TX"
#define TR_MODELIDUSED TR("ID już użyte","ID modelu już użyte") #define TR_MODELIDUSED TR("ID zajęte","ID modelu zajęte")
#define TR_MODULE INDENT "Moduł" #define TR_MODULE INDENT "Moduł"
#define TR_CHANNELRANGE INDENT "Zakres kanału" #define TR_CHANNELRANGE INDENT "Zakres kanału"
#define TR_LOWALARM INDENT "Alarm niski" #define TR_LOWALARM INDENT "Alarm niski"
#define TR_CRITICALALARM INDENT "Alarm krytyczny" #define TR_CRITICALALARM INDENT "Alarm krytyczny"
#define TR_PERSISTENT_MAH INDENT "Store mAh" #define TR_PERSISTENT_MAH INDENT "Zapisz mAh"
#define TR_FAS_OFFSET TR(INDENT "FAS Ofs", INDENT "FAS Offset") #define TR_FAS_OFFSET TR(INDENT "FAS Ofs", INDENT "FAS Offset")
#define TR_UART3MODE "Serial port" #define TR_UART3MODE "Port szreg."
#if defined(MAVLINK) #if defined(MAVLINK)
#define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI"
#define TR_MAVLINK_PC_RSSI_EN_LABEL "PC RSSI EN" #define TR_MAVLINK_PC_RSSI_EN_LABEL "PC RSSI EN"
#define TR_MAVMENUSETUP_TITLE "Mavlink Setup" #define TR_MAVMENUSETUP_TITLE "Mavlink Setup"
#define TR_MAVLINK_BAUD_LABEL "Baudrate" #define TR_MAVLINK_BAUD_LABEL "Baudrate"
#define TR_MAVLINK_INFOS "INFOS" #define TR_MAVLINK_INFOS "INFO"
#define TR_MAVLINK_MODE "MODE" #define TR_MAVLINK_MODE "TRYB"
#define TR_MAVLINK_CUR_MODE "Current Mode" #define TR_MAVLINK_CUR_MODE "Aktualy Tryb"
#define TR_MAVLINK_ARMED "Armed" #define TR_MAVLINK_ARMED "Armed"
#define TR_MAVLINK_BAT_MENU_TITLE "BAT RSSI" #define TR_MAVLINK_BAT_MENU_TITLE "BAT RSSI"
#define TR_MAVLINK_BATTERY_LABEL "Status baterii " #define TR_MAVLINK_BATTERY_LABEL "Status baterii "
@ -702,8 +702,8 @@
#define TR_MAVLINK_NO_FIX "NO Fix" #define TR_MAVLINK_NO_FIX "NO Fix"
#define TR_MAVLINK_SAT "SAT" #define TR_MAVLINK_SAT "SAT"
#define TR_MAVLINK_HDOP "HDOP" #define TR_MAVLINK_HDOP "HDOP"
#define TR_MAVLINK_LAT "LAT" #define TR_MAVLINK_LAT "SZER"
#define TR_MAVLINK_LON "LON" #define TR_MAVLINK_LON "DLUG"
#endif #endif
// Taranis column headers // Taranis column headers
@ -721,8 +721,8 @@
#define TR_ABOUT_OPENTX_5 TR("is welcome!", "donations is welcome!") #define TR_ABOUT_OPENTX_5 TR("is welcome!", "donations is welcome!")
#define TR_ABOUT_BERTRAND_1 "Bertrand Songis" #define TR_ABOUT_BERTRAND_1 "Bertrand Songis"
#define TR_ABOUT_BERTRAND_2 "OpenTX main author" #define TR_ABOUT_BERTRAND_2 "OpenTX główny autor"
#define TR_ABOUT_BERTRAND_3 "Companion9x co-author" #define TR_ABOUT_BERTRAND_3 "Companion9x współ-autor"
#define TR_ABOUT_MIKE_1 "Mike Blandford" #define TR_ABOUT_MIKE_1 "Mike Blandford"
#define TR_ABOUT_MIKE_2 "Guru kodu i driwerów" #define TR_ABOUT_MIKE_2 "Guru kodu i driwerów"
@ -730,12 +730,12 @@
#define TR_ABOUT_MIKE_4 "Inspirational" #define TR_ABOUT_MIKE_4 "Inspirational"
#define TR_ABOUT_ROMOLO_1 "Romolo Manfredini" #define TR_ABOUT_ROMOLO_1 "Romolo Manfredini"
#define TR_ABOUT_ROMOLO_2 "Companion9x co-author" #define TR_ABOUT_ROMOLO_2 "Companion9x współ-autor"
#define TR_ABOUT_ROMOLO_3 "" #define TR_ABOUT_ROMOLO_3 ""
#define TR_ABOUT_ANDRE_1 "Andre Bernet" #define TR_ABOUT_ANDRE_1 "Andre Bernet"
#define TR_ABOUT_ANDRE_2 "Functionality, usability," #define TR_ABOUT_ANDRE_2 "Funkcjonalność, użytkowość,"
#define TR_ABOUT_ANDRE_3 "debugging, documentation" #define TR_ABOUT_ANDRE_3 "debugging, documentacja"
#define TR_ABOUT_ROB_1 "Rob Thomson" #define TR_ABOUT_ROB_1 "Rob Thomson"
#define TR_ABOUT_ROB_2 "openrcforums webmaster" #define TR_ABOUT_ROB_2 "openrcforums webmaster"