1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 06:15:10 +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
Isaac Sloan
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);
str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd1->rssiAlarms[1].value,10)+"</td>");
str.append("</table>");
#if 0
if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) {
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2;
@ -1300,13 +1301,13 @@ void compareDialog::printFrSky()
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);
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);
value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMin,fd2);
// TODO value1 = getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMin,fd1);
// 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)
color=getColor1(value1,value2);
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);
value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMax,fd2);
// TODO value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMax,fd1);
// 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)
color=getColor1(value1,value2);
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("<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);
str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd2->rssiAlarms[1].value,10)+"</td>");
str.append("</table></br>");
#if 0
if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) {
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2;
@ -1418,13 +1420,13 @@ void compareDialog::printFrSky()
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);
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);
value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMin,fd2);
// TODO value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMin,fd1);
// 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)
color=getColor2(value1,value2);
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);
value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMax,fd2);
// TODO value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMax,fd1);
// 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)
color=getColor2(value1,value2);
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>");
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) {
switch (index) {
case TELEMETRY_SOURCE_A1:
case TELEMETRY_SOURCE_A2:
return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].type==0 ? 2: 0);
case TELEMETRY_SOURCE_CELL:
return 2;
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_VFAS:
case TELEMETRY_SOURCE_CURRENT:
return 1;
default:
return 0;
}
}
return 0;
}
RawSourceRange result;
int board = GetEepromInterface()->getBoard();
if (!singleprec && !IS_TARANIS(board)) {
singleprec = true;
}
double RawSource::getMin(const ModelData & Model)
{
switch (type) {
case SOURCE_TYPE_TELEMETRY:
switch (index) {
/*case TELEMETRY_SOURCE_NONE:
case TELEMETRY_SOURCE_TX_BATT:
result.step = 0.1;
result.decimals = 1;
result.max = 25.5;
break;
case TELEMETRY_SOURCE_TIMER1:
case TELEMETRY_SOURCE_TIMER2:
return 0; */
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;
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_TIMER2:
return 765;
result.step = singleprec ? 3 : 1;
result.max = singleprec ? 765 : 7200;
break;
case TELEMETRY_SOURCE_RSSI_TX:
case TELEMETRY_SOURCE_RSSI_RX:
return 100;
result.max = 100;
break;
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-(Model.frsky.channels[index-TELEMETRY_SOURCE_A1].offset*Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio)/255.0)/10;
} else {
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 (model) {
FrSkyChannelData channel = model->frsky.channels[index-TELEMETRY_SOURCE_A1]; // TODO const &
float ratio = channel.getRatio();
if (channel.type==0 || channel.type==1 || channel.type==2)
result.decimals = 2;
else
result.decimals = 0;
result.step = ratio / 255;
result.min = channel.offset * result.step;
result.max = ratio + result.min;
}
break;
case TELEMETRY_SOURCE_ALT:
case TELEMETRY_SOURCE_GPS_ALT:
return 1540;
case TELEMETRY_SOURCE_RPM:
return 12750;
case TELEMETRY_SOURCE_FUEL:
return 100;
result.step = singleprec ? 8 : 1;
result.min = -500;
result.max = singleprec ? 1540 : 3000;
break;
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;
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_GPS_ALT:
return 524;
case TELEMETRY_SOURCE_RPM:
return 6400;
case TELEMETRY_SOURCE_FUEL:
return 0;
case TELEMETRY_SOURCE_T1:
case TELEMETRY_SOURCE_T2:
return 98;
case TELEMETRY_SOURCE_SPEED:
return 474;
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;
result.min = -30;
result.max = 225;
break;
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:
return 4;
result.step = singleprec ? 4 : 1;
result.max = singleprec ? 944 : 2000;
if (model && !model->frsky.imperial) {
result.step *= 1.852;
result.max *= 1.852;
}
break;
case TELEMETRY_SOURCE_DIST:
return 8;
result.step = singleprec ? 8 : 1;
result.max = singleprec ? 2040 : 10000;
break;
case TELEMETRY_SOURCE_CELL:
return 0.02;
result.step = singleprec ? 0.02 : 0.01;
result.max = 5.1;
result.decimals = 2;
break;
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_VFAS:
return 0.1;
result.step = 0.1;
result.max = 25.5;
result.decimals = 1;
break;
case TELEMETRY_SOURCE_CURRENT:
return 0.5;
result.step = singleprec ? 0.5 : 0.1;
result.max = singleprec ? 127.5 : 200.0;
result.decimals = 1;
break;
case TELEMETRY_SOURCE_CONSUMPTION:
return 20;
result.step = singleprec ? 20 : 1;
result.max = singleprec ? 5100 : 10000;
break;
case TELEMETRY_SOURCE_POWER:
return 5;
result.step = singleprec ? 5 : 1;
result.max = singleprec ? 1275 : 2000;
break;
default:
return 1;
result.max = 125;
break;
}
if (singleprec) {
result.offset = result.max - (127*result.step);
}
break;
default:
return 1;
default:
result.max = (model && model->extendedLimits ? 125 : 100);
result.min = - result.max;
break;
}
return result;
}
QString AnalogString(int index)

View file

@ -283,6 +283,30 @@ class ModelData;
QString AnalogString(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 {
public:
RawSource():
@ -313,17 +337,16 @@ class RawSource {
QString toString();
int getDecimals(const ModelData & Model);
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);
RawSourceRange getRange(bool singleprec=false);
bool operator== ( const RawSource& other) {
bool operator == ( const RawSource & other) {
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;
int index;
const ModelData * model;
@ -664,7 +687,7 @@ class PhaseData {
unsigned int fadeOut;
int rotaryEncoders[2];
int gvars[C9X_MAX_GVARS];
void clear() { memset(this, 0, sizeof(PhaseData));}
void clear() { memset(this, 0, sizeof(PhaseData)); }
};
class SwashRingData { // Swash Ring data
@ -715,6 +738,14 @@ class FrSkyChannelData {
unsigned int multiplier;
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)); }
};
@ -983,11 +1014,10 @@ enum Capability {
GvarsInCS,
GvarsAreNamed,
GvarsFlightPhases,
GvarsAsSources,
GvarsName,
NoTelemetryProtocol,
TelemetryCSFields,
TelemetryColsCSFields,
TelemetryCustomScreens,
TelemetryCustomScreensFieldsPerLine,
TelemetryRSSIModel,
TelemetryAlarm,
TelemetryInternalAlarm,

View file

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

View file

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

View file

@ -201,7 +201,7 @@ class SourcesConversionTable: public ConversionTable {
if (!(flags & FLAG_NOTELEMETRY)) {
if (release21March2013) {
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++);
}
}

View file

@ -610,24 +610,12 @@ int Open9xInterface::getCapability(const Capability capability)
return TM_HASTELEMETRY|TM_HASOFFSET|TM_HASWSHH;
case TelemetryBars:
return 1;
case TelemetryCSFields:
if (IS_TARANIS(board)) {
return 36;
} else {
return IS_ARM(board) ? 24 : 16;
}
case TelemetryColsCSFields:
if (IS_TARANIS(board)) {
return 3;
} else {
return 2;
}
case TelemetryCustomScreens:
return IS_TARANIS(board) ? 3 : 2;
case TelemetryCustomScreensFieldsPerLine:
return IS_TARANIS(board) ? 3 : 2;
case NoTelemetryProtocol:
if (IS_TARANIS(board)) {
return 1;
} else {
return 0;
}
return IS_TARANIS(board) ? 1 : 0;
case TelemetryUnits:
return 0;
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 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));
break;
case CS_FAMILY_VOFS: {
RawSource source = RawSource(customSw->val1);
RawSource source = RawSource(customSw->val1, &model);
RawSourceRange range = source.getRange();
if (customSw->val1)
result += source.toString();
else
@ -204,7 +206,7 @@ QString getCustomSwitchStr(CustomSwData * customSw, const ModelData & model)
result += " &gt; ";
else if (customSw->func == CS_FN_ANEG || customSw->func == CS_FN_VNEG)
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;
}
case CS_FAMILY_VBOOL:
@ -1300,109 +1302,6 @@ QString getFrSkySrc(int index)
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)
{
switch (g_model->trimInc) {

View file

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

View file

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

View file

@ -146,36 +146,43 @@ void CustomSwitchesPanel::edited()
{
case (CS_FAMILY_VOFS):
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();
RawSource newSource = RawSource(model.customSw[i].val1);
RawSource newSource = RawSource(model.customSw[i].val1, &model);
if (newSource.type == SOURCE_TYPE_TELEMETRY) {
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
model.customSw[i].val2 = 0;
} else {
}
else {
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) {
model.customSw[i].val2 = (cswitchOffset[i]->value()/source.getStep(model));
} else {
model.customSw[i].val2 = ((cswitchOffset[i]->value()-source.getOffset(model))/source.getStep(model))-source.getRawOffset(model);
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
}
else {
model.customSw[i].val2 = (cswitchOffset[i]->value() - range.offset) / range.step/* TODO - source.getRawOffset(model)*/;
}
}
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) {
model.customSw[i].val2 = (cswitchOffset[i]->value()/source.getStep(model));
cswitchOffset[i]->setValue(model.customSw[i].val2*source.getStep(model));
} else {
model.customSw[i].val2 = ((cswitchOffset[i]->value()-source.getOffset(model))/source.getStep(model))-source.getRawOffset(model);
cswitchOffset[i]->setValue((model.customSw[i].val2 +source.getRawOffset(model))*source.getStep(model)+source.getOffset(model));
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
cswitchOffset[i]->setValue(model.customSw[i].val2*range.step);
}
else {
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;
case (CS_FAMILY_TIMERS): {
value=cswitchOffset[i]->value();
value = cswitchOffset[i]->value();
newval=TimToVal(value);
if (newval>model.customSw[i].val2) {
if (value >=60) {
@ -246,7 +253,9 @@ void CustomSwitchesPanel::edited()
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))
{
case CS_FAMILY_VOFS:
@ -255,16 +264,16 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
cswitchValue[i]->setVisible(false);
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));
cswitchOffset[i]->setDecimals(source.getDecimals(model));
cswitchOffset[i]->setSingleStep(source.getStep(model));
cswitchOffset[i]->setDecimals(range.decimals);
cswitchOffset[i]->setSingleStep(range.step);
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
cswitchOffset[i]->setMinimum(source.getStep(model)*-127);
cswitchOffset[i]->setMaximum(source.getStep(model)*127);
cswitchOffset[i]->setValue(source.getStep(model)*model.customSw[i].val2);
cswitchOffset[i]->setMinimum(range.step*-127);
cswitchOffset[i]->setMaximum(range.step*127);
cswitchOffset[i]->setValue(range.step*model.customSw[i].val2);
} else {
cswitchOffset[i]->setMinimum(source.getMin(model));
cswitchOffset[i]->setMaximum(source.getMax(model));
cswitchOffset[i]->setValue(source.getStep(model)*(model.customSw[i].val2+source.getRawOffset(model))+source.getOffset(model));
cswitchOffset[i]->setMinimum(range.min);
cswitchOffset[i]->setMaximum(range.max);
cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
}
break;
case CS_FAMILY_VBOOL:

View file

@ -48,7 +48,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
ui->sideLabel->hide();
ui->sideCB->hide();
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);
}
else {
@ -56,8 +56,6 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
ui->inputName->hide();
ui->sourceLabel->hide();
ui->sourceCB->hide();
ui->scaleLabel->hide();
ui->scaleSB->hide();
ui->trimLabel->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->setText(ed->name);
updateScale();
valuesChanged();
connect(ui->lineName,SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
connect(ui->sourceCB,SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
connect(ui->trimCB,SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
connect(ui->switchesCB,SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
connect(ui->sideCB,SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
connect(ui->lineName, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
connect(ui->sourceCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
connect(ui->scale, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
connect(ui->trimCB, 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++) {
connect(cb_fp[i], SIGNAL(toggled(bool)), this, SLOT(valuesChanged()));
}
@ -103,23 +103,35 @@ ExpoDialog::~ExpoDialog()
delete ui;
}
void ExpoDialog::changeEvent(QEvent *e)
void ExpoDialog::updateScale()
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
if (GetEepromInterface()->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) {
RawSourceRange range = ed->srcRaw.getRange();
ui->scaleLabel->show();
ui->scale->show();
ui->scale->setDecimals(range.decimals);
ui->scale->setMinimum(range.min);
ui->scale->setMaximum(range.max);
ui->scale->setValue(round(range.step * ed->scale));
}
else {
ui->scaleLabel->hide();
ui->scale->hide();
}
}
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 };
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->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
ed->mode = ui->sideCB->currentIndex() + 1;
@ -173,5 +185,5 @@ void ExpoDialog::valuesChanged()
void ExpoDialog::shrink()
{
resize(0,0);
resize(0, 0);
}

View file

@ -18,7 +18,7 @@ class ExpoDialog : public QDialog {
~ExpoDialog();
protected:
void changeEvent(QEvent *e);
void updateScale();
private slots:
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>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="scaleSB">
<widget class="QDoubleSpinBox" name="scale">
<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;
&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>
</layout>
</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>
<include location="../companion.qrc"/>
</resources>

View file

@ -20,7 +20,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, i
else
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);
int limit = GetEepromInterface()->getCapability(OffsetWeight);

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,7 @@
namespace Ui {
class TelemetryAnalog;
class TelemetryCustomScreen;
class Telemetry;
}
@ -44,6 +45,32 @@ class TelemetryAnalog : public QWidget
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
{
Q_OBJECT
@ -77,24 +104,12 @@ class TelemetryPanel : public ModelPanel
void on_fasOffset_DSB_editingFinished();
void on_mahCount_SB_editingFinished();
void on_mahCount_ChkB_toggled(bool checked);
void telBarCBcurrentIndexChanged(int index);
void ScreenTypeCBcurrentIndexChanged(int index);
void telMaxSBeditingFinished();
void telMinSBeditingFinished();
void customFieldEdited();
private:
Ui::Telemetry *ui;
TelemetryAnalog * analogs[2];
QGroupBox* barsGB[3];
QGroupBox* numsGB[3];
QComboBox* barsCB[12];
QDoubleSpinBox* minSB[12];
QDoubleSpinBox* maxSB[12];
QComboBox* csf[36];
void setup();
float getBarStep(int barId);
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("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>");
#if 0
if (GetEepromInterface()->getCapability(TelemetryBars) || (GetEepromInterface()->getCapability(TelemetryCSFields))) {
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2;
@ -834,12 +834,13 @@ void printDialog::printFrSky()
for (int i=0; i<4; i++) {
if (fd->screens[j].body.bars[i].source!=0)
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>");
}
}
}
#endif
if (tc>0)
te->append(str);
}

View file

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

View file

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

View file

@ -214,8 +214,8 @@ void menuTelemetryFrsky(uint8_t event)
for (int8_t i=3; i>=0; i--) {
FrSkyBarData & bar = screen.bars[i];
uint8_t source = bar.source;
getvalue_t barMin = convertTelemValue(source, bar.barMin);
getvalue_t barMax = convertTelemValue(source, 255-bar.barMax);
getvalue_t barMin = convertBarTelemValue(source, bar.barMin);
getvalue_t barMax = convertBarTelemValue(source, 255-bar.barMax);
if (source && barMax > barMin) {
uint8_t y = barHeight+6+i*(barHeight+6);
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];
#if defined(FRSKY_HUB)
else
threshold = convertTelemValue(source, barsThresholds[source-TELEM_ALT]);
threshold = convertBarTelemValue(source, barsThresholds[source-TELEM_ALT]);
#endif
if (threshold) {

View file

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

View file

@ -1637,9 +1637,24 @@ extern uint8_t barsThresholds[THLD_MAX];
#define maxTelemValue(channel) 255
#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);
#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)
lcdint_t applyChannelRatio(uint8_t channel, lcdint_t val);
#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_RESET[] PROGMEM = "Reset";
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_ALTITUDE[] PROGMEM = INDENT "Altitude";
const pm_char STR_TOP_BAR[] PROGMEM = TR_TOP_BAR;
const pm_char STR_ALTITUDE[] PROGMEM = TR_ALTITUDE;
const pm_char STR_SCALE[] PROGMEM = "Scale";
const pm_char STR_VIEW_CHANNELS[] PROGMEM = "View Channels";
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 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"
#if defined(PCBTARANIS)
@ -244,7 +244,7 @@
#define TR_RSSI_0 "Tx\0 "
#define TR_RSSI_1 "Rx\0 "
#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)
#define LEN_VUNITSSYSTEM TR("\006", "\012")
@ -284,7 +284,7 @@
#if defined(FRSKY_SPORT)
#define TR_VARIOSRC "Vario""A1\0 ""A2\0"
#else
#define TR_VARIOSRC "Alti\0""Alti+""Vario""A1\0 ""A2\0"
#define TR_VARIOSRC "Wys.\0""Wys.+""Vario""A1\0 ""A2\0"
#endif
#define LEN_VSCREEN "\006"
@ -295,13 +295,13 @@
#define LEN2_VTEMPLATES 17
#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 TR_VSWASHTYPE "--- ""120 ""120X""140 ""90\0"
#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 TR_VRENCODERS "REa""REb"
@ -383,7 +383,7 @@
#define TR_ENTER "[MENU]"
#endif
#define TR_POPUPS TR_ENTER"\010[EXIT]"
#define TR_POPUPS TR_ENTER"\010[WYJŚCIE]"
#define OFS_EXIT sizeof(TR_ENTER)
#define TR_MENUWHENDONE CENTER "\007"TR_ENTER" > DALEJ"
@ -396,9 +396,9 @@
#define TR_MODELNAME "Nazwa modelu"
#define TR_PHASENAME "Nazwa"
#define TR_MIXNAME "Nazwa"
#define TR_INPUTNAME "Input Name"
#define TR_INPUTNAME "Wpisz Nazw"
#if defined(PCBTARANIS)
#define TR_EXPONAME "Line Name"
#define TR_EXPONAME "Linia Nazw"
#else
#define TR_EXPONAME "Nazwa"
#endif
@ -411,21 +411,21 @@
#define TR_TTRIM TR("Trymer gazu", "Trymer gazu")
#define TR_BEEPCTR "(\043)Pikanie środka"
#define TR_PROTO INDENT"Protokól"
#define TR_PPMFRAME "PPM frame"
#define TR_PPMFRAME "Ramka PPM"
#define TR_MS "ms"
#define TR_SWITCH "Przełącznik"
#define TR_TRIMS "Trymery"
#define TR_FADEIN "Pojawianie"
#define TR_FADEOUT "Zanikanie"
#define TR_DEFAULT "(Bazowa)"
#define TR_CHECKTRIMS "\006Sprawdź \012 Trymery"
#define TR_CHECKTRIMS "\006Spr \012 Trymery"
#define OFS_CHECKTRIMS (9*FW)
#define TR_SWASHTYPE "Typ tarczy"
#define TR_COLLECTIVE "Kolektyw"
#define TR_SWASHRING "Tarcza"
#define TR_ELEDIRECTION "Ster Wysokości"
#define TR_AILDIRECTION "\012Lotki"
#define TR_COLDIRECTION "\012Kolektwy"
#define TR_COLDIRECTION "\012Kolektyw"
#define TR_MODE INDENT"Tryb"
#define TR_NOFREEEXPO "Brak wolnych expo!"
#define TR_NOFREEMIXER "Brak wolnych mix!"
@ -516,7 +516,7 @@
#define TR_MENUTORESET CENTER TR_ENTER" >> Reset"
#define TR_PPM "PPM"
#define TR_CH "Kn"
#define TR_CH "KN"
#define TR_MODEL "MODEL"
#define TR_FP "FL"
#define TR_MIX "MIX"
@ -556,8 +556,8 @@
#define TR_MENUCURVES "KRZYWE"
#define TR_MENUCURVE "KRZYWA"
#define TR_MENUCUSTOMSWITCH "PRZEŁĄCZNIK LOGICZNY"
#define TR_MENUCUSTOMSWITCHES "Przełączniki logiczne"
#define TR_MENUCUSTOMSWITCH "PRZEŁ. LOGICZNY"
#define TR_MENUCUSTOMSWITCHES TR("PRZEŁ. LOG.", "PRZEŁ. LOGICZNE")
#define TR_MENUCUSTOMFUNC "FUNKCJE SPECJALNE"
#define TR_MENUTELEMETRY "TELEMETRIA"
#define TR_MENUTEMPLATES "SZABLONY"
@ -635,7 +635,7 @@
#define TR_GLOBAL_VARS "Zmienne globalne"
#define TR_GLOBAL_VAR "Zmienna globalna"
#define TR_MENUGLOBALVARS "ZMIENNE GLOBALNE"
#define TR_OWN " Własność "
#define TR_OWN "Własność"
#define TR_DATE "Data"
#define TR_ROTARY_ENCODER "R.Encs"
#define TR_CHANNELS_MONITOR "MONITOR KANAŁÓW"
@ -666,28 +666,28 @@
#define TR_BUZZER INDENT"Brzęczyk"
#define TR_BYTES "[B]"
#define TR_MODULE_BIND "[Bind]"
#define TR_MODULE_RANGE "[Zasieg]"
#define TR_MODULE_RANGE "Zasięg"
#define TR_RESET_BTN "[Reset]"
#define TR_SET "[Ustaw]"
#define TR_TRAINER "Trener"
#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_CHANNELRANGE INDENT "Zakres kanału"
#define TR_LOWALARM INDENT "Alarm niski"
#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_UART3MODE "Serial port"
#define TR_UART3MODE "Port szreg."
#if defined(MAVLINK)
#define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI"
#define TR_MAVLINK_PC_RSSI_EN_LABEL "PC RSSI EN"
#define TR_MAVMENUSETUP_TITLE "Mavlink Setup"
#define TR_MAVLINK_BAUD_LABEL "Baudrate"
#define TR_MAVLINK_INFOS "INFOS"
#define TR_MAVLINK_MODE "MODE"
#define TR_MAVLINK_CUR_MODE "Current Mode"
#define TR_MAVLINK_INFOS "INFO"
#define TR_MAVLINK_MODE "TRYB"
#define TR_MAVLINK_CUR_MODE "Aktualy Tryb"
#define TR_MAVLINK_ARMED "Armed"
#define TR_MAVLINK_BAT_MENU_TITLE "BAT RSSI"
#define TR_MAVLINK_BATTERY_LABEL "Status baterii "
@ -702,8 +702,8 @@
#define TR_MAVLINK_NO_FIX "NO Fix"
#define TR_MAVLINK_SAT "SAT"
#define TR_MAVLINK_HDOP "HDOP"
#define TR_MAVLINK_LAT "LAT"
#define TR_MAVLINK_LON "LON"
#define TR_MAVLINK_LAT "SZER"
#define TR_MAVLINK_LON "DLUG"
#endif
// Taranis column headers
@ -721,8 +721,8 @@
#define TR_ABOUT_OPENTX_5 TR("is welcome!", "donations is welcome!")
#define TR_ABOUT_BERTRAND_1 "Bertrand Songis"
#define TR_ABOUT_BERTRAND_2 "OpenTX main author"
#define TR_ABOUT_BERTRAND_3 "Companion9x co-author"
#define TR_ABOUT_BERTRAND_2 "OpenTX główny autor"
#define TR_ABOUT_BERTRAND_3 "Companion9x współ-autor"
#define TR_ABOUT_MIKE_1 "Mike Blandford"
#define TR_ABOUT_MIKE_2 "Guru kodu i driwerów"
@ -730,12 +730,12 @@
#define TR_ABOUT_MIKE_4 "Inspirational"
#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_ANDRE_1 "Andre Bernet"
#define TR_ABOUT_ANDRE_2 "Functionality, usability,"
#define TR_ABOUT_ANDRE_3 "debugging, documentation"
#define TR_ABOUT_ANDRE_2 "Funkcjonalność, użytkowość,"
#define TR_ABOUT_ANDRE_3 "debugging, documentacja"
#define TR_ABOUT_ROB_1 "Rob Thomson"
#define TR_ABOUT_ROB_2 "openrcforums webmaster"