");
color=getColor1(g_model1->name,g_model2->name);
str.append(fv(tr("Name"), g_model1->name, color));
- color=getColor1(eepromInterface->getSize(*g_model1),eepromInterface->getSize(*g_model2));
- str.append(""+tr("EEprom Size")+QString(": %1 ").arg(eepromInterface->getSize(*g_model1)).arg(color));
+ color=getColor1(GetEepromInterface()->getSize(*g_model1), GetEepromInterface()->getSize(*g_model2));
+ str.append(""+tr("EEprom Size")+QString(": %1 ").arg(GetEepromInterface()->getSize(*g_model1)).arg(color));
color=getColor1(getTimerStr(g_model1->timers[0]), getTimerStr(g_model2->timers[0]));
str.append(fv(tr("Timer1"), getTimerStr(g_model1->timers[0]), color)); //value, mode, count up/down
color=getColor1(getTimerStr(g_model1->timers[1]), getTimerStr(g_model2->timers[1]));
@@ -270,8 +271,8 @@ void compareDialog::printSetup()
str.append("");
color=getColor2(g_model1->name,g_model2->name);
str.append(fv(tr("Name"), g_model2->name, color));
- color=getColor2(eepromInterface->getSize(*g_model1),eepromInterface->getSize(*g_model2));
- str.append(""+tr("EEprom Size")+QString(": %1 ").arg(eepromInterface->getSize(*g_model2)).arg(color));
+ color=getColor2(GetEepromInterface()->getSize(*g_model1), GetEepromInterface()->getSize(*g_model2));
+ str.append(""+tr("EEprom Size")+QString(": %1 ").arg(GetEepromInterface()->getSize(*g_model2)).arg(color));
color=getColor2(getTimerStr(g_model1->timers[0]), getTimerStr(g_model2->timers[0]));
str.append(fv(tr("Timer1"), getTimerStr(g_model2->timers[0]),color)); //value, mode, count up/down
color=getColor2(getTimerStr(g_model1->timers[1]), getTimerStr(g_model2->timers[1]));
@@ -293,7 +294,7 @@ void compareDialog::printSetup()
te->append(str);
}
-void compareDialog::printPhases()
+void CompareDialog::printPhases()
{
QString color;
int i,k;
@@ -308,7 +309,7 @@ void compareDialog::printPhases()
str.append(QString("%1 | ").arg(getInputStr(*g_model1, i)));
}
str.append("");
- for (i=0; igetCapability(FlightPhases); i++) {
+ for (i=0; igetCapability(FlightModes); i++) {
PhaseData *pd1=&g_model1->phaseData[i];
PhaseData *pd2=&g_model2->phaseData[i];
str.append("| "+tr("FM")+QString("%1 ").arg(i));
@@ -334,43 +335,44 @@ void compareDialog::printPhases()
str.append(" | ");
int gvars=0;
int gvarnum=0;
- if (GetEepromInterface()->getCapability(HasVariants)) {
+ if (GetCurrentFirmware()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
- } else {
+ }
+ else {
gvars=1;
}
if (gvars==1) {
- gvarnum=GetEepromInterface()->getCapability(Gvars);
+ gvarnum=GetCurrentFirmware()->getCapability(Gvars);
}
- if ((gvars==1 && GetEepromInterface()->getCapability(GvarsFlightPhases)) || GetEepromInterface()->getCapability(RotaryEncoders)) {
+ if ((gvars==1 && GetCurrentFirmware()->getCapability(GvarsFlightModes)) || GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append("
");
str.append("| | ");
- if (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
+ if (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
str.append(QString("").arg(gvarnum)+tr("Gvars")+" | ");
}
- if (GetEepromInterface()->getCapability(RotaryEncoders)) {
- str.append(QString("").arg(GetEepromInterface()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+" | ");
+ if (GetCurrentFirmware()->getCapability(RotaryEncoders)) {
+ str.append(QString("").arg(GetCurrentFirmware()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+" | ");
}
str.append(" | "+tr("Flight mode name")+" | ");
- if (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
+ if (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
for (i=0; iGV%1 %2").arg(i+1).arg(g_model1->gvars_names[i]));
}
}
- for (i=0; igetCapability(RotaryEncoders); i++) {
+ for (i=0; igetCapability(RotaryEncoders); i++) {
str.append(QString("RE%1 | ").arg((i==0 ? 'A': 'B')));
}
str.append(" ");
- for (i=0; igetCapability(FlightPhases); i++) {
+ for (i=0; igetCapability(FlightModes); i++) {
PhaseData *pd1=&g_model1->phaseData[i];
PhaseData *pd2=&g_model2->phaseData[i];
str.append("| "+tr("FM")+QString("%1 ").arg(i));
color=getColor1(pd1->name,pd2->name);
str.append(QString("%1 | ").arg(pd1->name).arg(color));
- if (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
+ if (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
for (k=0; kgvars[k],pd2->gvars[k]);
if (pd1->gvars[k]<=1024) {
@@ -383,7 +385,7 @@ void compareDialog::printPhases()
}
}
}
- for (k=0; kgetCapability(RotaryEncoders); k++) {
+ for (k=0; kgetCapability(RotaryEncoders); k++) {
color=getColor1(pd1->rotaryEncoders[k],pd2->rotaryEncoders[k]);
if (pd1->rotaryEncoders[k]<=1024) {
str.append(QString("%1").arg(pd1->rotaryEncoders[k]).arg(color)+" | ");
@@ -409,7 +411,7 @@ void compareDialog::printPhases()
str.append(QString("%1 | ").arg(getInputStr(*g_model1, i)));
}
str.append(" ");
- for (i=0; igetCapability(FlightPhases); i++) {
+ for (i=0; igetCapability(FlightModes); i++) {
PhaseData *pd1=&g_model1->phaseData[i];
PhaseData *pd2=&g_model2->phaseData[i];
str.append("| "+tr("FM")+QString("%1 ").arg(i));
@@ -434,32 +436,32 @@ void compareDialog::printPhases()
}
str.append(" | ");
- if ((gvars==1 && GetEepromInterface()->getCapability(GvarsFlightPhases)) || GetEepromInterface()->getCapability(RotaryEncoders)) {
+ if ((gvars==1 && GetCurrentFirmware()->getCapability(GvarsFlightModes)) || GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append("
");
str.append("| | ");
- if (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
+ if (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
str.append(QString("").arg(gvarnum)+tr("Gvars")+" | ");
}
- if (GetEepromInterface()->getCapability(RotaryEncoders)) {
- str.append(QString("").arg(GetEepromInterface()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+" | ");
+ if (GetCurrentFirmware()->getCapability(RotaryEncoders)) {
+ str.append(QString("").arg(GetCurrentFirmware()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+" | ");
}
str.append(" | "+tr("Flight mode name")+" | ");
- if (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
+ if (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
for (i=0; iGV%1 %2").arg(i+1).arg(g_model2->gvars_names[i]));
}
}
- for (i=0; igetCapability(RotaryEncoders); i++) {
+ for (i=0; igetCapability(RotaryEncoders); i++) {
str.append(QString("RE%1 | ").arg((i==0 ? 'A': 'B')));
}
str.append(" ");
- for (i=0; igetCapability(FlightPhases); i++) {
+ for (i=0; igetCapability(FlightModes); i++) {
PhaseData *pd1=&g_model1->phaseData[i];
PhaseData *pd2=&g_model2->phaseData[i];
str.append("| "+tr("FM")+QString("%1 ").arg(i));
color=getColor1(pd1->name,pd2->name);
str.append(QString("%1 | ").arg(pd2->name).arg(color));
- if (GetEepromInterface()->getCapability(GvarsFlightPhases)) {
+ if (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
for (k=0; kgvars[k],pd2->gvars[k]);
if (pd2->gvars[k]<=1024) {
@@ -472,7 +474,7 @@ void compareDialog::printPhases()
}
}
}
- for (k=0; kgetCapability(RotaryEncoders); k++) {
+ for (k=0; kgetCapability(RotaryEncoders); k++) {
color=getColor1(pd1->rotaryEncoders[k],pd2->rotaryEncoders[k]);
if (pd2->rotaryEncoders[k]<=1024) {
str.append(QString("%1").arg(pd2->rotaryEncoders[k]).arg(color)+" | ");
@@ -491,20 +493,20 @@ void compareDialog::printPhases()
te->append(str);
}
-void compareDialog::printLimits()
+void CompareDialog::printLimits()
{
QString color;
QString str = "";
str.append(""+tr("Limits")+" | ");
str.append("");
- if (GetEepromInterface()->getCapability(HasChNames)) {
+ if (GetCurrentFirmware()->getCapability(HasChNames)) {
str.append("| "+tr("Name")+" | "+tr("Offset")+" | "+tr("Min")+" | "+tr("Max")+" | "+tr("Invert")+" | ");
} else {
str.append(" | "+tr("Offset")+" | "+tr("Min")+" | "+tr("Max")+" | "+tr("Invert")+" | ");
}
- for(int i=0; igetCapability(Outputs); i++) {
+ for(int i=0; igetCapability(Outputs); i++) {
str.append("");
- if (GetEepromInterface()->getCapability(HasChNames)) {
+ if (GetCurrentFirmware()->getCapability(HasChNames)) {
QString name1=g_model1->limitData[i].name;
QString name2=g_model2->limitData[i].name;
color=getColor1(name1,name2);
@@ -529,9 +531,9 @@ void compareDialog::printLimits()
str.append(" | ");
str.append("");
str.append(" | "+tr("Offset")+" | "+tr("Min")+" | "+tr("Max")+" | "+tr("Invert")+" | ");
- for(int i=0; igetCapability(Outputs); i++) {
+ for(int i=0; igetCapability(Outputs); i++) {
str.append("");
- if (GetEepromInterface()->getCapability(HasChNames)) {
+ if (GetCurrentFirmware()->getCapability(HasChNames)) {
QString name1=g_model1->limitData[i].name;
QString name2=g_model2->limitData[i].name;
color=getColor2(name1,name2);
@@ -557,17 +559,17 @@ void compareDialog::printLimits()
te->append(str);
}
-void compareDialog::printGvars()
+void CompareDialog::printGvars()
{
QString color;
int gvars=0;
int gvarnum=0;
- if ((GetCurrentFirmwareVariant() & GVARS_VARIANT ) || (!GetEepromInterface()->getCapability(HasVariants) && GetEepromInterface()->getCapability(Gvars))) {
+ if ((GetCurrentFirmwareVariant() & GVARS_VARIANT ) || (!GetCurrentFirmware()->getCapability(HasVariants) && GetCurrentFirmware()->getCapability(Gvars))) {
gvars=1;
- gvarnum=GetEepromInterface()->getCapability(Gvars);
+ gvarnum=GetCurrentFirmware()->getCapability(Gvars);
}
- if (!GetEepromInterface()->getCapability(GvarsFlightPhases) && (gvars==1 && GetEepromInterface()->getCapability(Gvars))) {
+ if (!GetCurrentFirmware()->getCapability(GvarsFlightModes) && (gvars==1 && GetCurrentFirmware()->getCapability(Gvars))) {
QString str = "";
str.append(""+tr("Global Variables")+" | ");
str.append("");
@@ -605,7 +607,7 @@ void compareDialog::printGvars()
}
}
-void compareDialog::printExpos()
+void CompareDialog::printExpos()
{
QString color;
bool expoused[C9X_MAX_EXPOS]={false};
@@ -614,7 +616,7 @@ void compareDialog::printExpos()
QString str = "";
str.append(tr("Expo/Dr Settings"));
str.append(" | ");
- for(uint8_t i=0; igetCapability(Outputs); i++) {
+ for(uint8_t i=0; igetCapability(Outputs); i++) {
if (ChannelHasExpo(g_model1->expoData, i) || ChannelHasExpo(g_model2->expoData, i)) {
str.append("");
str.append("");
@@ -651,12 +653,12 @@ void compareDialog::printExpos()
str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight)).rightJustified(6, ' ');
str += ed->curve.toString().replace("<", "<").replace(">", ">");
- if (GetEepromInterface()->getCapability(FlightPhases)) {
+ if (GetCurrentFirmware()->getCapability(FlightModes)) {
if(ed->phases) {
- if (ed->phases!=(unsigned int)(1<getCapability(FlightPhases))-1) {
+ if (ed->phases!=(unsigned int)(1<getCapability(FlightModes))-1) {
int mask=1;
int first=0;
- for (int i=0; igetCapability(FlightPhases);i++) {
+ for (int i=0; igetCapability(FlightModes);i++) {
if (!(ed->phases & mask)) {
first++;
}
@@ -669,7 +671,7 @@ void compareDialog::printExpos()
}
mask=1;
first=1;
- for (int j=0; jgetCapability(FlightPhases);j++) {
+ for (int j=0; jgetCapability(FlightModes);j++) {
if (!(ed->phases & mask)) {
PhaseData *pd = &g_model1->phaseData[j];
if (!first) {
@@ -729,12 +731,12 @@ void compareDialog::printExpos()
str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight)).rightJustified(6, ' ');
str += ed->curve.toString().replace("<", "<").replace(">", ">");
- if (GetEepromInterface()->getCapability(FlightPhases)) {
+ if (GetCurrentFirmware()->getCapability(FlightModes)) {
if(ed->phases) {
- if (ed->phases!=(unsigned int)(1<getCapability(FlightPhases))-1) {
+ if (ed->phases!=(unsigned int)(1<getCapability(FlightModes))-1) {
int mask=1;
int first=0;
- for (int i=0; igetCapability(FlightPhases);i++) {
+ for (int i=0; igetCapability(FlightModes);i++) {
if (!(ed->phases & mask)) {
first++;
}
@@ -747,7 +749,7 @@ void compareDialog::printExpos()
}
mask=1;
first=1;
- for (int j=0; jgetCapability(FlightPhases);j++) {
+ for (int j=0; jgetCapability(FlightModes);j++) {
if (!(ed->phases & mask)) {
PhaseData *pd = &g_model2->phaseData[j];
if (!first) {
@@ -778,21 +780,21 @@ void compareDialog::printExpos()
te->append(str);
}
-void compareDialog::printMixers()
+void CompareDialog::printMixers()
{
QString color;
QString str = "";
str.append(tr("Mixers"));
str.append(" | ");
- float scale=GetEepromInterface()->getCapability(SlowScale);
+ float scale=GetCurrentFirmware()->getCapability(SlowScale);
bool mixused[64]={false};
bool mixused2[64]={false};
- for(uint8_t i=1; i<=GetEepromInterface()->getCapability(Outputs); i++) {
+ for(uint8_t i=1; i<=GetCurrentFirmware()->getCapability(Outputs); i++) {
if (ChannelHasMix(g_model1->mixData, i) || ChannelHasMix(g_model2->mixData, i)) {
str.append("");
str.append("");
str.append("");
- for (int j=0; jgetCapability(Mixes); j++) {
+ for (int j=0; jgetCapability(Mixes); j++) {
if (g_model1->mixData[j].destCh==i) {
int mix=ModelHasMix(g_model2->mixData, g_model1->mixData[j], mixused);
if (mix>-1) {
@@ -827,12 +829,12 @@ void compareDialog::printMixers()
if (md->delayDown || md->delayUp) str += tr(" Delay(u%1:d%2)").arg(md->delayUp/scale).arg(md->delayDown/scale);
if (md->speedDown || md->speedUp) str += tr(" Slow(u%1:d%2)").arg(md->speedUp/scale).arg(md->speedDown/scale);
if (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn);
- if (GetEepromInterface()->getCapability(FlightPhases)) {
+ if (GetCurrentFirmware()->getCapability(FlightModes)) {
if(md->phases) {
- if (md->phases!=(unsigned int)(1<getCapability(FlightPhases))-1) {
+ if (md->phases!=(unsigned int)(1<getCapability(FlightModes))-1) {
int mask=1;
int first=0;
- for (int i=0; igetCapability(FlightPhases);i++) {
+ for (int i=0; igetCapability(FlightModes);i++) {
if (!(md->phases & mask)) {
first++;
}
@@ -845,7 +847,7 @@ void compareDialog::printMixers()
}
mask=1;
first=1;
- for (int j=0; jgetCapability(FlightPhases);j++) {
+ for (int j=0; jgetCapability(FlightModes);j++) {
if (!(md->phases & mask)) {
PhaseData *pd = &g_model1->phaseData[j];
if (!first) {
@@ -870,7 +872,7 @@ void compareDialog::printMixers()
str.append("| "+tr("CH")+QString("%1 | ").arg(i,2,10,QChar('0')));
str.append("");
str.append("");
- for (int j=0; jgetCapability(Mixes); j++) {
+ for (int j=0; jgetCapability(Mixes); j++) {
if (g_model2->mixData[j].destCh==i) {
int mix=ModelHasMix(g_model1->mixData, g_model2->mixData[j],mixused2);
if (mix>-1) {
@@ -906,12 +908,12 @@ void compareDialog::printMixers()
if (md->delayDown || md->delayUp) str += tr(" Delay(u%1:d%2)").arg(md->delayUp/scale).arg(md->delayDown/scale);
if (md->speedDown || md->speedUp) str += tr(" Slow(u%1:d%2)").arg(md->speedUp/scale).arg(md->speedDown/scale);
if (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn);
- if (GetEepromInterface()->getCapability(FlightPhases)) {
+ if (GetCurrentFirmware()->getCapability(FlightModes)) {
if(md->phases) {
- if (md->phases!=(unsigned int)(1<getCapability(FlightPhases))-1) {
+ if (md->phases!=(unsigned int)(1<getCapability(FlightModes))-1) {
int mask=1;
int first=0;
- for (int i=0; igetCapability(FlightPhases);i++) {
+ for (int i=0; igetCapability(FlightModes);i++) {
if (!(md->phases & mask)) {
first++;
}
@@ -924,7 +926,7 @@ void compareDialog::printMixers()
}
mask=1;
first=1;
- for (int j=0; jgetCapability(FlightPhases);j++) {
+ for (int j=0; jgetCapability(FlightModes);j++) {
if (!(md->phases & mask)) {
PhaseData *pd = &g_model2->phaseData[j];
if (!first) {
@@ -953,7 +955,7 @@ void compareDialog::printMixers()
te->append(str);
}
-void compareDialog::printCurves()
+void CompareDialog::printCurves()
{
#if 0
int i,r,g,b,c;
@@ -971,7 +973,7 @@ void compareDialog::printCurves()
QString str = "";
str.append(tr("Curves"));
str.append(" | ");
- str.append("| "+tr("5 Points Curves")+" | ");
+ str.append("| "+tr("5 Point Curves")+" | ");
for(i=0; i<5; i++)
str.append(doTC(tr("pt %1").arg(i+1), "", true));
str.append(" | ");
@@ -1001,7 +1003,7 @@ void compareDialog::printCurves()
}
str.append("
");
- str.append("| "+tr("9 Points Curves")+" | ");
+ str.append("| "+tr("9 Point Curves")+" | ");
for(i=0; i<9; i++)
str.append(doTC(tr("pt %1").arg(i+1), "", true));
str.append(" | ");
@@ -1033,14 +1035,14 @@ void compareDialog::printCurves()
#endif
}
-void compareDialog::printSwitches()
+void CompareDialog::printSwitches()
{
int sc=0;
QString color;
QString str = "";
str.append(""+tr("Logical Switches")+" | ");
str.append("");
- for (int i=0; igetCapability(LogicalSwitches); i++) {
+ for (int i=0; igetCapability(LogicalSwitches); i++) {
QString sw1 = g_model1->customSw[i].toString(*g_model1);
QString sw2 = g_model2->customSw[i].toString(*g_model2);
if (!(sw1.isEmpty() && sw2.isEmpty())) {
@@ -1063,13 +1065,13 @@ void compareDialog::printSwitches()
te->append(str);
}
-void compareDialog::printFSwitches()
+void CompareDialog::printFSwitches()
{
QString color1;
QString color2;
int sc=0;
QString str = "";
- str.append(""+tr("Switch Assignment")+" | ");
+ str.append(""+tr("Special Functions")+" | ");
str.append("");
str.append("| "+tr("Switch")+" | ");
str.append(""+tr("Function")+" | ");
@@ -1083,7 +1085,7 @@ void compareDialog::printFSwitches()
str.append(""+tr("Repeat")+" | ");
str.append(""+tr("Enable")+" | ");
str.append(" ");
- for(int i=0; igetCapability(CustomFunctions); i++)
+ for(int i=0; igetCapability(CustomFunctions); i++)
{
if (g_model1->funcSw[i].swtch.type || g_model2->funcSw[i].swtch.type) {
if ((g_model1->funcSw[i].swtch != g_model2->funcSw[i].swtch) || (g_model1->funcSw[i].func!=g_model2->funcSw[i].func) || (g_model1->funcSw[i].adjustMode!=g_model2->funcSw[i].adjustMode) || (g_model1->funcSw[i].param!=g_model2->funcSw[i].param)) {
@@ -1112,7 +1114,7 @@ void compareDialog::printFSwitches()
} else {
str.append(" | | | | | ");
}
- str.append(doTC(tr("CF")+QString("%1").arg(i+1),"",true));
+ str.append(doTC(tr("SF")+QString("%1").arg(i+1),"",true));
if (g_model2->funcSw[i].swtch.type) {
str.append(doTC(g_model2->funcSw[i].swtch.toString(),color2));
str.append(doTC(g_model2->funcSw[i].funcToString(),color2));
@@ -1142,7 +1144,7 @@ void compareDialog::printFSwitches()
te->append(str);
}
-void compareDialog::printFrSky()
+void CompareDialog::printFrSky()
{
QString color;
float value1,value2;
@@ -1212,10 +1214,10 @@ void compareDialog::printFrSky()
str.append(""+QString::number(fd1->rssiAlarms[1].value,10)+" | ");
str.append(" ");
#if 0
- if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) {
- int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
+ if (GetCurrentFirmware()->getCapability(TelemetryBars) || GetCurrentFirmware()->getCapability(TelemetryCSFields)) {
+ int cols=GetCurrentFirmware()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2;
- for (int j=0; jgetCapability(TelemetryCSFields)/(4*cols); j++) {
+ for (int j=0; jgetCapability(TelemetryCSFields)/(4*cols); j++) {
QString tcols;
QString cwidth;
QString swidth;
@@ -1331,10 +1333,10 @@ void compareDialog::printFrSky()
str.append(""+QString::number(fd2->rssiAlarms[1].value,10)+" | ");
str.append(" | ");
#if 0
- if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) {
- int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
+ if (GetCurrentFirmware()->getCapability(TelemetryBars) || GetCurrentFirmware()->getCapability(TelemetryCSFields)) {
+ int cols=GetCurrentFirmware()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2;
- for (int j=0; jgetCapability(TelemetryCSFields)/(4*cols); j++) {
+ for (int j=0; jgetCapability(TelemetryCSFields)/(4*cols); j++) {
QString tcols;
QString cwidth;
QString swidth;
@@ -1391,7 +1393,7 @@ void compareDialog::printFrSky()
te->append(str);
}
-void compareDialog::on_printButton_clicked()
+void CompareDialog::on_printButton_clicked()
{
QPrinter printer;
printer.setPageMargins(10.0,10.0,10.0,10.0,printer.Millimeter);
@@ -1402,7 +1404,7 @@ void compareDialog::on_printButton_clicked()
te->print(&printer);
}
-void compareDialog::on_printFileButton_clicked()
+void CompareDialog::on_printFileButton_clicked()
{
QPrinter printer;
QString filename = QFileDialog::getSaveFileName(this,tr("Select PDF output file"),QString(),"Pdf File(*.pdf)");
diff --git a/companion/src/comparedialog.h b/companion/src/comparedialog.h
index e955ea2db..6f1c83875 100644
--- a/companion/src/comparedialog.h
+++ b/companion/src/comparedialog.h
@@ -7,29 +7,27 @@
#include "eeprominterface.h"
namespace Ui {
- class compareDialog;
+ class CompareDialog;
}
-class compareDialog : public QDialog
+class CompareDialog : public QDialog
{
Q_OBJECT
-public:
- explicit compareDialog(QWidget *parent = 0, GeneralSettings *gg = 0);
-
- ~compareDialog();
- void closeEvent(QCloseEvent *event);
-
+ public:
+ CompareDialog(QWidget *parent);
+ ~CompareDialog();
+
+ protected:
ModelData * g_model1;
ModelData * g_model2;
ModelData * modeltemp;
int model1;
int model2;
- GeneralSettings *g_eeGeneral;
- EEPROMInterface *eepromInterface;
-private:
- Ui::compareDialog *ui;
+ private:
+ void closeEvent(QCloseEvent *event);
+ Ui::CompareDialog *ui;
QString doTC(const QString s, const QString color, bool bold);
QString doTR(const QString s, const QString color, bool bold);
QString doTL(const QString s, const QString color, bool bold);
diff --git a/companion/src/comparedialog.ui b/companion/src/comparedialog.ui
index 4a26482b0..d56701196 100644
--- a/companion/src/comparedialog.ui
+++ b/companion/src/comparedialog.ui
@@ -1,7 +1,7 @@
- compareDialog
-
+ CompareDialog
+
0
@@ -131,7 +131,7 @@
closeButton
clicked()
- compareDialog
+ CompareDialog
reject()
diff --git a/companion/src/contributorsdialog.ui b/companion/src/contributorsdialog.ui
index 5d7d670c1..1301c22ba 100644
--- a/companion/src/contributorsdialog.ui
+++ b/companion/src/contributorsdialog.ui
@@ -11,7 +11,7 @@
- Dialog
+
-
diff --git a/companion/src/customizesplashdialog.cpp b/companion/src/customizesplashdialog.cpp
index 42bf463da..cf125d35c 100644
--- a/companion/src/customizesplashdialog.cpp
+++ b/companion/src/customizesplashdialog.cpp
@@ -142,7 +142,7 @@ customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
ui(new Ui::customizeSplashDialog)
{
ui->setupUi(this);
- this->setWindowIcon(CompanionIcon("paint.png"));
+ setWindowIcon(CompanionIcon("paintbrush.png"));
ui->leftLibraryButton->setIcon(CompanionIcon("library.png"));
ui->rightLibraryButton->setIcon(CompanionIcon("library.png"));
@@ -225,7 +225,7 @@ void customizeSplashDialog::loadProfile(Side side)
if (!fileName.isEmpty()) {
if (!side.displayImage( fileName, PROFILE ))
- QMessageBox::critical(this, tr("Error"), tr("Cannot load the profile image %1.").arg(fileName));
+ QMessageBox::critical(this, tr("Error"), tr("Cannot load profile image %1.").arg(fileName));
}
side.markSourceButton();
}
diff --git a/companion/src/customizesplashdialog.ui b/companion/src/customizesplashdialog.ui
index 72b241276..9a6971893 100644
--- a/companion/src/customizesplashdialog.ui
+++ b/companion/src/customizesplashdialog.ui
@@ -10,7 +10,7 @@
0
0
1087
- 285
+ 298
@@ -165,6 +165,9 @@
QFrame::Plain
+
+ 0
+
@@ -470,6 +473,9 @@
QFrame::Plain
+
+ 0
+
diff --git a/companion/src/downloaddialog.cpp b/companion/src/downloaddialog.cpp
index 794dbbcd1..aa7ea6ef3 100644
--- a/companion/src/downloaddialog.cpp
+++ b/companion/src/downloaddialog.cpp
@@ -2,6 +2,7 @@
#include "ui_downloaddialog.h"
#include
#include
+#include
#include "helpers.h"
downloadDialog::downloadDialog(QWidget *parent, QString src, QString tgt) :
@@ -87,3 +88,14 @@ void downloadDialog::fileError()
file = 0;
reject();
}
+
+void downloadDialog::closeEvent( QCloseEvent * event)
+{
+ // Delay closing 2 seconds to avoid unpleasant flashing download dialogs
+ QTime closeTime= QTime::currentTime().addSecs(2);
+ while( QTime::currentTime() < closeTime )
+ QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
+
+ event->accept();
+}
+
diff --git a/companion/src/downloaddialog.h b/companion/src/downloaddialog.h
index 596002250..9730e3134 100644
--- a/companion/src/downloaddialog.h
+++ b/companion/src/downloaddialog.h
@@ -27,6 +27,7 @@ private slots:
void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
private:
+ void closeEvent( QCloseEvent * event);
Ui::downloadDialog *ui;
QNetworkAccessManager qnam;
diff --git a/companion/src/eepromimportexport.h b/companion/src/eepromimportexport.h
index 242c1f7f7..0d7ea49ec 100644
--- a/companion/src/eepromimportexport.h
+++ b/companion/src/eepromimportexport.h
@@ -638,41 +638,45 @@ class ConversionField: public TransformedField {
virtual void beforeExport()
{
- int val = field;
+ _field = field;
if (scale) {
- val /= scale;
+ _field /= scale;
}
if (table) {
- if (table->exportValue(val, _field))
+ if (table->exportValue(_field, _field))
return;
if (!error.isEmpty())
EEPROMWarnings += error + "\n";
}
if (shift) {
- if (val < min) _field = min + shift;
- else if (val > max) _field = max + shift;
- else _field = val + shift;
+ if (_field < min) _field = min + shift;
+ else if (_field > max) _field = max + shift;
+ else _field += shift;
}
if (exportFunc) {
- _field = exportFunc(val);
+ _field = exportFunc(_field);
}
}
virtual void afterImport()
{
+ field = _field;
+
if (table) {
- if (table->importValue(_field, field))
+ if (table->importValue(field, field))
return;
}
- field = _field - shift;
+ if (shift) {
+ field -= shift;
+ }
if (importFunc) {
- field = importFunc(_field);
+ field = importFunc(field);
}
if (scale) {
diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp
index c05a3bcec..cc266de4f 100644
--- a/companion/src/eeprominterface.cpp
+++ b/companion/src/eeprominterface.cpp
@@ -5,14 +5,27 @@
#include "firmwares/th9x/th9xinterface.h"
#include "firmwares/gruvin9x/gruvin9xinterface.h"
#include "firmwares/opentx/opentxinterface.h"
+#include "firmwares/opentx/opentxeeprom.h"
#include "firmwares/ersky9x/ersky9xinterface.h"
#include "appdata.h"
#include "helpers.h"
+#include "wizarddata.h"
QString EEPROMWarnings;
const char * switches9X[] = { "3POS", "THR", "RUD", "ELE", "AIL", "GEA", "TRN" };
const char * switchesX9D[] = { "SA", "SB", "SC", "SD", "SE", "SF", "SG", "SH" };
+const char leftArrow[] = {(char)0xE2, (char)0x86, (char)0x90, 0};
+const char rightArrow[] = {(char)0xE2, (char)0x86, (char)0x92, 0};
+const char upArrow[] = {(char)0xE2, (char)0x86, (char)0x91, 0};
+const char downArrow[] = {(char)0xE2, (char)0x86, (char)0x93, 0};
+
+const uint8_t chout_ar[] = { // First number is 0..23 -> template setup, Second is relevant channel out
+ 1,2,3,4 , 1,2,4,3 , 1,3,2,4 , 1,3,4,2 , 1,4,2,3 , 1,4,3,2,
+ 2,1,3,4 , 2,1,4,3 , 2,3,1,4 , 2,3,4,1 , 2,4,1,3 , 2,4,3,1,
+ 3,1,2,4 , 3,1,4,2 , 3,2,1,4 , 3,2,4,1 , 3,4,1,2 , 3,4,2,1,
+ 4,1,2,3 , 4,1,3,2 , 4,2,1,3 , 4,2,3,1 , 4,3,1,2 , 4,3,2,1
+};
void setEEPROMString(char *dst, const char *src, int size)
{
@@ -84,7 +97,7 @@ RawSourceRange RawSource::getRange(bool singleprec)
int board = GetEepromInterface()->getBoard();
- if (!singleprec && !IS_TARANIS(board)) {
+ if (!singleprec && !IS_ARM(board)) {
singleprec = true;
}
@@ -96,6 +109,10 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.decimals = 1;
result.max = 25.5;
break;
+ case TELEMETRY_SOURCE_TX_TIME:
+ result.step = 1;
+ result.max = 24*60 - 1;
+ break;
case TELEMETRY_SOURCE_TIMER1:
case TELEMETRY_SOURCE_TIMER2:
result.step = singleprec ? 5 : 1;
@@ -104,6 +121,7 @@ RawSourceRange RawSource::getRange(bool singleprec)
case TELEMETRY_SOURCE_RSSI_TX:
case TELEMETRY_SOURCE_RSSI_RX:
result.max = 100;
+ if (singleprec) result.offset = 128;
break;
case TELEMETRY_SOURCE_A1:
case TELEMETRY_SOURCE_A2:
@@ -126,11 +144,19 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.max = singleprec ? 1540 : 3000;
break;
case TELEMETRY_SOURCE_T1:
+ case TELEMETRY_SOURCE_T1_MAX:
case TELEMETRY_SOURCE_T2:
+ case TELEMETRY_SOURCE_T2_MAX:
result.min = -30;
result.max = 225;
break;
+ case TELEMETRY_SOURCE_HDG:
+ result.step = singleprec ? 2 : 1;
+ result.max = 360;
+ if (singleprec) result.offset = 256;
+ break;
case TELEMETRY_SOURCE_RPM:
+ case TELEMETRY_SOURCE_RPM_MAX:
result.step = singleprec ? 50 : 1;
result.max = singleprec ? 12750 : 20000;
break;
@@ -138,46 +164,66 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.max = 100;
break;
case TELEMETRY_SOURCE_SPEED:
+ case TELEMETRY_SOURCE_SPEED_MAX:
result.step = singleprec ? 4 : 1;
- result.max = singleprec ? 944 : 2000;
+ result.max = singleprec ? (4*236) : 2000;
if (model && !model->frsky.imperial) {
result.step *= 1.852;
result.max *= 1.852;
}
break;
+ case TELEMETRY_SOURCE_VERTICAL_SPEED:
+ result.step = 0.1;
+ result.min = -12.5;
+ result.max = 13.0;
+ result.decimals = 1;
+ break;
case TELEMETRY_SOURCE_DIST:
+ case TELEMETRY_SOURCE_DIST_MAX:
result.step = singleprec ? 8 : 1;
result.max = singleprec ? 2040 : 10000;
break;
case TELEMETRY_SOURCE_CELL:
+ case TELEMETRY_SOURCE_CELL_MIN:
result.step = singleprec ? 0.02 : 0.01;
result.max = 5.1;
result.decimals = 2;
break;
case TELEMETRY_SOURCE_CELLS_SUM:
+ case TELEMETRY_SOURCE_CELLS_MIN:
case TELEMETRY_SOURCE_VFAS:
+ case TELEMETRY_SOURCE_VFAS_MIN:
result.step = 0.1;
result.max = 25.5;
result.decimals = 1;
break;
case TELEMETRY_SOURCE_CURRENT:
+ case TELEMETRY_SOURCE_CURRENT_MAX:
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;
+ result.step = singleprec ? 100 : 1;
+ result.max = singleprec ? 25500 : 10000;
break;
case TELEMETRY_SOURCE_POWER:
+ case TELEMETRY_SOURCE_POWER_MAX:
result.step = singleprec ? 5 : 1;
result.max = singleprec ? 1275 : 2000;
break;
+ case TELEMETRY_SOURCE_ACCX:
+ case TELEMETRY_SOURCE_ACCY:
+ case TELEMETRY_SOURCE_ACCZ:
+ result.step = 0.01;
+ result.decimals = 2;
+ result.max = 2.55;
+ break;
default:
result.max = 125;
break;
}
- if (singleprec) {
+ if (singleprec && !result.offset) {
result.offset = result.max - (127*result.step);
}
break;
@@ -216,25 +262,25 @@ QString RawSource::toString()
};
static const QString telemetry[] = {
- QObject::tr("Batt"), QObject::tr("Timer1"), QObject::tr("Timer2"),
+ QObject::tr("Batt"), QObject::tr("Time"), QObject::tr("Timer1"), QObject::tr("Timer2"),
QObject::tr("SWR"), QObject::tr("RSSI Tx"), QObject::tr("RSSI Rx"), QObject::tr("Rx Batt"),
QObject::tr("A1"), QObject::tr("A2"), QObject::tr("A3"), QObject::tr("A4"),
QObject::tr("Alt"), QObject::tr("Rpm"), QObject::tr("Fuel"), QObject::tr("T1"), QObject::tr("T2"),
QObject::tr("Speed"), QObject::tr("Dist"), QObject::tr("GPS Alt"),
- QObject::tr("Cell"), QObject::tr("Cels"), QObject::tr("Vfas"), QObject::tr("Curr"), QObject::tr("Cnsp"), QObject::tr("Powr"),
+ QObject::tr("Cell"), QObject::tr("Cells"), QObject::tr("Vfas"), QObject::tr("Curr"), QObject::tr("Cnsp"), QObject::tr("Powr"),
QObject::tr("AccX"), QObject::tr("AccY"), QObject::tr("AccZ"),
- QObject::tr("HDG "), QObject::tr("VSpd"), QObject::tr("ASpd"), QObject::tr("dTE"),
+ QObject::tr("Hdg "), QObject::tr("VSpd"), QObject::tr("AirSpeed"), QObject::tr("dTE"),
QObject::tr("A1-"), QObject::tr("A2-"), QObject::tr("A3-"), QObject::tr("A4-"),
- QObject::tr("Alt-"), QObject::tr("Alt+"), QObject::tr("Rpm+"), QObject::tr("T1+"), QObject::tr("T2+"), QObject::tr("Spd+"), QObject::tr("Dst+"),
- QObject::tr("Cel-"), QObject::tr("Cels-"), QObject::tr("Vfs-"), QObject::tr("Cur+"), QObject::tr("Pwr+"),
- QObject::tr("ACC"), QObject::tr("Time"),
+ QObject::tr("Alt-"), QObject::tr("Alt+"), QObject::tr("Rpm+"), QObject::tr("T1+"), QObject::tr("T2+"), QObject::tr("Speed+"), QObject::tr("Dist+"), QObject::tr("AirSpeed+"),
+ QObject::tr("Cell-"), QObject::tr("Cells-"), QObject::tr("Vfas-"), QObject::tr("Curr+"), QObject::tr("Powr+"),
+ QObject::tr("ACC"), QObject::tr("GPS Time"),
};
- static const QString virtualSwitches[] = {
- QObject::tr("LS1"), QObject::tr("LS2"), QObject::tr("LS3"), QObject::tr("LS4"), QObject::tr("LS5"), QObject::tr("LS6"), QObject::tr("LS7"), QObject::tr("LS8"), QObject::tr("LS9"), QObject::tr("LSA"),
- QObject::tr("LSB"), QObject::tr("LSC"), QObject::tr("LSD"), QObject::tr("LSE"), QObject::tr("LSF"), QObject::tr("LSG"), QObject::tr("LSH"), QObject::tr("LSI"), QObject::tr("LSJ"), QObject::tr("LSK"),
- QObject::tr("LSL"), QObject::tr("LSM"), QObject::tr("LSN"), QObject::tr("LSO"), QObject::tr("LSP"), QObject::tr("LSQ"), QObject::tr("LSR"), QObject::tr("LSS"), QObject::tr("LST"), QObject::tr("LSU"),
- QObject::tr("LSV"), QObject::tr("LSW")
+ static const QString logicalSwitches[] = {
+ QObject::tr("L1"), QObject::tr("L2"), QObject::tr("L3"), QObject::tr("L4"), QObject::tr("L5"), QObject::tr("L6"), QObject::tr("L7"), QObject::tr("L8"), QObject::tr("L9"), QObject::tr("L10"),
+ QObject::tr("L11"), QObject::tr("L12"), QObject::tr("L13"), QObject::tr("L14"), QObject::tr("L15"), QObject::tr("L16"), QObject::tr("L17"), QObject::tr("L18"), QObject::tr("L19"), QObject::tr("L20"),
+ QObject::tr("L21"), QObject::tr("L22"), QObject::tr("L23"), QObject::tr("L24"), QObject::tr("L25"), QObject::tr("L26"), QObject::tr("L27"), QObject::tr("L28"), QObject::tr("L29"), QObject::tr("L30"),
+ QObject::tr("L31"), QObject::tr("L32")
};
if (index<0) {
@@ -260,16 +306,13 @@ QString RawSource::toString()
case SOURCE_TYPE_SWITCH:
return (IS_TARANIS(GetEepromInterface()->getBoard()) ? CHECK_IN_ARRAY(switchesX9D, index) : CHECK_IN_ARRAY(switches9X, index));
case SOURCE_TYPE_CUSTOM_SWITCH:
- return virtualSwitches[index];
+ return logicalSwitches[index];
case SOURCE_TYPE_CYC:
return QObject::tr("CYC%1").arg(index+1);
case SOURCE_TYPE_PPM:
- return QObject::tr("PPM%1").arg(index+1);
+ return QObject::tr("TR%1").arg(index+1);
case SOURCE_TYPE_CH:
- if (index < GetEepromInterface()->getCapability(Outputs))
- return QObject::tr("CH%1%2").arg((index+1)/10).arg((index+1)%10);
- else
- return QObject::tr("X%1").arg(index-GetEepromInterface()->getCapability(Outputs)+1);
+ return QObject::tr("CH%1").arg(index+1);
case SOURCE_TYPE_TELEMETRY:
return CHECK_IN_ARRAY(telemetry, index);
case SOURCE_TYPE_GVAR:
@@ -281,13 +324,13 @@ QString RawSource::toString()
QString SwitchUp(const char sw)
{
- const char result[] = {'S', sw, (char)0xE2, (char)0x86, (char)0x91, 0};
+ const char result[] = {'S', sw, upArrow[0], upArrow[1], upArrow[2], 0};
return QString::fromUtf8(result);
}
QString SwitchDn(const char sw)
{
- const char result[] = {'S', sw, (char)0xE2, (char)0x86, (char)0x93, 0};
+ const char result[] = {'S', sw, downArrow[0], downArrow[1], downArrow[2], 0};
return QString::fromUtf8(result);
}
@@ -310,11 +353,15 @@ QString RawSwitch::toString()
SwitchUp('H'), SwitchDn('H'),
};
- static const QString virtualSwitches[] = {
- QObject::tr("LS1"), QObject::tr("LS2"), QObject::tr("LS3"), QObject::tr("LS4"), QObject::tr("LS5"), QObject::tr("LS6"), QObject::tr("LS7"), QObject::tr("LS8"), QObject::tr("LS9"), QObject::tr("LSA"),
- QObject::tr("LSB"), QObject::tr("LSC"), QObject::tr("LSD"), QObject::tr("LSE"), QObject::tr("LSF"), QObject::tr("LSG"), QObject::tr("LSH"), QObject::tr("LSI"), QObject::tr("LSJ"), QObject::tr("LSK"),
- QObject::tr("LSL"), QObject::tr("LSM"), QObject::tr("LSN"), QObject::tr("LSO"), QObject::tr("LSP"), QObject::tr("LSQ"), QObject::tr("LSR"), QObject::tr("LSS"), QObject::tr("LST"), QObject::tr("LSU"),
- QObject::tr("LSV"), QObject::tr("LSW")
+ static const QString logicalSwitches[] = {
+ QObject::tr("L1"), QObject::tr("L2"), QObject::tr("L3"), QObject::tr("L4"), QObject::tr("L5"), QObject::tr("L6"), QObject::tr("L7"), QObject::tr("L8"), QObject::tr("L9"), QObject::tr("L10"),
+ QObject::tr("L11"), QObject::tr("L12"), QObject::tr("L13"), QObject::tr("L14"), QObject::tr("L15"), QObject::tr("L16"), QObject::tr("L17"), QObject::tr("L18"), QObject::tr("L19"), QObject::tr("L20"),
+ QObject::tr("L21"), QObject::tr("L22"), QObject::tr("L23"), QObject::tr("L24"), QObject::tr("L25"), QObject::tr("L26"), QObject::tr("L27"), QObject::tr("L28"), QObject::tr("L29"), QObject::tr("L30"),
+ QObject::tr("L31"), QObject::tr("L32")
+ };
+
+ static const QString flightModes[] = {
+ QObject::tr("FM0"), QObject::tr("FM1"), QObject::tr("FM2"), QObject::tr("FM3"), QObject::tr("FM4"), QObject::tr("FM5"), QObject::tr("FM6"), QObject::tr("FM7"), QObject::tr("FM8")
};
static const QString multiposPots[] = {
@@ -350,7 +397,7 @@ QString RawSwitch::toString()
else
return CHECK_IN_ARRAY(switches9X, index-1);
case SWITCH_TYPE_VIRTUAL:
- return CHECK_IN_ARRAY(virtualSwitches, index-1);
+ return CHECK_IN_ARRAY(logicalSwitches, index-1);
case SWITCH_TYPE_MULTIPOS_POT:
return CHECK_IN_ARRAY(multiposPots, index-1);
case SWITCH_TYPE_TRIM:
@@ -361,6 +408,8 @@ QString RawSwitch::toString()
return QObject::tr("ON");
case SWITCH_TYPE_OFF:
return QObject::tr("OFF");
+ case SWITCH_TYPE_FLIGHT_MODE:
+ return CHECK_IN_ARRAY(flightModes, index-1);
case SWITCH_TYPE_NONE:
return QObject::tr("----");
case SWITCH_TYPE_TIMER_MODE:
@@ -450,7 +499,7 @@ QString LogicalSwitchData::funcToString()
case LS_FN_STICKY:
return QObject::tr("Sticky");
case LS_FN_STAY:
- return QObject::tr("Stay");
+ return QObject::tr("Edge");
default:
return QObject::tr("Unknown");
}
@@ -468,36 +517,43 @@ QString LogicalSwitchData::toString(const ModelData & model)
}
switch (getFunctionFamily()) {
case LS_FAMILY_STAY:
- result = QObject::tr("STAY(%1, [%2:%3])").arg(RawSwitch(val1).toString()).arg(ValToTim(val2)).arg(ValToTim(val2+val3));
+ result += QObject::tr("Edge(%1, [%2:%3])").arg(RawSwitch(val1).toString()).arg(ValToTim(val2)).arg(ValToTim(val2+val3));
break;
case LS_FAMILY_STICKY:
- result = QObject::tr("STICKY(%1, %2)").arg(RawSwitch(val1).toString()).arg(RawSwitch(val2).toString());
+ result += QObject::tr("Sticky(%1, %2)").arg(RawSwitch(val1).toString()).arg(RawSwitch(val2).toString());
break;
case LS_FAMILY_TIMER:
- result = QObject::tr("TIMER(%1, %2)").arg(ValToTim(val1)).arg(ValToTim(val2));
+ result += QObject::tr("Timer(%1, %2)").arg(ValToTim(val1)).arg(ValToTim(val2));
break;
case LS_FAMILY_VOFS: {
RawSource source = RawSource(val1, &model);
RawSourceRange range = source.getRange();
+ QString res;
if (val1)
- result += source.toString();
+ res += source.toString();
else
- result += "0";
- result.remove(" ");
+ res += "0";
+ res.remove(" ");
if (func == LS_FN_APOS || func == LS_FN_ANEG)
- result = "|" + result + "|";
+ res = "|" + res + "|";
else if (func == LS_FN_DAPOS)
- result = "|d(" + result + ")|";
- else if (func == LS_FN_DPOS) result = "d(" + result + ")";
+ res = "|d(" + res + ")|";
+ else if (func == LS_FN_DPOS) result = "d(" + res + ")";
+ result += res;
+
if (func == LS_FN_APOS || func == LS_FN_VPOS || func == LS_FN_DAPOS || func == LS_FN_DPOS)
result += " > ";
else if (func == LS_FN_ANEG || func == LS_FN_VNEG)
result += " < ";
+ else if (func == LS_FN_VALMOSTEQUAL)
+ result += " ~ ";
+ else
+ result += " missing";
result += QString::number(range.step * (val2 /*TODO+ source.getRawOffset(model)*/) + range.offset);
break;
}
case LS_FAMILY_VBOOL:
- result = RawSwitch(val1).toString();
+ result += RawSwitch(val1).toString();
switch (func) {
case LS_FN_AND:
result += " AND ";
@@ -508,7 +564,8 @@ QString LogicalSwitchData::toString(const ModelData & model)
case LS_FN_XOR:
result += " XOR ";
break;
- default:
+ default:
+ result += " bar ";
break;
}
result += RawSwitch(val2).toString();
@@ -521,6 +578,7 @@ QString LogicalSwitchData::toString(const ModelData & model)
result += "0";
switch (func) {
case LS_FN_EQUAL:
+ case LS_FN_VEQUAL:
result += " = ";
break;
case LS_FN_NEQUAL:
@@ -539,6 +597,7 @@ QString LogicalSwitchData::toString(const ModelData & model)
result += " <= ";
break;
default:
+ result += " foo ";
break;
}
if (val2)
@@ -553,11 +612,11 @@ QString LogicalSwitchData::toString(const ModelData & model)
result += RawSwitch(andsw).toString();
}
- if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
- if (delay)
- result += QObject::tr(" Delay %1 sec").arg(delay/10.0);
+ if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
if (duration)
- result += QObject::tr(" Duration %1 sec").arg(duration/10.0);
+ result += QObject::tr(" Duration (%1s)").arg(duration/10.0);
+ if (delay)
+ result += QObject::tr(" Delay (%1s)").arg(delay/10.0);
}
return result;
@@ -605,7 +664,7 @@ QStringList FuncSwData::toStringList()
result << item.toString();
}
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
- if ( GetEepromInterface()->getCapability(VoicesAsNumbers)) {
+ if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
result << QString("%1").arg(param);
} else {
result << paramarm;
@@ -735,7 +794,7 @@ QString FuncSwData::paramToString()
return item.toString();
}
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
- if ( GetEepromInterface()->getCapability(VoicesAsNumbers)) {
+ if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
return QString("%1").arg(param);
} else {
return paramarm;
@@ -781,121 +840,157 @@ QString FuncSwData::repeatToString()
GeneralSettings::GeneralSettings()
{
memset(this, 0, sizeof(GeneralSettings));
+
contrast = 25;
vBatWarn = 90;
- for (int i=0; i<(NUM_STICKS+C9X_NUM_POTS ); ++i) {
+
+ for (int i=0; igetBoard())) {
+ potsType[0] = 1;
+ potsType[1] = 1;
+ }
+
templateSetup = g.profile[g.id()].channelOrder();
stickMode = g.profile[g.id()].defaultMode();
- QString t_calib=g.profile[g.id()].stickPotCalib();
- int potsnum=GetEepromInterface()->getCapability(Pots);
- if (t_calib.isEmpty()) {
- return;
- }
- else {
- QString t_trainercalib=g.profile[g.id()].trainerCalib();
- int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib();
- int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib();
- int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier();
- uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
- uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
- QString t_DisplaySet=g.profile[g.id()].display();
- QString t_BeeperSet=g.profile[g.id()].beeper();
- QString t_HapticSet=g.profile[g.id()].haptic();
- QString t_SpeakerSet=g.profile[g.id()].speaker();
- QString t_CountrySet=g.profile[g.id()].countryCode();
+ QString t_calib=g.profile[g.id()].stickPotCalib();
+ int potsnum=GetCurrentFirmware()->getCapability(Pots);
+ if (t_calib.isEmpty()) {
+ return;
+ }
+ else {
+ QString t_trainercalib=g.profile[g.id()].trainerCalib();
+ int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib();
+ int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib();
+ int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier();
+ uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
+ uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
+ QString t_DisplaySet=g.profile[g.id()].display();
+ QString t_BeeperSet=g.profile[g.id()].beeper();
+ QString t_HapticSet=g.profile[g.id()].haptic();
+ QString t_SpeakerSet=g.profile[g.id()].speaker();
+ QString t_CountrySet=g.profile[g.id()].countryCode();
- if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) {
- QString Byte;
- int16_t byte16;
- bool ok;
- for (int i=0; i<(NUM_STICKS+potsnum); i++) {
- Byte=t_calib.mid(i*12,4);
- byte16=(int16_t)Byte.toInt(&ok,16);
- if (ok)
- calibMid[i]=byte16;
- Byte=t_calib.mid(4+i*12,4);
- byte16=(int16_t)Byte.toInt(&ok,16);
- if (ok)
- calibSpanNeg[i]=byte16;
- Byte=t_calib.mid(8+i*12,4);
- byte16=(int16_t)Byte.toInt(&ok,16);
- if (ok)
- calibSpanPos[i]=byte16;
- }
- for (int i=0; i<4; i++) {
- Byte=t_trainercalib.mid(i*4,4);
- byte16=(int16_t)Byte.toInt(&ok,16);
- if (ok)
- trainer.calib[i]=byte16;
- }
- currentCalib=t_currentCalib;
- vBatCalib=t_vBatCalib;
- vBatWarn=t_vBatWarn;
- PPM_Multiplier=t_PPM_Multiplier;
- stickMode = t_stickMode;
+ if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) {
+ QString Byte;
+ int16_t byte16;
+ bool ok;
+ for (int i=0; i<(NUM_STICKS+potsnum); i++) {
+ Byte=t_calib.mid(i*12,4);
+ byte16=(int16_t)Byte.toInt(&ok,16);
+ if (ok)
+ calibMid[i]=byte16;
+ Byte=t_calib.mid(4+i*12,4);
+ byte16=(int16_t)Byte.toInt(&ok,16);
+ if (ok)
+ calibSpanNeg[i]=byte16;
+ Byte=t_calib.mid(8+i*12,4);
+ byte16=(int16_t)Byte.toInt(&ok,16);
+ if (ok)
+ calibSpanPos[i]=byte16;
}
- if ((t_DisplaySet.length()==6) && (t_BeeperSet.length()==4) && (t_HapticSet.length()==6) && (t_SpeakerSet.length()==6)) {
- uint8_t byte8u;
- int8_t byte8;
- bool ok;
- byte8=(int8_t)t_DisplaySet.mid(0,2).toInt(&ok,16);
+ for (int i=0; i<4; i++) {
+ Byte=t_trainercalib.mid(i*4,4);
+ byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
- optrexDisplay=(byte8==1 ? true : false);
- byte8u=(uint8_t)t_DisplaySet.mid(2,2).toUInt(&ok,16);
+ trainer.calib[i]=byte16;
+ }
+ currentCalib=t_currentCalib;
+ vBatCalib=t_vBatCalib;
+ vBatWarn=t_vBatWarn;
+ PPM_Multiplier=t_PPM_Multiplier;
+ stickMode = t_stickMode;
+ }
+ if ((t_DisplaySet.length()==6) && (t_BeeperSet.length()==4) && (t_HapticSet.length()==6) && (t_SpeakerSet.length()==6)) {
+ uint8_t byte8u;
+ int8_t byte8;
+ bool ok;
+ byte8=(int8_t)t_DisplaySet.mid(0,2).toInt(&ok,16);
+ if (ok)
+ optrexDisplay=(byte8==1 ? true : false);
+ byte8u=(uint8_t)t_DisplaySet.mid(2,2).toUInt(&ok,16);
+ if (ok)
+ contrast=byte8u;
+ byte8u=(uint8_t)t_DisplaySet.mid(4,2).toUInt(&ok,16);
+ if (ok)
+ backlightBright=byte8u;
+ byte8=(int8_t)t_BeeperSet.mid(0,2).toUInt(&ok,16);
+ if (ok)
+ beeperMode=(BeeperMode)byte8;
+ byte8=(int8_t)t_BeeperSet.mid(2,2).toInt(&ok,16);
+ if (ok)
+ beeperLength=byte8;
+ byte8=(int8_t)t_HapticSet.mid(0,2).toUInt(&ok,16);
+ if (ok)
+ hapticMode=(BeeperMode)byte8;
+ byte8u=(uint8_t)t_HapticSet.mid(2,2).toUInt(&ok,16);
+ if (ok)
+ hapticStrength=byte8u;
+ byte8=(int8_t)t_HapticSet.mid(4,2).toInt(&ok,16);
+ if (ok)
+ hapticLength=byte8;
+ byte8u=(uint8_t)t_SpeakerSet.mid(0,2).toUInt(&ok,16);
+ if (ok)
+ speakerMode=byte8u;
+ byte8u=(uint8_t)t_SpeakerSet.mid(2,2).toUInt(&ok,16);
+ if (ok)
+ speakerPitch=byte8u;
+ byte8u=(uint8_t)t_SpeakerSet.mid(4,2).toUInt(&ok,16);
+ if (ok)
+ speakerVolume=byte8u;
+ if (t_CountrySet.length()==6) {
+ byte8u=(uint8_t)t_CountrySet.mid(0,2).toUInt(&ok,16);
if (ok)
- contrast=byte8u;
- byte8u=(uint8_t)t_DisplaySet.mid(4,2).toUInt(&ok,16);
+ countryCode=byte8u;
+ byte8u=(uint8_t)t_CountrySet.mid(2,2).toUInt(&ok,16);
if (ok)
- backlightBright=byte8u;
- byte8=(int8_t)t_BeeperSet.mid(0,2).toUInt(&ok,16);
- if (ok)
- beeperMode=(BeeperMode)byte8;
- byte8=(int8_t)t_BeeperSet.mid(2,2).toInt(&ok,16);
- if (ok)
- beeperLength=byte8;
- byte8=(int8_t)t_HapticSet.mid(0,2).toUInt(&ok,16);
- if (ok)
- hapticMode=(BeeperMode)byte8;
- byte8u=(uint8_t)t_HapticSet.mid(2,2).toUInt(&ok,16);
- if (ok)
- hapticStrength=byte8u;
- byte8=(int8_t)t_HapticSet.mid(4,2).toInt(&ok,16);
- if (ok)
- hapticLength=byte8;
- byte8u=(uint8_t)t_SpeakerSet.mid(0,2).toUInt(&ok,16);
- if (ok)
- speakerMode=byte8u;
- byte8u=(uint8_t)t_SpeakerSet.mid(2,2).toUInt(&ok,16);
- if (ok)
- speakerPitch=byte8u;
- byte8u=(uint8_t)t_SpeakerSet.mid(4,2).toUInt(&ok,16);
- if (ok)
- speakerVolume=byte8u;
- if (t_CountrySet.length()==6) {
- byte8u=(uint8_t)t_CountrySet.mid(0,2).toUInt(&ok,16);
- if (ok)
- countryCode=byte8u;
- byte8u=(uint8_t)t_CountrySet.mid(2,2).toUInt(&ok,16);
- if (ok)
- imperial=byte8u;
- QString chars=t_CountrySet.mid(4,2);
- ttsLanguage[0]=chars[0].toAscii();
- ttsLanguage[1]=chars[1].toAscii();
- }
+ imperial=byte8u;
+ QString chars=t_CountrySet.mid(4,2);
+ ttsLanguage[0]=chars[0].toAscii();
+ ttsLanguage[1]=chars[1].toAscii();
}
}
-
+ }
}
-RawSource GeneralSettings::getDefaultSource(unsigned int channel)
+int GeneralSettings::getDefaultStick(unsigned int channel) const
{
- unsigned int stick_index = chout_ar[4*templateSetup + channel] - 1;
- return RawSource(SOURCE_TYPE_STICK, stick_index);
+ if (channel >= NUM_STICKS)
+ return -1;
+ else
+ return chout_ar[4*templateSetup + channel] - 1;
+}
+
+RawSource GeneralSettings::getDefaultSource(unsigned int channel) const
+{
+ int stick = getDefaultStick(channel);
+ if (stick >= 0)
+ return RawSource(SOURCE_TYPE_STICK, stick);
+ else
+ return RawSource(SOURCE_TYPE_NONE);
+}
+
+int GeneralSettings::getDefaultChannel(unsigned int stick) const
+{
+ for (int i=0; i<4; i++){
+ if (getDefaultStick(i) == (int)stick)
+ return i;
+ }
+ return -1;
+}
+
+void FrSkyData::clear()
+{
+ memset(this, 0, sizeof(FrSkyData));
+ rssiAlarms[0].clear(2, 45);
+ rssiAlarms[1].clear(3, 42);
+ varioSource = 2/*VARIO*/;
+ blades = 2;
}
ModelData::ModelData()
@@ -903,6 +998,24 @@ ModelData::ModelData()
clear();
}
+ModelData::ModelData(const ModelData & src)
+{
+ *this = src;
+}
+
+ModelData & ModelData::operator = (const ModelData & src)
+{
+ memcpy(this, &src, sizeof(ModelData));
+
+ for (int i=0; imode == 0) break;
+ if (expo->chn == idx)
+ return true;
+ }
+ return false;
+}
+
void ModelData::removeInput(const int idx)
{
memmove(&expoData[idx], &expoData[idx+1], (C9X_MAX_EXPOS-(idx+1))*sizeof(ExpoData));
@@ -946,7 +1070,7 @@ void ModelData::clear()
moduleData[0].protocol=PPM;
moduleData[1].protocol=OFF;
}
- for (int i=0; igetBoard())) {
for (int i=0; isrcRaw = settings.getDefaultSource(i);
expo->weight = 100;
strncpy(inputNames[i], expo->srcRaw.toString().toLatin1().constData(), sizeof(inputNames[i])-1);
- MixData * mix = &mixData[i];
- mix->destCh = i+1;
- mix->weight = 100;
- mix->srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, this);
}
}
- else {
- for (int i=0; igetBoard())) {
+ setDefaultInputs(settings);
+ }
+
+ for (int i=0; idestCh = i+1;
+ mix->weight = 100;
+ if (IS_TARANIS(GetEepromInterface()->getBoard())) {
+ mix->srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, this);
+ }
+ else {
+ mix->srcRaw = RawSource(SOURCE_TYPE_STICK, i);
+ }
+ }
+}
+
+void ModelData::setDefaultValues(unsigned int id, const GeneralSettings & settings)
{
clear();
used = true;
@@ -1008,7 +1140,7 @@ void ModelData::setDefaultValues(unsigned int id, GeneralSettings & settings)
int ModelData::getTrimValue(int phaseIdx, int trimIdx)
{
int result = 0;
- for (int i=0; i eepromInterfaces;
void RegisterEepromInterfaces()
{
- eepromInterfaces.push_back(new OpenTxInterface(BOARD_STOCK));
- eepromInterfaces.push_back(new OpenTxInterface(BOARD_M128));
- eepromInterfaces.push_back(new OpenTxInterface(BOARD_GRUVIN9X));
- eepromInterfaces.push_back(new OpenTxInterface(BOARD_SKY9X));
- eepromInterfaces.push_back(new OpenTxInterface(BOARD_9XRPRO));
- eepromInterfaces.push_back(new OpenTxInterface(BOARD_TARANIS));
+ eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_STOCK));
+ eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_M128));
+ eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_GRUVIN9X));
+ eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_SKY9X));
+ eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_9XRPRO));
+ eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS));
+ eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS_PLUS));
if (g.rev4aSupport())
- eepromInterfaces.push_back(new OpenTxInterface(BOARD_TARANIS_REV4a));
+ eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS_REV4a));
eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_STOCK));
eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_GRUVIN9X));
eepromInterfaces.push_back(new Ersky9xInterface());
@@ -1100,16 +1233,24 @@ void RegisterEepromInterfaces()
eepromInterfaces.push_back(new Er9xInterface());
}
-QList firmwares;
+void UnregisterEepromInterfaces()
+{
+ foreach(EEPROMInterface * intf, eepromInterfaces) {
+ // qDebug() << "UnregisterEepromInterfaces(): deleting " << QString::number( reinterpret_cast(intf), 16 );
+ delete intf;
+ }
+ OpenTxEepromCleanup();
+}
+
+QList firmwares;
FirmwareVariant default_firmware_variant;
FirmwareVariant current_firmware_variant;
-void RegisterFirmwares()
+void UnregisterFirmwares()
{
- RegisterOpen9xFirmwares();
- default_firmware_variant = GetFirmwareVariant("opentx-9x-heli-templates-en");
- current_firmware_variant = default_firmware_variant;
- RegisterEepromInterfaces();
+ foreach (FirmwareInterface * f, firmwares) {
+ delete f;
+ }
}
bool LoadEeprom(RadioData &radioData, const uint8_t *eeprom, const int size)
@@ -1148,7 +1289,7 @@ FirmwareVariant GetFirmwareVariant(QString id)
{
FirmwareVariant result;
- foreach(FirmwareInfo * firmware, firmwares) {
+ foreach(FirmwareInterface * firmware, firmwares) {
if (id.contains(firmware->id+"-") || (!id.contains("-") && id.contains(firmware->id))) {
result.id = id;
result.firmware = firmware;
@@ -1160,13 +1301,13 @@ FirmwareVariant GetFirmwareVariant(QString id)
return default_firmware_variant;
}
-void FirmwareInfo::addOption(const char *option, QString tooltip, uint32_t variant)
+void FirmwareInterface::addOption(const char *option, QString tooltip, uint32_t variant)
{
Option options[] = { { option, tooltip, variant }, { NULL } };
addOptions(options);
}
-unsigned int FirmwareInfo::getVariant(const QString & variantId)
+unsigned int FirmwareInterface::getVariant(const QString & variantId)
{
unsigned int variant = variantBase;
QStringList options = variantId.mid(id.length()+1).split("-", QString::SkipEmptyParts);
@@ -1182,17 +1323,17 @@ unsigned int FirmwareInfo::getVariant(const QString & variantId)
return variant;
}
-void FirmwareInfo::addLanguage(const char *lang)
+void FirmwareInterface::addLanguage(const char *lang)
{
languages.push_back(lang);
}
-void FirmwareInfo::addTTSLanguage(const char *lang)
+void FirmwareInterface::addTTSLanguage(const char *lang)
{
ttslanguages.push_back(lang);
}
-void FirmwareInfo::addOptions(Option options[])
+void FirmwareInterface::addOptions(Option options[])
{
QList
- -
+
-
@@ -540,11 +65,11 @@
- Voice Language
+ Voice
- -
+
-
@@ -553,158 +78,122 @@
- Set language of voice.
+ Set voice language.
May be different from firmware language
+
-
+
+ en
+
+
+ -
+
+ cz
+
+
+ -
+
+ de
+
+
+ -
+
+ es
+
+
+ -
+
+ fr
+
+
+ -
+
+ it
+
+
+ -
+
+ pl
+
+
+ -
+
+ pt
+
+
+ -
+
+ se
+
+
- -
+
-
Download Voice
- -
-
-
-
- 0
- 0
-
-
-
- CheckBox
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- CheckBox
-
-
-
- -
+
-
Download FW
- -
-
-
- Options
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Qt::Horizontal
- -
-
+
-
+
+
+ Qt::Horizontal
+
+
+
+ -
+
-
+
0
0
+
+
+ Sans Serif
+ 75
+ true
+
+
- CheckBox
+ Firmware
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
- -
-
-
-
- 0
- 0
-
-
-
- CheckBox
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- CheckBox
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- CheckBox
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- CheckBox
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- CheckBox
-
-
-
- -
-
-
- Processor ID
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- CheckBox
-
-
-
- -
-
+
-
+
0
@@ -712,34 +201,21 @@ May be different from firmware language
- FwInfo
+ FwType
- -
-
-
-
- 0
- 0
-
-
+
-
+
- CheckBox
+ -
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Qt::Horizontal
+
-
+
+
+ Latest Download
@@ -747,51 +223,6 @@ May be different from firmware language
buttonBox
- downloadVerCB
- CPU_ID_LE
- langCombo
- optionCheckBox_2
- optionCheckBox_1
- optionCheckBox_3
- optionCheckBox_4
- optionCheckBox_5
- optionCheckBox_6
- optionCheckBox_7
- optionCheckBox_8
- optionCheckBox_9
- optionCheckBox_10
- optionCheckBox_11
- optionCheckBox_12
- optionCheckBox_13
- optionCheckBox_14
- optionCheckBox_15
- optionCheckBox_16
- optionCheckBox_17
- optionCheckBox_18
- optionCheckBox_19
- optionCheckBox_20
- optionCheckBox_21
- optionCheckBox_22
- optionCheckBox_23
- optionCheckBox_24
- optionCheckBox_25
- optionCheckBox_26
- optionCheckBox_27
- optionCheckBox_28
- optionCheckBox_29
- optionCheckBox_30
- optionCheckBox_31
- optionCheckBox_32
- optionCheckBox_33
- optionCheckBox_34
- optionCheckBox_35
- optionCheckBox_36
- optionCheckBox_37
- optionCheckBox_38
- optionCheckBox_39
- optionCheckBox_40
- optionCheckBox_41
- optionCheckBox_42
@@ -800,32 +231,16 @@ May be different from firmware language
buttonBox
accepted()
- fwPreferencesDialog
- accept()
+ FirmwarePreferencesDialog
+ close()
- 370
- 49
+ 345
+ 133
- 157
- 274
-
-
-
-
- buttonBox
- rejected()
- fwPreferencesDialog
- reject()
-
-
- 390
- 55
-
-
- 286
- 274
+ 207
+ 76
diff --git a/companion/src/generaledit.cpp b/companion/src/generaledit.cpp
index 8cccc654c..db610616e 100644
--- a/companion/src/generaledit.cpp
+++ b/companion/src/generaledit.cpp
@@ -2,6 +2,7 @@
#include "ui_generaledit.h"
#include "helpers.h"
#include "appdata.h"
+#include
#include
#define BIT_WARN_THR ( 0x01 )
@@ -78,13 +79,11 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
}
}
}
-
- QRegExp rx(CHAR_FOR_NAMES_REGEX);
- ui->ownerNameLE->setValidator(new QRegExpValidator(rx, this));
+
switchDefPosEditLock=true;
populateBacklightCB(ui->backlightswCB, g_eeGeneral.backlightMode);
bool voice = current_firmware_variant.id.contains("voice");
- if (!GetEepromInterface()->getCapability(MultiLangVoice)) {
+ if (!GetCurrentFirmware()->getCapability(MultiLangVoice)) {
ui->VoiceLang_label->hide();
ui->voiceLang_CB->hide();
} else {
@@ -103,11 +102,11 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
mavbaudEditLock=false;
}
- if (!GetEepromInterface()->getCapability(HasContrast)) {
+ if (!GetCurrentFirmware()->getCapability(HasContrast)) {
ui->contrastSB->hide();
ui->label_contrast->hide();
}
- if (!GetEepromInterface()->getCapability(HasSoundMixer)) {
+ if (!GetCurrentFirmware()->getCapability(HasSoundMixer)) {
ui->beepVolume_SL->hide();
ui->beepVolume_label->hide();
ui->varioVolume_SL->hide();
@@ -116,70 +115,44 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->bgVolume_label->hide();
ui->wavVolume_SL->hide();
ui->wavVolume_label->hide();
+ ui->varioP0_label->hide();
+ ui->varioP0_SB->hide();
+ ui->varioPMax_label->hide();
+ ui->varioPMax_SB->hide();
+ ui->varioR0_label->hide();
+ ui->varioR0_SB->hide();
} else {
ui->beepVolume_SL->setValue(g_eeGeneral.beepVolume);
ui->varioVolume_SL->setValue(g_eeGeneral.varioVolume);
ui->bgVolume_SL->setValue(g_eeGeneral.backgroundVolume);
ui->wavVolume_SL->setValue(g_eeGeneral.wavVolume);
+ ui->varioP0_SB->setValue(700+(g_eeGeneral.varioPitch*10));
+ updateVarioPitchRange();
+ ui->varioPMax_SB->setValue(700+(g_eeGeneral.varioPitch*10)+1000+(g_eeGeneral.varioRange*10));
+ ui->varioR0_SB->setValue(500+(g_eeGeneral.varioRepeat*10));
}
-
- if (!GetEepromInterface()->getCapability(HasBlInvert)) {
- ui->blinvert_cb->hide();
- ui->blinvert_label->hide();
- } else {
- ui->blinvert_cb->setChecked(g_eeGeneral.blightinv);
- }
- if (!GetEepromInterface()->getCapability(HasFAIMode)) {
+ if (!GetCurrentFirmware()->getCapability(HasFAIMode)) {
ui->faimode_CB->hide();
ui->label_faimode->hide();
}
else {
ui->faimode_CB->setChecked(g_eeGeneral.fai);
}
- ui->ownerNameLE->setText(g_eeGeneral.ownerName);
- if (!GetEepromInterface()->getCapability(OwnerName)) {
- ui->ownerNameLE->setDisabled(true);
- ui->label_ownerName->hide();
- ui->ownerNameLE->hide();
- ui->hideNameOnSplashChkB->setDisabled(true);
- ui->hideNameOnSplashChkB->hide();
- ui->label_hideOwnerName->hide();
- }
- if (!GetEepromInterface()->getCapability(HasInputFilter)) {
- ui->inputfilterCB->hide();
- ui->inputfilterLabel->hide();
- }
- if (!GetEepromInterface()->getCapability(HasStickScroll)) {
- ui->StickScrollChkB->hide();
- ui->StickScrollLB->hide();
- }
- if (!GetEepromInterface()->getCapability(TelemetryInternalAlarm)) {
- ui->frskyintalarmChkB->hide();
- ui->label_frskyintalarm->hide();
- }
- if (!GetEepromInterface()->getCapability(HasCrossTrims)) {
- ui->crosstrimChkB->hide();
- ui->crosstrimLB->hide();
- }
- if (!GetEepromInterface()->getCapability(HasPPMSim)) {
- ui->PPMSimLB->hide();
- ui->PPMSimChkB->hide();
- }
- if (!GetEepromInterface()->getCapability( HasPxxCountry)) {
+ if (!GetCurrentFirmware()->getCapability( HasPxxCountry)) {
ui->countrycode_label->hide();
ui->countrycode_CB->hide();
layout()->removeItem(ui->pxxCountry);
} else {
ui->countrycode_CB->setCurrentIndex(g_eeGeneral.countryCode);
}
- if (!GetEepromInterface()->getCapability( HasGeneralUnits)) {
+ if (!GetCurrentFirmware()->getCapability( HasGeneralUnits)) {
ui->units_label->hide();
ui->units_CB->hide();
} else {
ui->units_CB->setCurrentIndex(g_eeGeneral.imperial);
}
- if (!GetEepromInterface()->getCapability(TelemetryTimeshift)) {
+ if (!GetCurrentFirmware()->getCapability(TelemetryTimeshift)) {
ui->label_timezone->hide();
ui->timezoneSB->hide();
ui->timezoneSB->setDisabled(true);
@@ -189,155 +162,73 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->gpsFormatCB->setCurrentIndex(g_eeGeneral.gpsFormat);
ui->timezoneSB->setValue(g_eeGeneral.timezone);
- if (!GetEepromInterface()->getCapability(OptrexDisplay)) {
+ if (!GetCurrentFirmware()->getCapability(OptrexDisplay)) {
ui->label_displayType->hide();
ui->displayTypeCB->setDisabled(true);
ui->displayTypeCB->hide();
}
- if (!GetEepromInterface()->getCapability(HasVolume) && !voice) {
+ if (!GetCurrentFirmware()->getCapability(HasVolume) && !voice) {
ui->volume_SB->hide();
ui->volume_SB->setDisabled(true);
ui->label_volume->hide();
} else {
- ui->volume_SB->setMaximum(GetEepromInterface()->getCapability(MaxVolume));
+ ui->volume_SB->setMaximum(GetCurrentFirmware()->getCapability(MaxVolume));
}
- if (!GetEepromInterface()->getCapability(HasBrightness)) {
+ if (!GetCurrentFirmware()->getCapability(HasBrightness)) {
ui->BLBright_SB->hide();
ui->BLBright_SB->setDisabled(true);
ui->label_BLBright->hide();
}
- if (!GetEepromInterface()->getCapability(HasCurrentCalibration)) {
+ if (!GetCurrentFirmware()->getCapability(HasCurrentCalibration)) {
ui->CurrentCalib_SB->hide();
ui->CurrentCalib_SB->setDisabled(true);
ui->label_CurrentCalib->hide();
}
- if (GetEepromInterface()->getCapability(TelemetryRSSIModel) ) {
- ui->tabWidget->removeTab(2);
- }
ui->tabWidget->setCurrentIndex(0);
- if (!GetEepromInterface()->getCapability(SoundMod)) {
+ if (!GetCurrentFirmware()->getCapability(SoundMod)) {
ui->soundModeCB->setDisabled(true);
ui->label_soundMode->hide();
ui->soundModeCB->hide();
}
- if (!GetEepromInterface()->getCapability(SoundPitch)) {
+ if (!GetCurrentFirmware()->getCapability(SoundPitch)) {
ui->speakerPitchSB->setDisabled(true);
ui->label_speakerPitch->hide();
ui->speakerPitchSB->hide();
}
- if (!GetEepromInterface()->getCapability(Haptic)) {
+ if (!GetCurrentFirmware()->getCapability(Haptic)) {
ui->hapticStrengthSB->setDisabled(true);
- ui->hapticStrengthSB->hide();
- ui->label_hapticStrengthSB->hide();
- }
-
- if (GetEepromInterface()->getCapability(PerModelTimers)) {
- ui->beepCountDownChkB->hide();
- ui->beepFlashChkB->hide();
- ui->beepMinuteChkB->hide();
- ui->label_timers->hide();
- }
-
-
- if (!GetEepromInterface()->getCapability(HapticMode)) {
ui->hapticmodeCB->setDisabled(true);
- ui->hapticmodeCB->hide();
- ui->label_hapticmode->hide();
}
- if (!GetEepromInterface()->getCapability(BandgapMeasure)) {
- ui->BandGapEnableChkB->setDisabled(true);
- ui->BandGapEnableChkB->hide();
- ui->label_BandGapEnable->hide();
- }
-
- if (!GetEepromInterface()->getCapability(PotScrolling)) {
- ui->PotScrollEnableChkB->setDisabled(true);
- ui->PotScrollEnableChkB->hide();
- ui->label_PotScrollEnable->hide();
- }
-
- if (!GetEepromInterface()->getCapability(TrainerSwitch)) {
- ui->label_switch->hide();
- ui->swtchCB_1->setDisabled(true);
- ui->swtchCB_2->setDisabled(true);
- ui->swtchCB_3->setDisabled(true);
- ui->swtchCB_4->setDisabled(true);
- ui->swtchCB_1->hide();
- ui->swtchCB_2->hide();
- ui->swtchCB_3->hide();
- ui->swtchCB_4->hide();
- } else {
- populateSwitchCB(ui->swtchCB_1,g_eeGeneral.trainer.mix[0].swtch);
- populateSwitchCB(ui->swtchCB_2,g_eeGeneral.trainer.mix[1].swtch);
- populateSwitchCB(ui->swtchCB_3,g_eeGeneral.trainer.mix[2].swtch);
- populateSwitchCB(ui->swtchCB_4,g_eeGeneral.trainer.mix[3].swtch);
- }
- if (!GetEepromInterface()->getCapability(BLonStickMove)) {
- ui->blOnStickMoveSB->setDisabled(true);
- ui->blOnStickMoveSB->hide();
- ui->label_blOnStickMove->hide();
- } else {
- ui->blOnStickMoveSB->setValue(g_eeGeneral.lightOnStickMove*5);
- }
- if (!GetEepromInterface()->getCapability(gsSwitchMask)) {
- ui->swAILChkB->setDisabled(true);
- ui->swELEChkB->setDisabled(true);
- ui->swTHRChkB->setDisabled(true);
- ui->swRUDChkB->setDisabled(true);
- ui->swGEAChkB->setDisabled(true);
- ui->swID0ChkB->setDisabled(true);
- ui->swID1ChkB->setDisabled(true);
- ui->swID2ChkB->setDisabled(true);
- ui->swAILChkB->hide();
- ui->swELEChkB->hide();
- ui->swTHRChkB->hide();
- ui->swRUDChkB->hide();
- ui->swGEAChkB->hide();
- ui->swID0ChkB->hide();
- ui->swID1ChkB->hide();
- ui->swID2ChkB->hide();
- this->layout()->removeItem(ui->switchMaskLayout);
- } else {
- setSwitchDefPos();
- }
- if (!GetEepromInterface()->getCapability(TelemetryAlarm)) {
- ui->telalarmsChkB->hide();
- ui->label_telalarms->hide();
- }
- int renumber=GetEepromInterface()->getCapability(RotaryEncoders);
+ int renumber=GetCurrentFirmware()->getCapability(RotaryEncoders);
if (renumber==0) {
ui->re_label->hide();
ui->re_CB->hide();
- } else {
+ }
+ else {
populateRotEncCB(ui->re_CB, g_eeGeneral.reNavigation, renumber);
}
- ui->telalarmsChkB->setChecked(g_eeGeneral.enableTelemetryAlarm);
- ui->PotScrollEnableChkB->setChecked(!g_eeGeneral.disablePotScroll);
- ui->BandGapEnableChkB->setChecked(!g_eeGeneral.disableBG);
+
ui->contrastSB->setValue(g_eeGeneral.contrast);
ui->battwarningDSB->setValue((double)g_eeGeneral.vBatWarn/10);
ui->backlightautoSB->setValue(g_eeGeneral.backlightDelay*5);
ui->inactimerSB->setValue(g_eeGeneral.inactivityTimer);
- ui->crosstrimChkB->setChecked(g_eeGeneral.crosstrim);
- ui->frskyintalarmChkB->setChecked(g_eeGeneral.frskyinternalalarm);
- ui->StickScrollChkB->setChecked(g_eeGeneral.stickScroll);
- ui->PPMSimChkB->setChecked(g_eeGeneral.enablePpmsim);
- ui->inputfilterCB->setCurrentIndex(g_eeGeneral.filterInput);
ui->memwarnChkB->setChecked(!g_eeGeneral.disableMemoryWarning); //Default is zero=checked
ui->alarmwarnChkB->setChecked(!g_eeGeneral.disableAlarmWarning);//Default is zero=checked
- ui->enableTelemetryAlarmChkB->setChecked(g_eeGeneral.enableTelemetryAlarm);
- ui->beepMinuteChkB->setChecked(g_eeGeneral.minuteBeep);
- ui->beepCountDownChkB->setChecked(g_eeGeneral.preBeep);
- ui->beepFlashChkB->setChecked(g_eeGeneral.flashBeep);
- ui->splashScreenChkB->setChecked(!g_eeGeneral.splashMode);
- ui->hideNameOnSplashChkB->setChecked(!g_eeGeneral.hideNameOnSplash);
+ if (IS_TARANIS(GetEepromInterface()->getBoard())) {
+ ui->splashScreenChkB->hide();
+ ui->splashScreenDuration->setCurrentIndex(3-g_eeGeneral.splashDuration);
+ }
+ else {
+ ui->splashScreenDuration->hide();
+ ui->splashScreenChkB->setChecked(!g_eeGeneral.splashMode);
+ }
ui->trnMode_1->setCurrentIndex(g_eeGeneral.trainer.mix[0].mode);
ui->trnChn_1->setCurrentIndex(g_eeGeneral.trainer.mix[0].src);
@@ -351,7 +242,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->trnMode_4->setCurrentIndex(g_eeGeneral.trainer.mix[3].mode);
ui->trnChn_4->setCurrentIndex(g_eeGeneral.trainer.mix[3].src);
ui->trnWeight_4->setValue(g_eeGeneral.trainer.mix[3].weight);
- int potsnum=GetEepromInterface()->getCapability(Pots);
+ int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (potsnum==3) {
ui->label_pot4->hide();
ui->ana8Neg->hide();
@@ -365,9 +256,10 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(unlockSwitchEdited()));
}
- if (GetEepromInterface()->getCapability(MultiposPots)) {
+ if (GetCurrentFirmware()->getCapability(MultiposPots)) {
ui->pot1Type->setCurrentIndex(g_eeGeneral.potsType[0]);
ui->pot2Type->setCurrentIndex(g_eeGeneral.potsType[1]);
+ ui->pot3Type->setCurrentIndex(g_eeGeneral.potsType[2]);
}
else {
ui->potsTypeSeparator->hide();
@@ -375,6 +267,44 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->pot1TypeLabel->hide();
ui->pot2Type->hide();
ui->pot2TypeLabel->hide();
+ ui->pot3Type->hide();
+ ui->pot3TypeLabel->hide();
+ }
+
+ if (IS_TARANIS(eepromInterface->getBoard())) {
+ ui->serialPortMode->setCurrentIndex(g_eeGeneral.hw_uartMode);
+ }
+ else {
+ ui->serialPortMode->hide();
+ ui->serialPortLabel->hide();
+ }
+
+ if (!IS_TARANIS(eepromInterface->getBoard())) {
+ ui->stickReverse1->setChecked(g_eeGeneral.stickReverse & (1 << 0));
+ ui->stickReverse2->setChecked(g_eeGeneral.stickReverse & (1 << 1));
+ ui->stickReverse3->setChecked(g_eeGeneral.stickReverse & (1 << 2));
+ ui->stickReverse4->setChecked(g_eeGeneral.stickReverse & (1 << 3));
+ connect(ui->stickReverse1, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited()));
+ connect(ui->stickReverse2, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited()));
+ connect(ui->stickReverse3, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited()));
+ connect(ui->stickReverse4, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited()));
+ }
+ else {
+ ui->stickReverseLB->hide();
+ ui->stickReverse1->hide();
+ ui->stickReverse2->hide();
+ ui->stickReverse3->hide();
+ ui->stickReverse4->hide();
+ }
+
+ if (IS_TARANIS_PLUS(eepromInterface->getBoard())) {
+ ui->backlightColor_SL->setValue(g_eeGeneral.backlightColor);
+ }
+ else {
+ ui->backlightColor_label->hide();
+ ui->backlightColor_SL->hide();
+ ui->backlightColor1_label->hide();
+ ui->backlightColor2_label->hide();
}
}
@@ -383,6 +313,12 @@ GeneralEdit::~GeneralEdit()
delete ui;
}
+void GeneralEdit::stickReverseEdited()
+{
+ g_eeGeneral.stickReverse = ((int)ui->stickReverse1->isChecked()) | ((int)ui->stickReverse2->isChecked()<<1) | ((int)ui->stickReverse3->isChecked()<<2) | ((int)ui->stickReverse4->isChecked()<<3);
+ updateSettings();
+}
+
void GeneralEdit::on_pot1Type_currentIndexChanged(int index)
{
g_eeGeneral.potsType[0] = index;
@@ -395,6 +331,18 @@ void GeneralEdit::on_pot2Type_currentIndexChanged(int index)
updateSettings();
}
+void GeneralEdit::on_pot3Type_currentIndexChanged(int index)
+{
+ g_eeGeneral.potsType[2] = index;
+ updateSettings();
+}
+
+void GeneralEdit::on_serialPortMode_currentIndexChanged(int index)
+{
+ g_eeGeneral.hw_uartMode = index;
+ updateSettings();
+}
+
void GeneralEdit::unlockSwitchEdited()
{
int i=0;
@@ -415,11 +363,12 @@ void GeneralEdit::setValues()
ui->beeperCB->setCurrentIndex(g_eeGeneral.beeperMode+2);
ui->channelorderCB->setCurrentIndex(g_eeGeneral.templateSetup);
ui->stickmodeCB->setCurrentIndex(g_eeGeneral.stickMode);
- if (!GetEepromInterface()->getCapability(HapticLength)) {
+ if (GetCurrentFirmware()->getCapability(Haptic)) {
+ ui->hapticLengthCB->setCurrentIndex(g_eeGeneral.hapticLength+2);
+ }
+ else {
ui->label_HL->hide();
ui->hapticLengthCB->hide();
- } else {
- ui->hapticLengthCB->setCurrentIndex(g_eeGeneral.hapticLength+2);
}
ui->BLBright_SB->setValue(100-g_eeGeneral.backlightBright);
ui->soundModeCB->setCurrentIndex(g_eeGeneral.speakerMode);
@@ -428,9 +377,8 @@ void GeneralEdit::setValues()
ui->speakerPitchSB->setValue(g_eeGeneral.speakerPitch);
ui->hapticStrengthSB->setValue(g_eeGeneral.hapticStrength);
ui->hapticmodeCB->setCurrentIndex(g_eeGeneral.hapticMode+2);
- ui->battcalibDSB->setValue((double)g_eeGeneral.vBatCalib/10);
+ ui->battCalibDSB->setValue((double)g_eeGeneral.vBatCalib/10);
ui->CurrentCalib_SB->setValue((double)g_eeGeneral.currentCalib);
- ui->battCalib->setValue((double)g_eeGeneral.vBatCalib/10);
ui->ana1Neg->setValue(g_eeGeneral.calibSpanNeg[0]);
ui->ana2Neg->setValue(g_eeGeneral.calibSpanNeg[1]);
@@ -466,27 +414,6 @@ void GeneralEdit::setValues()
ui->PPM_MultiplierDSB->setValue((qreal)(g_eeGeneral.PPM_Multiplier+10)/10);
}
-void GeneralEdit::setSwitchDefPos()
-{
- quint8 x = g_eeGeneral.switchWarningStates & 0x38;
- if(x==0x00 || x==0x18 || x== 0x28 || x==0x38 || x==0x30) //illegal states for ID0/1/2
- {
- g_eeGeneral.switchWarningStates &= ~0x38; // turn all off, make sure only one is on
- g_eeGeneral.switchWarningStates |= 0x08;
- }
-
- switchDefPosEditLock = true;
- ui->swTHRChkB->setChecked(g_eeGeneral.switchWarningStates & 0x01);
- ui->swRUDChkB->setChecked(g_eeGeneral.switchWarningStates & 0x02);
- ui->swELEChkB->setChecked(g_eeGeneral.switchWarningStates & 0x04);
- ui->swID0ChkB->setChecked(g_eeGeneral.switchWarningStates & 0x08);
- ui->swID1ChkB->setChecked(g_eeGeneral.switchWarningStates & 0x10);
- ui->swID2ChkB->setChecked(g_eeGeneral.switchWarningStates & 0x20);
- ui->swAILChkB->setChecked(g_eeGeneral.switchWarningStates & 0x40);
- ui->swGEAChkB->setChecked(g_eeGeneral.switchWarningStates & 0x80);
- switchDefPosEditLock = false;
-}
-
void GeneralEdit::updateSettings()
{
radioData.generalSettings = g_eeGeneral;
@@ -505,10 +432,9 @@ void GeneralEdit::on_battwarningDSB_editingFinished()
updateSettings();
}
-void GeneralEdit::on_battcalibDSB_editingFinished()
+void GeneralEdit::on_battCalibDSB_editingFinished()
{
- g_eeGeneral.vBatCalib = ui->battcalibDSB->value()*10;
- ui->battCalib->setValue(ui->battcalibDSB->value());
+ g_eeGeneral.vBatCalib = ui->battCalibDSB->value()*10;
updateSettings();
}
@@ -590,35 +516,24 @@ void GeneralEdit::on_backlightautoSB_editingFinished()
}
}
+void GeneralEdit::on_backlightColor_SL_valueChanged()
+{
+ g_eeGeneral.backlightColor = ui->backlightColor_SL->value();
+ updateSettings();
+}
+
void GeneralEdit::on_timezoneSB_editingFinished()
{
g_eeGeneral.timezone = ui->timezoneSB->value();
updateSettings();
}
-
-void GeneralEdit::on_blOnStickMoveSB_editingFinished()
-{
- int i = ui->blOnStickMoveSB->value()/5;
- if((i*5)!=ui->blOnStickMoveSB->value())
- ui->blOnStickMoveSB->setValue(i*5);
-
- g_eeGeneral.lightOnStickMove = i;
- updateSettings();
-}
-
void GeneralEdit::on_inactimerSB_editingFinished()
{
g_eeGeneral.inactivityTimer = ui->inactimerSB->value();
updateSettings();
}
-void GeneralEdit::on_inputfilterCB_currentIndexChanged(int index)
-{
- g_eeGeneral.filterInput = index;
- updateSettings();
-}
-
void GeneralEdit::on_memwarnChkB_stateChanged(int )
{
g_eeGeneral.disableMemoryWarning = ui->memwarnChkB->isChecked() ? 0 : 1;
@@ -631,12 +546,6 @@ void GeneralEdit::on_alarmwarnChkB_stateChanged(int )
updateSettings();
}
-void GeneralEdit::on_enableTelemetryAlarmChkB_stateChanged(int )
-{
- g_eeGeneral.enableTelemetryAlarm = ui->enableTelemetryAlarmChkB->isChecked();
- updateSettings();
-}
-
void GeneralEdit::on_beeperCB_currentIndexChanged(int index)
{
g_eeGeneral.beeperMode = (BeeperMode)(index-2);
@@ -885,13 +794,6 @@ void GeneralEdit::on_ana8Pos_editingFinished()
updateSettings();
}
-void GeneralEdit::on_battCalib_editingFinished()
-{
- g_eeGeneral.vBatCalib = ui->battCalib->value()*10;
- ui->battcalibDSB->setValue(ui->battCalib->value());
- updateSettings();
-}
-
void GeneralEdit::on_volume_SB_editingFinished()
{
g_eeGeneral.speakerVolume = ui->volume_SB->value();
@@ -934,6 +836,31 @@ void GeneralEdit::on_bgVolume_SL_valueChanged()
updateSettings();
}
+void GeneralEdit::on_varioP0_SB_editingFinished()
+{
+ g_eeGeneral.varioPitch = (ui->varioP0_SB->value()-700)/10;
+ updateVarioPitchRange();
+ updateSettings();
+}
+
+void GeneralEdit::updateVarioPitchRange()
+{
+ ui->varioPMax_SB->setMaximum(700+(g_eeGeneral.varioPitch*10)+1000+800);
+ ui->varioPMax_SB->setMinimum(700+(g_eeGeneral.varioPitch*10)+1000-800);
+}
+
+void GeneralEdit::on_varioPMax_SB_editingFinished()
+{
+ g_eeGeneral.varioRange = (ui->varioPMax_SB->value()-(700+(g_eeGeneral.varioPitch*10))-1000)/10;
+ updateSettings();
+}
+
+void GeneralEdit::on_varioR0_SB_editingFinished()
+{
+ g_eeGeneral.varioRepeat = (ui->varioR0_SB->value()-500)/10;
+ updateSettings();
+}
+
void GeneralEdit::on_PPM1_editingFinished()
{
g_eeGeneral.trainer.calib[0] = ui->PPM1->value();
@@ -963,34 +890,15 @@ void GeneralEdit::on_tabWidget_currentChanged(int index)
g.generalEditTab(index);
}
-
-void GeneralEdit::on_beepMinuteChkB_stateChanged(int )
-{
- g_eeGeneral.minuteBeep = ui->beepMinuteChkB->isChecked() ? 1 : 0;
- updateSettings();
-}
-
-void GeneralEdit::on_beepCountDownChkB_stateChanged(int )
-{
- g_eeGeneral.preBeep = ui->beepCountDownChkB->isChecked() ? 1 : 0;
- updateSettings();
-}
-
-void GeneralEdit::on_beepFlashChkB_stateChanged(int )
-{
- g_eeGeneral.flashBeep = ui->beepFlashChkB->isChecked() ? 1 : 0;
- updateSettings();
-}
-
void GeneralEdit::on_splashScreenChkB_stateChanged(int )
{
g_eeGeneral.splashMode = ui->splashScreenChkB->isChecked() ? 0 : 1;
updateSettings();
}
-void GeneralEdit::on_hideNameOnSplashChkB_stateChanged(int )
+void GeneralEdit::on_splashScreenDuration_currentIndexChanged(int index)
{
- g_eeGeneral.hideNameOnSplash = ui->hideNameOnSplashChkB->isChecked() ? 0 : 1;
+ g_eeGeneral.splashDuration = 3-index;
updateSettings();
}
@@ -1000,12 +908,6 @@ void GeneralEdit::on_PPM_MultiplierDSB_editingFinished()
updateSettings();
}
-void GeneralEdit::on_ownerNameLE_editingFinished()
-{
- strncpy(g_eeGeneral.ownerName, ui->ownerNameLE->text().toAscii(), 10);
- updateSettings();
-}
-
void GeneralEdit::on_speakerPitchSB_editingFinished()
{
g_eeGeneral.speakerPitch = ui->speakerPitchSB->value();
@@ -1024,18 +926,6 @@ void GeneralEdit::on_soundModeCB_currentIndexChanged(int index)
updateSettings();
}
-void GeneralEdit::on_PotScrollEnableChkB_stateChanged(int )
-{
- g_eeGeneral.disablePotScroll = ui->PotScrollEnableChkB->isChecked() ? false : true;
- updateSettings();
-}
-
-void GeneralEdit::on_blinvert_cb_stateChanged(int )
-{
- g_eeGeneral.blightinv = ui->blinvert_cb->isChecked();
- updateSettings();
-}
-
void GeneralEdit::on_faimode_CB_stateChanged(int )
{
if (ui->faimode_CB->isChecked()) {
@@ -1053,164 +943,11 @@ void GeneralEdit::on_faimode_CB_stateChanged(int )
updateSettings();
}
-void GeneralEdit::on_BandGapEnableChkB_stateChanged(int )
-{
- g_eeGeneral.disableBG = ui->BandGapEnableChkB->isChecked() ? false : true;
- updateSettings();
-}
-
-void GeneralEdit::on_crosstrimChkB_stateChanged(int )
-{
- g_eeGeneral.crosstrim = ui->crosstrimChkB->isChecked() ? true : false;
- updateSettings();
-}
-
-void GeneralEdit::on_frskyintalarmChkB_stateChanged(int )
-{
- g_eeGeneral.frskyinternalalarm = ui->frskyintalarmChkB->isChecked() ? true : false ;
- updateSettings();
-}
-
-void GeneralEdit::on_StickScrollChkB_stateChanged(int )
-{
- g_eeGeneral.stickScroll = ui->StickScrollChkB->isChecked() ? true : false;
- updateSettings();
-}
-
-void GeneralEdit::on_PPMSimChkB_stateChanged(int )
-{
- g_eeGeneral.enablePpmsim = ui->PPMSimChkB->isChecked() ? true : false;
- updateSettings();
-}
-
-void GeneralEdit::on_swtchCB_1_currentIndexChanged(int index)
-{
- g_eeGeneral.trainer.mix[0].swtch = RawSwitch(ui->swtchCB_1->itemData(ui->swtchCB_1->currentIndex()).toInt());
- updateSettings();
-}
-
-void GeneralEdit::on_swtchCB_2_currentIndexChanged(int index)
-{
- g_eeGeneral.trainer.mix[1].swtch = RawSwitch(ui->swtchCB_2->itemData(ui->swtchCB_2->currentIndex()).toInt());
- updateSettings();
-}
-
-void GeneralEdit::on_swtchCB_3_currentIndexChanged(int index)
-{
- g_eeGeneral.trainer.mix[2].swtch = RawSwitch(ui->swtchCB_3->itemData(ui->swtchCB_3->currentIndex()).toInt());
- updateSettings();
-}
-
-void GeneralEdit::on_swtchCB_4_currentIndexChanged(int index)
-{
- g_eeGeneral.trainer.mix[3].swtch = RawSwitch(ui->swtchCB_4->itemData(ui->swtchCB_4->currentIndex()).toInt());
- updateSettings();
-}
-
-void GeneralEdit::getGeneralSwitchDefPos(int i, bool val)
-{
- if(val)
- g_eeGeneral.switchWarningStates |= (1<<(i-1));
- else
- g_eeGeneral.switchWarningStates &= ~(1<<(i-1));
-}
-
-void GeneralEdit::on_swTHRChkB_stateChanged(int )
-{
- if(switchDefPosEditLock) return;
- getGeneralSwitchDefPos(1,ui->swTHRChkB->isChecked());
- updateSettings();
-}
-
-void GeneralEdit::on_telalarmsChkB_stateChanged(int )
-{
- g_eeGeneral.enableTelemetryAlarm=ui->telalarmsChkB->isChecked();
- updateSettings();
-}
-
-void GeneralEdit::on_swRUDChkB_stateChanged(int )
-{
- if(switchDefPosEditLock) return;
- getGeneralSwitchDefPos(2,ui->swRUDChkB->isChecked());
- updateSettings();
-}
-void GeneralEdit::on_swELEChkB_stateChanged(int )
-{
- getGeneralSwitchDefPos(3,ui->swELEChkB->isChecked());
- updateSettings();
-}
-void GeneralEdit::on_swID0ChkB_stateChanged(int )
-{
- if(switchDefPosEditLock) return;
-
- if(ui->swID0ChkB->isChecked())
- {
- switchDefPosEditLock = true;
- ui->swID1ChkB->setChecked(false);
- ui->swID2ChkB->setChecked(false);
- switchDefPosEditLock = false;
- }
- else
- return;
-
- g_eeGeneral.switchWarningStates &= ~0x30; //turn off ID1/2
- getGeneralSwitchDefPos(4,ui->swID0ChkB->isChecked());
- updateSettings();
-}
-void GeneralEdit::on_swID1ChkB_stateChanged(int )
-{
- if(switchDefPosEditLock) return;
-
- if(ui->swID1ChkB->isChecked())
- {
- switchDefPosEditLock = true;
- ui->swID0ChkB->setChecked(false);
- ui->swID2ChkB->setChecked(false);
- switchDefPosEditLock = false;
- }
- else
- return;
-
- g_eeGeneral.switchWarningStates &= ~0x28; //turn off ID0/2
- getGeneralSwitchDefPos(5,ui->swID1ChkB->isChecked());
- updateSettings();
-}
-void GeneralEdit::on_swID2ChkB_stateChanged(int )
-{
- if(switchDefPosEditLock) return;
-
- if(ui->swID2ChkB->isChecked())
- {
- switchDefPosEditLock = true;
- ui->swID0ChkB->setChecked(false);
- ui->swID1ChkB->setChecked(false);
- switchDefPosEditLock = false;
- }
- else
- return;
-
- g_eeGeneral.switchWarningStates &= ~0x18; //turn off ID1/2
- getGeneralSwitchDefPos(6,ui->swID2ChkB->isChecked());
- updateSettings();
-}
-void GeneralEdit::on_swAILChkB_stateChanged(int )
-{
- if(switchDefPosEditLock) return;
- getGeneralSwitchDefPos(7,ui->swAILChkB->isChecked());
- updateSettings();
-}
-void GeneralEdit::on_swGEAChkB_stateChanged(int )
-{
- if(switchDefPosEditLock) return;
- getGeneralSwitchDefPos(8,ui->swGEAChkB->isChecked());
- updateSettings();
-}
-
void GeneralEdit::on_calretrieve_PB_clicked()
{
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
QString calib=g.profile[profile_id].stickPotCalib();
- int potsnum=GetEepromInterface()->getCapability(Pots);
+ int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (calib.isEmpty()) {
return;
} else {
@@ -1320,7 +1057,7 @@ void GeneralEdit::on_calstore_PB_clicked()
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
QString name=g.profile[profile_id].name();
- int potsnum=GetEepromInterface()->getCapability(Pots);
+ int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (name.isEmpty()) {
ui->calstore_PB->setDisabled(true);
return;
@@ -1356,6 +1093,9 @@ void GeneralEdit::on_calstore_PB_clicked()
g.profile[profile_id].haptic( QString("%1%2%3").arg(((uint8_t)g_eeGeneral.hapticMode), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticStrength, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticLength, 2, 16, QChar('0')));
g.profile[profile_id].speaker( QString("%1%2%3").arg((uint8_t)g_eeGeneral.speakerMode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerPitch, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerVolume, 2, 16, QChar('0')));
g.profile[profile_id].countryCode( QString("%1%2%3").arg((uint8_t)g_eeGeneral.countryCode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.imperial, 2, 16, QChar('0')).arg(g_eeGeneral.ttsLanguage));
+
+ QDateTime dateTime = QDateTime::currentDateTime();
+ g.profile[profile_id].timeStamp(dateTime.toString("yyyy-MM-dd hh:mm"));
QMessageBox::information(this, "Companion", tr("Calibration and HW parameters saved."));
}
}
diff --git a/companion/src/generaledit.h b/companion/src/generaledit.h
index ce160dc0b..f48bb91a0 100644
--- a/companion/src/generaledit.h
+++ b/companion/src/generaledit.h
@@ -27,20 +27,13 @@ private:
bool mavbaudEditLock;
void getGeneralSwitchDefPos(int i, bool val);
void setSwitchDefPos();
+ void updateVarioPitchRange();
signals:
void modelValuesChanged();
private slots:
- void on_ownerNameLE_editingFinished();
- void on_PotScrollEnableChkB_stateChanged(int);
- void on_blinvert_cb_stateChanged(int);
void on_faimode_CB_stateChanged(int );
- void on_BandGapEnableChkB_stateChanged(int);
- void on_crosstrimChkB_stateChanged(int );
- void on_frskyintalarmChkB_stateChanged(int );
- void on_StickScrollChkB_stateChanged(int );
- void on_PPMSimChkB_stateChanged(int );
void on_speakerPitchSB_editingFinished();
void on_timezoneSB_editingFinished();
void on_hapticStrengthSB_editingFinished();
@@ -50,37 +43,30 @@ private slots:
void on_hapticmodeCB_currentIndexChanged(int index);
void on_hapticLengthCB_currentIndexChanged(int index);
void on_PPM_MultiplierDSB_editingFinished();
- void on_splashScreenChkB_stateChanged(int );
- void on_hideNameOnSplashChkB_stateChanged(int);
- void on_beepCountDownChkB_stateChanged(int );
- void on_beepMinuteChkB_stateChanged(int );
+ void on_splashScreenChkB_stateChanged(int);
+ void on_splashScreenDuration_currentIndexChanged(int index);
void on_alarmwarnChkB_stateChanged(int );
- void on_enableTelemetryAlarmChkB_stateChanged(int );
void on_gpsFormatCB_currentIndexChanged(int index);
void on_tabWidget_currentChanged(int index);
void on_displayTypeCB_currentIndexChanged(int index);
void on_BLBright_SB_editingFinished();
+ void on_backlightColor_SL_valueChanged();
void on_re_CB_currentIndexChanged(int index);
void on_countrycode_CB_currentIndexChanged(int index);
void on_units_CB_currentIndexChanged(int index);
void on_trnMode_1_currentIndexChanged(int index);
void on_trnChn_1_currentIndexChanged(int index);
- void on_swtchCB_1_currentIndexChanged(int index);
void on_trnWeight_1_editingFinished();
void on_trnMode_2_currentIndexChanged(int index);
void on_trnChn_2_currentIndexChanged(int index);
- void on_swtchCB_2_currentIndexChanged(int index);
void on_trnWeight_2_editingFinished();
void on_trnMode_3_currentIndexChanged(int index);
void on_trnChn_3_currentIndexChanged(int index);
- void on_swtchCB_3_currentIndexChanged(int index);
void on_trnWeight_3_editingFinished();
void on_trnMode_4_currentIndexChanged(int index);
- void on_swtchCB_4_currentIndexChanged(int index);
void on_trnChn_4_currentIndexChanged(int index);
void on_trnWeight_4_editingFinished();
- void on_battCalib_editingFinished();
void on_CurrentCalib_SB_editingFinished();
void on_ana1Neg_editingFinished();
@@ -119,38 +105,33 @@ private slots:
void on_varioVolume_SL_valueChanged();
void on_wavVolume_SL_valueChanged();
+ void on_varioP0_SB_editingFinished();
+ void on_varioPMax_SB_editingFinished();
+ void on_varioR0_SB_editingFinished();
+
void on_pot1Type_currentIndexChanged(int index);
void on_pot2Type_currentIndexChanged(int index);
+ void on_pot3Type_currentIndexChanged(int index);
+ void on_serialPortMode_currentIndexChanged(int index);
void on_stickmodeCB_currentIndexChanged(int index);
void on_channelorderCB_currentIndexChanged(int index);
void on_beeperCB_currentIndexChanged(int index);
void on_memwarnChkB_stateChanged(int );
- void on_telalarmsChkB_stateChanged(int );
- void on_inputfilterCB_currentIndexChanged(int index);
void on_inactimerSB_editingFinished();
void on_backlightautoSB_editingFinished();
void on_backlightswCB_currentIndexChanged(int index);
void on_mavbaud_CB_currentIndexChanged(int index);
void on_voiceLang_CB_currentIndexChanged(int index);
- void on_blOnStickMoveSB_editingFinished();
- void on_battcalibDSB_editingFinished();
+ void on_battCalibDSB_editingFinished();
void on_battwarningDSB_editingFinished();
void on_contrastSB_editingFinished();
- void on_beepFlashChkB_stateChanged(int );
- void on_swTHRChkB_stateChanged(int );
- void on_swRUDChkB_stateChanged(int );
- void on_swELEChkB_stateChanged(int );
- void on_swID0ChkB_stateChanged(int );
- void on_swID1ChkB_stateChanged(int );
- void on_swID2ChkB_stateChanged(int );
- void on_swAILChkB_stateChanged(int );
- void on_swGEAChkB_stateChanged(int );
void on_calretrieve_PB_clicked();
void on_calstore_PB_clicked();
void unlockSwitchEdited();
void setValues();
void shrink();
+ void stickReverseEdited();
};
#endif // GENERALEDIT_H
diff --git a/companion/src/generaledit.ui b/companion/src/generaledit.ui
index 8f66dcab1..410f056e4 100644
--- a/companion/src/generaledit.ui
+++ b/companion/src/generaledit.ui
@@ -6,7 +6,7 @@
0
0
- 795
+ 804
912
@@ -106,638 +106,50 @@
These will be relevant for all models in the same EEPROM.
- 3
+ 0
Setup
- -
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- 23
-
-
-
- -
-
-
-
-
-
- Country Code
-
-
-
- -
-
-
-
-
- America
-
-
- -
-
- Japan
-
-
- -
-
- Europe
-
-
-
-
-
-
- -
-
-
- MAVLink Baud Rate
-
-
-
- -
-
-
-
-
-
- Voice Language
-
-
-
- -
-
-
-
-
- -
-
-
- Measurement Units
-
-
-
- -
-
-
-
-
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Single Beep Every whole Minute</span></p></body></html>
-
-
- Every Minute
-
-
-
- -
-
-
- Beeps at 30, 15, 10, and down from5 seconds
-
-
- Count Down to Zero
-
-
-
- -
-
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Flash backlight on timer beep</span></p></body></html>
-
-
- Flash on beep
-
-
-
-
-
- -
-
-
-
-
-
- Beep volume
-
-
-
- -
-
-
- -2
-
-
- 2
-
-
- 1
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Wav volume
-
-
-
- -
-
-
- -2
-
-
- 2
-
-
- 1
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Vario volume
-
-
-
- -
-
-
- -2
-
-
- 2
-
-
- 1
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Background volume
-
-
-
- -
-
-
- -2
-
-
- 2
-
-
- 1
-
-
- Qt::Horizontal
-
-
-
-
-
- -
-
-
- PPMSim
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
-
- -
-
+
-
+
-
- 4800 Baud
+ X-Short
-
- 9600 Baud
+ Short
-
- 14400 Baud
+ Normal
-
- 19200 Baud
+ Long
-
- 38400 Baud
-
-
- -
-
- 57600 Baud
-
-
- -
-
- 76800 Baud
-
-
- -
-
- 115200 Baud
+ X-Long
- -
-
+
-
+
- Beeper Length
+ Speaker Pitch (spkr only)
- -
-
-
- Pot Scrolling Enable
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
-
-
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">LCD Screen Contrast</span></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Values can be 20-45</span></p></body></html>
-
-
- 10
-
-
- 45
-
-
- 25
-
-
-
- -
-
-
- Haptic Length
-
-
-
- -
-
-
-
-
-
-
-
-
- Mode selection:
-
-Mode 1:
- Left stick: Elevator, Rudder
- Right stick: Throttle, Aileron
-
-Mode 2:
- Left stick: Throttle, Rudder
- Right stick: Elevator, Aileron
-
-Mode 3:
- Left stick: Elevator, Aileron
- Right stick: Throttle, Rudder
-
-Mode 4:
- Left stick: Throttle, Aileron
- Right stick: Elevator, Rudder
-
-
-
-
- 1
-
-
-
-
- Mode 1 (RUD ELE THR AIL)
-
-
- -
-
- Mode 2 (RUD THR ELE AIL)
-
-
- -
-
- Mode 3 (AIL ELE THR RUD)
-
-
- -
-
- Mode 4 (AIL THR ELE RUD)
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- LCD Display Type
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- 5
-
-
-
- -
-
-
- BackLight On Stick Move
-
-
-
- -
-
-
-
-
-
-
-
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">LCD Screen Contrast</span></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Values can be 20-45</span></p></body></html>
-
-
- 1
-
-
- 20
-
-
- 1
-
-
-
- -
-
-
- sec
-
-
- 600
-
-
- 5
-
-
-
- -
-
-
- Beeper Mode
-
-
-
- -
-
-
- Timeshift from UTC
-
-
-
- -
-
-
- RotEnc Navigation
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
-
-
-
-
- -
-
-
- FrSky Internal Alarm
-
-
-
- -
-
-
-
-
-
- THR
-
-
-
- -
-
-
- RUD
-
-
-
- -
-
-
- ELE
-
-
-
- -
-
-
- AIL
-
-
-
- -
-
-
- GEA
-
-
-
- -
-
-
- ID0
-
-
-
- -
-
-
- ID1
-
-
-
- -
-
-
- ID2
-
-
-
-
-
- -
-
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Warnings</span></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These will define startup warnings.</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Throttle warning - will alert if the throttle is not at idle during startup</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switch warning - will alert if switches are not in their defaul position</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Memory warning - will alert if there's not a lot of memory left</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Silent mode warning - will alert you if the beeper is set to quiet (0)</p></body></html>
-
-
-
-
-
- true
-
-
-
- -
-
-
-
-
-
- GPS Coordinates
-
-
-
- -
-
-
-
-
- hh° (N/S) mm' ss''.dd
-
-
- -
-
- NMEA
-
-
-
-
-
-
- -
-
-
- If you enable FAI, you loose the vario, the play functions, the telemetry screen. This function cannot be disabled by the radio.
-
-
-
-
-
-
- -
+
-
@@ -746,9 +158,7 @@ p, li { white-space: pre-wrap; }
- Channel order
-
-This is used by the templated to determine which channel goes to what number output.
+ <html><head/><body><p>Channel order</p><p><br/></p><p>Defines the order of the default mixes created on a new model.</p></body></html>
0
@@ -875,334 +285,187 @@ This is used by the templated to determine which channel goes to what number out
- -
-
+
-
+
+
+ If you enable FAI, you loose the vario, the play functions, the telemetry screen. This function cannot be disabled by the radio.
+
- Show Owner Name on Splash
+
- -
-
+
-
+
+
-
+
+
+ Color 1
+
+
+
+ -
+
+
+ 100
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Color 2
+
+
+
+
+
+ -
+
+
-
+
+
+ Country Code
+
+
+
+ -
+
+
-
+
+ America
+
+
+ -
+
+ Japan
+
+
+ -
+
+ Europe
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+ Mode selection:
+
+Mode 1:
+ Left stick: Elevator, Rudder
+ Right stick: Throttle, Aileron
+
+Mode 2:
+ Left stick: Throttle, Rudder
+ Right stick: Elevator, Aileron
+
+Mode 3:
+ Left stick: Elevator, Aileron
+ Right stick: Throttle, Rudder
+
+Mode 4:
+ Left stick: Throttle, Aileron
+ Right stick: Elevator, Rudder
+
+
+
+
+ 1
+
+
-
+
+ Mode 1 (RUD ELE THR AIL)
+
+
+ -
+
+ Mode 2 (RUD THR ELE AIL)
+
+
+ -
+
+ Mode 3 (AIL ELE THR RUD)
+
+
+ -
+
+ Mode 4 (AIL THR ELE RUD)
+
+
+
+
+ -
+
- Speaker Pitch (spkr only)
+ Beeper Length
- -
-
-
- -
-
-
-
-
- X-Short
-
-
- -
-
- Short
-
-
- -
-
- Normal
-
-
- -
-
- Long
-
-
- -
-
- X-Long
-
-
+ -
+
+
+ Vario pitch at zero
+
- -
-
+
-
+
+
-
+
+
+ Voice Language
+
+
+
+ -
+
+
+
+
+ -
+
- StickScroll
+ Readonly Unlock
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
- -
-
-
- FAI Mode
-
-
-
- -
-
-
- Haptic Strength
-
-
-
- -
-
-
-
-
- Beeper
-
-
- -
-
- Speaker
-
-
- -
-
- BeeperVoice
-
-
- -
-
- SpeakerVoice
-
-
-
-
- -
-
-
-
-
- X-Short
-
-
- -
-
- Short
-
-
- -
-
- Normal
-
-
- -
-
- Long
-
-
- -
-
- X-Long
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Show Splash Screen on Startup
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Warnings</span></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These will define startup warnings.</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Throttle warning - will alert if the throttle is not at idle during startup</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switch warning - will alert if switches are not in their defaul position</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Memory warning - will alert if there's not a lot of memory left</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Silent mode warning - will alert you if the beeper is set to quiet (0)</p></body></html>
-
-
-
-
-
- true
-
-
-
- -
-
-
- -14
-
-
- 12
-
-
- 0
-
-
-
- -
-
-
-
-
- Metric
-
-
- -
-
- Imperial
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Channel Order (For Templates)
-
-
-
- -
-
-
- Stick Mode
-
-
-
- -
-
-
- Haptic Mode
-
-
-
- -
-
-
-
-
-
- Owner Name
-
-
-
- -
-
-
- BackLight Invert
-
-
-
- -
-
+
-
+
- Qt::Horizontal
+ Qt::Vertical
- 40
- 20
+ 20
+ 5
- -
-
-
-
-
- Standard
-
-
- -
-
- Optrex
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
- Show splash screen on startup
-
-
- Show splash screen on startup
-
+
-
+
-
+ Sound Mode
- -
-
-
-
-
- Quiet
-
-
- -
-
- Only Alarms
-
-
- -
-
- No Keys
-
-
- -
-
- All
-
-
-
-
- -
-
-
- 100
-
-
-
- -
+
-
@@ -1241,291 +504,191 @@ p, li { white-space: pre-wrap; }
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
-
-
-
- If this value is not 0, any keypress will turn on the backlight and turn it off after the specified number of seconds.
-
-
- sec
-
-
- 600
-
-
- 5
-
-
-
- -
-
-
- 10
-
-
-
- -
-
-
- Timer Beeps
-
-
-
- -
-
-
- BackLight Brightness
-
-
-
- -
-
-
-
-
-
- Contrast
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- BackLight Auto OFF after
-
-
-
- -
-
+
-
+
-
- Single
+ Quiet
-
- Oversample
+ Only Alarms
-
- Filter
+ No Keys
+
+
+ -
+
+ All
- -
-
-
-
-
-
-
-
-
- This is the switch selectrion for turning on the backlight (if installed).
-
-
-
-
- -1
-
-
-
- -
-
-
- Bandgap Measuring Enable
-
-
-
- -
-
-
- Input Filter
-
-
-
- -
-
-
- CrossTrim
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
-
- -
-
-
- Sound Mode
-
-
-
- -
-
+
-
+
- Qt::Vertical
+ Qt::Horizontal
- 20
- 5
+ 40
+ 20
- -
-
+
-
+
- BackLight Switch
+ Haptic Mode
- -
-
-
-
-
-
-
-
-
- Battery calibration:
-This value will be added to the measured battery voltage. Use this value to calibrate the meter with an external meter.
-
-
-
-
-
- v
-
-
- 1
-
-
- -9.900000000000000
-
-
- 9.900000000000000
-
-
- 0.100000000000000
-
-
-
- -
-
+
-
+
- Battery Calibration
+ Stick Mode
- -
-
-
-
-
-
- Battery Warning
-
-
-
- -
-
+
-
+
-
+
0
0
-
-
-
-
-
-
-
- Battery warning voltage.
-This is the threashhold where the battery warning sounds.
-
-Acceptable values are 5v..10v
-
-
-
-
-
- v
-
-
- 1
+
+ Default Channel Order
+
+
+ -
+
+
-
+
+ Metric
+
+
+ -
+
+ Imperial
+
+
+
+
+ -
+
- 4.000000000000000
+ -14
- 12.000000000000000
-
-
- 0.100000000000000
+ 12
- 9.600000000000000
+ 0
- -
-
+
-
+
+
-
+
+ X-Short
+
+
+ -
+
+ Short
+
+
+ -
+
+ Normal
+
+
+ -
+
+ Long
+
+
+ -
+
+ X-Long
+
+
+
+
+ -
+
+
-
+
+ Beeper
+
+
+ -
+
+ Speaker
+
+
+ -
+
+ BeeperVoice
+
+
+ -
+
+ SpeakerVoice
+
+
+
+
+ -
+
- Telemetry NO DATA Alarm
+ FAI Mode
- -
-
+
-
+
+
-
+
+
+ GPS Coordinates
+
+
+
+ -
+
+
-
+
+ hh° (N/S) mm' ss''.dd
+
+
+ -
+
+ NMEA
+
+
+
+
+
+
+ -
+
- Readonly Unlock
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+ Measurement Units
- -
-
-
- Speaker Volume
-
-
-
- -
-
-
-
- 0
- 0
-
-
+
-
+
@@ -1533,32 +696,47 @@ Acceptable values are 5v..10v
- If not zero will sound beeps if the transmitter has been left without inputs for the specified number of minutes.
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">LCD Screen Contrast</span></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Values can be 20-45</span></p></body></html>
-
- min
+
+ 1
- 120
+ 20
+
+
+ 1
- -
-
+
-
+
- Inactivity Timer
+ Beeper Mode
- -
+
-
+
+
+ Timeshift from UTC
+
+
+
+ -
QLayout::SetMinimumSize
-
+
0
-
+
0
-
@@ -2078,49 +1256,348 @@ Acceptable values are 5v..10v
- -
-
+
-
+
+
+ Hz
+
+
+ 300
+
+
+ 1100
+
+
+ 10
+
+
+ 700
+
+
+
+ -
+
+
+
+
+
+ Battery Warning
+
+
+
+ -
+
-
+
0
0
-
-
- 16777215
- 16777215
-
-
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Warnings</span></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These will define startup warnings.</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Throttle warning - will alert if the throttle is not at idle during startup</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switch warning - will alert if switches are not in their defaul position</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Memory warning - will alert if there's not a lot of memory left</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Silent mode warning - will alert you if the beeper is set to quiet (0)</p></body></html>
-
-
+
-
- true
+
+
+
+
+ Battery warning voltage.
+This is the threashhold where the battery warning sounds.
+
+Acceptable values are 5v..10v
+
+
+
+
+
+ V
+
+
+ 1
+
+
+ 4.000000000000000
+
+
+ 12.000000000000000
+
+
+ 0.100000000000000
+
+
+ 9.600000000000000
- -
-
+
-
+
- Alarm Warning
+ Vario pitch at max
- -
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+ If this value is not 0, any keypress will turn on the backlight and turn it off after the specified number of seconds.
+
+
+ sec
+
+
+ 600
+
+
+ 5
+
+
+
+ -
+
+
+ Hz
+
+
+ 1300
+
+
+ 2900
+
+
+ 10
+
+
+ 1700
+
+
+
+ -
+
+
+ ms
+
+
+ 200
+
+
+ 1000
+
+
+ 10
+
+
+ 500
+
+
+
+ -
+
+
+ Backlight Brightness
+
+
+
+ -
+
+
+ Vario repeat at zero
+
+
+
+ -
+
+
+ Backlight Auto OFF after
+
+
+
+ -
+
+
+ 100
+
+
+
+ -
+
+
+ -
+
+
+ RotEnc Navigation
+
+
+
+ -
+
+
+ Backlight color
+
+
+
+ -
+
+
-
+
+ Standard
+
+
+ -
+
+ Optrex
+
+
+
+
+ -
+
+
+
+
+
+ Contrast
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+ If not zero will sound beeps if the transmitter has been left without inputs for the specified number of minutes.
+
+
+ min
+
+
+ 120
+
+
+
+ -
+
+
-
+
+ 4800 Baud
+
+
+ -
+
+ 9600 Baud
+
+
+ -
+
+ 14400 Baud
+
+
+ -
+
+ 19200 Baud
+
+
+ -
+
+ 38400 Baud
+
+
+ -
+
+ 57600 Baud
+
+
+ -
+
+ 76800 Baud
+
+
+ -
+
+ 115200 Baud
+
+
+
+
+ -
+
+
+ Backlight Switch
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ 23
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Show Splash Screen on Startup
+
+
+
+ -
+
+
+
+
+
+
+
+
+ This is the switch selectrion for turning on the backlight (if installed).
+
+
+
+
+ -1
+
+
+
+ -
+
+
+ LCD Display Type
+
+
+
+ -
@@ -2155,13 +1632,351 @@ p, li { white-space: pre-wrap; }
- -
-
+
-
+
- Memory Startup Warning
+ MAVLink Baud Rate
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+ 10
+
+
+ 45
+
+
+ 25
+
+
+
+ -
+
+
+ Speaker Volume
+
+
+
+ -
+
+
+ Haptic Length
+
+
+
+ -
+
+
+ Inactivity Timer
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Warnings</span></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These will define startup warnings.</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Throttle warning - will alert if the throttle is not at idle during startup</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switch warning - will alert if switches are not in their defaul position</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Memory warning - will alert if there's not a lot of memory left</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Silent mode warning - will alert you if the beeper is set to quiet (0)</p></body></html>
+
+
+
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ 5
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Show splash screen on startup
+
+
+ Show splash screen on startup
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
-
+
+ ---
+
+
+ -
+
+ 2s
+
+
+ -
+
+ 3s
+
+
+ -
+
+ 4s
+
+
+ -
+
+ 6s
+
+
+ -
+
+ 8s
+
+
+ -
+
+ 10s
+
+
+ -
+
+ 15s
+
+
+
+
+
+
+ -
+
+
+ "No Sound" Warning
+
+
+
+ -
+
+
+ Low Memory Warning
+
+
+
+ -
+
+
+ Haptic Strength
+
+
+
+ -
+
+
-
+
+
+ Beep volume
+
+
+
+ -
+
+
+ -2
+
+
+ 2
+
+
+ 1
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Wav volume
+
+
+
+ -
+
+
+ -2
+
+
+ 2
+
+
+ 1
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Vario volume
+
+
+
+ -
+
+
+ -2
+
+
+ 2
+
+
+ 1
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Background volume
+
+
+
+ -
+
+
+ -2
+
+
+ 2
+
+
+ 1
+
+
+ Qt::Horizontal
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Stick reverse (order as above)
+
+
+
+ -
+
+
-
+
+
+ 1
+
+
+
+ -
+
+
+ 2
+
+
+
+ -
+
+
+ 3
+
+
+
+ -
+
+
+ 4
+
+
+
+
+
@@ -2209,17 +2024,16 @@ p, li { white-space: pre-wrap; }
- -
-
-
- Switch
-
-
-
-
+
+
+ 0
+ 0
+
+
- PPM 1
+ Rud
@@ -2315,13 +2129,16 @@ p, li { white-space: pre-wrap; }
- -
-
-
-
+
+
+ 0
+ 0
+
+
- PPM 2
+ Ele
@@ -2456,13 +2273,16 @@ p, li { white-space: pre-wrap; }
- -
-
-
-
+
+
+ 0
+ 0
+
+
- PPM 3
+ Thr
@@ -2500,13 +2320,16 @@ p, li { white-space: pre-wrap; }
- -
-
-
-
+
+
+ 0
+ 0
+
+
- PPM 4
+ Ail
@@ -2602,9 +2425,6 @@ p, li { white-space: pre-wrap; }
- -
-
-
-
@@ -2620,209 +2440,6 @@ p, li { white-space: pre-wrap; }
-
-
- Telemetry
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- RSSI Alarm 1
-
-
-
- -
-
-
-
-
-
- true
-
-
-
- 0
- 0
-
-
-
-
-
-
- 0
-
-
- 256
-
-
- 1
-
-
- 0
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
- ----
-
-
- -
-
- Yellow
-
-
- -
-
- Orange
-
-
- -
-
- Red
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- RSSI Alarm 2
-
-
-
- -
-
-
-
-
-
- true
-
-
-
- 0
- 0
-
-
-
-
-
-
- 0
-
-
- 256
-
-
- 1
-
-
- 0
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
- ----
-
-
- -
-
- Yellow
-
-
- -
-
- Orange
-
-
- -
-
- Red
-
-
-
-
-
-
- -
-
-
- NO DATA Alarm
-
-
-
- -
-
-
- true
-
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Warnings</span></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These will define startup warnings.</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Throttle warning - will alert if the throttle is not at idle during startup</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switch warning - will alert if switches are not in their defaul position</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Memory warning - will alert if there's not a lot of memory left</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Silent mode warning - will alert you if the beeper is set to quiet (0)</p></body></html>
-
-
-
-
-
- false
-
-
-
-
-
Calibration
@@ -2844,7 +2461,7 @@ p, li { white-space: pre-wrap; }
-
- POT 4
+ Pot. 4
@@ -2858,7 +2475,7 @@ p, li { white-space: pre-wrap; }
-
- POT 3
+ Pot. 3
@@ -2878,14 +2495,14 @@ p, li { white-space: pre-wrap; }
-
- POT 2
+ Pot. 2
-
- POT 1
+ Pot. 1
@@ -2912,7 +2529,7 @@ p, li { white-space: pre-wrap; }
-
- STICK 3
+ Stick 3
@@ -2949,7 +2566,7 @@ p, li { white-space: pre-wrap; }
-
- STICK 1
+ Stick 1
@@ -2998,7 +2615,7 @@ p, li { white-space: pre-wrap; }
-
- STICK 2
+ Stick 2
@@ -3083,7 +2700,7 @@ p, li { white-space: pre-wrap; }
-
- STICK 4
+ Stick 4
@@ -3150,7 +2767,7 @@ p, li { white-space: pre-wrap; }
-
-
+
@@ -3520,6 +3137,11 @@ p, li { white-space: pre-wrap; }
3 - Loud.
4 - Extra loud.
+
-
+
+ None
+
+
-
Pot (normal)
@@ -3556,6 +3178,11 @@ p, li { white-space: pre-wrap; }
3 - Loud.
4 - Extra loud.
+
-
+
+ None
+
+
-
Pot (normal)
@@ -3575,6 +3202,76 @@ p, li { white-space: pre-wrap; }
+ -
+
+
+ S3 Type
+
+
+
+ -
+
+
+
+
+
+
+
+
+ Beeper volume
+
+0 - Quiet. No beeps at all.
+1 - No Keys. Normal beeps but menu keys do not beep.
+2 - Normal.
+3 - Loud.
+4 - Extra loud.
+
+
-
+
+ None
+
+
+ -
+
+ Pot (normal)
+
+
+ -
+
+ Multipos Switch
+
+
+
+
+ -
+
+
-
+
+ OFF
+
+
+ -
+
+ S-Port Mirror
+
+
+ -
+
+ Debug
+
+
+
+
+ -
+
+
+ Serial Port
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
@@ -3582,40 +3279,19 @@ p, li { white-space: pre-wrap; }
- ownerNameLE
- beepMinuteChkB
- beepCountDownChkB
- beepFlashChkB
- swTHRChkB
- swRUDChkB
- swELEChkB
- swAILChkB
- swGEAChkB
- swID0ChkB
- swID1ChkB
- swID2ChkB
channelorderCB
trnMode_1
trnChn_1
trnWeight_1
- swtchCB_1
trnMode_2
trnChn_2
trnWeight_2
- swtchCB_2
trnMode_3
trnChn_3
trnWeight_3
- swtchCB_3
trnMode_4
trnChn_4
trnWeight_4
- swtchCB_4
- rssiAlarm1SB
- rssiAlarm1CB
- rssiAlarm2SB
- rssiAlarm2CB
- enableTelemetryAlarmChkB
ana1Neg
ana1Mid
ana1Pos
@@ -3628,7 +3304,7 @@ p, li { white-space: pre-wrap; }
ana4Neg
ana4Mid
ana4Pos
- battCalib
+ battCalibDSB
PPM1
PPM2
PPM3
diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp
index 536921de1..d9d6fdde6 100644
--- a/companion/src/helpers.cpp
+++ b/companion/src/helpers.cpp
@@ -2,9 +2,45 @@
#include "appdata.h"
#include "helpers.h"
#include "simulatordialog.h"
+#include "simulatorinterface.h"
#include "flashinterface.h"
-QString getPhaseName(int val, char * phasename)
+const QColor colors[C9X_MAX_CURVES] = {
+ QColor(0,0,127),
+ QColor(0,127,0),
+ QColor(127,0,0),
+ QColor(0,127,127),
+ QColor(127,0,127),
+ QColor(127,127,0),
+ QColor(127,127,127),
+ QColor(0,0,255),
+ QColor(0,127,255),
+ QColor(127,0,255),
+ QColor(0,255,0),
+ QColor(0,255,127),
+ QColor(127,255,0),
+ QColor(255,0,0),
+ QColor(255,0,127),
+ QColor(255,127,0),
+ QColor(0,0,127),
+ QColor(0,127,0),
+ QColor(127,0,0),
+ QColor(0,127,127),
+ QColor(127,0,127),
+ QColor(127,127,0),
+ QColor(127,127,127),
+ QColor(0,0,255),
+ QColor(0,127,255),
+ QColor(127,0,255),
+ QColor(0,255,0),
+ QColor(0,255,127),
+ QColor(127,255,0),
+ QColor(255,0,0),
+ QColor(255,0,127),
+ QColor(255,127,0),
+};
+
+QString getPhaseName(int val, const char * phasename)
{
if (!val) return "---";
if (!phasename) {
@@ -26,9 +62,12 @@ QString getInputStr(ModelData & model, int index)
{
QString result;
- if (GetEepromInterface()->getCapability(VirtualInputs)) {
- result = model.inputNames[index];
- if (result.isEmpty()) {
+ if (GetCurrentFirmware()->getCapability(VirtualInputs)) {
+ if (strlen(model.inputNames[index]) > 0) {
+ result = QObject::tr("[I%1]").arg(index+1);
+ result += QString(model.inputNames[index]);
+ }
+ else {
result = QObject::tr("Input%1").arg(index+1, 2, 10, QChar('0'));
}
}
@@ -63,27 +102,6 @@ void populateVoiceLangCB(QComboBox *b, QString language)
}
}
-void populateTTraceCB(QComboBox *b, int value)
-{
- const QString strings9x[] = { QObject::tr("THR"), QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
- const QString stringstaranis[] = { QObject::tr("THR"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("LS"), QObject::tr("RS")};
- b->clear();
- if (IS_TARANIS(GetEepromInterface()->getBoard())) {
- for (int i=0; i< 5; i++) {
- b->addItem(stringstaranis[i]);
- }
- } else {
- for (int i=0; i< 4; i++) {
- b->addItem(strings9x[i]);
- }
- }
- int channels=(IS_ARM(GetEepromInterface()->getBoard()) ? 32 : 16);
- for (int i=1; i<= channels; i++) {
- b->addItem(QObject::tr("CH%1").arg(i, 2, 10, QChar('0')));
- }
- b->setCurrentIndex(value);
-}
-
void populateRotEncCB(QComboBox *b, int value, int renumber)
{
QString strings[] = { QObject::tr("No"), QObject::tr("RotEnc A"), QObject::tr("Rot Enc B"), QObject::tr("Rot Enc C"), QObject::tr("Rot Enc D"), QObject::tr("Rot Enc E")};
@@ -95,31 +113,6 @@ void populateRotEncCB(QComboBox *b, int value, int renumber)
b->setCurrentIndex(value);
}
-void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last=false, int hubproto=0)
-{
- int telem_hub[] = {0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,0,0,2,2,1,1,1,1,1,1};
- b->clear();
-
- b->addItem(RawSource(SOURCE_TYPE_NONE, 0).toString());
-
- for (unsigned int i = 0; i <= (last ? TELEMETRY_SOURCES_DISPLAY_COUNT : TELEMETRY_SOURCES_STATUS_COUNT); i++) {
- b->addItem(RawSource(SOURCE_TYPE_TELEMETRY, i).toString());
- if (!(i>=sizeof(telem_hub)/sizeof(int) || telem_hub[i]==0 || ((telem_hub[i]>=hubproto) && hubproto!=0))) {
- QModelIndex index = b->model()->index(i, 0);
- QVariant v(0);
- b->model()->setData(index, v, Qt::UserRole - 1);
- }
- }
-
- if (value>=sizeof(telem_hub)/sizeof(int))
- b->setCurrentIndex(0);
- else if (telem_hub[value]==0 || ((telem_hub[value]>=hubproto) && hubproto!=0)) {
- b->setCurrentIndex(value);
- }
-
- b->setMaxVisibleItems(10);
-}
-
QString getProtocolStr(const int proto)
{
static const char *strings[] = { "OFF",
@@ -136,7 +129,7 @@ QString getProtocolStr(const int proto)
void populatePhasesCB(QComboBox *b, int value)
{
- for (int i=-GetEepromInterface()->getCapability(FlightPhases); i<=GetEepromInterface()->getCapability(FlightPhases); i++) {
+ for (int i=-GetCurrentFirmware()->getCapability(FlightModes); i<=GetCurrentFirmware()->getCapability(FlightModes); i++) {
if (i < 0)
b->addItem(QObject::tr("!Flight mode %1").arg(-i-1), i);
else if (i > 0)
@@ -144,13 +137,13 @@ void populatePhasesCB(QComboBox *b, int value)
else
b->addItem(QObject::tr("----"), 0);
}
- b->setCurrentIndex(value + GetEepromInterface()->getCapability(FlightPhases));
+ b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightModes));
}
bool gvarsEnabled()
{
int gvars=0;
- if (GetEepromInterface()->getCapability(HasVariants)) {
+ if (GetCurrentFirmware()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
@@ -288,11 +281,11 @@ void CurveGroup::update()
break;
case CurveReference::CURVE_REF_CUSTOM:
{
- int numcurves = GetEepromInterface()->getCapability(NumCurves);
+ int numcurves = GetCurrentFirmware()->getCapability(NumCurves);
if (lastType != curve.type) {
lastType = curve.type;
curveValueCB->clear();
- for (int i=-numcurves; iaddItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, i).toString());
}
}
@@ -340,7 +333,7 @@ void CurveGroup::valuesChanged()
curve = CurveReference(CurveReference::CURVE_REF_FUNC, curveValueCB->currentIndex());
break;
case 3:
- curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, curveValueCB->currentIndex() - GetEepromInterface()->getCapability(NumCurves));
+ curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, curveValueCB->currentIndex() - GetCurrentFirmware()->getCapability(NumCurves));
break;
}
@@ -351,7 +344,7 @@ void CurveGroup::valuesChanged()
void populateGvarUseCB(QComboBox *b, unsigned int phase)
{
b->addItem(QObject::tr("Own value"));
- for (int i=0; igetCapability(FlightPhases); i++) {
+ for (int i=0; igetCapability(FlightModes); i++) {
if (i != (int)phase) {
b->addItem(QObject::tr("Flight mode %1 value").arg(i));
}
@@ -372,8 +365,10 @@ void populateBacklightCB(QComboBox *b, const uint8_t value)
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
{
+ GeneralSettings fakeSettings;
+
if (IS_ARM(GetEepromInterface()->getBoard())) {
- populateSwitchCB(b, value);
+ populateSwitchCB(b, value, fakeSettings);
}
else {
RawSwitch item;
@@ -384,7 +379,7 @@ void populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
- for (int i=1; i<=GetEepromInterface()->getCapability(SwitchesPositions); i++) {
+ for (int i=1; i<=GetCurrentFirmware()->getCapability(SwitchesPositions); i++) {
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
@@ -398,25 +393,32 @@ void populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
}
}
-void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr)
+void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr)
{
RawSwitch item;
b->clear();
if (attr & POPULATE_ONOFF) {
+ if (IS_ARM(GetCurrentFirmware()->getBoard())) {
+ for (int i=-GetCurrentFirmware()->getCapability(FlightModes); i<0; i++) {
+ item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
+ b->addItem(item.toString(), item.toValue());
+ if (item == value) b->setCurrentIndex(b->count()-1);
+ }
+ }
item = RawSwitch(SWITCH_TYPE_OFF);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
- for (int i=-GetEepromInterface()->getCapability(LogicalSwitches); i<0; i++) {
+ for (int i=-GetCurrentFirmware()->getCapability(LogicalSwitches); i<0; i++) {
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
- for (int i=-GetEepromInterface()->getCapability(RotaryEncoders); i<0; i++) {
+ for (int i=-GetCurrentFirmware()->getCapability(RotaryEncoders); i<0; i++) {
item = RawSwitch(SWITCH_TYPE_ROTARY_ENCODER, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
@@ -428,13 +430,17 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr)
if (item == value) b->setCurrentIndex(b->count()-1);
}
- for (int i=-GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i<0; i++) {
- item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i);
- b->addItem(item.toString(), item.toValue());
- if (item == value) b->setCurrentIndex(b->count()-1);
+ for (int i=GetCurrentFirmware()->getCapability(MultiposPots)-1; i>=0; i--) {
+ if (generalSettings.potsType[i] == 2/* TODO constant*/) {
+ for (int j=-GetCurrentFirmware()->getCapability(MultiposPotsPositions); j<0; j++) {
+ item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i*GetCurrentFirmware()->getCapability(MultiposPotsPositions)+j);
+ b->addItem(item.toString(), item.toValue());
+ if (item == value) b->setCurrentIndex(b->count()-1);
+ }
+ }
}
- for (int i=-GetEepromInterface()->getCapability(SwitchesPositions); i<0; i++) {
+ for (int i=-GetCurrentFirmware()->getCapability(SwitchesPositions); i<0; i++) {
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
@@ -453,16 +459,20 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr)
if (item == value) b->setCurrentIndex(b->count()-1);
}
- for (int i=1; i<=GetEepromInterface()->getCapability(SwitchesPositions); i++) {
+ for (int i=1; i<=GetCurrentFirmware()->getCapability(SwitchesPositions); i++) {
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
- for (int i=1; i<=GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i++) {
- item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i);
- b->addItem(item.toString(), item.toValue());
- if (item == value) b->setCurrentIndex(b->count()-1);
+ for (int i=0; igetCapability(MultiposPots); i++) {
+ if (generalSettings.potsType[i] == 2/* TODO constant*/) {
+ for (int j=1; j<=GetCurrentFirmware()->getCapability(MultiposPotsPositions); j++) {
+ item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i*GetCurrentFirmware()->getCapability(MultiposPotsPositions)+j);
+ b->addItem(item.toString(), item.toValue());
+ if (item == value) b->setCurrentIndex(b->count()-1);
+ }
+ }
}
for (int i=1; i<=8; i++) {
@@ -471,13 +481,13 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr)
if (item == value) b->setCurrentIndex(b->count()-1);
}
- for (int i=1; i<=GetEepromInterface()->getCapability(RotaryEncoders); i++) {
+ for (int i=1; i<=GetCurrentFirmware()->getCapability(RotaryEncoders); i++) {
item = RawSwitch(SWITCH_TYPE_ROTARY_ENCODER, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
- for (int i=1; i<=GetEepromInterface()->getCapability(LogicalSwitches); i++) {
+ for (int i=1; i<=GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
@@ -487,6 +497,13 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr)
item = RawSwitch(SWITCH_TYPE_ON);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
+ if (IS_ARM(GetCurrentFirmware()->getBoard())) {
+ for (int i=1; i<=GetCurrentFirmware()->getCapability(FlightModes); i++) {
+ item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
+ b->addItem(item.toString(), item.toValue());
+ if (item == value) b->setCurrentIndex(b->count()-1);
+ }
+ }
}
b->setMaxVisibleItems(10);
@@ -499,7 +516,7 @@ void populateGVCB(QComboBox *b, int value)
b->clear();
- int pgvars = GetEepromInterface()->getCapability(Gvars);
+ int pgvars = GetCurrentFirmware()->getCapability(Gvars);
for (int i=-pgvars; i<=-1; i++) {
int16_t gval = (int16_t)(-10000+i);
b->addItem(QObject::tr("-GV%1").arg(-i), gval);
@@ -543,21 +560,23 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
}
if (flags & POPULATE_VIRTUAL_INPUTS) {
- int virtualInputs = GetEepromInterface()->getCapability(VirtualInputs);
+ int virtualInputs = GetCurrentFirmware()->getCapability(VirtualInputs);
for (int i=0; iaddItem(item.toString(), item.toValue());
- if (item == source) b->setCurrentIndex(b->count()-1);
+ if (model.isInputValid(i)) {
+ item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, &model);
+ b->addItem(item.toString(), item.toValue());
+ if (item == source) b->setCurrentIndex(b->count()-1);
+ }
}
}
if (flags & POPULATE_SOURCES) {
- for (int i=0; i<4+GetEepromInterface()->getCapability(Pots); i++) {
+ for (int i=0; i<4+GetCurrentFirmware()->getCapability(Pots); i++) {
item = RawSource(SOURCE_TYPE_STICK, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
- for (int i=0; igetCapability(RotaryEncoders); i++) {
+ for (int i=0; igetCapability(RotaryEncoders); i++) {
item = RawSource(SOURCE_TYPE_ROTARY_ENCODER, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
@@ -579,13 +598,13 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
}
if (flags & POPULATE_SWITCHES) {
- for (int i=0; igetCapability(Switches); i++) {
+ for (int i=0; igetCapability(Switches); i++) {
item = RawSource(SOURCE_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
- for (int i=0; igetCapability(LogicalSwitches); i++) {
+ for (int i=0; igetCapability(LogicalSwitches); i++) {
item = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
@@ -599,13 +618,13 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (item == source) b->setCurrentIndex(b->count()-1);
}
- for (int i=0; igetCapability(TrainerInputs); i++) {
+ for (int i=0; igetCapability(TrainerInputs); i++) {
item = RawSource(SOURCE_TYPE_PPM, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
- for (int i=0; igetCapability(Outputs)+GetEepromInterface()->getCapability(ExtraChannels); i++) {
+ for (int i=0; igetCapability(Outputs); i++) {
item = RawSource(SOURCE_TYPE_CH, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
@@ -628,7 +647,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
}
if (flags & POPULATE_GVARS) {
- for (int i=0; igetCapability(Gvars); i++) {
+ for (int i=0; igetCapability(Gvars); i++) {
item = RawSource(SOURCE_TYPE_GVAR, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
@@ -668,11 +687,11 @@ void populateCSWCB(QComboBox *b, int value)
b->clear();
for (int i=0; igetBoard())) {
+ if (func == LS_FN_VEQUAL || func == LS_FN_STAY)
+ continue;
+ }
b->addItem(LogicalSwitchData(func).funcToString(), func);
-// if (i>GetEepromInterface()->getCapability(CSFunc)) {
-// QModelIndex index = b->model()->index(i, 0);
-// QVariant v(0);
-// }
if (value == func) {
b->setCurrentIndex(b->count()-1);
}
@@ -761,19 +780,6 @@ QString getFrSkyAlarmType(int alarm)
}
}
-QString getFrSkyBlades(int blades)
-{
- switch (blades) {
- case 1:
- return "3";
- case 2:
- return "4";
- default:
- return "2";
- }
-}
-
-
QString getFrSkyUnits(int units)
{
switch(units) {
@@ -788,7 +794,7 @@ QString getFrSkyProtocol(int protocol)
{
switch(protocol) {
case 2:
- if ((GetEepromInterface()->getCapability(Telemetry) & TM_HASWSHH))
+ if ((GetCurrentFirmware()->getCapability(Telemetry) & TM_HASWSHH))
return QObject::tr("Winged Shadow How High");
else
return QObject::tr("Winged Shadow How High (not supported)");
@@ -843,7 +849,7 @@ QString getProtocol(ModelData * g_model)
QString getPhasesStr(unsigned int phases, ModelData & model)
{
- int numphases = GetEepromInterface()->getCapability(FlightPhases);
+ int numphases = GetCurrentFirmware()->getCapability(FlightModes);
if (numphases && phases) {
QString str;
@@ -919,7 +925,9 @@ CompanionIcon::CompanionIcon(QString baseimage)
void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
{
- if (GetEepromInterface()->getSimulator()) {
+ SimulatorInterface * si = GetCurrentFirmware()->getSimulator();
+ if (si) {
+ delete si;
RadioData * simuData = new RadioData(radioData);
unsigned int flags = 0;
if (modelIdx >= 0) {
@@ -929,14 +937,14 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
if (radioData.generalSettings.stickMode & 1) {
flags |= SIMULATOR_FLAGS_STICK_MODE_LEFT;
}
- BoardEnum board = GetEepromInterface()->getBoard();
+ BoardEnum board = GetCurrentFirmware()->getBoard();
SimulatorDialog * sd;
if (IS_TARANIS(board))
sd = new SimulatorDialogTaranis(parent, flags);
else
sd = new SimulatorDialog9X(parent, flags);
QByteArray eeprom(GetEepromInterface()->getEEpromSize(), 0);
- GetEepromInterface()->save((uint8_t *)eeprom.data(), *simuData, GetEepromInterface()->getCapability(SimulatorVariant));
+ GetEepromInterface()->save((uint8_t *)eeprom.data(), *simuData, GetCurrentFirmware()->getCapability(SimulatorVariant));
delete simuData;
sd->start(eeprom);
sd->exec();
@@ -969,27 +977,3 @@ QPixmap makePixMap( QImage image, QString firmwareType )
}
return(QPixmap::fromImage(image));
}
-
-int getRadioType(QString firmwareType)
-{
- if (firmwareType.contains( "taranis" )) return 6;
- if (firmwareType.contains( "sky9x" )) return 5;
- if (firmwareType.contains( "gruvin9x")) return 4;
- if (firmwareType.contains( "9xr128" )) return 3;
- if (firmwareType.contains( "9xr" )) return 2;
- if (firmwareType.contains( "9x128" )) return 1;
- return 0; // 9x
-}
-
-QString getDefaultFwType( int radioType )
-{
- switch (radioType){
- case 6: return "opentx-taranis-en";
- case 5: return "opentx-sky9x-en";
- case 4: return "opentx-gruvin9x-en";
- case 3: return "opentx-9xr128-en";
- case 2: return "opentx-9xr-en";
- case 1: return "opentx-9x128-en";
- default: return "opentx-9x-en";
- }
-}
diff --git a/companion/src/helpers.h b/companion/src/helpers.h
index 857d66749..d368c7ae7 100644
--- a/companion/src/helpers.h
+++ b/companion/src/helpers.h
@@ -4,17 +4,17 @@
#include
#include "eeprominterface.h"
-#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetEepromInterface()->getCapability(LogicalSwitches)-1)
+extern const QColor colors[C9X_MAX_CURVES];
+
+#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetCurrentFirmware()->getCapability(LogicalSwitches)-1)
//convert from mode 1 to mode generalSettings.stickMode
//NOTICE! => 1..4 -> 1..4
-#define CONVERT_MODE(x) (((x)<=4) ? modn12x3[generalSettings.stickMode][((x)-1)] : (x))
-#define CHANNEL_ORDER(x) (chout_ar[generalSettings.templateSetup*4 + (x)-1])
+#define CONVERT_MODE(x) (((x)<=4) ? modn12x3[generalSettings.stickMode][((x)-1)] : (x))
#define CURVE_BASE 7
#define CH(x) (SRC_CH1+(x)-1-(SRC_SWC-SRC_3POS))
#define CV(x) (CURVE_BASE+(x)-1)
-#define CC(x) (CHANNEL_ORDER(x)) //need to invert this to work with dest
#define CURVE5(x) ((x)-1)
#define CURVE9(x) (MAX_CURVE5+(x)-1)
@@ -27,7 +27,6 @@
void populateGvSourceCB(QComboBox *b, int value);
void populateVoiceLangCB(QComboBox *b, QString language);
-void populateTTraceCB(QComboBox *b, int value);
void populateRotEncCB(QComboBox *b, int value, int renumber);
void populateBacklightCB(QComboBox *b, const uint8_t value);
@@ -38,6 +37,8 @@ class CompanionIcon: public QIcon {
CompanionIcon(QString baseimage);
};
+bool gvarsEnabled();
+
class GVarGroup : public QObject {
Q_OBJECT
@@ -84,11 +85,10 @@ class CurveGroup : public QObject {
#define POPULATE_ONOFF 0x01
#define POPULATE_TIMER_MODES 0x02
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value);
-void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr=0);
+void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr=0);
void populatePhasesCB(QComboBox *b, int value);
void populateGvarUseCB(QComboBox *b, unsigned int phase);
-void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last, int hubproto);
QString getProtocolStr(const int proto);
QString getPhasesStr(unsigned int phases, ModelData & model);
@@ -107,7 +107,7 @@ QString getPhasesStr(unsigned int phases, ModelData & model);
void populateGVCB(QComboBox *b, int value);
void populateSourceCB(QComboBox *b, const RawSource &source, const ModelData & model, unsigned int flags);
void populateCSWCB(QComboBox *b, int value);
-QString getPhaseName(int val, char * phasename=NULL);
+QString getPhaseName(int val, const char * phasename=NULL);
QString getInputStr(ModelData & model, int index);
QString image2qstring(QImage image);
QImage qstring2image(QString imagestr);
@@ -120,7 +120,6 @@ QString getCenterBeep(ModelData * g_model);
/* FrSky helpers */
QString getFrSkyAlarmType(int alarm);
-QString getFrSkyBlades(int blades);
QString getFrSkyUnits(int units);
QString getFrSkyProtocol(int protocol);
QString getFrSkyMeasure(int units);
@@ -131,10 +130,4 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx);
// Format a pixmap to fit on the radio using a specific firmware
QPixmap makePixMap( QImage image, QString firmwareType );
-// Return a radio type derived from a firmware type string
-int getRadioType(QString firmwareType);
-
-// Return the default firmware string for a specified radio
-QString getDefaultFwType( int radioType );
-
#endif // HELPERS_H
diff --git a/companion/src/images/mcw/aicon.png b/companion/src/images/mcw/aicon.png
deleted file mode 100644
index f593b6de0..000000000
Binary files a/companion/src/images/mcw/aicon.png and /dev/null differ
diff --git a/companion/src/images/mcw/at1e1r.png b/companion/src/images/mcw/at1e1r.png
deleted file mode 100644
index 1b60bb3fa..000000000
Binary files a/companion/src/images/mcw/at1e1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/at2e1r.png b/companion/src/images/mcw/at2e1r.png
deleted file mode 100644
index 1a3507886..000000000
Binary files a/companion/src/images/mcw/at2e1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/atailv.png b/companion/src/images/mcw/atailv.png
deleted file mode 100644
index 31eadc6ba..000000000
Binary files a/companion/src/images/mcw/atailv.png and /dev/null differ
diff --git a/companion/src/images/mcw/aw0a0f.png b/companion/src/images/mcw/aw0a0f.png
deleted file mode 100644
index 1cea2b7ac..000000000
Binary files a/companion/src/images/mcw/aw0a0f.png and /dev/null differ
diff --git a/companion/src/images/mcw/aw1a0f.png b/companion/src/images/mcw/aw1a0f.png
deleted file mode 100644
index 41cf475bc..000000000
Binary files a/companion/src/images/mcw/aw1a0f.png and /dev/null differ
diff --git a/companion/src/images/mcw/aw1a1f.png b/companion/src/images/mcw/aw1a1f.png
deleted file mode 100644
index e5662f22e..000000000
Binary files a/companion/src/images/mcw/aw1a1f.png and /dev/null differ
diff --git a/companion/src/images/mcw/aw1a2f.png b/companion/src/images/mcw/aw1a2f.png
deleted file mode 100644
index 64e7c56dd..000000000
Binary files a/companion/src/images/mcw/aw1a2f.png and /dev/null differ
diff --git a/companion/src/images/mcw/aw2a0f.png b/companion/src/images/mcw/aw2a0f.png
deleted file mode 100644
index a19ca05c5..000000000
Binary files a/companion/src/images/mcw/aw2a0f.png and /dev/null differ
diff --git a/companion/src/images/mcw/aw2a1f.png b/companion/src/images/mcw/aw2a1f.png
deleted file mode 100644
index 97a52a90c..000000000
Binary files a/companion/src/images/mcw/aw2a1f.png and /dev/null differ
diff --git a/companion/src/images/mcw/aw2a2f.png b/companion/src/images/mcw/aw2a2f.png
deleted file mode 100644
index cb1819f80..000000000
Binary files a/companion/src/images/mcw/aw2a2f.png and /dev/null differ
diff --git a/companion/src/images/mcw/db0t2e0f0r.png b/companion/src/images/mcw/db0t2e0f0r.png
deleted file mode 100644
index a73bbcbbc..000000000
Binary files a/companion/src/images/mcw/db0t2e0f0r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db0t2e0f1r.png b/companion/src/images/mcw/db0t2e0f1r.png
deleted file mode 100644
index 07339cc83..000000000
Binary files a/companion/src/images/mcw/db0t2e0f1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db0t2e0f2r.png b/companion/src/images/mcw/db0t2e0f2r.png
deleted file mode 100644
index a824ca1a9..000000000
Binary files a/companion/src/images/mcw/db0t2e0f2r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db0t2e1f0r.png b/companion/src/images/mcw/db0t2e1f0r.png
deleted file mode 100644
index efeae963d..000000000
Binary files a/companion/src/images/mcw/db0t2e1f0r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db0t2e1f1r.png b/companion/src/images/mcw/db0t2e1f1r.png
deleted file mode 100644
index 9930dab84..000000000
Binary files a/companion/src/images/mcw/db0t2e1f1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db0t2e1f2r.png b/companion/src/images/mcw/db0t2e1f2r.png
deleted file mode 100644
index 12641edb4..000000000
Binary files a/companion/src/images/mcw/db0t2e1f2r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db0t2e2f0r.png b/companion/src/images/mcw/db0t2e2f0r.png
deleted file mode 100644
index becb783f2..000000000
Binary files a/companion/src/images/mcw/db0t2e2f0r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db0t2e2f1r.png b/companion/src/images/mcw/db0t2e2f1r.png
deleted file mode 100644
index 16714038d..000000000
Binary files a/companion/src/images/mcw/db0t2e2f1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db0t2e2f2r.png b/companion/src/images/mcw/db0t2e2f2r.png
deleted file mode 100644
index e444189cd..000000000
Binary files a/companion/src/images/mcw/db0t2e2f2r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db1t2e0f0r.png b/companion/src/images/mcw/db1t2e0f0r.png
deleted file mode 100644
index 902c5999f..000000000
Binary files a/companion/src/images/mcw/db1t2e0f0r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db1t2e0f1r.png b/companion/src/images/mcw/db1t2e0f1r.png
deleted file mode 100644
index 16a2132a0..000000000
Binary files a/companion/src/images/mcw/db1t2e0f1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db1t2e0f2r.png b/companion/src/images/mcw/db1t2e0f2r.png
deleted file mode 100644
index fbc1ef005..000000000
Binary files a/companion/src/images/mcw/db1t2e0f2r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db1t2e1f0r.png b/companion/src/images/mcw/db1t2e1f0r.png
deleted file mode 100644
index 0dc293d93..000000000
Binary files a/companion/src/images/mcw/db1t2e1f0r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db1t2e1f1r.png b/companion/src/images/mcw/db1t2e1f1r.png
deleted file mode 100644
index 4a76499f4..000000000
Binary files a/companion/src/images/mcw/db1t2e1f1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db1t2e1f2r.png b/companion/src/images/mcw/db1t2e1f2r.png
deleted file mode 100644
index 87afdbdde..000000000
Binary files a/companion/src/images/mcw/db1t2e1f2r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db1t2e2f0r.png b/companion/src/images/mcw/db1t2e2f0r.png
deleted file mode 100644
index 2053df985..000000000
Binary files a/companion/src/images/mcw/db1t2e2f0r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db1t2e2f1r.png b/companion/src/images/mcw/db1t2e2f1r.png
deleted file mode 100644
index 4a91ef4e9..000000000
Binary files a/companion/src/images/mcw/db1t2e2f1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/db1t2e2f2r.png b/companion/src/images/mcw/db1t2e2f2r.png
deleted file mode 100644
index be4af6587..000000000
Binary files a/companion/src/images/mcw/db1t2e2f2r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dicon.png b/companion/src/images/mcw/dicon.png
deleted file mode 100644
index ba7a630ce..000000000
Binary files a/companion/src/images/mcw/dicon.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt0t2e0f0r.png b/companion/src/images/mcw/dt0t2e0f0r.png
deleted file mode 100644
index 7590cea97..000000000
Binary files a/companion/src/images/mcw/dt0t2e0f0r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt0t2e0f1r.png b/companion/src/images/mcw/dt0t2e0f1r.png
deleted file mode 100644
index 8e8a90e3a..000000000
Binary files a/companion/src/images/mcw/dt0t2e0f1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt0t2e0f2r.png b/companion/src/images/mcw/dt0t2e0f2r.png
deleted file mode 100644
index b80bf5ae6..000000000
Binary files a/companion/src/images/mcw/dt0t2e0f2r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt0t2e1f0r.png b/companion/src/images/mcw/dt0t2e1f0r.png
deleted file mode 100644
index 6ae2c6f49..000000000
Binary files a/companion/src/images/mcw/dt0t2e1f0r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt0t2e1f1r.png b/companion/src/images/mcw/dt0t2e1f1r.png
deleted file mode 100644
index ffccb518a..000000000
Binary files a/companion/src/images/mcw/dt0t2e1f1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt0t2e1f2r.png b/companion/src/images/mcw/dt0t2e1f2r.png
deleted file mode 100644
index 9f0c34621..000000000
Binary files a/companion/src/images/mcw/dt0t2e1f2r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt0t2e2f0r.png b/companion/src/images/mcw/dt0t2e2f0r.png
deleted file mode 100644
index 4aa7ad219..000000000
Binary files a/companion/src/images/mcw/dt0t2e2f0r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt0t2e2f1r.png b/companion/src/images/mcw/dt0t2e2f1r.png
deleted file mode 100644
index cc0eee059..000000000
Binary files a/companion/src/images/mcw/dt0t2e2f1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt0t2e2f2r.png b/companion/src/images/mcw/dt0t2e2f2r.png
deleted file mode 100644
index 6e629c769..000000000
Binary files a/companion/src/images/mcw/dt0t2e2f2r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt1t2e0f0r.png b/companion/src/images/mcw/dt1t2e0f0r.png
deleted file mode 100644
index a266c4eae..000000000
Binary files a/companion/src/images/mcw/dt1t2e0f0r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt1t2e0f1r.png b/companion/src/images/mcw/dt1t2e0f1r.png
deleted file mode 100644
index eae7cdbed..000000000
Binary files a/companion/src/images/mcw/dt1t2e0f1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt1t2e0f2r.png b/companion/src/images/mcw/dt1t2e0f2r.png
deleted file mode 100644
index 45e900679..000000000
Binary files a/companion/src/images/mcw/dt1t2e0f2r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt1t2e1f0r.png b/companion/src/images/mcw/dt1t2e1f0r.png
deleted file mode 100644
index 096f24c5b..000000000
Binary files a/companion/src/images/mcw/dt1t2e1f0r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt1t2e1f1r.png b/companion/src/images/mcw/dt1t2e1f1r.png
deleted file mode 100644
index 2c8ecb604..000000000
Binary files a/companion/src/images/mcw/dt1t2e1f1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt1t2e1f2r.png b/companion/src/images/mcw/dt1t2e1f2r.png
deleted file mode 100644
index c92f8f02f..000000000
Binary files a/companion/src/images/mcw/dt1t2e1f2r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt1t2e2f0r.png b/companion/src/images/mcw/dt1t2e2f0r.png
deleted file mode 100644
index b3fff09e7..000000000
Binary files a/companion/src/images/mcw/dt1t2e2f0r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt1t2e2f1r.png b/companion/src/images/mcw/dt1t2e2f1r.png
deleted file mode 100644
index 025efe33c..000000000
Binary files a/companion/src/images/mcw/dt1t2e2f1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/dt1t2e2f2r.png b/companion/src/images/mcw/dt1t2e2f2r.png
deleted file mode 100644
index 22e138ac0..000000000
Binary files a/companion/src/images/mcw/dt1t2e2f2r.png and /dev/null differ
diff --git a/companion/src/images/mcw/gicon.png b/companion/src/images/mcw/gicon.png
deleted file mode 100644
index 035dd642e..000000000
Binary files a/companion/src/images/mcw/gicon.png and /dev/null differ
diff --git a/companion/src/images/mcw/gt1e1r.png b/companion/src/images/mcw/gt1e1r.png
deleted file mode 100644
index 20b55ae8e..000000000
Binary files a/companion/src/images/mcw/gt1e1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/gt2e1r.png b/companion/src/images/mcw/gt2e1r.png
deleted file mode 100644
index ebde7ca17..000000000
Binary files a/companion/src/images/mcw/gt2e1r.png and /dev/null differ
diff --git a/companion/src/images/mcw/gtailv.png b/companion/src/images/mcw/gtailv.png
deleted file mode 100644
index d14df9f8b..000000000
Binary files a/companion/src/images/mcw/gtailv.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t0a0f0s.png b/companion/src/images/mcw/gw0t0a0f0s.png
deleted file mode 100644
index 6604948b3..000000000
Binary files a/companion/src/images/mcw/gw0t0a0f0s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t1a0f0s.png b/companion/src/images/mcw/gw0t1a0f0s.png
deleted file mode 100644
index d9755ba82..000000000
Binary files a/companion/src/images/mcw/gw0t1a0f0s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t1a0f1s.png b/companion/src/images/mcw/gw0t1a0f1s.png
deleted file mode 100644
index fc77a33ea..000000000
Binary files a/companion/src/images/mcw/gw0t1a0f1s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t1a0f2s.png b/companion/src/images/mcw/gw0t1a0f2s.png
deleted file mode 100644
index a2af45705..000000000
Binary files a/companion/src/images/mcw/gw0t1a0f2s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t1a1f0s.png b/companion/src/images/mcw/gw0t1a1f0s.png
deleted file mode 100644
index 668ac0593..000000000
Binary files a/companion/src/images/mcw/gw0t1a1f0s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t1a1f1s.png b/companion/src/images/mcw/gw0t1a1f1s.png
deleted file mode 100644
index 4b6e7f7ed..000000000
Binary files a/companion/src/images/mcw/gw0t1a1f1s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t1a1f2s.png b/companion/src/images/mcw/gw0t1a1f2s.png
deleted file mode 100644
index 475a5d60b..000000000
Binary files a/companion/src/images/mcw/gw0t1a1f2s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t1a2f0s.png b/companion/src/images/mcw/gw0t1a2f0s.png
deleted file mode 100644
index 5e1bd0be6..000000000
Binary files a/companion/src/images/mcw/gw0t1a2f0s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t1a2f1s.png b/companion/src/images/mcw/gw0t1a2f1s.png
deleted file mode 100644
index 66cc21144..000000000
Binary files a/companion/src/images/mcw/gw0t1a2f1s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t1a2f2s.png b/companion/src/images/mcw/gw0t1a2f2s.png
deleted file mode 100644
index 535b08f0d..000000000
Binary files a/companion/src/images/mcw/gw0t1a2f2s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t2a0f0s.png b/companion/src/images/mcw/gw0t2a0f0s.png
deleted file mode 100644
index f2acb1189..000000000
Binary files a/companion/src/images/mcw/gw0t2a0f0s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t2a0f1s.png b/companion/src/images/mcw/gw0t2a0f1s.png
deleted file mode 100644
index c4ec3e332..000000000
Binary files a/companion/src/images/mcw/gw0t2a0f1s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t2a0f2s.png b/companion/src/images/mcw/gw0t2a0f2s.png
deleted file mode 100644
index 2e116cbb2..000000000
Binary files a/companion/src/images/mcw/gw0t2a0f2s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t2a1f0s.png b/companion/src/images/mcw/gw0t2a1f0s.png
deleted file mode 100644
index 067f47949..000000000
Binary files a/companion/src/images/mcw/gw0t2a1f0s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t2a1f1s.png b/companion/src/images/mcw/gw0t2a1f1s.png
deleted file mode 100644
index fa7cedfd3..000000000
Binary files a/companion/src/images/mcw/gw0t2a1f1s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t2a1f2s.png b/companion/src/images/mcw/gw0t2a1f2s.png
deleted file mode 100644
index 16e2e75ad..000000000
Binary files a/companion/src/images/mcw/gw0t2a1f2s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t2a2f0s.png b/companion/src/images/mcw/gw0t2a2f0s.png
deleted file mode 100644
index a7c9e96e9..000000000
Binary files a/companion/src/images/mcw/gw0t2a2f0s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t2a2f1s.png b/companion/src/images/mcw/gw0t2a2f1s.png
deleted file mode 100644
index 3e95b67e2..000000000
Binary files a/companion/src/images/mcw/gw0t2a2f1s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw0t2a2f2s.png b/companion/src/images/mcw/gw0t2a2f2s.png
deleted file mode 100644
index 5dbc36f1c..000000000
Binary files a/companion/src/images/mcw/gw0t2a2f2s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t0a0f0s.png b/companion/src/images/mcw/gw1t0a0f0s.png
deleted file mode 100644
index 1cc9964f5..000000000
Binary files a/companion/src/images/mcw/gw1t0a0f0s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t1a0f0s.png b/companion/src/images/mcw/gw1t1a0f0s.png
deleted file mode 100644
index 002927aad..000000000
Binary files a/companion/src/images/mcw/gw1t1a0f0s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t1a0f1s.png b/companion/src/images/mcw/gw1t1a0f1s.png
deleted file mode 100644
index 687aa3d77..000000000
Binary files a/companion/src/images/mcw/gw1t1a0f1s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t1a0f2s.png b/companion/src/images/mcw/gw1t1a0f2s.png
deleted file mode 100644
index 8da28c64c..000000000
Binary files a/companion/src/images/mcw/gw1t1a0f2s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t1a1f0s.png b/companion/src/images/mcw/gw1t1a1f0s.png
deleted file mode 100644
index 7fa51b589..000000000
Binary files a/companion/src/images/mcw/gw1t1a1f0s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t1a1f1s.png b/companion/src/images/mcw/gw1t1a1f1s.png
deleted file mode 100644
index 43306d05d..000000000
Binary files a/companion/src/images/mcw/gw1t1a1f1s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t1a1f2s.png b/companion/src/images/mcw/gw1t1a1f2s.png
deleted file mode 100644
index e10d75ae7..000000000
Binary files a/companion/src/images/mcw/gw1t1a1f2s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t1a2f0s.png b/companion/src/images/mcw/gw1t1a2f0s.png
deleted file mode 100644
index 6eb1e395e..000000000
Binary files a/companion/src/images/mcw/gw1t1a2f0s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t1a2f1s.png b/companion/src/images/mcw/gw1t1a2f1s.png
deleted file mode 100644
index c1ad61c7d..000000000
Binary files a/companion/src/images/mcw/gw1t1a2f1s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t1a2f2s.png b/companion/src/images/mcw/gw1t1a2f2s.png
deleted file mode 100644
index d4658221a..000000000
Binary files a/companion/src/images/mcw/gw1t1a2f2s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t2a0f0s.png b/companion/src/images/mcw/gw1t2a0f0s.png
deleted file mode 100644
index 927caea69..000000000
Binary files a/companion/src/images/mcw/gw1t2a0f0s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t2a0f1s.png b/companion/src/images/mcw/gw1t2a0f1s.png
deleted file mode 100644
index 92caadaed..000000000
Binary files a/companion/src/images/mcw/gw1t2a0f1s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t2a0f2s.png b/companion/src/images/mcw/gw1t2a0f2s.png
deleted file mode 100644
index 7a658fd19..000000000
Binary files a/companion/src/images/mcw/gw1t2a0f2s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t2a1f0s.png b/companion/src/images/mcw/gw1t2a1f0s.png
deleted file mode 100644
index 865ece280..000000000
Binary files a/companion/src/images/mcw/gw1t2a1f0s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t2a1f1s.png b/companion/src/images/mcw/gw1t2a1f1s.png
deleted file mode 100644
index 897a7f8ae..000000000
Binary files a/companion/src/images/mcw/gw1t2a1f1s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t2a1f2s.png b/companion/src/images/mcw/gw1t2a1f2s.png
deleted file mode 100644
index 99466bc25..000000000
Binary files a/companion/src/images/mcw/gw1t2a1f2s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t2a2f0s.png b/companion/src/images/mcw/gw1t2a2f0s.png
deleted file mode 100644
index ebaf6a19c..000000000
Binary files a/companion/src/images/mcw/gw1t2a2f0s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t2a2f1s.png b/companion/src/images/mcw/gw1t2a2f1s.png
deleted file mode 100644
index 5fd800df7..000000000
Binary files a/companion/src/images/mcw/gw1t2a2f1s.png and /dev/null differ
diff --git a/companion/src/images/mcw/gw1t2a2f2s.png b/companion/src/images/mcw/gw1t2a2f2s.png
deleted file mode 100644
index 915771f83..000000000
Binary files a/companion/src/images/mcw/gw1t2a2f2s.png and /dev/null differ
diff --git a/companion/src/images/mcw/h120.png b/companion/src/images/mcw/h120.png
deleted file mode 100644
index 0827df6b6..000000000
Binary files a/companion/src/images/mcw/h120.png and /dev/null differ
diff --git a/companion/src/images/mcw/h120x.png b/companion/src/images/mcw/h120x.png
deleted file mode 100644
index d43f70e12..000000000
Binary files a/companion/src/images/mcw/h120x.png and /dev/null differ
diff --git a/companion/src/images/mcw/h140.png b/companion/src/images/mcw/h140.png
deleted file mode 100644
index 04562ab9a..000000000
Binary files a/companion/src/images/mcw/h140.png and /dev/null differ
diff --git a/companion/src/images/mcw/h90.png b/companion/src/images/mcw/h90.png
deleted file mode 100644
index 935e3d390..000000000
Binary files a/companion/src/images/mcw/h90.png and /dev/null differ
diff --git a/companion/src/images/mcw/hfbl.png b/companion/src/images/mcw/hfbl.png
deleted file mode 100644
index 9f344adff..000000000
Binary files a/companion/src/images/mcw/hfbl.png and /dev/null differ
diff --git a/companion/src/images/mcw/hicon.png b/companion/src/images/mcw/hicon.png
deleted file mode 100644
index 270da8365..000000000
Binary files a/companion/src/images/mcw/hicon.png and /dev/null differ
diff --git a/companion/src/images/mcw/htailfblg.png b/companion/src/images/mcw/htailfblg.png
deleted file mode 100644
index c0220ab6f..000000000
Binary files a/companion/src/images/mcw/htailfblg.png and /dev/null differ
diff --git a/companion/src/images/mcw/htailfblng.png b/companion/src/images/mcw/htailfblng.png
deleted file mode 100644
index 8f9db5d70..000000000
Binary files a/companion/src/images/mcw/htailfblng.png and /dev/null differ
diff --git a/companion/src/images/mcw/htailg.png b/companion/src/images/mcw/htailg.png
deleted file mode 100644
index 225ab38d2..000000000
Binary files a/companion/src/images/mcw/htailg.png and /dev/null differ
diff --git a/companion/src/images/mcw/htailng.png b/companion/src/images/mcw/htailng.png
deleted file mode 100644
index 6752fd6f2..000000000
Binary files a/companion/src/images/mcw/htailng.png and /dev/null differ
diff --git a/companion/src/images/originals/logotypes/firmware_logo.xcf b/companion/src/images/originals/logotypes/firmware_logo.xcf
new file mode 100644
index 000000000..ced05eb12
Binary files /dev/null and b/companion/src/images/originals/logotypes/firmware_logo.xcf differ
diff --git a/companion/src/images/originals/wizard/ailerons.svg b/companion/src/images/originals/wizard/ailerons.svg
new file mode 100644
index 000000000..9d85389df
--- /dev/null
+++ b/companion/src/images/originals/wizard/ailerons.svg
@@ -0,0 +1,1102 @@
+
+
+
+
diff --git a/companion/src/images/originals/wizard/airbrakes.svg b/companion/src/images/originals/wizard/airbrakes.svg
new file mode 100644
index 000000000..1ddf048ad
--- /dev/null
+++ b/companion/src/images/originals/wizard/airbrakes.svg
@@ -0,0 +1,1364 @@
+
+
+
+
diff --git a/companion/src/images/originals/wizard/bank.svg b/companion/src/images/originals/wizard/bank.svg
new file mode 100644
index 000000000..26fbccd02
--- /dev/null
+++ b/companion/src/images/originals/wizard/bank.svg
@@ -0,0 +1,3205 @@
+
+
+
+
diff --git a/companion/src/images/originals/wizard/conclusion.svg b/companion/src/images/originals/wizard/conclusion.svg
new file mode 100644
index 000000000..7cf94495a
--- /dev/null
+++ b/companion/src/images/originals/wizard/conclusion.svg
@@ -0,0 +1,654 @@
+
+
+
+
diff --git a/companion/src/images/originals/wizard/flaps.svg b/companion/src/images/originals/wizard/flaps.svg
new file mode 100644
index 000000000..46631277a
--- /dev/null
+++ b/companion/src/images/originals/wizard/flaps.svg
@@ -0,0 +1,1499 @@
+
+
+
+
diff --git a/companion/src/images/originals/wizard/helictrl.svg b/companion/src/images/originals/wizard/helictrl.svg
new file mode 100644
index 000000000..aeed07a1f
--- /dev/null
+++ b/companion/src/images/originals/wizard/helictrl.svg
@@ -0,0 +1,2295 @@
+
+
+
+
diff --git a/companion/src/images/originals/wizard/models.svg b/companion/src/images/originals/wizard/models.svg
new file mode 100644
index 000000000..ecf8581bf
--- /dev/null
+++ b/companion/src/images/originals/wizard/models.svg
@@ -0,0 +1,1137 @@
+
+
+
+
diff --git a/companion/src/images/originals/wizard/rudder.svg b/companion/src/images/originals/wizard/rudder.svg
new file mode 100644
index 000000000..3f53ba776
--- /dev/null
+++ b/companion/src/images/originals/wizard/rudder.svg
@@ -0,0 +1,3115 @@
+
+
+
+
diff --git a/companion/src/images/originals/wizard/tails.svg b/companion/src/images/originals/wizard/tails.svg
new file mode 100644
index 000000000..8fb67dff6
--- /dev/null
+++ b/companion/src/images/originals/wizard/tails.svg
@@ -0,0 +1,1970 @@
+
+
+
+
diff --git a/companion/src/images/originals/wizard/throttle.svg b/companion/src/images/originals/wizard/throttle.svg
new file mode 100644
index 000000000..af5da5373
--- /dev/null
+++ b/companion/src/images/originals/wizard/throttle.svg
@@ -0,0 +1,2032 @@
+
+
+
+
diff --git a/companion/src/images/originals/wizard/wingtype.svg b/companion/src/images/originals/wizard/wingtype.svg
new file mode 100644
index 000000000..2748d56df
--- /dev/null
+++ b/companion/src/images/originals/wizard/wingtype.svg
@@ -0,0 +1,2149 @@
+
+
+
+
diff --git a/companion/src/images/taranison.png b/companion/src/images/taranison.png
new file mode 100644
index 000000000..61fcbe0be
Binary files /dev/null and b/companion/src/images/taranison.png differ
diff --git a/companion/src/images/wizard/ailerons.png b/companion/src/images/wizard/ailerons.png
new file mode 100644
index 000000000..26ef75eb7
Binary files /dev/null and b/companion/src/images/wizard/ailerons.png differ
diff --git a/companion/src/images/wizard/airbrakes.png b/companion/src/images/wizard/airbrakes.png
new file mode 100644
index 000000000..1802e1479
Binary files /dev/null and b/companion/src/images/wizard/airbrakes.png differ
diff --git a/companion/src/images/wizard/bank.png b/companion/src/images/wizard/bank.png
new file mode 100644
index 000000000..9c0c7738a
Binary files /dev/null and b/companion/src/images/wizard/bank.png differ
diff --git a/companion/src/images/wizard/conclusion.png b/companion/src/images/wizard/conclusion.png
new file mode 100644
index 000000000..7f3057d79
Binary files /dev/null and b/companion/src/images/wizard/conclusion.png differ
diff --git a/companion/src/images/wizard/cyclic.png b/companion/src/images/wizard/cyclic.png
new file mode 100644
index 000000000..6b1922241
Binary files /dev/null and b/companion/src/images/wizard/cyclic.png differ
diff --git a/companion/src/images/wizard/fblheli.png b/companion/src/images/wizard/fblheli.png
new file mode 100644
index 000000000..6ff59f70e
Binary files /dev/null and b/companion/src/images/wizard/fblheli.png differ
diff --git a/companion/src/images/wizard/flaps.png b/companion/src/images/wizard/flaps.png
new file mode 100644
index 000000000..629e6d569
Binary files /dev/null and b/companion/src/images/wizard/flaps.png differ
diff --git a/companion/src/images/wizard/flybar.png b/companion/src/images/wizard/flybar.png
new file mode 100644
index 000000000..a90f242b1
Binary files /dev/null and b/companion/src/images/wizard/flybar.png differ
diff --git a/companion/src/images/wizard/gyro.png b/companion/src/images/wizard/gyro.png
new file mode 100644
index 000000000..1fef2d933
Binary files /dev/null and b/companion/src/images/wizard/gyro.png differ
diff --git a/companion/src/images/wizard/helictrl.png b/companion/src/images/wizard/helictrl.png
new file mode 100644
index 000000000..4f12808f8
Binary files /dev/null and b/companion/src/images/wizard/helictrl.png differ
diff --git a/companion/src/images/wizard/models.png b/companion/src/images/wizard/models.png
new file mode 100644
index 000000000..ab1fe8bca
Binary files /dev/null and b/companion/src/images/wizard/models.png differ
diff --git a/companion/src/images/wizard/multirotor.png b/companion/src/images/wizard/multirotor.png
new file mode 100644
index 000000000..064eeb1c9
Binary files /dev/null and b/companion/src/images/wizard/multirotor.png differ
diff --git a/companion/src/images/wizard/options.png b/companion/src/images/wizard/options.png
new file mode 100644
index 000000000..39d6190e7
Binary files /dev/null and b/companion/src/images/wizard/options.png differ
diff --git a/companion/src/images/wizard/rudder.png b/companion/src/images/wizard/rudder.png
new file mode 100644
index 000000000..6c4618c62
Binary files /dev/null and b/companion/src/images/wizard/rudder.png differ
diff --git a/companion/src/images/wizard/simpletail.png b/companion/src/images/wizard/simpletail.png
new file mode 100644
index 000000000..710681292
Binary files /dev/null and b/companion/src/images/wizard/simpletail.png differ
diff --git a/companion/src/images/wizard/tail.png b/companion/src/images/wizard/tail.png
new file mode 100644
index 000000000..7419c97ad
Binary files /dev/null and b/companion/src/images/wizard/tail.png differ
diff --git a/companion/src/images/wizard/tails.png b/companion/src/images/wizard/tails.png
new file mode 100644
index 000000000..00320c0e1
Binary files /dev/null and b/companion/src/images/wizard/tails.png differ
diff --git a/companion/src/images/wizard/throttle.png b/companion/src/images/wizard/throttle.png
new file mode 100644
index 000000000..5f2a27d26
Binary files /dev/null and b/companion/src/images/wizard/throttle.png differ
diff --git a/companion/src/images/wizard/vtail.png b/companion/src/images/wizard/vtail.png
new file mode 100644
index 000000000..d804b7591
Binary files /dev/null and b/companion/src/images/wizard/vtail.png differ
diff --git a/companion/src/images/wizard/wingtype.png b/companion/src/images/wizard/wingtype.png
new file mode 100644
index 000000000..a9481470d
Binary files /dev/null and b/companion/src/images/wizard/wingtype.png differ
diff --git a/companion/src/logsdialog.cpp b/companion/src/logsdialog.cpp
index 7a4b6745b..2a26dc0d9 100644
--- a/companion/src/logsdialog.cpp
+++ b/companion/src/logsdialog.cpp
@@ -63,6 +63,7 @@ logsDialog::logsDialog(QWidget *parent) :
connect(ui->customPlot, SIGNAL(plottableDoubleClick(QCPAbstractPlottable *, QMouseEvent *)), this, SLOT(plottableItemDoubleClick(QCPAbstractPlottable *, QMouseEvent *)));
connect(ui->FieldsTW, SIGNAL(itemSelectionChanged()), this, SLOT(plotLogs()));
connect(ui->logTable, SIGNAL(itemSelectionChanged()), this, SLOT(plotLogs()));
+ connect(ui->Reset_PB, SIGNAL(clicked()), this, SLOT(plotLogs()));
}
logsDialog::~logsDialog()
diff --git a/companion/src/logsdialog.ui b/companion/src/logsdialog.ui
index 0ea51523e..e483cbbdf 100644
--- a/companion/src/logsdialog.ui
+++ b/companion/src/logsdialog.ui
@@ -66,16 +66,7 @@
0
-
- 0
-
-
- 0
-
-
- 0
-
-
+
0
-
@@ -114,6 +105,13 @@
+ -
+
+
+ Reset
+
+
+
-
diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp
index 9b0686b73..0e55eac9b 100644
--- a/companion/src/mainwindow.cpp
+++ b/companion/src/mainwindow.cpp
@@ -63,6 +63,7 @@
#include "warnings.h"
#include "helpers.h"
#include "appdata.h"
+#include "taranisnotfound.h"
#include "firmwares/opentx/opentxinterface.h" // TODO get rid of this include
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
@@ -86,7 +87,7 @@
MainWindow::MainWindow():
downloadDialog_forWait(NULL)
{
- mdiArea = new QMdiArea;
+ mdiArea = new QMdiArea(this);
mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
setCentralWidget(mdiArea);
@@ -101,6 +102,7 @@ MainWindow::MainWindow():
updateMenus();
restoreState(g.mainWinState());
+ restoreGeometry(g.mainWinGeo());
setUnifiedTitleAndToolBarOnMac(true);
this->setWindowIcon(QIcon(":/icon.png"));
@@ -197,7 +199,7 @@ void MainWindow::checkForUpdates(bool ignoreSettings, QString & fwId)
check1done = true;
check2done = true;
fwToUpdate = fwId;
- QString stamp = GetFirmware(fwToUpdate)->stamp;
+ QString stamp = GetFirmware(fwToUpdate)->getStampUrl();
if (!stamp.isEmpty()) {
if (g.autoCheckFw() || ignoreSettings) {
@@ -222,7 +224,7 @@ void MainWindow::checkForUpdates(bool ignoreSettings, QString & fwId)
if(ignoreSettings) {
downloadDialog_forWait = new downloadDialog(this, tr("Checking for updates"));
- downloadDialog_forWait->show();
+ downloadDialog_forWait->exec();
} else {
downloadDialog_forWait = NULL; // TODO needed?
}
@@ -272,11 +274,11 @@ void MainWindow::checkForUpdateFinished(QNetworkReply * reply)
downloadDialog * dd = new downloadDialog(this, QString(OPENTX_COMPANION_DOWNLOADS C9X_INSTALLER).arg(version), fileName);
installer_fileName = fileName;
connect(dd, SIGNAL(accepted()), this, SLOT(updateDownloaded()));
- dd->show();
+ dd->exec();
}
}
#else
- QMessageBox::warning(this, tr("New release available"), tr("A new release of Companion is available please check the OpenTX website!"));
+ QMessageBox::warning(this, tr("New release available"), tr("A new release of Companion is available, please check the OpenTX website!"));
#endif
} else {
if (showcheckForUpdatesResult && check1done && check2done)
@@ -298,15 +300,15 @@ void MainWindow::updateDownloaded()
}
}
-void MainWindow::downloadLatestFW(FirmwareInfo * firmware, const QString & firmwareId)
+void MainWindow::downloadLatestFW(FirmwareVariant & firmware)
{
QString url, ext, cpuid;
- url = firmware->getUrl(firmwareId);
+ url = firmware.getFirmwareUrl();
cpuid=g.cpuId();
ext = url.mid(url.lastIndexOf("."));
- QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.flashDir() + "/" + firmwareId + ext);
+ QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.flashDir() + "/" + firmware.id + ext);
if (!fileName.isEmpty()) {
- downloadedFW = firmwareId;
+ downloadedFW = firmware.id;
needRename=true;
g.profile[g.id()].fwName( fileName );
if (!cpuid.isEmpty()) {
@@ -340,7 +342,7 @@ void MainWindow::reply1Accepted()
int errnum=hline.mid(6).toInt();
switch(errnum) {
case 1:
- errormsg=tr("Firmware does not longer fit in the Tx, due to selected firmware options");
+ errormsg=tr("Not enough memory for all the selected firmware options");
break;
case 2:
errormsg=tr("Compilation server temporary failure, try later");
@@ -379,7 +381,7 @@ void MainWindow::reply1Accepted()
int errnum=hline.mid(6).toInt();
switch(errnum) {
case 1:
- errormsg=tr("Firmware does not fit in the Tx, due to selected firmware options");
+ errormsg=tr("Not enough memory for all the selected firmware options");
break;
case 2:
errormsg=tr("Compilation server termporary failure, try later");
@@ -418,7 +420,7 @@ void MainWindow::reply1Accepted()
}
g.fwRev.set(downloadedFW, currentFWrev);
if (g.profile[g.id()].burnFirmware()) {
- int ret = QMessageBox::question(this, "Companion", tr("Do you want to write the firmware to the transmitter now ?"), QMessageBox::Yes | QMessageBox::No);
+ int ret = QMessageBox::question(this, "Companion", tr("Do you want to write the firmware to the radio now ?"), QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes) {
writeFlash(g.profile[g.id()].fwName());
}
@@ -467,7 +469,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
if (OldFwRev == 0) {
showcheckForUpdatesResult = false; // update is available - do not show dialog
- QString rn = GetFirmware(fwToUpdate)->rnurl;
+ QString rn = GetFirmware(fwToUpdate)->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL;
msgBox.setWindowTitle("Companion");
msgBox.setInformativeText(tr("Firmware %1 does not seem to have ever been downloaded.\nVersion %2 is available.\nDo you want to download it now ?").arg(fwToUpdate).arg(NewFwRev));
@@ -494,9 +496,10 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
} else {
ignore = true;
}
- } else if (NewFwRev > OldFwRev) {
+ }
+ else if (NewFwRev > OldFwRev) {
showcheckForUpdatesResult = false; // update is available - do not show dialog
- QString rn = GetFirmware(fwToUpdate)->rnurl;
+ QString rn = GetFirmware(fwToUpdate)->getReleaseNotesUrl();
QAbstractButton *rnButton;
msgBox.setText("Companion");
msgBox.setInformativeText(tr("A new version of %1 firmware is available (current %2 - newer %3).\nDo you want to download it now ?").arg(fwToUpdate).arg(OldFwRev).arg(NewFwRev));
@@ -535,7 +538,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
}
} else if (download == true) {
if (warning>0) {
- QString rn = GetFirmware(fwToUpdate)->rnurl;
+ QString rn = GetFirmware(fwToUpdate)->getReleaseNotesUrl();
if (!rn.isEmpty()) {
int ret2 = QMessageBox::warning(this, "Companion", tr("Release notes contain very important informations. Do you want to see them now ?"), QMessageBox::Yes | QMessageBox::No);
if (ret2 == QMessageBox::Yes) {
@@ -545,7 +548,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
}
}
downloadedFW = fwToUpdate;
- QString url = GetFirmware(fwToUpdate)->getUrl(fwToUpdate);
+ QString url = GetFirmwareVariant(fwToUpdate).getFirmwareUrl();
QString ext = url.mid(url.lastIndexOf("."));
needRename=false;
bool addversion=g.profile[g.id()].renameFwFiles();
@@ -715,14 +718,14 @@ void MainWindow::loadProfile() //TODO Load all variables - Also HW!
void MainWindow::appPrefs()
{
- appPreferencesDialog *pd = new appPreferencesDialog(this);
+ AppPreferencesDialog *pd = new AppPreferencesDialog(this);
pd->exec();
updateMenus();
}
void MainWindow::fwPrefs()
{
- fwPreferencesDialog *pd = new fwPreferencesDialog(this);
+ FirmwarePreferencesDialog *pd = new FirmwarePreferencesDialog(this);
pd->exec();
foreach (QMdiSubWindow *window, mdiArea->subWindowList()) {
MdiChild *mdiChild = qobject_cast(window->widget());
@@ -745,11 +748,12 @@ void MainWindow::changelog()
void MainWindow::fwchangelog()
{
- FirmwareInfo *currfirm = GetCurrentFirmware();
- QString rn=currfirm->rnurl;
+ FirmwareInterface *currfirm = GetCurrentFirmware();
+ QString rn=currfirm->getReleaseNotesUrl();
if (rn.isEmpty()) {
QMessageBox::information(this, tr("Firmware updates"), tr("Current firmware does not provide release notes informations."));
- } else {
+ }
+ else {
contributorsDialog *cd = new contributorsDialog(this,2, rn);
cd->exec();
}
@@ -957,6 +961,7 @@ QString MainWindow::FindTaranisPath()
{
int pathcount=0;
QString path;
+ QString temppath;
QStringList drives;
QString eepromfile;
QString fsname;
@@ -971,12 +976,21 @@ QString MainWindow::FindTaranisPath()
if(ret) {
QString vName=QString::fromUtf16 ( (const ushort *) szVolumeName) ;
if (vName.contains("TARANIS")) {
- eepromfile=drive.absolutePath();
- eepromfile.append("/TARANIS.BIN");
+ temppath=drive.absolutePath();
+ eepromfile=temppath;
+ eepromfile.append("/EEPROM.BIN");
if (QFile::exists(eepromfile)) {
pathcount++;
path=eepromfile;
}
+ else {
+ eepromfile=temppath;
+ eepromfile.append("/TARANIS.BIN");
+ if (QFile::exists(eepromfile)) {
+ pathcount++;
+ path=eepromfile;
+ }
+ }
}
}
}
@@ -986,12 +1000,11 @@ QString MainWindow::FindTaranisPath()
while (entry != NULL) {
if (!drives.contains(entry->me_devname)) {
drives.append(entry->me_devname);
- eepromfile=entry->me_mountdir;
-
- eepromfile.append("/TARANIS.BIN");
+ temppath=entry->me_mountdir;
+ eepromfile=temppath;
+ eepromfile.append("/EEPROM.BIN");
#if !defined __APPLE__ && !defined WIN32
- QString fstype=entry->me_type;
- qDebug() << fstype;
+ QString fstype = entry->me_type;
if (QFile::exists(eepromfile) && fstype.contains("fat") ) {
#else
if (QFile::exists(eepromfile)) {
@@ -999,6 +1012,19 @@ QString MainWindow::FindTaranisPath()
pathcount++;
path=eepromfile;
}
+ else {
+ eepromfile=temppath;
+ eepromfile.append("/TARANIS.BIN");
+ #if !defined __APPLE__ && !defined WIN32
+ QString fstype = entry->me_type;
+ if (QFile::exists(eepromfile) && fstype.contains("fat") ) {
+ #else
+ if (QFile::exists(eepromfile)) {
+ #endif
+ pathcount++;
+ path=eepromfile;
+ }
+ }
}
entry = entry->me_next; ;
}
@@ -1028,19 +1054,20 @@ void MainWindow::readEeprom()
if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath();
if (path.isEmpty()) {
- QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected."));
+ taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
+ tnfd->exec();
res=false;
} else {
QStringList str;
str << path << tempFile;
- avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Read Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN);
+ avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Read Models and Settings From Radio")); //, AVR_DIALOG_KEEP_OPEN);
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
res = ad->exec();
sleep(1);
}
} else {
QStringList str = GetReceiveEEpromCommand(tempFile);
- avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Read Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN);
+ avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Read Models and Settings From Radio")); //, AVR_DIALOG_KEEP_OPEN);
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
res = ad->exec();
}
@@ -1052,7 +1079,7 @@ void MainWindow::readEeprom()
}
}
-void MainWindow::writeFileToEeprom()
+void MainWindow::writeBackup()
{
QString fileName;
bool backup = false;
@@ -1060,7 +1087,7 @@ void MainWindow::writeFileToEeprom()
cd->exec();
if (!fileName.isEmpty()) {
g.eepromDir(QFileInfo(fileName).dir().absolutePath());
- int ret = QMessageBox::question(this, "Companion", tr("Write Models and settings from %1 to the Tx?").arg(QFileInfo(fileName).fileName()), QMessageBox::Yes | QMessageBox::No);
+ int ret = QMessageBox::question(this, "Companion", tr("Write Radio Backup from %1 to the radio?").arg(QFileInfo(fileName).fileName()), QMessageBox::Yes | QMessageBox::No);
if (ret != QMessageBox::Yes) return;
if (!isValidEEPROM(fileName))
ret = QMessageBox::question(this, "Companion", tr("The file %1\nhas not been recognized as a valid Models and Settings file\nWrite anyway ?").arg(QFileInfo(fileName).fileName()), QMessageBox::Yes | QMessageBox::No);
@@ -1084,19 +1111,20 @@ void MainWindow::writeFileToEeprom()
if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath();
if (path.isEmpty()) {
- QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected."));
+ taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
+ tnfd->exec();
return;
} else {
QStringList str;
str << path << backupFile;
- avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN);
+ avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup Models and Settings From Radio")); //, AVR_DIALOG_KEEP_OPEN);
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
ad->exec();
sleep(1);
}
} else {
QStringList str = GetReceiveEEpromCommand(backupFile);
- avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx"));
+ avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Radio"));
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
ad->exec();
sleep(1);
@@ -1106,7 +1134,7 @@ void MainWindow::writeFileToEeprom()
QString tempDir = QDir::tempPath();
QString tempFlash = tempDir + "/flash.bin";
QStringList str = GetReceiveFlashCommand(tempFlash);
- avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Read Firmware From Tx");
+ avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Read Firmware From Radio");
ad->setWindowIcon(CompanionIcon("read_flash.png"));
ad->exec();
sleep(1);
@@ -1119,10 +1147,10 @@ void MainWindow::writeFileToEeprom()
} else {
int rev = getEpromVersion(restoreFile);
if ((rev / 100) != (oldrev / 100)) {
- QMessageBox::warning(this, tr("Warning"), tr("The transmitter firmware belongs to another product family, check file and preferences!"));
+ QMessageBox::warning(this, tr("Warning"), tr("The radio firmware belongs to another product family, check file and preferences!"));
}
else if (rev < oldrev) {
- QMessageBox::warning(this, tr("Warning"), tr("The transmitter firmware is outdated, please upgrade!"));
+ QMessageBox::warning(this, tr("Warning"), tr("The radio firmware is outdated, please upgrade!"));
}
fileName = restoreFile;
}
@@ -1135,12 +1163,13 @@ void MainWindow::writeFileToEeprom()
if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath();
if (path.isEmpty()) {
- QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected."));
+ taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
+ tnfd->exec();
return;
} else {
QStringList str;
str << path << backupFile;
- avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN);
+ avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup Models and Settings From Radio")); //, AVR_DIALOG_KEEP_OPEN);
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
ad->exec();
delete ad;
@@ -1149,7 +1178,7 @@ void MainWindow::writeFileToEeprom()
}
else {
QStringList str = ((MainWindow *)this->parent())->GetReceiveEEpromCommand(backupFile);
- avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx"));
+ avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, tr("Backup Models and Settings From Radio"));
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
ad->exec();
delete ad;
@@ -1160,13 +1189,14 @@ void MainWindow::writeFileToEeprom()
if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath();
if (path.isEmpty()) {
- QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected."));
+ taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
+ tnfd->exec();
return;
}
else {
QStringList str;
str << fileName << path;
- avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Write Models and Settings To Tx")); //, AVR_DIALOG_KEEP_OPEN);
+ avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Write Backup To Radio")); //, AVR_DIALOG_KEEP_OPEN);
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
ad->exec();
delete ad;
@@ -1175,7 +1205,7 @@ void MainWindow::writeFileToEeprom()
}
else {
QStringList str = GetSendEEpromCommand(fileName);
- avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Write Models and Settings To Tx", AVR_DIALOG_SHOW_DONE);
+ avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Write Backup To Radio", AVR_DIALOG_SHOW_DONE);
ad->setWindowIcon(CompanionIcon("write_eeprom.png"));
ad->exec();
delete ad;
@@ -1234,7 +1264,7 @@ bool MainWindow::isValidEEPROM(QString eepromfile)
bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString flashFile)
{
- FirmwareInfo *firmware = GetCurrentFirmware();
+ FirmwareInterface *firmware = GetCurrentFirmware();
FlashInterface flash(flashFile);
if (!flash.isValid())
return false;
@@ -1255,19 +1285,17 @@ bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString
if ((svnTags.at(0) == "open9x")||(svnTags.at(0) == "opentx")) {
if (revision > 1464) {
- QString fwBuild = flash.getBuild();
- if (fwBuild.contains("-")) {
- QStringList buildTags = fwBuild.split("-", QString::SkipEmptyParts);
+ QString fwEEprom = flash.getEEprom();
+ if (fwEEprom.contains("-")) {
+ QStringList buildTags = fwEEprom.split("-", QString::SkipEmptyParts);
if (buildTags.size() >= 1)
version = buildTags.at(0).toInt();
if (buildTags.size() >= 2)
variant = buildTags.at(1).toInt();
- } else {
- version = fwBuild.toInt(); // TODO changer le nom de la variable
}
- }
- else {
- version = ((Open9xFirmware *)firmware)->getEepromVersion(revision);
+ else {
+ version = fwEEprom.toInt();
+ }
}
}
@@ -1332,14 +1360,14 @@ void MainWindow::writeFlash(QString fileToFlash)
backupFile=backupPath+"/backup-"+QDateTime().currentDateTime().toString("yyyy-MM-dd-hhmmss")+".bin";
}
QStringList str = GetReceiveEEpromCommand(backupFile);
- avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL);
+ avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Radio"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL);
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
int res = ad->exec();
delete ad;
if (QFileInfo(backupFile).exists() && res) {
sleep(1);
QStringList str = GetSendFlashCommand(fileName);
- avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Write Firmware To Tx"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL);
+ avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Write Firmware To Radio"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL);
CompanionIcon iconw("write_eeprom.png");
ad->setWindowIcon(iconw);
int res = ad->exec();
@@ -1352,20 +1380,20 @@ void MainWindow::writeFlash(QString fileToFlash)
}
sleep(1);
QStringList str = GetSendEEpromCommand(restoreFile);
- avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Restore Models and Settings To Tx"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL);
+ avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Restore Models and Settings To Radio"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL);
ad->setWindowIcon(iconw);
res = ad->exec();
delete ad;
if (!res) {
- QMessageBox::warning(this, tr("Restore failed"), tr("Could not restore Models and Settings to TX. The models and settings data file can be found at: %1").arg(backupFile));
+ QMessageBox::warning(this, tr("Restore failed"), tr("Could not restore Models and Settings to Radio. The models and settings data file can be found at: %1").arg(backupFile));
}
}
else {
- QMessageBox::warning(this, tr("Firmware write failed"), tr("Could not write firmware to to transmitter. The models and settings data file can be found at: %1").arg(backupFile));
+ QMessageBox::warning(this, tr("Firmware write failed"), tr("Could not write firmware to radio. The models and settings data file can be found at: %1").arg(backupFile));
}
}
else {
- QMessageBox::warning(this, tr("Backup failed"), tr("Cannot backup existing Models and Settings from TX. Firmware write process aborted"));
+ QMessageBox::warning(this, tr("Backup failed"), tr("Cannot backup existing Models and Settings from Radio. Firmware write process aborted"));
}
}
else {
@@ -1381,7 +1409,7 @@ void MainWindow::writeFlash(QString fileToFlash)
QDateTime datetime;
QString backupFile=backupPath+"/backup-"+QDateTime().currentDateTime().toString("yyyy-MM-dd-hhmmss")+".bin";
QStringList str = GetReceiveEEpromCommand(backupFile);
- avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx"));
+ avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Radio"));
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
ad->exec();
delete ad;
@@ -1389,7 +1417,7 @@ void MainWindow::writeFlash(QString fileToFlash)
}
QStringList str = GetSendFlashCommand(fileName);
- avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Write Firmware To Tx"), AVR_DIALOG_SHOW_DONE);
+ avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Write Firmware To Radio"), AVR_DIALOG_SHOW_DONE);
ad->setWindowIcon(CompanionIcon("write_flash.png"));
ad->exec();
delete ad;
@@ -1397,21 +1425,22 @@ void MainWindow::writeFlash(QString fileToFlash)
}
}
-void MainWindow::readEepromToFile()
+void MainWindow::readBackup()
{
- QString fileName = QFileDialog::getSaveFileName(this, tr("Save transmitter Models and Settings to File"), g.eepromDir(), tr(EXTERNAL_EEPROM_FILES_FILTER));
+ QString fileName = QFileDialog::getSaveFileName(this, tr("Save Radio Backup to File"), g.eepromDir(), tr(EXTERNAL_EEPROM_FILES_FILTER));
if (!fileName.isEmpty()) {
EEPROMInterface *eepromInterface = GetEepromInterface();
if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=FindTaranisPath();
if (path.isEmpty()) {
- QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify that the eeprom disk is connected."));
+ taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
+ tnfd->exec();
return;
}
else {
QStringList str;
str << path << fileName;
- avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Read Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN);
+ avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Read Radio Backup")); //, AVR_DIALOG_KEEP_OPEN);
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
ad->exec();
delete ad;
@@ -1420,7 +1449,7 @@ void MainWindow::readEepromToFile()
else {
g.eepromDir(QFileInfo(fileName).dir().absolutePath());
QStringList str = GetReceiveEEpromCommand(fileName);
- avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Read Models and Settings From Tx"));
+ avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Read Models and Settings From Radio"));
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
ad->exec();
delete ad;
@@ -1430,7 +1459,7 @@ void MainWindow::readEepromToFile()
void MainWindow::readFlash()
{
- QString fileName = QFileDialog::getSaveFileName(this,tr("Read Tx Firmware to File"), g.flashDir(),tr(FLASH_FILES_FILTER));
+ QString fileName = QFileDialog::getSaveFileName(this,tr("Read Radio Firmware to File"), g.flashDir(),tr(FLASH_FILES_FILTER));
if (!fileName.isEmpty()) {
QFile file(fileName);
if (file.exists()) {
@@ -1438,7 +1467,7 @@ void MainWindow::readFlash()
}
g.flashDir(QFileInfo(fileName).dir().absolutePath());
QStringList str = GetReceiveFlashCommand(fileName);
- avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Read Firmware From Tx");
+ avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Read Firmware From Radio");
ad->setWindowIcon(CompanionIcon("read_flash.png"));
ad->exec();
delete ad;
@@ -1447,32 +1476,36 @@ void MainWindow::readFlash()
void MainWindow::burnConfig()
{
- burnConfigDialog *bcd = new burnConfigDialog(this);
- bcd->exec();
+ burnConfigDialog *bcd = new burnConfigDialog(this);
+ bcd->exec();
+ delete bcd;
}
void MainWindow::burnList()
{
- burnConfigDialog *bcd = new burnConfigDialog(this);
- bcd->listProgrammers();
+ burnConfigDialog *bcd = new burnConfigDialog(this);
+ bcd->listProgrammers();
}
void MainWindow::burnFuses()
{
- fusesDialog *fd = new fusesDialog(this);
- fd->exec();
+ fusesDialog *fd = new fusesDialog(this);
+ fd->exec();
+ delete fd;
}
void MainWindow::compare()
{
- compareDialog *fd = new compareDialog(this);
- fd->show();
+ CompareDialog *fd = new CompareDialog(this);
+ fd->setAttribute(Qt::WA_DeleteOnClose, true);
+ fd->show();
}
void MainWindow::logFile()
{
- logsDialog *fd = new logsDialog(this);
- fd->show();
+ logsDialog *fd = new logsDialog(this);
+ fd->setAttribute(Qt::WA_DeleteOnClose, true);
+ fd->show();
}
void MainWindow::about()
@@ -1521,40 +1554,47 @@ void MainWindow::updateMenus()
MdiChild *MainWindow::createMdiChild()
{
- MdiChild *child = new MdiChild;
- mdiArea->addSubWindow(child);
- if(!child->parentWidget()->isMaximized() && !child->parentWidget()->isMinimized())
- child->parentWidget()->resize(400, 400);
+ MdiChild *child = new MdiChild();
+ mdiArea->addSubWindow(child);
+ if(!child->parentWidget()->isMaximized() && !child->parentWidget()->isMinimized())
+ child->parentWidget()->resize(400, 400);
- connect(child, SIGNAL(copyAvailable(bool)),cutAct, SLOT(setEnabled(bool)));
- connect(child, SIGNAL(copyAvailable(bool)),copyAct, SLOT(setEnabled(bool)));
- connect(child, SIGNAL(copyAvailable(bool)),simulateAct, SLOT(setEnabled(bool)));
- connect(child, SIGNAL(copyAvailable(bool)),printAct, SLOT(setEnabled(bool)));
+ connect(child, SIGNAL(copyAvailable(bool)),cutAct, SLOT(setEnabled(bool)));
+ connect(child, SIGNAL(copyAvailable(bool)),copyAct, SLOT(setEnabled(bool)));
+ connect(child, SIGNAL(copyAvailable(bool)),simulateAct, SLOT(setEnabled(bool)));
+ connect(child, SIGNAL(copyAvailable(bool)),printAct, SLOT(setEnabled(bool)));
- return child;
+ return child;
}
-QAction * MainWindow::addAct(QString icon, QString sName, QString lName, QKeySequence::StandardKey shortcut, const char *slot)
+QAction * MainWindow::addAct(const QString & icon, const QString & sName, const QString & lName, enum QKeySequence::StandardKey shortcut, const char *slot, QObject *slotObj)
+{
+ return addAct(icon, sName, lName, QKeySequence(shortcut), slot, slotObj);
+}
+
+QAction * MainWindow::addAct(const QString & icon, const QString & sName, const QString & lName, const QKeySequence & shortcut, const char *slot, QObject *slotObj)
{
QAction * newAction = new QAction( this );
if (!icon.isEmpty())
- newAction->setIcon(CompanionIcon(icon));
+ newAction->setIcon(CompanionIcon(icon));
if (!sName.isEmpty())
newAction->setText(sName);
if (!lName.isEmpty())
newAction->setStatusTip(lName);
- if (shortcut != 0)
- newAction->setShortcuts(shortcut);
- connect(newAction, SIGNAL(triggered()), this, slot);
+ newAction->setShortcut(shortcut);
+ if (slotObj == NULL)
+ slotObj = this;
+ connect(newAction, SIGNAL(triggered()), slotObj, slot);
return newAction;
}
-QAction * MainWindow::addAct(QString icon, QString sName, QString lName, const char *slot)
+
+QAction * MainWindow::addAct(const QString & icon, const QString & sName, const QString & lName, const char *slot)
{
return addAct(icon, sName, lName, QKeySequence::UnknownKey, slot);
}
-QAction * MainWindow::addAct(QActionGroup *aGroup, QString sName, QString lName, const char *slot)
+QAction * MainWindow::addAct(QActionGroup *aGroup, const QString & sName, const QString & lName, const char *slot)
{
QAction *action = addAct("", sName, lName, QKeySequence::UnknownKey, slot);
action->setCheckable(true);
@@ -1584,14 +1624,14 @@ void MainWindow::createActions()
}
updateProfilesActions();
- newAct = addAct("new.png", tr("New Models+Settings"), tr("Create a new Models and Settings file"), QKeySequence::New, SLOT(newFile()));
- openAct = addAct("open.png", tr("Open Models+Settings..."), tr("Open Models and Settings file"), QKeySequence::Open, SLOT(openFile()));
- saveAct = addAct("save.png", tr("Save Models+Settings..."), tr("Save Models and Settings file"), QKeySequence::Save, SLOT(save()));
- saveAsAct = addAct("saveas.png", tr("Save Models+Settings as..."), tr("Save Models and Settings file"), QKeySequence::SaveAs, SLOT(saveAs()));
- exitAct = addAct("exit.png", tr("Exit"), tr("Exit the application"), QKeySequence::Quit, SLOT(newFile()));
- cutAct = addAct("cut.png", tr("Cut Model"), tr("Cut current model to the clipboard"), QKeySequence::Cut, SLOT(cut()));
- copyAct = addAct("copy.png", tr("Copy Model..."), tr("Copy current model to the clipboard"), QKeySequence::Copy, SLOT(copy()));
- pasteAct = addAct("paste.png", tr("Paste Model..."), tr("Paste model from clipboard"), QKeySequence::Paste, SLOT(paste()));
+ newAct = addAct("new.png", tr("New"), tr("Create a new Models and Settings file"), QKeySequence::New, SLOT(newFile()));
+ openAct = addAct("open.png", tr("Open..."), tr("Open Models and Settings file"), QKeySequence::Open, SLOT(openFile()));
+ saveAct = addAct("save.png", tr("Save"), tr("Save Models and Settings file"), QKeySequence::Save, SLOT(save()));
+ saveAsAct = addAct("saveas.png", tr("Save As..."), tr("Save Models and Settings file"), QKeySequence::SaveAs, SLOT(saveAs()));
+ exitAct = addAct("exit.png", tr("Exit"), tr("Exit the application"), QKeySequence::Quit, SLOT(closeAllWindows()), qApp);
+ cutAct = addAct("cut.png", tr("Cut Model"), tr("Cut current model to the clipboard"), QKeySequence::Cut, SLOT(cut()));
+ copyAct = addAct("copy.png", tr("Copy Model"), tr("Copy current model to the clipboard"), QKeySequence::Copy, SLOT(copy()));
+ pasteAct = addAct("paste.png", tr("Paste Model"), tr("Paste model from clipboard"), QKeySequence::Paste, SLOT(paste()));
QActionGroup *themeAlignGroup = new QActionGroup(this);
classicThemeAct = addAct( themeAlignGroup, tr("Classical"), tr("The classic companion9x icon theme"), SLOT(setClassicTheme()));
@@ -1614,15 +1654,16 @@ void MainWindow::createActions()
finnishLangAct = addAct( langAlignGroup, tr("Finnish"), tr("Use Finnish in menus"), SLOT(setFILanguage()));
frenchLangAct = addAct( langAlignGroup, tr("French"), tr("Use French in menus"), SLOT(setFRLanguage()));
italianLangAct = addAct( langAlignGroup, tr("Italian"), tr("Use Italian in menus"), SLOT(setITLanguage()));
- hebrewLangAct = addAct( langAlignGroup, tr("Hebrew"), tr("Use Hebrew in menus"), SLOT(setHELanguage()));
+// hebrewLangAct = addAct( langAlignGroup, tr("Hebrew"), tr("Use Hebrew in menus"), SLOT(setHELanguage()));
polishLangAct = addAct( langAlignGroup, tr("Polish"), tr("Use Polish in menus"), SLOT(setPLLanguage()));
- portugueseLangAct = addAct( langAlignGroup, tr("Portuguese"), tr("Use Portuguese in menus"), SLOT(setPTLanguage()));
+// portugueseLangAct = addAct( langAlignGroup, tr("Portuguese"), tr("Use Portuguese in menus"), SLOT(setPTLanguage()));
swedishLangAct = addAct( langAlignGroup, tr("Swedish"), tr("Use Swedish in menus"), SLOT(setSELanguage()));
- russianLangAct = addAct( langAlignGroup, tr("Russian"), tr("Use Russian in menus"), SLOT(setRULanguage()));
+// russianLangAct = addAct( langAlignGroup, tr("Russian"), tr("Use Russian in menus"), SLOT(setRULanguage()));
+// dutchLangAct = addAct( langAlignGroup, tr("Dutch"), tr("Use Dutch in menus"), SLOT(setNLLanguage()));
aboutAct = addAct("information.png", tr("About..."), tr("Show the application's About box"), SLOT(about()));
- printAct = addAct("print.png", tr("Print..."), tr("Print current model"), SLOT(print()));
- simulateAct = addAct("simulate.png", tr("Simulate..."), tr("Simulate current model"), SLOT(simulate()));
+ printAct = addAct("print.png", tr("Print..."), tr("Print current model"), QKeySequence::Print, SLOT(print()));
+ simulateAct = addAct("simulate.png", tr("Simulate..."), tr("Simulate current model"), QKeySequence(tr("Alt+S")), SLOT(simulate()));
loadbackupAct = addAct("open.png", tr("Load Backup..."), tr("Load backup from file"), SLOT(loadBackup()));
logsAct = addAct("logs.png", tr("View Log File..."), tr("Open and view log file"), SLOT(logFile()));
appPrefsAct = addAct("apppreferences.png",tr("Settings..."), tr("Edit Settings"), SLOT(appPrefs()));
@@ -1631,18 +1672,18 @@ void MainWindow::createActions()
changelogAct = addAct("changelog.png", tr("Companion Changes..."), tr("Show Companion change log"), SLOT(changelog()));
fwchangelogAct = addAct("changelog.png", tr("Firmware Changes..."), tr("Show firmware change log"), SLOT(fwchangelog()));
compareAct = addAct("compare.png", tr("Compare Models..."), tr("Compare models"), SLOT(compare()));
- editSplashAct = addAct("paintbrush.png", tr("Edit Tx Splash Image..."), tr("Edit the splash image of your TX"), SLOT(customizeSplash()));
+ editSplashAct = addAct("paintbrush.png", tr("Edit Radio Splash Image..."), tr("Edit the splash image of your Radio"), SLOT(customizeSplash()));
burnListAct = addAct("list.png", tr("List programmers..."), tr("List available programmers"), SLOT(burnList()));
burnFusesAct = addAct("fuses.png", tr("Fuses..."), tr("Show fuses dialog"), SLOT(burnFuses()));
- readFlashAct = addAct("read_flash.png", tr("Read Firmware"), tr("Read firmware from transmitter"), SLOT(readFlash()));
- writeFlashAct = addAct("write_flash.png", tr("Write Firmware"), tr("Write firmware to transmitter"), SLOT(writeFlash()));
- createProfileAct = addAct("", tr("Add Radio Profile"), tr("Create a new Radio Setting Profile"), SLOT(createProfile()));
+ readFlashAct = addAct("read_flash.png", tr("Read Firmware from Radio"),tr("Read firmware from Radio"), SLOT(readFlash()));
+ writeFlashAct = addAct("write_flash.png", tr("Write Firmware to Radio"), tr("Write firmware to Radio"), SLOT(writeFlash()));
+ createProfileAct = addAct("", tr("Add Radio Profile"), tr("Create a new Radio Setting Profile"), SLOT(createProfile()));
openDocURLAct = addAct("", tr("Manuals and other Documents"), tr("Open the OpenTX document page in a web browser"), SLOT(openDocURL()));
- writeEepromAct = addAct("write_eeprom.png", tr("Write Models and Settings To Tx"), tr("Write Models and Settings to transmitter"), SLOT(writeEeprom()));
- readEepromAct = addAct("read_eeprom.png", tr("Read Models and Settings From Tx"), tr("Read Models and Settings from transmitter"), SLOT(readEeprom()));
- burnConfigAct = addAct("configure.png", tr("Configure Communications..."), tr("Configure software for communicating with the transmitter"), SLOT(burnConfig()));
- writeFileToEepromAct = addAct("write_eeprom_file.png", tr("Write Models and Settings from file to Tx"), tr("Write Models and Settings from file to transmitter"), SLOT(writeFileToEeprom()));
- readEepromToFileAct = addAct("read_eeprom_file.png", tr("Save Tx Models and Settings to file"), tr("Save the Models and Settings from the transmitter to a file"), SLOT(readEepromToFile()));
+ writeEepromAct = addAct("write_eeprom.png", tr("Write Models and Settings To Radio"), tr("Write Models and Settings to Radio"), SLOT(writeEeprom()));
+ readEepromAct = addAct("read_eeprom.png", tr("Read Models and Settings From Radio"), tr("Read Models and Settings from Radio"), SLOT(readEeprom()));
+ burnConfigAct = addAct("configure.png", tr("Configure Communications..."), tr("Configure software for communicating with the Radio"), SLOT(burnConfig()));
+ writeBackupToRadioAct = addAct("write_eeprom_file.png", tr("Write Backup to Radio"), tr("Write Backup from file to to Radio"), SLOT(writeBackup()));
+ readBackupToFileAct = addAct("read_eeprom_file.png", tr("Backup Radio to File"), tr("Save a complete backup file of all settings and model data in the Radio"), SLOT(readBackup()));
contributorsAct = addAct("contributors.png", tr("Contributors..."), tr("A tribute to those who have contributed to OpenTX and Companion"), SLOT(contributors()));
compareAct->setEnabled(false);
@@ -1651,12 +1692,11 @@ void MainWindow::createActions()
}
void MainWindow::createMenus()
-
{
- QMenu *recentFileMenu=new QMenu(tr("Recent Models+Settings"));
- QMenu *languageMenu=new QMenu(tr("Set Menu Language"));
- QMenu *themeMenu=new QMenu(tr("Set Icon Theme"));
- QMenu *iconThemeSizeMenu=new QMenu(tr("Set Icon Size"));
+ QMenu *recentFileMenu = new QMenu(tr("Recent Files"), this);
+ QMenu *languageMenu = new QMenu(tr("Set Menu Language"), this);
+ QMenu *themeMenu = new QMenu(tr("Set Icon Theme"), this);
+ QMenu *iconThemeSizeMenu = new QMenu(tr("Set Icon Size"), this);
fileMenu = menuBar()->addMenu(tr("File"));
fileMenu->addAction(newAct);
@@ -1690,12 +1730,13 @@ void MainWindow::createMenus()
languageMenu->addAction(germanLangAct);
languageMenu->addAction(finnishLangAct);
languageMenu->addAction(frenchLangAct);
- languageMenu->addAction(hebrewLangAct);
+// languageMenu->addAction(hebrewLangAct);
languageMenu->addAction(italianLangAct);
languageMenu->addAction(polishLangAct);
- languageMenu->addAction(portugueseLangAct);
+// languageMenu->addAction(portugueseLangAct);
languageMenu->addAction(swedishLangAct);
- languageMenu->addAction(russianLangAct);
+// languageMenu->addAction(russianLangAct);
+// languageMenu->addAction(dutchLangAct);
settingsMenu->addMenu(themeMenu);
themeMenu->addAction(classicThemeAct);
@@ -1718,8 +1759,8 @@ void MainWindow::createMenus()
burnMenu->addAction(writeEepromAct);
burnMenu->addAction(readEepromAct);
burnMenu->addSeparator();
- burnMenu->addAction(writeFileToEepromAct);
- burnMenu->addAction(readEepromToFileAct);
+ burnMenu->addAction(writeBackupToRadioAct);
+ burnMenu->addAction(readBackupToFileAct);
burnMenu->addSeparator();
burnMenu->addAction(writeFlashAct);
burnMenu->addAction(readFlashAct);
@@ -1754,7 +1795,7 @@ QMenu *MainWindow::createRecentFileMenu()
QMenu *MainWindow::createProfilesMenu()
{
- QMenu *profilesMenu=new QMenu(tr("Radio Settings Profile"));
+ QMenu *profilesMenu=new QMenu(tr("Radio Profile"), this);
int i;
for ( i = 0; i < MAX_PROFILES; ++i) {
profilesMenu->addAction(profileActs[i]);
@@ -1813,8 +1854,8 @@ void MainWindow::createToolBars()
profileButton->setFocusPolicy(Qt::NoFocus);
profileButton->setMenu(createProfilesMenu());
profileButton->setIcon(CompanionIcon("profiles.png"));
- profileButton->setToolTip(tr("Radio Settings Profile"));
- profileButton->setStatusTip(tr("Show a selection list of radio settings profiles"));
+ profileButton->setToolTip(tr("Radio Profile"));
+ profileButton->setStatusTip(tr("Show the list of radio profiles"));
fileToolBar->addWidget(profileButton);
fileToolBar->addAction(editSplashAct);
@@ -1837,8 +1878,8 @@ void MainWindow::createToolBars()
burnToolBar->addAction(writeEepromAct);
burnToolBar->addAction(readEepromAct);
burnToolBar->addSeparator();
- burnToolBar->addAction(writeFileToEepromAct);
- burnToolBar->addAction(readEepromToFileAct);
+ burnToolBar->addAction(writeBackupToRadioAct);
+ burnToolBar->addAction(readBackupToFileAct);
burnToolBar->addSeparator();
burnToolBar->addAction(writeFlashAct);
burnToolBar->addAction(readFlashAct);
@@ -1945,6 +1986,8 @@ void MainWindow::updateLanguageActions()
russianLangAct->setChecked(true);
else if (langId=="sv_SE")
swedishLangAct->setChecked(true);
+ else if (langId=="nl_NL")
+ dutchLangAct->setChecked(true);
}
void MainWindow::updateIconThemeActions()
@@ -1988,7 +2031,7 @@ for (i=0; i
#if defined WIN32 || !defined __GNUC__
@@ -64,6 +66,7 @@
MdiChild::MdiChild():
QWidget(),
ui(new Ui::mdiChild),
+ firmware(GetCurrentFirmware()),
isUntitled(true),
fileChanged(false)
{
@@ -79,6 +82,11 @@ MdiChild::MdiChild():
}
}
+MdiChild::~MdiChild()
+{
+ delete ui;
+}
+
void MdiChild::qSleep(int ms)
{
if (ms<0)
@@ -95,7 +103,7 @@ void MdiChild::qSleep(int ms)
void MdiChild::eepromInterfaceChanged()
{
ui->modelsList->refreshList();
- ui->SimulateTxButton->setEnabled(GetEepromInterface()->getCapability(Simulation));
+ ui->SimulateTxButton->setEnabled(GetCurrentFirmware()/*firmware*/->getCapability(Simulation));
updateTitle();
}
@@ -145,47 +153,69 @@ void MdiChild::on_SimulateTxButton_clicked()
startSimulation(this, radioData, -1);
}
-void MdiChild::OpenEditWindow(bool wizard=false)
+void MdiChild::checkAndInitModel(int row)
+{
+ ModelData &model = radioData.models[row - 1];
+ if (model.isempty()) {
+ model.setDefaultValues(row - 1, radioData.generalSettings);
+ setModified();
+ }
+}
+
+void MdiChild::generalEdit()
+{
+ GeneralEdit *t = new GeneralEdit(radioData, this);
+ connect(t, SIGNAL(modelValuesChanged()), this, SLOT(setModified()));
+ t->show();
+}
+
+void MdiChild::modelEdit()
{
int row = ui->modelsList->currentRow();
- if (row) {
- //TODO error checking
- bool isNew = false;
+ if (row == 0){
+ generalEdit();
+ }
+ else {
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ checkAndInitModel( row );
ModelData &model = radioData.models[row - 1];
-
- if (model.isempty()) {
- model.setDefaultValues(row - 1, radioData.generalSettings);
- isNew = true; //modeledit - clear mixes, apply first template
- setModified();
- }
- if (isNew && !wizard) {
- int ret;
- bool wizardEnable=g.enableWizard();
- if (wizardEnable) {
- ret = QMessageBox::question(this, tr("Companion"), tr("Do you want to use model wizard? "), QMessageBox::Yes | QMessageBox::No);
- if (ret == QMessageBox::Yes) {
- wizard=true;
- } else {
- qSleep(500);
- ret = QMessageBox::question(this, tr("Companion"), tr("Ask this question again ? "), QMessageBox::Yes | QMessageBox::No);
- if (ret == QMessageBox::No) {
- g.enableWizard( false );
- }
- }
- }
- }
- ModelEdit *t = new ModelEdit(radioData, (row - 1), wizard, this);
- // TODO if (isNew && !wizard) t->applyBaseTemplate();
+ ModelEdit *t = new ModelEdit(this, radioData, (row - 1), GetCurrentFirmware()/*firmware*/);
t->setWindowTitle(tr("Editing model %1: ").arg(row) + model.name);
connect(t, SIGNAL(modified()), this, SLOT(setModified()));
- //t->exec();
t->show();
+ QApplication::restoreOverrideCursor();
}
- else {
- GeneralEdit *t = new GeneralEdit(radioData, this);
- connect(t, SIGNAL(modelValuesChanged()), this, SLOT(setModified()));
- t->show();
+}
+
+void MdiChild::wizardEdit()
+{
+ int row = ui->modelsList->currentRow();
+ if (row > 0) {
+ checkAndInitModel(row);
+ WizardDialog * wizard = new WizardDialog(radioData.generalSettings, row, this);
+ wizard->exec();
+ if (wizard->mix.complete /*TODO rather test the exec() result?*/) {
+ radioData.models[row - 1] = wizard->mix;
+ setModified();
+ }
+ }
+}
+
+void MdiChild::openEditWindow()
+{
+ int row = ui->modelsList->currentRow();
+ if (row == 0){
+ generalEdit();
+ }
+ else{
+ ModelData &model = radioData.models[row - 1];
+ if (model.isempty() && g.useWizard()) {
+ wizardEdit();
+ }
+ else {
+ modelEdit();
+ }
}
}
@@ -496,7 +526,8 @@ void MdiChild::writeEeprom() // write to Tx
}
backupEnable=false;
}
- } else {
+ }
+ else {
backupEnable=false;
}
QString stickCal=g.profile[g.id()].stickPotCalib();
@@ -519,13 +550,14 @@ void MdiChild::writeEeprom() // write to Tx
if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=((MainWindow *)this->parent())->FindTaranisPath();
if (path.isEmpty()) {
- QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected."));
+ taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
+ tnfd->exec();
return;
}
else {
QStringList str;
str << path << backupFile;
- avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup EEPROM From Tx")); //, AVR_DIALOG_KEEP_OPEN);
+ avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup EEPROM From Radio")); //, AVR_DIALOG_KEEP_OPEN);
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
ad->exec();
delete ad;
@@ -534,7 +566,7 @@ void MdiChild::writeEeprom() // write to Tx
}
else {
QStringList str = ((MainWindow *)this->parent())->GetReceiveEEpromCommand(backupFile);
- avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, tr("Backup EEPROM From Tx"));
+ avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, tr("Backup EEPROM From Radio"));
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
ad->exec();
delete ad;
@@ -544,7 +576,7 @@ void MdiChild::writeEeprom() // write to Tx
int oldrev=((MainWindow *)this->parent())->getEpromVersion(tempFile);
QString tempFlash=tempDir + "/flash.bin";
QStringList str = ((MainWindow *)this->parent())->GetReceiveFlashCommand(tempFlash);
- avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, "Read Flash From Tx");
+ avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, "Read Flash From Radio");
ad->setWindowIcon(CompanionIcon("read_flash.png"));
ad->exec();
delete ad;
@@ -575,7 +607,8 @@ void MdiChild::writeEeprom() // write to Tx
if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=((MainWindow *)this->parent())->FindTaranisPath();
if (path.isEmpty()) {
- QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected."));
+ taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
+ tnfd->exec();
return;
}
else {
@@ -584,7 +617,7 @@ void MdiChild::writeEeprom() // write to Tx
}
else {
QStringList str = ((MainWindow *)this->parent())->GetReceiveEEpromCommand(backupFile);
- avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, tr("Backup EEPROM From Tx"));
+ avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, tr("Backup EEPROM From Radio"));
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
ad->exec();
delete ad;
@@ -596,13 +629,14 @@ void MdiChild::writeEeprom() // write to Tx
if (IS_TARANIS(eepromInterface->getBoard())) {
QString path=((MainWindow *)this->parent())->FindTaranisPath();
if (path.isEmpty()) {
- QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected."));
+ taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
+ tnfd->exec();
return;
}
else {
QStringList str;
str << tempFile << path;
- avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Write EEPROM To Tx"), AVR_DIALOG_SHOW_DONE); //, AVR_DIALOG_KEEP_OPEN);
+ avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Write EEPROM To Radio"), AVR_DIALOG_SHOW_DONE); //, AVR_DIALOG_KEEP_OPEN);
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
ad->exec();
delete ad;
@@ -611,7 +645,7 @@ void MdiChild::writeEeprom() // write to Tx
}
else {
QStringList str = ((MainWindow *)this->parent())->GetSendEEpromCommand(tempFile);
- avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, "Write EEPROM To Tx", AVR_DIALOG_SHOW_DONE);
+ avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, "Write EEPROM To Radio", AVR_DIALOG_SHOW_DONE);
ad->setWindowIcon(CompanionIcon("write_eeprom.png"));
ad->exec();
delete ad;
@@ -628,13 +662,17 @@ void MdiChild::simulate()
void MdiChild::print(int model, QString filename)
{
+ PrintDialog * pd = NULL;
+
if (model>=0 && !filename.isEmpty()) {
+ pd = new PrintDialog(this, GetCurrentFirmware()/*firmware*/, &radioData.generalSettings, &radioData.models[model], filename);
+ }
+ else if (ui->modelsList->currentRow() > 0) {
+ pd = new PrintDialog(this, GetCurrentFirmware()/*firmware*/, &radioData.generalSettings, &radioData.models[ui->modelsList->currentRow()-1]);
+ }
- printDialog *pd = new printDialog(this, &radioData.generalSettings, &radioData.models[model], filename);
- pd->show();
- } else {
- if(ui->modelsList->currentRow()<1) return;
- printDialog *pd = new printDialog(this, &radioData.generalSettings, &radioData.models[ui->modelsList->currentRow()-1]);
+ if (pd) {
+ pd->setAttribute(Qt::WA_DeleteOnClose, true);
pd->show();
}
}
@@ -671,9 +709,8 @@ bool MdiChild::loadBackup()
.arg(file.errorString()));
return false;
}
- uint8_t *eeprom = (uint8_t *)malloc(eeprom_size);
- memset(eeprom, 0, eeprom_size);
- long result = file.read((char*)eeprom, eeprom_size);
+ QByteArray eeprom(eeprom_size, 0);
+ long result = file.read((char*)eeprom.data(), eeprom_size);
file.close();
if (result != eeprom_size) {
@@ -685,7 +722,7 @@ bool MdiChild::loadBackup()
return false;
}
- if (!LoadBackup(radioData, eeprom, eeprom_size, index)) {
+ if (!LoadBackup(radioData, (uint8_t *)eeprom.data(), eeprom_size, index)) {
QMessageBox::critical(this, tr("Error"),
tr("Invalid binary backup File %1")
.arg(fileName));
@@ -693,6 +730,6 @@ bool MdiChild::loadBackup()
}
ui->modelsList->refreshList();
- free(eeprom);
+
return true;
}
diff --git a/companion/src/mdichild.h b/companion/src/mdichild.h
index 7a18491eb..4f6887108 100644
--- a/companion/src/mdichild.h
+++ b/companion/src/mdichild.h
@@ -59,8 +59,9 @@ class MdiChild : public QWidget
Q_OBJECT
-public:
+ public:
MdiChild();
+ ~MdiChild();
void newFile();
bool loadFile(const QString &fileName, bool resetCurrentFile=true);
@@ -77,20 +78,24 @@ public:
void eepromInterfaceChanged();
void setEEpromAvail(int eavail);
-signals:
+ signals:
void copyAvailable(bool val);
-protected:
+ protected:
void closeEvent(QCloseEvent *event);
-private slots:
+ private slots:
void documentWasModified();
void on_SimulateTxButton_clicked();
void qSleep(int ms);
-public slots:
- void OpenEditWindow(bool wizard);
-
+ public slots:
+ void checkAndInitModel(int row);
+ void generalEdit();
+ void modelEdit();
+ void wizardEdit();
+ void openEditWindow();
+
void cut();
void copy();
void paste();
@@ -100,7 +105,7 @@ public slots:
void setModified();
void updateTitle();
-private:
+ private:
bool maybeSave();
void setCurrentFile(const QString &fileName);
QString strippedName(const QString &fullFileName);
@@ -110,6 +115,8 @@ private:
Ui::mdiChild *ui;
QString curFile;
+
+ FirmwareInterface * firmware;
RadioData radioData;
bool isUntitled;
diff --git a/companion/src/modelconfigdialog.cpp b/companion/src/modelconfigdialog.cpp
deleted file mode 100644
index 4badaa906..000000000
--- a/companion/src/modelconfigdialog.cpp
+++ /dev/null
@@ -1,937 +0,0 @@
-#include "modelconfigdialog.h"
-#include "ui_modelconfigdialog.h"
-#include "helpers.h"
-#include "eeprominterface.h"
-#include
-#include "helpers.h"
-
-#define NUM_CH 10
-
-modelConfigDialog::modelConfigDialog(RadioData &radioData, uint64_t * result, QWidget *parent) :
- QDialog(parent),
- ui(new Ui::modelConfigDialog),
- radioData(radioData),
- result(result),
- generalSettings(radioData.generalSettings)
-{
- ui->setupUi(this);
- this->setWindowIcon(CompanionIcon("wizard.png"));
- rxLock=false;
- ruddercolor << "#ffd100" << "#ffff00";
- throttlecolor << "#e40000";
- aileroncolor << "#0000ff" << "#00ffff";
- elevatorcolor << "#827f00" << "#ffff00";
- flapscolor << "#007f00" << "#00ff00";
- airbrakecolor << "#9b0099" << "#ff00fc";
- helicolor << "#00ff00" << "#0000ff" << "#00ffff" << "#ffff00" << "#e40000" << "#ffa400";
- connect(ui->ailType_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(ConfigChanged()));
- connect(ui->flapsType_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(ConfigChanged()));
- connect(ui->spoilersType_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(ConfigChanged()));
- connect(ui->swashType_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(ConfigChanged()));
- connect(ui->engine_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(ConfigChanged()));
- connect(ui->rudder_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(ConfigChanged()));
- connect(ui->tailType_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(tailConfigChanged()));
- connect(ui->gyro_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(tailConfigChanged()));
- connect(ui->chStyle_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(ConfigChanged()));
- connect(ui->asail2_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(rxUpdate()));
- connect(ui->asele2_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(rxUpdate()));
- connect(ui->asrud2_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(rxUpdate()));
- connect(ui->asfla1_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(rxUpdate()));
- connect(ui->asfla2_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(rxUpdate()));
- connect(ui->asspo1_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(rxUpdate()));
- connect(ui->asspo2_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(rxUpdate()));
- connect(ui->as_CB,SIGNAL(clicked()),this,SLOT(rxUpdate()));
- formSetup();
- QTimer::singleShot(0, this, SLOT(shrink()));
- connect(ui->buttonBox,SIGNAL(clicked(QAbstractButton*)), this, SLOT(doAction(QAbstractButton*)));
-}
-
-modelConfigDialog::~modelConfigDialog()
-{
- delete ui;
-}
-
-void modelConfigDialog::rxUpdate()
-{
- QLabel * channel[] = {ui->CH_1,ui->CH_2,ui->CH_3,ui->CH_4,ui->CH_5,ui->CH_6,ui->CH_7,ui->CH_8,ui->CH_9,ui->CH_10,NULL};
- for (int i=0; channel[i]; i++) {
- channel[i]->setStyleSheet("");
- }
- for (int i=0; ias_CB->isChecked()) {
- if ((ModelType==0) || (ModelType==2)) {
- index=ui->asail2_CB->currentIndex();
- if (ailerons>1 && index>0) {
- rx[index-1]=true;
- }
- index=ui->asele2_CB->currentIndex();
- if (elevators>1 && index>0) {
- rx[index-1]=true;
- }
- }
- if (ModelType==3) {
- index=ui->asrud2_CB->currentIndex();
- if (rudders>1 && index>0) {
- rx[index-1]=true;
- }
- }
- index=ui->asfla1_CB->currentIndex();
- if (flaps>0 && index>0) {
- rx[index-1]=true;
- }
- index=ui->asfla2_CB->currentIndex();
- if (flaps>1 && index>0) {
- rx[index-1]=true;
- }
- if ((ModelType==0) || (ModelType==2)) {
- index=ui->asspo1_CB->currentIndex();
- if (spoilers>0 && index>0) {
- rx[index-1]=true;
- }
- index=ui->asspo2_CB->currentIndex();
- if (spoilers>1 && index>0) {
- rx[index-1]=true;
- }
- }
- }
- #define ICC(x) icc[(x)-1]
- uint8_t icc[4] = {0};
- for(uint8_t i=1; i<=4; i++) //generate inverse array
- for(uint8_t j=1; j<=4; j++) if(CC(i)==j) icc[j-1]=i;
- uint8_t stick;
- switch (ModelType) {
- case 0: //AIRPLANE
- stick=ICC(STK_THR);
- channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(throttlecolor.at(0)));
- rx[stick-1]=true;
- stick=ICC(STK_RUD);
- channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(ruddercolor.at(0)));
- rx[stick-1]=true;
- if (ailerons>0) {
- stick=ICC(STK_AIL);
- channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(aileroncolor.at(0)));
- rx[stick-1]=true;
- }
- stick=ICC(STK_ELE);
- channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(elevatorcolor.at(0)));
- rx[stick-1]=true;
- if (ailerons>1) {
- index=ui->asail2_CB->currentIndex();
- if (!ui->as_CB->isChecked())
- index=0;
- if (index==0) {
- for (int j=0; jsetStyleSheet(QString("background-color: %1;").arg(aileroncolor.at(1)));
- rx[j]=true;
- break;
- }
- }
- } else {
- channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(aileroncolor.at(1)));
- }
- }
- if (elevators>1) {
- index=ui->asele2_CB->currentIndex();
- if (!ui->as_CB->isChecked())
- index=0;
- if (index==0) {
- for (int j=0; jsetStyleSheet(QString("background-color: %1;").arg(elevatorcolor.at(1)));
- rx[j]=true;
- break;
- }
- }
- } else {
- channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(elevatorcolor.at(1)));
- }
- }
- for (uint8_t i=0; i< flaps; i++) {
- if (i==0) {
- index=ui->asfla1_CB->currentIndex();
- } else {
- index=ui->asfla2_CB->currentIndex();
- }
- if (!ui->as_CB->isChecked())
- index=0;
- if (index==0) {
- for (int j=0; jsetStyleSheet(QString("background-color: %1;").arg(flapscolor.at(i)));
- rx[j]=true;
- break;
- }
- };
- } else {
- channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(flapscolor.at(i)));
- }
- }
- break;
- case 1: //HELI
- switch (ui->chStyle_CB->currentIndex()) {
- case 0:
- channel[0]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(0))); //ELE CYC1
- channel[1]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(1))); //AIL CYC2
- channel[2]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(2))); //PITCH CYC3
- channel[3]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(3))); //RUD
- channel[4]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(4))); //THR
- if (ui->gyro_CB->currentIndex()>0) {
- channel[5]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(5))); //GYRO
- }
- break;
- case 1:
- channel[0]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(1))); //AIL CYC2
- channel[1]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(0))); //ELE CYC1
- channel[2]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(4))); //THR
- channel[3]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(3))); //RUD
- if (ui->gyro_CB->currentIndex()>0) {
- channel[4]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(5))); //GYRO
- }
- channel[5]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(2))); //PIT CYC3
- break;
- }
- break;
- case 2: //GLIDER
- if (throttle>0) {
- stick=ICC(STK_THR);
- channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(throttlecolor.at(0)));
- rx[stick-1]=true;
- }
- if (ailerons>0) {
- stick=ICC(STK_AIL);
- channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(aileroncolor.at(0)));
- rx[stick-1]=true;
- }
- stick=ICC(STK_ELE);
- channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(elevatorcolor.at(0)));
- rx[stick-1]=true;
- stick=ICC(STK_RUD);
- channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(ruddercolor.at(0)));
- rx[stick-1]=true;
- if (ailerons>1) {
- index=ui->asail2_CB->currentIndex();
- if (!ui->as_CB->isChecked())
- index=0;
- if (index==0) {
- for (int j=0; jsetStyleSheet(QString("background-color: %1;").arg(aileroncolor.at(1)));
- rx[j]=true;
- break;
- }
- }
- } else {
- channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(aileroncolor.at(1)));
- }
- }
- if (elevators>1) {
- index=ui->asele2_CB->currentIndex();
- if (!ui->as_CB->isChecked())
- index=0;
- if (index==0) {
- for (int j=0; jsetStyleSheet(QString("background-color: %1;").arg(elevatorcolor.at(1)));
- rx[j]=true;
- break;
- }
- }
- } else {
- channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(elevatorcolor.at(1)));
- }
- }
- for (uint8_t i=0; i< flaps; i++) {
- if (i==0) {
- index=ui->asfla1_CB->currentIndex();
- } else {
- index=ui->asfla2_CB->currentIndex();
- }
- if (!ui->as_CB->isChecked())
- index=0;
- if (index==0) {
- for (int j=0; jsetStyleSheet(QString("background-color: %1;").arg(flapscolor.at(i)));
- rx[j]=true;
- break;
- }
- };
- } else {
- channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(flapscolor.at(i)));
- }
- }
- for (uint8_t i=0; i< spoilers; i++) {
- if (i==0) {
- index=ui->asspo1_CB->currentIndex();
- } else {
- index=ui->asspo2_CB->currentIndex();
- }
- if (!ui->as_CB->isChecked())
- index=0;
- if (index==0) {
- for (int j=0; jsetStyleSheet(QString("background-color: %1;").arg(airbrakecolor.at(i)));
- rx[j]=true;
- break;
- }
- };
- } else {
- channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(airbrakecolor.at(i)));
- }
- }
- break;
- case 3: //DELTA WING
- if (throttle>0) {
- stick=ICC(STK_THR);
- channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(throttlecolor.at(0)));
- rx[stick-1]=true;
- }
- stick=ICC(STK_AIL);
- channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(aileroncolor.at(0)));
- rx[stick-1]=true;
- stick=ICC(STK_ELE);
- channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(elevatorcolor.at(0)));
- rx[stick-1]=true;
- if (rudders>0) {
- stick=ICC(STK_RUD);
- channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(ruddercolor.at(0)));
- rx[stick-1]=true;
- }
- if (rudders>1) {
- index=ui->asrud2_CB->currentIndex();
- if (!ui->as_CB->isChecked())
- index=0;
- if (index==0) {
- for (int j=0; jsetStyleSheet(QString("background-color: %1;").arg(ruddercolor.at(1)));
- rx[j]=true;
- break;
- }
- }
- } else {
- channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(ruddercolor.at(1)));
- }
- }
- for (uint8_t i=0; i< flaps; i++) {
- if (i==0) {
- index=ui->asfla1_CB->currentIndex();
- } else {
- index=ui->asfla2_CB->currentIndex();
- }
- if (!ui->as_CB->isChecked())
- index=0;
- if (index==0) {
- for (int j=0; jsetStyleSheet(QString("background-color: %1;").arg(flapscolor.at(i)));
- rx[j]=true;
- break;
- }
- };
- } else {
- channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(flapscolor.at(i)));
- }
- }
- break;
- }
- asUpdate();
-}
-
-void modelConfigDialog::tailConfigChanged()
-{
- if (tailLock)
- return;
- tailLock=true;
- QImage image;
- int index;
- int head;
- switch (ModelType) {
- case 0:
- index=ui->tailType_CB->currentIndex();
- switch (index) {
- case 0:
- rudders=1;
- elevators=1;
- image.load(":/images/mcw/at1e1r.png");
- break;
- case 1:
- rudders=1;
- elevators=1;
- image.load(":/images/mcw/atailv.png");
- break;
- case 2:
- rudders=1;
- elevators=2;
- image.load(":/images/mcw/at2e1r.png");
- break;
- }
- break;
- case 1:
- elevators=1;
- rudders=1;
- head=ui->swashType_CB->currentIndex();
- if (head==4) {
- index=ui->gyro_CB->currentIndex();
- switch (index) {
- case 0:
- image.load(":/images/mcw/htailfblng.png");
- break;
- case 1:
- image.load(":/images/mcw/htailfblg.png");
- break;
- case 2:
- image.load(":/images/mcw/htailfblg.png");
- break;
- }
- } else {
- index=ui->gyro_CB->currentIndex();
- switch (index) {
- case 0:
- image.load(":/images/mcw/htailng.png");
- break;
- case 1:
- image.load(":/images/mcw/htailg.png");
- break;
- case 2:
- image.load(":/images/mcw/htailg.png");
- break;
- }
- }
- break;
- case 2:
- index=ui->tailType_CB->currentIndex();
- switch (index) {
- case 0:
- elevators=1;
- rudders=1;
- image.load(":/images/mcw/gt1e1r.png");
- break;
- case 1:
- elevators=1;
- rudders=1;
- image.load(":/images/mcw/gtailv.png");
- break;
- case 2:
- elevators=2;
- rudders=1;
- image.load(":/images/mcw/gt2e1r.png");
- break;
- }
- break;
- }
- ui->tailImg->setPixmap(QPixmap::fromImage(image));
- tailLock=false;
- rxUpdate();
-}
-
-void modelConfigDialog::ConfigChanged()
-{
- if (wingsLock)
- return;
- wingsLock=true;
- QImage image;
- QString imgname=":/images/mcw/";
- QStringList wimages;
- int index;
- switch (ModelType) {
- case 0:
- if (ui->ailType_CB->currentIndex()==0) {
- ui->flapsType_CB->setCurrentIndex(0);
- ui->flapsType_CB->setDisabled(true);
- } else {
- ui->flapsType_CB->setEnabled(true);
- }
- ailerons=ui->ailType_CB->currentIndex();
- flaps=ui->flapsType_CB->currentIndex();
- throttle=1;
- imgname.append(QString("aw%1a%2f.png").arg(ui->ailType_CB->currentIndex()).arg(ui->flapsType_CB->currentIndex()));
- image.load(imgname);
- ui->wingImg->setPixmap(QPixmap::fromImage(image));
- break;
- case 1:
- wimages.clear();
- wimages << "h90.png" << "h120.png" << "h120x.png" << "h140.png" << "hfbl.png";
- index=ui->swashType_CB->currentIndex();
- ui->gyroType_Label->show();
- ui->gyro_CB->show();
- ailerons=1;
- throttle=1;
- imgname.append(wimages.at(index));
- image.load(imgname);
- ui->wingImg->setPixmap(QPixmap::fromImage(image));
- tailConfigChanged();
- break;
- case 2:
- if (ui->ailType_CB->currentIndex()==0) {
- ui->flapsType_CB->setCurrentIndex(0);
- ui->flapsType_CB->setDisabled(true);
- } else {
- ui->flapsType_CB->setEnabled(true);
- }
- if (ui->ailType_CB->currentIndex()==0) {
- ui->spoilersType_CB->setCurrentIndex(0);
- ui->spoilersType_CB->setDisabled(true);
- } else {
- ui->spoilersType_CB->setEnabled(true);
- }
- ailerons=ui->ailType_CB->currentIndex();
- flaps=ui->flapsType_CB->currentIndex();
- spoilers=ui->spoilersType_CB->currentIndex();
- throttle=ui->engine_CB->currentIndex();
- imgname.append(QString("gw%1t%2a%3f%4s.png").arg(ui->engine_CB->currentIndex()).arg(ui->ailType_CB->currentIndex()).arg(ui->flapsType_CB->currentIndex()).arg(ui->spoilersType_CB->currentIndex()));
- image.load(imgname);
- ui->wingImg->setPixmap(QPixmap::fromImage(image));
- break;
- case 3:
- ailerons=ui->ailType_CB->currentIndex();
- flaps=ui->flapsType_CB->currentIndex();
- rudders=ui->rudder_CB->currentIndex();
- throttle=ui->engine_CB->currentIndex();
- imgname.append(QString("dt%1t2e%2f%3r.png").arg(ui->engine_CB->currentIndex()).arg(ui->flapsType_CB->currentIndex()).arg(ui->rudder_CB->currentIndex()));
- image.load(imgname);
- ui->wingImg->setPixmap(QPixmap::fromImage(image));
- imgname.clear();
- imgname.append(QString(":/images/mcw/db%1t2e%2f%3r.png").arg(ui->engine_CB->currentIndex()).arg(ui->flapsType_CB->currentIndex()).arg(ui->rudder_CB->currentIndex()));
- image.load(imgname);
- ui->tailImg->setPixmap(QPixmap::fromImage(image));
- break;
- default:
- ui->wingImg->clear();
- break;
- }
- wingsLock=false;
- rxUpdate();
-}
-
-void modelConfigDialog::on_planeButton_clicked()
-{
- ui->planeButton->setStyleSheet("background-color: #007f00; color: white;");
- ui->heliButton->setStyleSheet("");
- ui->gliderButton->setStyleSheet("");
- ui->deltaButton->setStyleSheet("");
- ModelType=0;
- wingsLock=true;
- tailLock=true;
- ui->engine_Label->hide();
- ui->engine_CB->setCurrentIndex(0);
- ui->engine_CB->hide();
- ui->rudder_Label->hide();
- ui->rudder_CB->setCurrentIndex(0);
- ui->rudder_CB->hide();
- ui->spoilersLabel->hide();
- ui->spoilersType_CB->setCurrentIndex(0);
- ui->spoilersType_CB->hide();
- ui->spLabel->hide();
- ui->sp_Label->hide();
- ui->swashType_CB->setCurrentIndex(0);
- ui->swashType_CB->hide();
- ui->gyroType_Label->hide();
- ui->gyro_CB->setCurrentIndex(0);
- ui->gyro_CB->hide();
- ui->chStyle_CB->hide();
- ui->chStyle_CB->setCurrentIndex(0);
- ui->chassign_Label->hide();
- ui->wingLabel->show();
- ui->ailType_Label->show();
- ui->ailType_CB->show();
- ui->ailType_CB->setCurrentIndex(0);
- ui->tailLabel->show();
- ui->tailType_Label->show();
- ui->tailType_CB->show();
- ui->tailType_CB->setCurrentIndex(0);
- ui->flapsType_Label->show();
- ui->flapsType_CB->show();
- ui->flapsType_CB->setCurrentIndex(0);
- ui->flapsType_CB->setDisabled(true);
- ui->planeButton->setDisabled(true);
- ui->heliButton->setEnabled(true);
- ui->gliderButton->setEnabled(true);
- ui->deltaButton->setEnabled(true);
- wingsLock=false;
- tailLock=false;
- resetControls();
- ConfigChanged();
- tailConfigChanged();
-}
-
-void modelConfigDialog::on_heliButton_clicked()
-{
- ui->planeButton->setStyleSheet("");
- ui->heliButton->setStyleSheet("background-color: #007f00; color: white;");
- ui->gliderButton->setStyleSheet("");
- ui->deltaButton->setStyleSheet("");
- ModelType=1;
- wingsLock=true;
- tailLock=true;
- ui->engine_Label->hide();
- ui->engine_CB->setCurrentIndex(0);
- ui->engine_CB->hide();
- ui->rudder_Label->hide();
- ui->rudder_CB->setCurrentIndex(0);
- ui->rudder_CB->hide();
- ui->wingLabel->hide();
- ui->ailType_Label->hide();
- ui->ailType_CB->hide();
- ui->ailType_CB->setCurrentIndex(0);
- ui->tailType_Label->hide();
- ui->tailType_CB->hide();
- ui->tailType_CB->setCurrentIndex(0);
- ui->flapsType_Label->hide();
- ui->flapsType_CB->hide();
- ui->flapsType_CB->setCurrentIndex(0);
- ui->flapsType_CB->setDisabled(true);
- ui->spoilersLabel->hide();
- ui->spoilersType_CB->setCurrentIndex(0);
- ui->spoilersType_CB->hide();
- ui->tailLabel->show();
- ui->spLabel->show();
- ui->sp_Label->show();
- ui->swashType_CB->setCurrentIndex(0);
- ui->swashType_CB->show();
- ui->gyroType_Label->show();
- ui->gyro_CB->setCurrentIndex(0);
- ui->gyro_CB->show();
- ui->chStyle_CB->show();
- ui->chStyle_CB->setCurrentIndex(0);
- ui->chassign_Label->show();
- ui->planeButton->setEnabled(true);
- ui->heliButton->setDisabled(true);
- ui->gliderButton->setEnabled(true);
- ui->deltaButton->setEnabled(true);
- wingsLock=false;
- tailLock=false;
- resetControls();
- ConfigChanged();
- tailConfigChanged();
-}
-
-void modelConfigDialog::on_gliderButton_clicked()
-{
- ui->planeButton->setStyleSheet("");
- ui->heliButton->setStyleSheet("");
- ui->gliderButton->setStyleSheet("background-color: #007f00; color: white;");
- ui->deltaButton->setStyleSheet("");
- ModelType=2;
- wingsLock=true;
- tailLock=true;
- ui->rudder_Label->hide();
- ui->rudder_CB->setCurrentIndex(0);
- ui->rudder_CB->hide();
- ui->spLabel->hide();
- ui->sp_Label->hide();
- ui->swashType_CB->setCurrentIndex(0);
- ui->swashType_CB->hide();
- ui->gyroType_Label->hide();
- ui->gyro_CB->setCurrentIndex(0);
- ui->gyro_CB->hide();
- ui->chStyle_CB->hide();
- ui->chStyle_CB->setCurrentIndex(0);
- ui->chassign_Label->hide();
- ui->wingLabel->show();
- ui->engine_Label->show();
- ui->engine_CB->setCurrentIndex(0);
- ui->engine_CB->show();
- ui->ailType_Label->show();
- ui->ailType_CB->show();
- ui->ailType_CB->setCurrentIndex(0);
- ui->tailLabel->show();
- ui->tailType_Label->show();
- ui->tailType_CB->show();
- ui->tailType_CB->setCurrentIndex(0);
- ui->flapsType_Label->show();
- ui->flapsType_CB->show();
- ui->flapsType_CB->setCurrentIndex(0);
- ui->flapsType_CB->setDisabled(true);
- ui->spoilersLabel->show();
- ui->spoilersType_CB->setCurrentIndex(0);
- ui->spoilersType_CB->setDisabled(true);
- ui->spoilersType_CB->show();
- ui->planeButton->setEnabled(true);
- ui->heliButton->setEnabled(true);
- ui->gliderButton->setDisabled(true);
- ui->deltaButton->setEnabled(true);
- wingsLock=false;
- tailLock=false;
- resetControls();
- ConfigChanged();
- tailConfigChanged();
-}
-
-void modelConfigDialog::on_deltaButton_clicked()
-{
- ui->planeButton->setStyleSheet("");
- ui->heliButton->setStyleSheet("");
- ui->gliderButton->setStyleSheet("");
- ui->deltaButton->setStyleSheet("background-color: #007f00; color: white;");
- ModelType=3;
- wingsLock=true;
- tailLock=true;
- ui->spLabel->hide();
- ui->sp_Label->hide();
- ui->swashType_CB->setCurrentIndex(0);
- ui->swashType_CB->hide();
- ui->gyroType_Label->hide();
- ui->gyro_CB->setCurrentIndex(0);
- ui->gyro_CB->hide();
- ui->chStyle_CB->hide();
- ui->chStyle_CB->setCurrentIndex(0);
- ui->chassign_Label->hide();
- ui->ailType_Label->hide();
- ui->ailType_CB->hide();
- ui->ailType_CB->setCurrentIndex(0);
- ui->tailLabel->hide();
- ui->tailType_Label->hide();
- ui->tailType_CB->hide();
- ui->tailType_CB->setCurrentIndex(0);
- ui->spoilersLabel->hide();
- ui->spoilersType_CB->setCurrentIndex(0);
- ui->spoilersType_CB->hide();
- ui->engine_Label->show();
- ui->engine_CB->setCurrentIndex(0);
- ui->engine_CB->show();
- ui->rudder_Label->show();
- ui->rudder_CB->setCurrentIndex(0);
- ui->rudder_CB->show();
- ui->wingLabel->show();
- ui->flapsType_Label->show();
- ui->flapsType_CB->show();
- ui->flapsType_CB->setCurrentIndex(0);
- ui->flapsType_CB->setEnabled(true);
- ui->planeButton->setEnabled(true);
- ui->heliButton->setEnabled(true);
- ui->gliderButton->setEnabled(true);
- ui->deltaButton->setDisabled(true);
- wingsLock=false;
- tailLock=false;
- resetControls();
- ConfigChanged();
-}
-
-
-void modelConfigDialog::formSetup()
-{
- on_planeButton_clicked();
-}
-
-void modelConfigDialog::resetControls() {
- ailerons=0;
- rudders=0;
- throttle=0;
- elevators=0;
- spoilers=0;
- flaps=0;
-}
-
-
-void modelConfigDialog::shrink()
-{
- resize(0,0);
-}
-
-void modelConfigDialog::doAction(QAbstractButton *button)
-{
- if ( ui->buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) {
- int res = QMessageBox::question(this,tr("Apply configuration ?"),tr("Apply configuration deleting existing model ?"),QMessageBox::Yes | QMessageBox::No);
- if(res==QMessageBox::Yes) {
- uint64_t tmp=0;
- tmp=ModelType;
- tmp <<=2;
- tmp |= ui->engine_CB->currentIndex();
- tmp <<=2;
- tmp |= ui->ailType_CB->currentIndex();
- tmp <<=2;
- tmp |= ui->flapsType_CB->currentIndex();
- tmp <<=2;
- tmp |= ui->spoilersType_CB->currentIndex();
- tmp <<=2;
- tmp |= ui->rudder_CB->currentIndex();
- tmp <<=3;
- tmp |= ui->swashType_CB->currentIndex();
- tmp <<=2;
- tmp |= ui->tailType_CB->currentIndex();
- tmp <<=2;
- tmp |= ui->gyro_CB->currentIndex();
- tmp <<=2;
- tmp |= ui->chStyle_CB->currentIndex();
- if (ui->as_CB->isChecked()) {
- tmp <<=4;
- tmp |= ui->asail2_CB->currentIndex();
- tmp <<=4;
- tmp |= ui->asele2_CB->currentIndex();
- tmp <<=4;
- tmp |= ui->asrud2_CB->currentIndex();
- tmp <<=4;
- tmp |= ui->asfla1_CB->currentIndex();
- tmp <<=4;
- tmp |= ui->asfla2_CB->currentIndex();
- tmp <<=4;
- tmp |= ui->asspo1_CB->currentIndex();
- tmp <<=4;
- tmp |= ui->asspo2_CB->currentIndex();
- } else {
- tmp <<=28;
- }
- *result=tmp;
- }
- }
- this->close();
-}
-
-void modelConfigDialog::asUpdate()
-{
- if (rxLock==true)
- return;
- rxLock=true;
- QVariant v(1 | 32);
- int i;
- //disable default channels used
- for (i=0; i<4; i++ ) {
- if (rx[i]) {
- ui->asail2_CB->setItemData(i+1,false, Qt::UserRole - 1);
- ui->asele2_CB->setItemData(i+1,false, Qt::UserRole - 1);
- ui->asrud2_CB->setItemData(i+1,false, Qt::UserRole - 1);
- ui->asfla1_CB->setItemData(i+1,false, Qt::UserRole - 1);
- ui->asfla2_CB->setItemData(i+1,false, Qt::UserRole - 1);
- ui->asspo1_CB->setItemData(i+1,false, Qt::UserRole - 1);
- ui->asspo2_CB->setItemData(i+1,false, Qt::UserRole - 1);
- } else {
- ui->asail2_CB->setItemData(i+1,v, Qt::UserRole-1);
- ui->asele2_CB->setItemData(i+1,v, Qt::UserRole-1);
- ui->asrud2_CB->setItemData(i+1,v, Qt::UserRole-1);
- ui->asfla1_CB->setItemData(i+1,v, Qt::UserRole-1);
- ui->asfla2_CB->setItemData(i+1,v, Qt::UserRole-1);
- ui->asspo1_CB->setItemData(i+1,v, Qt::UserRole-1);
- ui->asspo2_CB->setItemData(i+1,v, Qt::UserRole-1);
- }
- }
- for (i=4; iasail2_CB->setItemData(i+1,v, Qt::UserRole-1);
- ui->asele2_CB->setItemData(i+1,v, Qt::UserRole-1);
- ui->asrud2_CB->setItemData(i+1,v, Qt::UserRole-1);
- ui->asfla1_CB->setItemData(i+1,v, Qt::UserRole-1);
- ui->asfla2_CB->setItemData(i+1,v, Qt::UserRole-1);
- ui->asspo1_CB->setItemData(i+1,v, Qt::UserRole-1);
- ui->asspo2_CB->setItemData(i+1,v, Qt::UserRole-1);
- }
-
- i=ui->asail2_CB->currentIndex();
- if (i>0) {
- ui->asele2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asrud2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asfla1_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asfla2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asspo1_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asspo2_CB->setItemData(i,false, Qt::UserRole - 1);
- }
- i=ui->asrud2_CB->currentIndex();
- if (i>0) {
- ui->asail2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asele2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asfla1_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asfla2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asspo1_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asspo2_CB->setItemData(i,false, Qt::UserRole - 1);
- }
- i=ui->asele2_CB->currentIndex();
- if (i>0) {
- ui->asail2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asrud2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asfla1_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asfla2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asspo1_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asspo2_CB->setItemData(i,false, Qt::UserRole - 1);
- }
- i=ui->asfla1_CB->currentIndex();
- if (i>0) {
- ui->asail2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asele2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asrud2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asfla2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asspo1_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asspo2_CB->setItemData(i,false, Qt::UserRole - 1);
- }
- i=ui->asfla2_CB->currentIndex();
- if (i>0) {
- ui->asail2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asele2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asrud2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asfla1_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asspo1_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asspo2_CB->setItemData(i,false, Qt::UserRole - 1);
- }
- i=ui->asspo1_CB->currentIndex();
- if (i>0) {
- ui->asail2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asele2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asrud2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asfla1_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asfla2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asspo2_CB->setItemData(i,false, Qt::UserRole - 1);
- }
- i=ui->asspo2_CB->currentIndex();
- if (i>0) {
- ui->asail2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asele2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asrud2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asfla1_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asfla2_CB->setItemData(i,false, Qt::UserRole - 1);
- ui->asspo1_CB->setItemData(i,false, Qt::UserRole - 1);
- }
-
- if (ailerons>1 && ui->as_CB->isChecked()) {
- ui->asail2_label->show();
- ui->asail2_CB->show();
- } else {
- ui->asail2_label->hide();
- ui->asail2_CB->hide();
- }
- if (elevators>1 && ui->as_CB->isChecked()) {
- ui->asele2_label->show();
- ui->asele2_CB->show();
- } else {
- ui->asele2_label->hide();
- ui->asele2_CB->hide();
- }
- if (rudders>1 && ui->as_CB->isChecked()) {
- ui->asrud2_label->show();
- ui->asrud2_CB->show();
- } else {
- ui->asrud2_label->hide();
- ui->asrud2_CB->hide();
- }
- if (flaps>0 && ui->as_CB->isChecked()) {
- ui->asfla1_label->show();
- ui->asfla1_CB->show();
- } else {
- ui->asfla1_label->hide();
- ui->asfla1_CB->hide();
- }
- if (flaps>1 && ui->as_CB->isChecked()) {
- ui->asfla2_label->show();
- ui->asfla2_CB->show();
- } else {
- ui->asfla2_label->hide();
- ui->asfla2_CB->hide();
- }
- if (spoilers>0 && ui->as_CB->isChecked()) {
- ui->asspo1_label->show();
- ui->asspo1_CB->show();
- } else {
- ui->asspo1_label->hide();
- ui->asspo1_CB->hide();
- }
- if (spoilers>1 && ui->as_CB->isChecked()) {
- ui->asspo2_label->show();
- ui->asspo2_CB->show();
- } else {
- ui->asspo2_label->hide();
- ui->asspo2_CB->hide();
- }
- rxLock=false;
-}
diff --git a/companion/src/modelconfigdialog.h b/companion/src/modelconfigdialog.h
deleted file mode 100644
index f8f508c71..000000000
--- a/companion/src/modelconfigdialog.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef MODELCONFIGDIALOG_H
-#define MODELCONFIGDIALOG_H
-#include "eeprominterface.h"
-#include
-#include
-
-
-namespace Ui {
- class modelConfigDialog;
-}
-
-class modelConfigDialog : public QDialog {
- Q_OBJECT
-public:
- modelConfigDialog(RadioData &radioData, uint64_t * result, QWidget *parent = 0);
- ~modelConfigDialog();
-
-private:
- Ui::modelConfigDialog *ui;
- bool wingsLock;
- bool tailLock;
- bool rxLock;
- int ModelType;
- RadioData &radioData;
- uint64_t * result;
- GeneralSettings generalSettings;
- QStringList ruddercolor;
- QStringList aileroncolor;
- QStringList elevatorcolor;
- QStringList throttlecolor;
- QStringList flapscolor;
- QStringList airbrakecolor;
- QStringList helicolor;
- bool rx[10];
- unsigned int ailerons;
- unsigned int rudders;
- unsigned int throttle;
- unsigned int elevators;
- unsigned int spoilers;
- unsigned int flaps;
-
-
-
-private slots:
- void ConfigChanged();
- void tailConfigChanged();
- void rxUpdate();
- void resetControls();
- void on_planeButton_clicked();
- void on_heliButton_clicked();
- void on_gliderButton_clicked();
- void on_deltaButton_clicked();
- void formSetup();
- void asUpdate();
- void shrink();
- void doAction(QAbstractButton *button);
-};
-
-#endif // MODELCONFIGDIALOG_H
diff --git a/companion/src/modelconfigdialog.ui b/companion/src/modelconfigdialog.ui
deleted file mode 100644
index afa4dd0bd..000000000
--- a/companion/src/modelconfigdialog.ui
+++ /dev/null
@@ -1,1264 +0,0 @@
-
-
- modelConfigDialog
-
-
-
- 0
- 0
- 793
- 599
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
- Model Configuration Wizard
-
-
-
-
-
-
- Engine
-
-
-
- -
-
-
- 0
-
-
-
-
-
- Qt::Vertical
-
-
-
- 400
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 400
- 200
-
-
-
- QFrame::Panel
-
-
- 0
-
-
-
-
-
- :/images/mcw/aw0a0f.png
-
-
- false
-
-
- 0
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 400
- 200
-
-
-
- QFrame::Panel
-
-
- 0
-
-
-
-
-
- :/images/mcw/atailv.png
-
-
- false
-
-
- 0
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- -
-
-
-
- 18
-
-
-
- Model Type
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 85
- 0
-
-
-
- Airplane
-
-
-
-
-
-
- :/images/mcw/aicon.png:/images/mcw/aicon.png
-
-
-
- 50
- 29
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 85
- 0
-
-
-
- Helicopter
-
-
-
-
-
-
- :/images/mcw/hicon.png:/images/mcw/hicon.png
-
-
-
- 50
- 29
-
-
-
-
- -
-
-
-
- 85
- 0
-
-
-
- Glider
-
-
-
-
-
-
- :/images/mcw/gicon.png:/images/mcw/gicon.png
-
-
-
- 50
- 29
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 14
- 75
- true
-
-
-
- Wing
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Aileron controls
-
-
-
- -
-
-
-
-
- No Ailerons
-
-
- -
-
- 1 Servo (or Y)
-
-
- -
-
- 2 Servos
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Flaps controls
-
-
-
- -
-
-
-
-
- No Flaps
-
-
- -
-
- 1 Servo (or inverting Y)
-
-
- -
-
- 2 Servos
-
-
-
-
- -
-
-
- Spoilers
-
-
-
- -
-
-
-
-
- No Spoilers/Airbrakes
-
-
- -
-
- 1 Servo (or Y or inverting Y)
-
-
- -
-
- 2 Servos
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 14
- 75
- true
-
-
-
- Swash Plate
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- Swash plate
-
-
-
- -
-
-
-
-
- 90° / Fixed / Coax
-
-
- -
-
- 120°
-
-
- -
-
- 120X°
-
-
- -
-
- 140°
-
-
- -
-
- FlyBarLess
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 14
- 75
- true
-
-
-
- Tail
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Tail controls
-
-
-
- -
-
-
-
-
- 1 Servo Elevator / 1 Servo Rudder
-
-
- -
-
- V Tail
-
-
- -
-
- 2 Servos Elevator / 1 Servo Rudder
-
-
-
-
- -
-
-
- Gyroscope
-
-
-
- -
-
-
-
-
- NoGyro
-
-
- -
-
- Switch control
-
-
- -
-
- Pot control
-
-
-
-
- -
-
-
- Channel style
-
-
-
- -
-
-
-
-
- Open9x Style
-
-
- -
-
- Futaba Style
-
-
-
-
- -
-
-
- 3
-
-
-
-
-
- QFrame::Panel
-
-
- QFrame::Raised
-
-
- 2
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- QFrame::Panel
-
-
- QFrame::Raised
-
-
- 3
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- QFrame::Panel
-
-
- QFrame::Raised
-
-
- 4
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- QFrame::Panel
-
-
- QFrame::Raised
-
-
- 5
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- QFrame::Panel
-
-
- QFrame::Raised
-
-
- 6
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- QFrame::Panel
-
-
- QFrame::Raised
-
-
- 7
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- QFrame::Panel
-
-
- QFrame::Raised
-
-
- 8
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- QFrame::Panel
-
-
- QFrame::Raised
-
-
- 9
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- QFrame::Panel
-
-
- QFrame::Raised
-
-
- 1
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 0
-
-
-
-
- -
-
-
- QFrame::Panel
-
-
- QFrame::Raised
-
-
- 10
-
-
- Qt::AlignCenter
-
-
-
-
-
- -
-
-
-
-
-
- Qt::Vertical
-
-
- QSizePolicy::Expanding
-
-
-
- 20
- 0
-
-
-
-
- -
-
-
- Ele2
-
-
-
- -
-
-
- Use advanced controls
-
-
-
- -
-
-
- Spoiler2
-
-
-
- -
-
-
- Flap2
-
-
-
- -
-
-
- Flap1
-
-
-
- -
-
-
- Rud2
-
-
-
- -
-
-
-
-
- AUTO
-
-
- -
-
- CH01
-
-
- -
-
- CH02
-
-
- -
-
- CH03
-
-
- -
-
- CH04
-
-
- -
-
- CH05
-
-
- -
-
- CH06
-
-
- -
-
- CH07
-
-
- -
-
- CH08
-
-
- -
-
- CH09
-
-
- -
-
- CH10
-
-
-
-
- -
-
-
- Ail2
-
-
-
- -
-
-
- Spoiler 1
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QDialogButtonBox::Apply|QDialogButtonBox::Cancel
-
-
- false
-
-
-
- -
-
-
-
-
- AUTO
-
-
- -
-
- CH01
-
-
- -
-
- CH02
-
-
- -
-
- CH03
-
-
- -
-
- CH04
-
-
- -
-
- CH05
-
-
- -
-
- CH06
-
-
- -
-
- CH07
-
-
- -
-
- CH08
-
-
- -
-
- CH09
-
-
- -
-
- CH10
-
-
-
-
- -
-
-
-
-
- AUTO
-
-
- -
-
- CH01
-
-
- -
-
- CH02
-
-
- -
-
- CH03
-
-
- -
-
- CH04
-
-
- -
-
- CH05
-
-
- -
-
- CH06
-
-
- -
-
- CH07
-
-
- -
-
- CH08
-
-
- -
-
- CH09
-
-
- -
-
- CH10
-
-
-
-
- -
-
-
-
-
- AUTO
-
-
- -
-
- CH01
-
-
- -
-
- CH02
-
-
- -
-
- CH03
-
-
- -
-
- CH04
-
-
- -
-
- CH05
-
-
- -
-
- CH06
-
-
- -
-
- CH07
-
-
- -
-
- CH08
-
-
- -
-
- CH09
-
-
- -
-
- CH10
-
-
-
-
- -
-
-
-
-
- AUTO
-
-
- -
-
- CH01
-
-
- -
-
- CH02
-
-
- -
-
- CH03
-
-
- -
-
- CH04
-
-
- -
-
- CH05
-
-
- -
-
- CH06
-
-
- -
-
- CH07
-
-
- -
-
- CH08
-
-
- -
-
- CH09
-
-
- -
-
- CH10
-
-
-
-
- -
-
-
-
-
- AUTO
-
-
- -
-
- CH01
-
-
- -
-
- CH02
-
-
- -
-
- CH03
-
-
- -
-
- CH04
-
-
- -
-
- CH05
-
-
- -
-
- CH06
-
-
- -
-
- CH07
-
-
- -
-
- CH08
-
-
- -
-
- CH09
-
-
- -
-
- CH10
-
-
-
-
- -
-
-
-
-
- AUTO
-
-
- -
-
- CH01
-
-
- -
-
- CH02
-
-
- -
-
- CH03
-
-
- -
-
- CH04
-
-
- -
-
- CH05
-
-
- -
-
- CH06
-
-
- -
-
- CH07
-
-
- -
-
- CH08
-
-
- -
-
- CH09
-
-
- -
-
- CH10
-
-
-
-
-
-
- -
-
-
-
- 85
- 0
-
-
-
- Delta wing
-
-
-
-
-
-
- :/images/mcw/dicon.png:/images/mcw/dicon.png
-
-
-
- 50
- 29
-
-
-
-
- -
-
-
-
-
- Not present
-
-
- -
-
- Present
-
-
-
-
- -
-
-
- Rudder
-
-
-
- -
-
-
-
-
- Not present
-
-
- -
-
- Single rudder
-
-
- -
-
- Dual rudder (with 2 servos)
-
-
-
-
-
-
-
-
-
-
-
diff --git a/companion/src/modeledit/channels.cpp b/companion/src/modeledit/channels.cpp
index 070a0fcdc..80b47cc34 100644
--- a/companion/src/modeledit/channels.cpp
+++ b/companion/src/modeledit/channels.cpp
@@ -6,33 +6,40 @@
#include
#include
-Channels::Channels(QWidget * parent, ModelData & model):
- ModelPanel(parent, model)
+Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
+ ModelPanel(parent, model, generalSettings, firmware)
{
QGridLayout * gridLayout = new QGridLayout(this);
+ bool minimize = false;
int col = 1;
- if (GetEepromInterface()->getCapability(ChannelsName))
+ if (firmware->getCapability(ChannelsName))
+ {
+ minimize=true;
addLabel(gridLayout, tr("Name"), col++);
- addLabel(gridLayout, tr("Offset"), col++);
- addLabel(gridLayout, tr("Min"), col++);
- addLabel(gridLayout, tr("Max"), col++);
- addLabel(gridLayout, tr("Invert"), col++);
- if (GetEepromInterface()->getCapability(PPMCenter))
- addLabel(gridLayout, tr("Center"), col++);
- if (GetEepromInterface()->getCapability(SYMLimits))
- addLabel(gridLayout, tr("Sym"), col++);
+ }
+ addLabel(gridLayout, tr("Subtrim"), col++, minimize);
+ addLabel(gridLayout, tr("Min"), col++, minimize);
+ addLabel(gridLayout, tr("Max"), col++, minimize);
+ addLabel(gridLayout, tr("Direction"), col++, minimize);
+ if (IS_TARANIS(GetEepromInterface()->getBoard()))
+ addLabel(gridLayout, tr("Curve"), col++, minimize);
+ if (firmware->getCapability(PPMCenter))
+ addLabel(gridLayout, tr("PPM Center"), col++, minimize);
+ if (firmware->getCapability(SYMLimits))
+ addLabel(gridLayout, tr("Linear Subtrim"), col++, true);
- for (int i=0; igetCapability(Outputs); i++) {
+ for (int i=0; igetCapability(Outputs); i++) {
col = 0;
// Channel label
QLabel *label = new QLabel(this);
label->setText(tr("Channel %1").arg(i+1));
+ label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
gridLayout->addWidget(label, i+1, col++, 1, 1);
// Channel name
- int nameLen = GetEepromInterface()->getCapability(ChannelsName);
+ int nameLen = firmware->getCapability(ChannelsName);
if (nameLen > 0) {
QLineEdit * name = new QLineEdit(this);
name->setProperty("index", i);
@@ -63,10 +70,12 @@ Channels::Channels(QWidget * parent, ModelData & model):
minSB->setAccelerated(true);
minSB->setDecimals(1);
minSB->setMinimum(model.extendedLimits ? -125 : -100);
+ minSB->setSingleStep(0.1);
minSB->setMaximum(0);
minSB->setValue(float(model.limitData[i].min) / 10);
connect(minSB, SIGNAL(editingFinished()), this, SLOT(minEdited()));
gridLayout->addWidget(minSB, i+1, col++, 1, 1);
+ minSpins << minSB;
// Channel max
QDoubleSpinBox * maxSB = new QDoubleSpinBox(this);
@@ -75,10 +84,12 @@ Channels::Channels(QWidget * parent, ModelData & model):
maxSB->setAccelerated(true);
maxSB->setDecimals(1);
maxSB->setMinimum(0);
+ maxSB->setSingleStep(0.1);
maxSB->setMaximum(model.extendedLimits ? 125 : 100);
maxSB->setValue(float(model.limitData[i].max) / 10);
connect(maxSB, SIGNAL(editingFinished()), this, SLOT(maxEdited()));
gridLayout->addWidget(maxSB, i+1, col++, 1, 1);
+ maxSpins << maxSB;
// Channel inversion
QComboBox * invCB = new QComboBox(this);
@@ -88,8 +99,21 @@ Channels::Channels(QWidget * parent, ModelData & model):
connect(invCB, SIGNAL(currentIndexChanged(int)), this, SLOT(invEdited()));
gridLayout->addWidget(invCB, i+1, col++, 1, 1);
+ // Curve
+ if (IS_TARANIS(GetEepromInterface()->getBoard())) {
+ QComboBox * curveCB = new QComboBox(this);
+ curveCB->setProperty("index", i);
+ int numcurves = firmware->getCapability(NumCurves);
+ for (int j=-numcurves; j<=numcurves; j++) {
+ curveCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, j).toString(), j);
+ }
+ curveCB->setCurrentIndex(model.limitData[i].curve.value+numcurves);
+ connect(curveCB, SIGNAL(currentIndexChanged(int)), this, SLOT(curveEdited()));
+ gridLayout->addWidget(curveCB, i+1, col++, 1, 1);
+ }
+
// PPM center
- if (GetEepromInterface()->getCapability(PPMCenter)) {
+ if (firmware->getCapability(PPMCenter)) {
QSpinBox * center = new QSpinBox(this);
center->setProperty("index", i);
center->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
@@ -102,7 +126,7 @@ Channels::Channels(QWidget * parent, ModelData & model):
}
// Symetrical limits
- if (GetEepromInterface()->getCapability(SYMLimits)) {
+ if (firmware->getCapability(SYMLimits)) {
QCheckBox * symlimits = new QCheckBox(this);
symlimits->setProperty("index", i);
symlimits->setChecked(model.limitData[i].symetrical);
@@ -110,6 +134,8 @@ Channels::Channels(QWidget * parent, ModelData & model):
gridLayout->addWidget(symlimits, i+1, col++, 1, 1);
}
}
+ // Push the rows up
+ addVSpring(gridLayout, 0,firmware->getCapability(Outputs)+1);
}
Channels::~Channels()
@@ -160,6 +186,18 @@ void Channels::maxEdited()
emit modified();
}
+void Channels::refreshExtendedLimits()
+{
+ for (int i=0; igetCapability(Outputs); i++) {
+ QDoubleSpinBox * minDSB = minSpins[i];
+ QDoubleSpinBox * maxDSB = maxSpins[i];
+
+ minDSB->setMinimum(model.extendedLimits ? -125 : -100);
+ maxDSB->setMaximum(model.extendedLimits ? 125 : 100);
+ }
+ emit modified();
+}
+
void Channels::invEdited()
{
QComboBox *cb = qobject_cast(sender());
@@ -168,6 +206,14 @@ void Channels::invEdited()
emit modified();
}
+void Channels::curveEdited()
+{
+ QComboBox *cb = qobject_cast(sender());
+ int index = cb->property("index").toInt();
+ model.limitData[index].curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, cb->itemData(cb->currentIndex()).toInt());
+ emit modified();
+}
+
void Channels::ppmcenterEdited()
{
QSpinBox *sb = qobject_cast(sender());
diff --git a/companion/src/modeledit/channels.h b/companion/src/modeledit/channels.h
index ee372ecd7..202f4a03d 100644
--- a/companion/src/modeledit/channels.h
+++ b/companion/src/modeledit/channels.h
@@ -2,14 +2,22 @@
#define CHANNELS_H
#include "modelpanel.h"
+#include
class Channels : public ModelPanel
{
Q_OBJECT
public:
- Channels(QWidget *parent, ModelData & model);
+ Channels(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
~Channels();
+
+ private:
+ QVector minSpins;
+ QVector maxSpins;
+
+ public slots:
+ void refreshExtendedLimits();
private slots:
void symlimitsEdited();
@@ -18,6 +26,7 @@ class Channels : public ModelPanel
void minEdited();
void maxEdited();
void invEdited();
+ void curveEdited();
void ppmcenterEdited();
};
diff --git a/companion/src/modeledit/curvedialog.ui b/companion/src/modeledit/curvedialog.ui
deleted file mode 100644
index f8ccccba3..000000000
--- a/companion/src/modeledit/curvedialog.ui
+++ /dev/null
@@ -1,217 +0,0 @@
-
-
- Dialog
-
-
-
- 0
- 0
- 400
- 300
-
-
-
- Dialog
-
-
- -
-
-
-
-
-
- Curve type
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- -100
-
-
- 100
-
-
-
- -
-
-
- Coefficient
-
-
-
- -
-
-
-
-
- Both
-
-
- -
-
- x>0
-
-
- -
-
- x<0
-
-
-
-
- -
-
-
- Y at X=0
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- -100
-
-
- 100
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- -100
-
-
- 100
-
-
-
- -
-
-
- Side
-
-
-
- -
-
-
- Y at X=-100
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- -100
-
-
- 100
-
-
-
- -
-
-
- Y at X=100
-
-
-
- -
-
-
-
-
- Linear
-
-
- -
-
- Single Expo
-
-
- -
-
- Symmetrical f(x)=-f(-x)
-
-
- -
-
- Symmetrical f(x)=f(-x)
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
-
-
-
-
-
-
-
- buttonBox
- accepted()
- Dialog
- accept()
-
-
- 248
- 254
-
-
- 157
- 274
-
-
-
-
- buttonBox
- rejected()
- Dialog
- reject()
-
-
- 316
- 260
-
-
- 286
- 274
-
-
-
-
-
diff --git a/companion/src/modeledit/curves.cpp b/companion/src/modeledit/curves.cpp
index 1112b1dde..31b7eb64f 100644
--- a/companion/src/modeledit/curves.cpp
+++ b/companion/src/modeledit/curves.cpp
@@ -10,65 +10,90 @@
#define GFX_MARGIN 16
-static const QColor colors[C9X_MAX_CURVES] = {
- QColor(0,0,127),
- QColor(0,127,0),
- QColor(127,0,0),
- QColor(0,127,127),
- QColor(127,0,127),
- QColor(127,127,0),
- QColor(127,127,127),
- QColor(0,0,255),
- QColor(0,127,255),
- QColor(127,0,255),
- QColor(0,255,0),
- QColor(0,255,127),
- QColor(127,255,0),
- QColor(255,0,0),
- QColor(255,0,127),
- QColor(255,127,0),
-};
+#define CURVE_COEFF_ENABLE 1
+#define CURVE_YMID_ENABLE 2
+#define CURVE_YMIN_ENABLE 4
-#if 0
-#ifdef __APPLE__
- ui->curveEdit_1->setStyleSheet("color: #00007f;");
- ui->curveEdit_2->setStyleSheet("color: #007f00;");
- ui->curveEdit_3->setStyleSheet("color: #7f0000;");
- ui->curveEdit_4->setStyleSheet("color: #007f7f;");
- ui->curveEdit_5->setStyleSheet("color: #7f007f;");
- ui->curveEdit_6->setStyleSheet("color: #7f7f00;");
- ui->curveEdit_7->setStyleSheet("color: #7f7f7f;");
- ui->curveEdit_8->setStyleSheet("color: #0000ff;");
- ui->curveEdit_9->setStyleSheet("color: #007fff;");
- ui->curveEdit_10->setStyleSheet("color: #7f00ff;");
- ui->curveEdit_11->setStyleSheet("color: #00ff00;");
- ui->curveEdit_12->setStyleSheet("color: #00ff7f;");
- ui->curveEdit_13->setStyleSheet("color: #7fff00;");
- ui->curveEdit_14->setStyleSheet("color: #ff0000;");
- ui->curveEdit_15->setStyleSheet("color: #ff007f;");
- ui->curveEdit_16->setStyleSheet("color: #ff7f00;");
-#else
- ui->curveEdit_1->setStyleSheet("background-color: #00007f; color: white;");
- ui->curveEdit_2->setStyleSheet("background-color: #007f00; color: white;");
- ui->curveEdit_3->setStyleSheet("background-color: #7f0000; color: white;");
- ui->curveEdit_4->setStyleSheet("background-color: #007f7f; color: white;");
- ui->curveEdit_5->setStyleSheet("background-color: #7f007f; color: white;");
- ui->curveEdit_6->setStyleSheet("background-color: #7f7f00; color: white;");
- ui->curveEdit_7->setStyleSheet("background-color: #7f7f7f; color: white;");
- ui->curveEdit_8->setStyleSheet("background-color: #0000ff; color: white;");
- ui->curveEdit_9->setStyleSheet("background-color: #007fff; color: white;");
- ui->curveEdit_10->setStyleSheet("background-color: #7f00ff; color: white;");
- ui->curveEdit_11->setStyleSheet("background-color: #00ff00; color: white;");
- ui->curveEdit_12->setStyleSheet("background-color: #00ff7f; color: white;");
- ui->curveEdit_13->setStyleSheet("background-color: #7fff00; color: white;");
- ui->curveEdit_14->setStyleSheet("background-color: #ff0000; color: white;");
- ui->curveEdit_15->setStyleSheet("background-color: #ff007f; color: white;");
- ui->curveEdit_16->setStyleSheet("background-color: #ff7f00; color: white;");
-#endif
-#endif
+float curveLinear(float x, float coeff, float yMin, float yMid, float yMax)
+{
+ float a = (yMax-yMin) / 200.0;
+ return yMin + a * (x+100.0);
+}
-Curves::Curves(QWidget * parent, ModelData & model):
- ModelPanel(parent, model),
+float c9xexpou(float point, float coeff)
+{
+ float x = point*1024.0/100.0;
+ float k = coeff*256.0/100.0;
+ return ((k*x*x*x/(1024*1024) + x*(256-k) + 128) / 256) / 1024.0 * 100;
+}
+
+float curveExpo(float x, float coeff, float yMin, float yMid, float yMax)
+{
+ float a = (yMax-yMin) / 100.0;
+
+ x += 100.0;
+ x /= 2.0;
+
+ if (coeff >= 0) {
+ return round(c9xexpou(x, coeff)*a + yMin);
+ }
+ else {
+ coeff = -coeff;
+ x = 100 - x;
+ return round((100.0 - c9xexpou(x, coeff))*a + yMin);
+ }
+}
+
+float curveSymmetricalY(float x, float coeff, float yMin, float yMid, float yMax)
+{
+ bool invert;
+ if (x<0) {
+ x = -x;
+ invert = 1;
+ }
+ else {
+ invert = 0;
+ }
+
+ float y;
+ if (coeff >= 0) {
+ y = round(c9xexpou(x, coeff) * (yMax/100.0));
+ }
+ else {
+ coeff = -coeff;
+ x = 100.0 - x;
+ y = round((100.0-c9xexpou(x, coeff)) * (yMax/100.0));
+ }
+
+ if (invert) {
+ y = -y;
+ }
+
+ return y;
+}
+
+float curveSymmetricalX(float x, float coeff, float yMin, float yMid, float yMax)
+{
+ float a = (yMax-yMid) / 100.0;
+
+ if (x<0)
+ x = -x;
+
+ float y;
+ if (coeff >= 0) {
+ y = round(c9xexpou(x, coeff) * a + yMid);
+ }
+ else {
+ coeff = -coeff;
+ x = 100-x;
+ y = round((100.0-c9xexpou(x, coeff)) * a + yMid);
+ }
+
+ return y;
+}
+
+Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
+ ModelPanel(parent, model, generalSettings, firmware),
ui(new Ui::Curves),
currentCurve(0)
{
@@ -76,7 +101,7 @@ Curves::Curves(QWidget * parent, ModelData & model):
lock = true;
- if (!GetEepromInterface()->getCapability(HasCvNames)) {
+ if (!firmware->getCapability(HasCvNames)) {
ui->curveName->hide();
ui->curveNameLabel->hide();
}
@@ -85,7 +110,7 @@ Curves::Curves(QWidget * parent, ModelData & model):
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
ui->curvePreview->setScene(scene);
- for (int i=0; igetCapability(NumCurves); i++) {
+ for (int i=0; igetCapability(NumCurves); i++) {
visibleCurves[i] = false;
// The reset curve button
@@ -103,6 +128,11 @@ Curves::Curves(QWidget * parent, ModelData & model):
QPalette palette;
palette.setBrush(QPalette::Active, QPalette::Button, QBrush(colors[i]));
palette.setBrush(QPalette::Active, QPalette::ButtonText, QBrush(Qt::white));
+#ifdef __APPLE__
+ edit->setStyleSheet(QString("color: %1;").arg(colors[i].name()));
+#else
+ edit->setStyleSheet(QString("background-color: %1; color: white;").arg(colors[i].name()));
+#endif
edit->setPalette(palette);
edit->setText(tr("Curve %1").arg(i+1));
connect(edit, SIGNAL(clicked()), this, SLOT(editCurve()));
@@ -134,7 +164,7 @@ Curves::Curves(QWidget * parent, ModelData & model):
ui->pointsLayout->addWidget(spnx[i], i, 1, 1, 1);
bool insert;
- if (GetEepromInterface()->getCapability(EnhancedCurves)) {
+ if (firmware->getCapability(EnhancedCurves)) {
insert = (i >= 1);
}
else {
@@ -145,6 +175,11 @@ Curves::Curves(QWidget * parent, ModelData & model):
}
}
+ addTemplate(tr("Linear"), CURVE_YMIN_ENABLE, curveLinear);
+ addTemplate(tr("Single Expo"), CURVE_COEFF_ENABLE | CURVE_YMIN_ENABLE, curveExpo);
+ addTemplate(tr("Symmetrical f(x)=-f(-x)"), CURVE_COEFF_ENABLE, curveSymmetricalY);
+ addTemplate(tr("Symmetrical f(x)=f(-x)"), CURVE_COEFF_ENABLE | CURVE_YMID_ENABLE, curveSymmetricalX);
+
lock = false;
}
@@ -185,45 +220,20 @@ void Curves::update()
{
lock = true;
- if (GetEepromInterface()->getCapability(HasCvNames)) {
+ if (firmware->getCapability(HasCvNames)) {
ui->curveName->setText(model.curves[currentCurve].name);
}
- int count = model.curves[currentCurve].count;
- for (int i=0; ishow();
- spny[i]->setValue(model.curves[currentCurve].points[i].y);
- if (model.curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM) {
- spnx[i]->show();
- if (i==0 || i==model.curves[currentCurve].count-1) {
- spnx[i]->setDisabled(true);
- spnx[i]->setMaximum(+100);
- spnx[i]->setMinimum(-100);
- }
- else {
- spnx[i]->setMaximum(model.curves[currentCurve].points[i+1].x);
- spnx[i]->setMinimum(model.curves[currentCurve].points[i-1].x);
- }
- spnx[i]->setValue(model.curves[currentCurve].points[i].x);
- }
- else {
- spnx[i]->hide();
- }
- }
- for (int i=count; ihide();
- spnx[i]->hide();
- }
-
updateCurveType();
updateCurve();
+ updateCurvePoints();
lock = false;
}
void Curves::setCurrentCurve(int index)
{
- currentCurve = index;
+ currentCurve = index;
}
void Curves::updateCurveType()
@@ -232,7 +242,7 @@ void Curves::updateCurveType()
int index = 0;
- if (GetEepromInterface()->getCapability(EnhancedCurves)) {
+ if (firmware->getCapability(EnhancedCurves)) {
index = model.curves[currentCurve].count - 2;
}
else {
@@ -253,6 +263,8 @@ void Curves::updateCurveType()
void Curves::updateCurve()
{
+ lock = true;
+
Node * nodel = 0;
Node * nodex = 0;
QColor color;
@@ -276,7 +288,7 @@ void Curves::updateCurve()
pen.setWidth(1);
pen.setStyle(Qt::SolidLine);
- int numcurves = GetEepromInterface()->getCapability(NumCurves);
+ int numcurves = firmware->getCapability(NumCurves);
for (int k=0; kaddItem(nodex);
if (i>0) scene->addItem(new Edge(nodel, nodex));
}
+
+ lock = false;
+}
+
+void Curves::updateCurvePoints()
+{
+ lock = true;
+
+ int count = model.curves[currentCurve].count;
+ for (int i=0; ishow();
+ spny[i]->setValue(model.curves[currentCurve].points[i].y);
+ if (model.curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM) {
+ spnx[i]->show();
+ if (i==0 || i==model.curves[currentCurve].count-1) {
+ spnx[i]->setDisabled(true);
+ spnx[i]->setMaximum(+100);
+ spnx[i]->setMinimum(-100);
+ }
+ else {
+ spnx[i]->setMaximum(model.curves[currentCurve].points[i+1].x);
+ spnx[i]->setMinimum(model.curves[currentCurve].points[i-1].x);
+ }
+ spnx[i]->setValue(model.curves[currentCurve].points[i].x);
+ }
+ else {
+ spnx[i]->hide();
+ }
+ }
+ for (int i=count; ihide();
+ spnx[i]->hide();
+ }
+
+ lock = false;
}
void Curves::onPointEdited()
{
if (!lock) {
- lock = true;
int index = sender()->property("index").toInt();
model.curves[currentCurve].points[index].x = spnx[index]->value();
model.curves[currentCurve].points[index].y = spny[index]->value();
updateCurve();
emit modified();
- lock = false;
}
}
@@ -341,6 +386,10 @@ void Curves::onNodeMoved(int x, int y)
model.curves[currentCurve].points[index].y = y;
spnx[index]->setValue(x);
spny[index]->setValue(y);
+ if (index > 0)
+ spnx[index-1]->setMaximum(x);
+ if (index < model.curves[currentCurve].count-1)
+ spnx[index+1]->setMinimum(x);
emit modified();
lock = false;
}
@@ -361,7 +410,7 @@ void Curves::onNodeUnfocus()
bool Curves::allowCurveType(int points, CurveData::CurveType type)
{
- int numcurves = GetEepromInterface()->getCapability(NumCurves);
+ int numcurves = firmware->getCapability(NumCurves);
int totalpoints = 0;
for (int i=0; igetCapability(NumCurvePoints);
+ int fwpoints = firmware->getCapability(NumCurvePoints);
if (totalpoints > fwpoints) {
QMessageBox::warning(this, "companion", tr("Not enough free points in EEPROM to store the curve."));
return false;
@@ -390,7 +439,7 @@ void Curves::on_curvePoints_currentIndexChanged(int index)
// TODO something better + reuse!
for (int i=0; i= model.curves[currentCurve].count-1 ? +100 : -100 + (200*i)/(numpoints-1));
+ model.curves[currentCurve].points[i].x = (i >= numpoints-1 ? +100 : -100 + (200*i)/(numpoints-1));
model.curves[currentCurve].points[i].y = 0;
}
@@ -413,7 +462,7 @@ void Curves::on_curveCustom_currentIndexChanged(int index)
// TODO something better + reuse!
for (int i=0; i= model.curves[currentCurve].count-1 ? +100 : -100 + (200*i)/(numpoints-1));
+ model.curves[currentCurve].points[i].x = (i >= numpoints-1 ? +100 : -100 + (200*i)/(numpoints-1));
model.curves[currentCurve].points[i].y = 0;
}
@@ -444,213 +493,72 @@ void Curves::resizeEvent(QResizeEvent *event)
QRect qr = ui->curvePreview->contentsRect();
ui->curvePreview->scene()->setSceneRect(GFX_MARGIN, GFX_MARGIN, qr.width()-GFX_MARGIN*2, qr.height()-GFX_MARGIN*2);
updateCurve();
-
ModelPanel::resizeEvent(event);
}
-#if 0
-void ModelEdit::on_ca_ctype_CB_currentIndexChanged()
+void Curves::on_curveType_currentIndexChanged()
{
- int index=ui->ca_ctype_CB->currentIndex();
- switch (index) {
+ int index = ui->curveType->currentIndex();
+ unsigned int flags = templates[index].flags;
+ ui->curveCoeffLabel->setVisible(flags & CURVE_COEFF_ENABLE);
+ ui->curveCoeff->setVisible(flags & CURVE_COEFF_ENABLE);
+ ui->yMax->setValue(100);
+ ui->yMidLabel->setVisible(flags & CURVE_YMID_ENABLE);
+ ui->yMid->setVisible(flags & CURVE_YMID_ENABLE);
+ ui->yMid->setValue(0);
+ ui->yMinLabel->setVisible(flags & CURVE_YMIN_ENABLE);
+ ui->yMin->setVisible(flags & CURVE_YMIN_ENABLE);
+ ui->yMin->setValue(-100);
+}
+
+void Curves::addTemplate(QString name, unsigned int flags, curveFunction function)
+{
+ CurveCreatorTemplate tmpl;
+ tmpl.name = name;
+ tmpl.flags = flags;
+ tmpl.function = function;
+ templates.append(tmpl);
+ ui->curveType->addItem(name);
+}
+
+void Curves::on_curveApply_clicked()
+{
+ int index = ui->curveType->currentIndex();
+ int numpoints = model.curves[currentCurve].count;
+
+ for (int i=0; icurveSide->currentIndex()) {
case 0:
- ui->ca_coeff_SB->hide();
- ui->ca_coeff_label->hide();
- ui->ca_ymid_SB->hide();
- ui->ca_ymid_label->hide();
- ui->ca_ymin_SB->show();
- ui->ca_ymin_label->show();
- ui->ca_ymin_SB->setValue(-100);
- ui->ca_ymax_SB->setValue(100);
+ apply = true;
break;
case 1:
- ui->ca_coeff_SB->show();
- ui->ca_coeff_label->show();
- ui->ca_ymid_SB->hide();
- ui->ca_ymid_label->hide();
- ui->ca_ymin_SB->show();
- ui->ca_ymin_label->show();
- ui->ca_ymin_SB->setValue(-100);
- ui->ca_ymax_SB->setValue(100);
+ if (x>=0)
+ apply = true;
break;
case 2:
- ui->ca_coeff_SB->show();
- ui->ca_coeff_label->show();
- ui->ca_ymid_SB->hide();
- ui->ca_ymid_label->hide();
- ui->ca_ymin_SB->hide();
- ui->ca_ymin_label->hide();
- ui->ca_ymax_SB->setValue(100);
- break;
- case 3:
- ui->ca_coeff_SB->show();
- ui->ca_coeff_label->show();
- ui->ca_ymid_SB->show();
- ui->ca_ymid_label->show();
- ui->ca_ymin_SB->hide();
- ui->ca_ymin_label->hide();
- ui->ca_ymid_SB->setValue(0);
- ui->ca_ymax_SB->setValue(100);
+ if (x<0)
+ apply = true;
break;
}
-}
-float c9xexpou(float point, float coeff)
-{
- float x=point*1024.0/100.0;
- float k=coeff*256.0/100.0;
- return ((k*x*x*x/(1024*1024) + x*(256-k) + 128) / 256)/1024.0*100;
-}
-
-void ModelEdit::on_ca_apply_PB_clicked()
-{
- int index=ui->ca_ctype_CB->currentIndex();
- float x;
- int y;
- int invert=0;
- float a;
- if (index==0) {
- a=(ui->ca_ymax_SB->value()-ui->ca_ymin_SB->value())/200.0;
- int numpoints=model.curves[currentCurve].count;
- for (int i=0; ica_ymin_SB->value()+a*x;
- switch (ui->ca_side_CB->currentIndex()) {
- case 0:
- model.curves[currentCurve].points[i].y=y;
- break;
- case 1:
- if (x>=100) {
- model.curves[currentCurve].points[i].y=y;
- }
- break;
- case 2:
- if (x<100) {
- model.curves[currentCurve].points[i].y=y;
- }
- break;
- }
- }
- } else if (index==1) {
- int numpoints=model.curves[currentCurve].count;
- for (int i=0; ica_coeff_SB->value();
- if (a>=0) {
- y=round(c9xexpou(x,a)*(ui->ca_ymax_SB->value()-ui->ca_ymin_SB->value())/100.0+ui->ca_ymin_SB->value());
- } else {
- a=-a;
- x=100-x;
- y=round((100.0-c9xexpou(x,a))*(ui->ca_ymax_SB->value()-ui->ca_ymin_SB->value())/100.0+ui->ca_ymin_SB->value());
- }
- switch (ui->ca_side_CB->currentIndex()) {
- case 0:
- model.curves[currentCurve].points[i].y=y;
- break;
- case 1:
- if (x>=50) {
- model.curves[currentCurve].points[i].y=y;
- }
- break;
- case 2:
- if (x<50) {
- model.curves[currentCurve].points[i].y=y;
- }
- break;
- }
- }
- } else if (index==2) {
- int numpoints=model.curves[currentCurve].count;
- for (int i=0; ica_coeff_SB->value();
- if (x<0) {
- x=-x;
- invert=1;
- } else {
- invert=0;
- }
- if (a>=0) {
- y=round(c9xexpou(x,a)*(ui->ca_ymax_SB->value()/100.0));
- } else {
- a=-a;
- x=100-x;
- y=round((100.0-c9xexpou(x,a))*(ui->ca_ymax_SB->value()/100.0));
- }
- switch (ui->ca_side_CB->currentIndex()) {
- case 0:
- if (invert==1) {
- model.curves[currentCurve].points[i].y=-y;
- } else {
- model.curves[currentCurve].points[i].y=y;
- }
- break;
- case 1:
- if (invert==0) {
- model.curves[currentCurve].points[i].y=y;
- }
- break;
- case 2:
- if (invert==1) {
- model.curves[currentCurve].points[i].y=-y;
- }
- break;
- }
- }
- } else if (index==3) {
- int numpoints=model.curves[currentCurve].count;
- for (int i=0; i=0);
- a=ui->ca_coeff_SB->value();
- if (x<0) {
- x=-x;
- }
- if (a>=0) {
- y=round(c9xexpou(x,a)*((ui->ca_ymax_SB->value()-ui->ca_ymid_SB->value())/100.0)+ui->ca_ymid_SB->value());
- } else {
- a=-a;
- x=100-x;
- y=round((100.0-c9xexpou(x,a))*((ui->ca_ymax_SB->value()-ui->ca_ymid_SB->value())/100.0)+ui->ca_ymid_SB->value());
- }
- switch (ui->ca_side_CB->currentIndex()) {
- case 0:
- model.curves[currentCurve].points[i].y=y;
- break;
- case 1:
- if (pos) {
- model.curves[currentCurve].points[i].y=y;
- }
- break;
- case 2:
- if (!pos) {
- model.curves[currentCurve].points[i].y=y;
- }
- break;
- }
- }
+ if (apply) {
+ model.curves[currentCurve].points[i].y = templates[index].function(x, ui->curveCoeff->value(), ui->yMin->value(), ui->yMid->value(), ui->yMax->value());
}
- updateSettings();
- setCurrentCurve(currentCurve);
- drawCurve();
+ }
+
+ updateCurve();
+ updateCurvePoints();
+ emit modified();
}
+#if 0
void ModelEdit::clearCurves(bool ask)
{
if (ask) {
diff --git a/companion/src/modeledit/curves.h b/companion/src/modeledit/curves.h
index e8915cf65..57a39504a 100644
--- a/companion/src/modeledit/curves.h
+++ b/companion/src/modeledit/curves.h
@@ -8,12 +8,20 @@ namespace Ui {
class Curves;
}
+typedef float (*curveFunction) (float x, float coeff, float yMin, float yMid, float yMax);
+
+struct CurveCreatorTemplate {
+ QString name;
+ unsigned int flags;
+ curveFunction function;
+};
+
class Curves : public ModelPanel
{
Q_OBJECT
public:
- Curves(QWidget *parent, ModelData & model);
+ Curves(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
virtual ~Curves();
virtual void update();
@@ -30,9 +38,12 @@ class Curves : public ModelPanel
void onNodeMoved(int x, int y);
void onNodeFocus();
void onNodeUnfocus();
+ void on_curveType_currentIndexChanged();
+ void on_curveApply_clicked();
protected:
virtual void resizeEvent(QResizeEvent *event);
+ void addTemplate(QString name, unsigned int flags, curveFunction function);
private:
Ui::Curves *ui;
@@ -40,10 +51,13 @@ class Curves : public ModelPanel
bool visibleCurves[C9X_MAX_CURVES];
QSpinBox * spnx[C9X_MAX_POINTS];
QSpinBox * spny[C9X_MAX_POINTS];
+ QVector templates;
void setCurrentCurve(int index);
void updateCurve();
void updateCurveType();
+ void updateCurvePoints();
bool allowCurveType(int points, CurveData::CurveType type);
+ void setPointY(int i, int x, int y);
};
diff --git a/companion/src/modeledit/curves.ui b/companion/src/modeledit/curves.ui
index ed9800e89..1be96eecd 100644
--- a/companion/src/modeledit/curves.ui
+++ b/companion/src/modeledit/curves.ui
@@ -1,161 +1,344 @@
-
-
- Curves
-
-
-
- 0
- 0
- 638
- 587
-
-
-
- Form
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- 0
-
-
-
-
-
- -
-
-
-
-
- Standard
-
-
- -
-
- Custom
-
-
-
-
- -
-
-
-
-
- Lines
-
-
- -
-
- Smooth
-
-
-
-
-
-
- -
-
-
- Curve type
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
- Curve name
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
- 6
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 400
- 400
-
-
-
- Qt::AlignCenter
-
-
-
-
-
- -
-
-
- 0
-
-
- 2
-
-
- 0
-
-
- 0
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::MinimumExpanding
-
-
-
- 20
- 0
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
-
-
-
+
+
+ Curves
+
+
+
+ 0
+ 0
+ 718
+ 539
+
+
+
+
+
+
+ -
+
+
+ -
+
+
+ 10
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 400
+ 400
+
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
-
+
+
+ Curve name
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+ -
+
+
-
+
+ Fixed X
+
+
+ -
+
+ Custom X
+
+
+
+
+ -
+
+
-
+
+ Lines
+
+
+ -
+
+ Smooth
+
+
+
+
+
+
+ -
+
+
+ 6
+
+
+
+ -
+
+
+ Curve type
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+ 0
+
+
+ 2
+
+
+ 0
+
+
+ 0
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+ -
+
+
+
+ 50
+ false
+
+
+
+ false
+
+
+ Curve Creator
+
+
+
-
+
+
+ Y at X=0
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ -100
+
+
+ 100
+
+
+
+ -
+
+
+ Y at X=100
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ -100
+
+
+ 100
+
+
+
+ -
+
+
-
+
+ Both
+
+
+ -
+
+ x>0
+
+
+ -
+
+ x<0
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ -100
+
+
+ 100
+
+
+
+ -
+
+
+ Apply
+
+
+
+ -
+
+
+ Side
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ -100
+
+
+ 100
+
+
+
+ -
+
+
+ -
+
+
+ Curve type
+
+
+
+ -
+
+
+ Y at X=-100
+
+
+
+ -
+
+
+ Coefficient
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp
index b1805df46..8ce2e41ef 100644
--- a/companion/src/modeledit/customfunctions.cpp
+++ b/companion/src/modeledit/customfunctions.cpp
@@ -47,23 +47,28 @@ void RepeatComboBox::update()
setCurrentIndex(value);
}
-CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
- ModelPanel(parent, model),
- generalSettings(generalSettings),
- phononLock(false)
+CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
+ ModelPanel(parent, model, generalSettings, firmware),
+ initialized(false)
+#if defined(PHONON)
+ ,
+ phononCurrent(-1),
+ clickObject(NULL),
+ clickOutput(NULL)
+#endif
{
QGridLayout * gridLayout = new QGridLayout(this);
- int col = 1;
- addLabel(gridLayout, tr("Switch"), col++);
- addLabel(gridLayout, tr("Action"), col++);
- addLabel(gridLayout, tr("Parameters"), col++);
- addLabel(gridLayout, tr("Enable"), col++);
+ addLabel(gridLayout, tr("Switch"), 1);
+ addLabel(gridLayout, tr("Action"), 2);
+ addLabel(gridLayout, tr("Parameters"), 3);
+ addLabel(gridLayout, tr("Enable"), 4, true );
+ addEmptyLabel(gridLayout, 5 );
lock = true;
- int num_fsw = GetEepromInterface()->getCapability(CustomFunctions);
+ int num_fsw = firmware->getCapability(CustomFunctions);
- if (!GetEepromInterface()->getCapability(VoicesAsNumbers)) {
+ if (!firmware->getCapability(VoicesAsNumbers)) {
for (int i=0; igetCapability(VoicesMaxLength)+4;
+ int vml= firmware->getCapability(VoicesMaxLength)+4;
if (qd.exists()) {
QStringList filters;
filters << "*.wav" << "*.WAV";
@@ -96,31 +101,31 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
}
}
- for (int i=0; isetContextMenuPolicy(Qt::CustomContextMenu);
label->setMouseTracking(true);
label->setProperty("index", i);
- label->setText(tr("CF%1").arg(i+1));
- gridLayout->addWidget(label, i+1, 0);
+ label->setText(tr("SF%1").arg(i+1));
+ label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint)));
+ gridLayout->addWidget(label, i+1, 0);
// The switch
fswtchSwtch[i] = new QComboBox(this);
fswtchSwtch[i]->setProperty("index", i);
+ fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
gridLayout->addWidget(fswtchSwtch[i], i+1, 1);
- populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, POPULATE_ONOFF);
// The function
fswtchFunc[i] = new QComboBox(this);
fswtchFunc[i]->setProperty("index", i);
connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
gridLayout->addWidget(fswtchFunc[i], i+1, 2);
- populateFuncCB(fswtchFunc[i], model.funcSw[i].func);
QHBoxLayout *paramLayout = new QHBoxLayout();
gridLayout->addLayout(paramLayout, i+1, 3);
@@ -129,7 +134,6 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
fswtchGVmode[i]->setProperty("index", i);
connect(fswtchGVmode[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
paramLayout->addWidget(fswtchGVmode[i]);
- populateGVmodeCB(fswtchGVmode[i], model.funcSw[i].adjustMode);
fswtchParamGV[i] = new QCheckBox(this);
fswtchParamGV[i]->setProperty("index", i);
@@ -148,23 +152,29 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
fswtchParamT[i] = new QComboBox(this);
fswtchParamT[i]->setProperty("index", i);
paramLayout->addWidget(fswtchParamT[i]);
- populateFuncParamCB(fswtchParamT[i], model, func, model.funcSw[i].param, model.funcSw[i].adjustMode);
connect(fswtchParamT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
fswtchParamArmT[i] = new QComboBox(this);
fswtchParamArmT[i]->setProperty("index", i);
- populateFuncParamArmTCB(fswtchParamArmT[i], model.funcSw[i].paramarm, paramarmList);
fswtchParamArmT[i]->setEditable(true);
paramLayout->addWidget(fswtchParamArmT[i]);
connect(fswtchParamArmT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
connect(fswtchParamArmT[i], SIGNAL(editTextChanged ( const QString)), this, SLOT(customFunctionEdited()));
+
+ fswtchBLcolor[i] = new QSlider(this);
+ fswtchBLcolor[i]->setProperty("index", i);
+ fswtchBLcolor[i]->setMinimum(0);
+ fswtchBLcolor[i]->setMaximum(100);
+ fswtchBLcolor[i]->setSingleStep(1);
+ fswtchBLcolor[i]->setOrientation(Qt::Horizontal);
+ paramLayout->addWidget(fswtchBLcolor[i]);
+ connect(fswtchBLcolor[i], SIGNAL(sliderReleased()), this, SLOT(customFunctionEdited()));
#ifdef PHONON
playBT[i] = new QPushButton(this);
playBT[i]->setProperty("index", i);
- playBT[i]->setProperty("state", "play");
- playBT[i]->setIcon(CompanionIcon("play.png"));
+ playBT[i]->setIcon(playIcon);
paramLayout->addWidget(playBT[i]);
connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic()));
#endif
@@ -178,11 +188,14 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
fswtchEnable[i] = new QCheckBox(this);
fswtchEnable[i]->setProperty("index", i);
fswtchEnable[i]->setText(tr("ON"));
+ fswtchEnable[i]->setFixedWidth( 50 );
repeatLayout->addWidget(fswtchEnable[i], i+1);
- fswtchEnable[i]->setChecked(model.funcSw[i].enabled);
connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
}
+ // Push rows upward
+ addDoubleSpring(gridLayout, 5, num_fsw+1);
+
lock = false;
}
@@ -191,80 +204,73 @@ CustomFunctionsPanel::~CustomFunctionsPanel()
}
#ifdef PHONON
-
void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::State oldState)
{
- if (phononLock)
- return;
-
- phononLock=true;
- if ((newState==Phonon::StoppedState || newState==Phonon::PausedState) && oldState==Phonon::PlayingState) {
+ if (!lock) {
+ lock = true;
+ if ((newState==Phonon::ErrorState || newState==Phonon::StoppedState || newState==Phonon::PausedState) && oldState==Phonon::PlayingState) {
clickObject->stop();
clickObject->clearQueue();
clickObject->clear();
- for (int i=0; igetCapability(CustomFunctions); i++) {
- playBT[i]->setObjectName(QString("play_%1").arg(i));
- playBT[i]->setIcon(CompanionIcon("play.png"));
+ if (phononCurrent >= 0) {
+ playBT[phononCurrent]->setIcon(CompanionIcon("play.png"));
+ phononCurrent = -1;
}
}
- if (newState==Phonon::ErrorState) {
- clickObject->stop();
- clickObject->clearQueue();
- clickObject->clear();
- for (int i=0; igetCapability(CustomFunctions); i++) {
- playBT[i]->setObjectName(QString("play_%1").arg(i));
- playBT[i]->setIcon(CompanionIcon("play.png"));
- }
- }
-
- phononLock=false;
+ lock = false;
+ }
}
-#endif
void CustomFunctionsPanel::playMusic()
{
- QPushButton * button = qobject_cast(sender());
- int index = button->property("index").toInt();
- QString function = button->property("state").toString();
- QString path = g.profile[g.id()].sdPath();
- QDir qd(path);
- QString track;
- if (qd.exists()) {
- if (GetEepromInterface()->getCapability(VoicesAsNumbers)) {
- track = path + QString("/%1.wav").arg(int(fswtchParam[index]->value()), 4, 10, (const QChar)'0');
- }
- else {
- path.append("/SOUNDS/");
- QString lang = generalSettings.ttsLanguage;
- if (lang.isEmpty())
- lang = "en";
- path.append(lang);
- if (fswtchParamArmT[index]->currentText() != "----") {
- track = path + "/" + fswtchParamArmT[index]->currentText() + ".wav";
- }
- }
- QFile file(track);
- if (!file.exists()) {
- QMessageBox::critical(this, tr("Error"), tr("Unable to find sound file %1!").arg(track));
- return;
- }
-#ifdef PHONON
- if (function=="play") {
- clickObject->clear();
- clickObject->setCurrentSource(Phonon::MediaSource(track));
- clickObject->play();
- playBT[index]->setProperty("state", "stop");
- playBT[index]->setIcon(CompanionIcon("stop.png"));
- }
- else {
- clickObject->stop();
- clickObject->clear();
- playBT[index]->setProperty("state", "play");
- playBT[index]->setIcon(CompanionIcon("play.png"));
- }
-#endif
+ if (!clickObject) {
+ clickObject = new Phonon::MediaObject(this);
+ clickOutput = new Phonon::AudioOutput(Phonon::NoCategory, this);
+ Phonon::createPath(clickObject, clickOutput);
+ connect(clickObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(mediaPlayer_state(Phonon::State, Phonon::State)));
+ }
+
+ QPushButton * button = qobject_cast(sender());
+ int index = button->property("index").toInt();
+ QString path = g.profile[g.id()].sdPath();
+ QDir qd(path);
+ QString track;
+ if (qd.exists()) {
+ if (firmware->getCapability(VoicesAsNumbers)) {
+ track = path + QString("/%1.wav").arg(int(fswtchParam[index]->value()), 4, 10, (const QChar)'0');
}
+ else {
+ path.append("/SOUNDS/");
+ QString lang = generalSettings.ttsLanguage;
+ if (lang.isEmpty())
+ lang = "en";
+ path.append(lang);
+ if (fswtchParamArmT[index]->currentText() != "----") {
+ track = path + "/" + fswtchParamArmT[index]->currentText() + ".wav";
+ }
+ }
+ QFile file(track);
+ if (!file.exists()) {
+ QMessageBox::critical(this, tr("Error"), tr("Unable to find sound file %1!").arg(track));
+ return;
+ }
+
+ if (phononCurrent == index) {
+ clickObject->stop();
+ clickObject->clear();
+ playBT[index]->setIcon(CompanionIcon("play.png"));
+ phononCurrent = -1;
+ }
+ else {
+ phononCurrent = index;
+ clickObject->clear();
+ clickObject->setCurrentSource(QUrl(track));
+ clickObject->play();
+ playBT[index]->setIcon(CompanionIcon("stop.png"));
+ }
+ }
}
+#endif
#define CUSTOM_FUNCTION_NUMERIC_PARAM (1<<0)
#define CUSTOM_FUNCTION_SOURCE_PARAM (1<<1)
@@ -274,6 +280,7 @@ void CustomFunctionsPanel::playMusic()
#define CUSTOM_FUNCTION_ENABLE (1<<5)
#define CUSTOM_FUNCTION_REPEAT (1<<6)
#define CUSTOM_FUNCTION_PLAY (1<<7)
+#define CUSTOM_FUNCTION_BL_COLOR (1<<8)
void CustomFunctionsPanel::customFunctionEdited()
{
@@ -332,8 +339,14 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
if (modified) model.funcSw[i].param = fswtchParam[i]->value();
fswtchParam[i]->setDecimals(0);
fswtchParam[i]->setSingleStep(1);
- fswtchParam[i]->setMinimum(-125);
- fswtchParam[i]->setMaximum(125);
+ if (IS_ARM(GetEepromInterface()->getBoard())) {
+ fswtchParam[i]->setMinimum(-500);
+ fswtchParam[i]->setMaximum(500);
+ }
+ else {
+ fswtchParam[i]->setMinimum(-125);
+ fswtchParam[i]->setMaximum(125);
+ }
fswtchParam[i]->setValue(model.funcSw[i].param);
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM;
}
@@ -363,7 +376,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_ENABLE;
}
else if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
- if (index != FuncBackgroundMusic && GetEepromInterface()->getCapability(HasFuncRepeat)) {
+ if (index != FuncBackgroundMusic && firmware->getCapability(HasFuncRepeat)) {
widgetsMask |= CUSTOM_FUNCTION_REPEAT;
fswtchRepeat[i]->update();
}
@@ -373,7 +386,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_REPEAT;
}
else if (index==FuncPlayPrompt || index==FuncPlayBoth) {
- if (GetEepromInterface()->getCapability(VoicesAsNumbers)) {
+ if (firmware->getCapability(VoicesAsNumbers)) {
fswtchParam[i]->setDecimals(0);
fswtchParam[i]->setSingleStep(1);
fswtchParam[i]->setMinimum(0);
@@ -410,7 +423,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
if (modified) {
memset(model.funcSw[i].paramarm, 0, sizeof(model.funcSw[i].paramarm));
- int vml = GetEepromInterface()->getCapability(VoicesMaxLength);
+ int vml = firmware->getCapability(VoicesMaxLength);
if (fswtchParamArmT[i]->currentText() != "----") {
widgetsMask |= CUSTOM_FUNCTION_PLAY;
for (int j=0; jcurrentText().length(), vml); j++) {
@@ -430,7 +443,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
if (modified) {
memset(model.funcSw[i].paramarm, 0, sizeof(model.funcSw[i].paramarm));
- int vml=GetEepromInterface()->getCapability(VoicesMaxLength);
+ int vml=firmware->getCapability(VoicesMaxLength);
if (fswtchParamArmT[i]->currentText() != "----") {
widgetsMask |= CUSTOM_FUNCTION_PLAY;
for (int j=0; jcurrentText().length(),vml); j++) {
@@ -450,6 +463,11 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM;
}
}
+ else if (index==FuncBacklight && IS_TARANIS_PLUS(GetEepromInterface()->getBoard())) {
+ if (modified) model.funcSw[i].param = (uint8_t)fswtchBLcolor[i]->value();
+ fswtchBLcolor[i]->setValue(model.funcSw[i].param);
+ widgetsMask |= CUSTOM_FUNCTION_BL_COLOR;
+ }
else {
if (modified) model.funcSw[i].param = fswtchParam[i]->value();
fswtchParam[i]->setDecimals(0);
@@ -465,9 +483,13 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
fswtchParamT[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_SOURCE_PARAM);
fswtchParamArmT[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_FILE_PARAM);
fswtchEnable[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_ENABLE);
- if (!(widgetsMask & CUSTOM_FUNCTION_ENABLE)) fswtchEnable[i]->setChecked(false);
+ if (widgetsMask & CUSTOM_FUNCTION_ENABLE)
+ fswtchEnable[i]->setChecked(model.funcSw[i].enabled);
+ else
+ fswtchEnable[i]->setChecked(false);
fswtchRepeat[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_REPEAT);
fswtchGVmode[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_GV_MODE);
+ fswtchBLcolor[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_BL_COLOR);
#ifdef PHONON
playBT[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_PLAY);
#endif
@@ -476,9 +498,17 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
void CustomFunctionsPanel::update()
{
lock = true;
- for (int i=0; igetCapability(CustomFunctions); i++) {
+ for (int i=0; igetCapability(CustomFunctions); i++) {
+ if (!initialized) {
+ populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, generalSettings, POPULATE_ONOFF);
+ populateFuncCB(fswtchFunc[i], model.funcSw[i].func);
+ populateGVmodeCB(fswtchGVmode[i], model.funcSw[i].adjustMode);
+ populateFuncParamCB(fswtchParamT[i], model, model.funcSw[i].func, model.funcSw[i].param, model.funcSw[i].adjustMode);
+ populateFuncParamArmTCB(fswtchParamArmT[i], model.funcSw[i].paramarm, paramarmList);
+ }
refreshCustomFunction(i);
}
+ initialized = true;
lock = false;
}
@@ -491,8 +521,11 @@ void CustomFunctionsPanel::fswPaste()
FuncSwData *fsw = &model.funcSw[selectedFunction];
memcpy(fsw, fswData.mid(0, sizeof(FuncSwData)).constData(), sizeof(FuncSwData));
lock = true;
- populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, POPULATE_ONOFF);
+ populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, generalSettings, POPULATE_ONOFF);
populateFuncCB(fswtchFunc[selectedFunction], model.funcSw[selectedFunction].func);
+ populateGVmodeCB(fswtchGVmode[selectedFunction], model.funcSw[selectedFunction].adjustMode);
+ populateFuncParamCB(fswtchParamT[selectedFunction], model, model.funcSw[selectedFunction].func, model.funcSw[selectedFunction].param, model.funcSw[selectedFunction].adjustMode);
+ populateFuncParamArmTCB(fswtchParamArmT[selectedFunction], model.funcSw[selectedFunction].paramarm, paramarmList);
refreshCustomFunction(selectedFunction);
lock = false;
emit modified();
@@ -503,9 +536,11 @@ void CustomFunctionsPanel::fswDelete()
{
model.funcSw[selectedFunction].clear();
// TODO update switch and func
- populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, POPULATE_ONOFF);
+ lock = true;
+ populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, generalSettings, POPULATE_ONOFF);
populateFuncCB(fswtchFunc[selectedFunction], model.funcSw[selectedFunction].func);
refreshCustomFunction(selectedFunction);
+ lock = false;
emit modified();
}
@@ -549,24 +584,24 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
b->clear();
for (unsigned int i=0; iaddItem(FuncSwData(AssignFunc(i)).funcToString());
- if (!GetEepromInterface()->getCapability(HasVolume)) {
+ if (!firmware->getCapability(HasVolume)) {
if (i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
}
- if ((i==FuncPlayHaptic) && !GetEepromInterface()->getCapability(Haptic)) {
+ if ((i==FuncPlayHaptic) && !firmware->getCapability(Haptic)) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
- if ((i==FuncPlayBoth) && !GetEepromInterface()->getCapability(HasBeeper)) {
+ if ((i==FuncPlayBoth) && !firmware->getCapability(HasBeeper)) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
- if ((i==FuncLogs) && !GetEepromInterface()->getCapability(HasSDLogs)) {
+ if ((i==FuncLogs) && !firmware->getCapability(HasSDLogs)) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
@@ -627,7 +662,7 @@ void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, const ModelData & m
qs.append( QObject::tr("Timer2"));
qs.append( QObject::tr("All"));
qs.append( QObject::tr("Telemetry"));
- int reCount = GetEepromInterface()->getCapability(RotaryEncoders);
+ int reCount = firmware->getCapability(RotaryEncoders);
if (reCount == 1) {
qs.append( QObject::tr("Rotary Encoder"));
}
@@ -647,7 +682,7 @@ void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, const ModelData & m
else if (function>=FuncAdjustGV1 && function<=FuncAdjustGVLast) {
switch (adjustmode) {
case 1:
- populateSourceCB(b, RawSource(value), model, POPULATE_SOURCES|POPULATE_TRIMS|POPULATE_SWITCHES);
+ populateSourceCB(b, RawSource(value), model, POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_TRIMS|POPULATE_SWITCHES);
break;
case 2:
populateSourceCB(b, RawSource(value), model, POPULATE_GVARS);
diff --git a/companion/src/modeledit/customfunctions.h b/companion/src/modeledit/customfunctions.h
index 0730e46c6..40d69cede 100644
--- a/companion/src/modeledit/customfunctions.h
+++ b/companion/src/modeledit/customfunctions.h
@@ -36,7 +36,7 @@ class CustomFunctionsPanel : public ModelPanel
Q_OBJECT
public:
- CustomFunctionsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
+ CustomFunctionsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
~CustomFunctionsPanel();
virtual void update();
@@ -45,9 +45,9 @@ class CustomFunctionsPanel : public ModelPanel
void customFunctionEdited();
void fsw_customContextMenuRequested(QPoint pos);
void refreshCustomFunction(int index, bool modified=false);
- void playMusic();
void onChildModified();
#ifdef PHONON
+ void playMusic();
void mediaPlayer_state(Phonon::State newState, Phonon::State oldState);
#endif
void fswDelete();
@@ -61,9 +61,9 @@ class CustomFunctionsPanel : public ModelPanel
void populateFuncParamCB(QComboBox *b, const ModelData & model, uint function, unsigned int value, unsigned int adjustmode=0);
void populateFuncParamArmTCB(QComboBox *b, char * value, QStringList & paramsList);
- GeneralSettings & generalSettings;
+ bool initialized;
QStringList paramarmList;
- bool phononLock;
+ int phononCurrent;
QComboBox * fswtchSwtch[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchFunc[C9X_MAX_CUSTOM_FUNCTIONS];
QCheckBox * fswtchParamGV[C9X_MAX_CUSTOM_FUNCTIONS];
@@ -74,6 +74,7 @@ class CustomFunctionsPanel : public ModelPanel
QCheckBox * fswtchEnable[C9X_MAX_CUSTOM_FUNCTIONS];
RepeatComboBox * fswtchRepeat[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchGVmode[C9X_MAX_CUSTOM_FUNCTIONS];
+ QSlider * fswtchBLcolor[C9X_MAX_CUSTOM_FUNCTIONS];
#ifdef PHONON
Phonon::MediaObject *clickObject;
Phonon::AudioOutput *clickOutput;
diff --git a/companion/src/modeledit/expodialog.cpp b/companion/src/modeledit/expodialog.cpp
index 49e86fc8a..0d66f874a 100644
--- a/companion/src/modeledit/expodialog.cpp
+++ b/companion/src/modeledit/expodialog.cpp
@@ -1,13 +1,15 @@
#include "expodialog.h"
#include "ui_expodialog.h"
-#include "eeprominterface.h"
#include "helpers.h"
-ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, int stickMode) :
- QDialog(parent),
- ui(new Ui::ExpoDialog),
- model(model),
- ed(expoData)
+ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, GeneralSettings & generalSettings, FirmwareInterface * firmware, char * inputName) :
+ QDialog(parent),
+ ui(new Ui::ExpoDialog),
+ model(model),
+ generalSettings(generalSettings),
+ firmware(firmware),
+ ed(expoData),
+ inputName(inputName)
{
ui->setupUi(this);
QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 };
@@ -16,14 +18,18 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
setWindowTitle(tr("Edit %1").arg(getInputStr(model, ed->chn)));
QRegExp rx(CHAR_FOR_NAMES_REGEX);
- gvGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, 100, 0, 100);
+ if (IS_TARANIS(GetEepromInterface()->getBoard()))
+ gvGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, 100, -100, 100);
+ else
+ gvGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, 100, 0, 100);
+
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve);
- populateSwitchCB(ui->switchesCB,ed->swtch);
+ populateSwitchCB(ui->switchesCB, ed->swtch, generalSettings);
ui->sideCB->setCurrentIndex(ed->mode-1);
- if (!GetEepromInterface()->getCapability(FlightPhases)) {
+ if (!firmware->getCapability(FlightModes)) {
ui->label_phases->hide();
for (int i=0; i<9; i++) {
lb_fp[i]->hide();
@@ -38,15 +44,13 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
}
mask <<= 1;
}
- for (int i=GetEepromInterface()->getCapability(FlightPhases); i<9;i++) {
+ for (int i=firmware->getCapability(FlightModes); i<9;i++) {
lb_fp[i]->hide();
cb_fp[i]->hide();
}
}
- if (GetEepromInterface()->getCapability(VirtualInputs)) {
- ui->sideLabel->hide();
- ui->sideCB->hide();
+ if (firmware->getCapability(VirtualInputs)) {
ui->inputName->setMaxLength(4);
populateSourceCB(ui->sourceCB, ed->srcRaw, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
ui->sourceCB->removeItem(0);
@@ -66,7 +70,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
ui->trimCB->addItem(tr("Ail"), 4);
ui->trimCB->setCurrentIndex(1 - ed->carryTrim);
- int expolength = GetEepromInterface()->getCapability(HasExpoNames);
+ int expolength = firmware->getCapability(HasExpoNames);
if (!expolength) {
ui->lineNameLabel->hide();
ui->lineName->hide();
@@ -76,7 +80,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
}
ui->inputName->setValidator(new QRegExpValidator(rx, this));
- ui->inputName->setText(model.inputNames[ed->chn]);
+ ui->inputName->setText(inputName);
ui->lineName->setValidator(new QRegExpValidator(rx, this));
ui->lineName->setText(ed->name);
@@ -93,6 +97,9 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
for (int i=0; i<9; i++) {
connect(cb_fp[i], SIGNAL(toggled(bool)), this, SLOT(valuesChanged()));
}
+ if (firmware->getCapability(VirtualInputs))
+ connect(ui->inputName, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
+
QTimer::singleShot(0, this, SLOT(shrink()));
}
@@ -105,7 +112,7 @@ ExpoDialog::~ExpoDialog()
void ExpoDialog::updateScale()
{
- if (GetEepromInterface()->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) {
+ if (firmware->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) {
RawSourceRange range = ed->srcRaw.getRange();
ui->scaleLabel->show();
ui->scale->show();
@@ -137,7 +144,7 @@ void ExpoDialog::valuesChanged()
ed->mode = ui->sideCB->currentIndex() + 1;
strcpy(ed->name, ui->lineName->text().toAscii().data());
- strcpy(model.inputNames[ed->chn], ui->inputName->text().toAscii().data());
+ strcpy(inputName, ui->inputName->text().toAscii().data());
ed->phases=0;
for (int i=8; i>=0 ; i--) {
@@ -147,11 +154,11 @@ void ExpoDialog::valuesChanged()
ed->phases<<=1;
}
ed->phases>>=1;
- if (GetEepromInterface()->getCapability(FlightPhases)) {
+ if (firmware->getCapability(FlightModes)) {
int zeros=0;
int ones=0;
int phtemp=ed->phases;
- for (int i=0; igetCapability(FlightPhases); i++) {
+ for (int i=0; igetCapability(FlightModes); i++) {
if (phtemp & 1) {
ones++;
}
@@ -162,7 +169,7 @@ void ExpoDialog::valuesChanged()
}
if (zeros==1) {
phtemp=ed->phases;
- for (int i=0; igetCapability(FlightPhases); i++) {
+ for (int i=0; igetCapability(FlightModes); i++) {
if ((phtemp & 1)==0) {
break;
}
@@ -171,14 +178,15 @@ void ExpoDialog::valuesChanged()
}
else if (ones==1) {
phtemp=ed->phases;
- for (int i=0; igetCapability(FlightPhases); i++) {
+ for (int i=0; igetCapability(FlightModes); i++) {
if (phtemp & 1) {
break;
}
phtemp >>=1;
}
}
- } else {
+ }
+ else {
ed->phases=0;
}
}
diff --git a/companion/src/modeledit/expodialog.h b/companion/src/modeledit/expodialog.h
index 2d96b130a..eac2edc52 100644
--- a/companion/src/modeledit/expodialog.h
+++ b/companion/src/modeledit/expodialog.h
@@ -14,7 +14,7 @@ namespace Ui {
class ExpoDialog : public QDialog {
Q_OBJECT
public:
- ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, int stickMode);
+ ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, GeneralSettings & generalSettings, FirmwareInterface * firmware, char * inputName);
~ExpoDialog();
protected:
@@ -27,7 +27,10 @@ class ExpoDialog : public QDialog {
private:
Ui::ExpoDialog * ui;
ModelData & model;
+ GeneralSettings & generalSettings;
+ FirmwareInterface * firmware;
ExpoData * ed;
+ char * inputName;
GVarGroup * gvGroup;
CurveGroup * curveGroup;
};
diff --git a/companion/src/modeledit/expodialog.ui b/companion/src/modeledit/expodialog.ui
index 82d16dbc2..b51d1e82a 100644
--- a/companion/src/modeledit/expodialog.ui
+++ b/companion/src/modeledit/expodialog.ui
@@ -33,7 +33,7 @@
-
- The source for the mixer
+ Source for the mixer.
@@ -73,7 +73,7 @@
-
- Phase used by the input.
+
@@ -104,7 +104,7 @@
-
- 0
+ 0
Qt::AlignCenter
@@ -114,7 +114,7 @@
-
- 1
+ 1
Qt::AlignCenter
@@ -124,7 +124,7 @@
-
- 2
+ 2
Qt::AlignCenter
@@ -134,7 +134,7 @@
-
- 3
+ 3
Qt::AlignCenter
@@ -144,7 +144,7 @@
-
- 4
+ 4
Qt::AlignCenter
@@ -154,7 +154,7 @@
-
- 5
+ 5
Qt::AlignCenter
@@ -164,7 +164,7 @@
-
- 6
+ 6
Qt::AlignCenter
@@ -174,7 +174,7 @@
-
- 7
+ 7
Qt::AlignCenter
@@ -184,7 +184,7 @@
-
- 8
+ 8
Qt::AlignCenter
@@ -266,7 +266,7 @@
-
- Switch used by the input.
+ Switch used to enable the line.
If blank then the input is considered to be "ON" all the time.
@@ -332,17 +332,7 @@ If blank then the input is considered to be "ON" all the time.
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; text-decoration: underline;">Delay ans Slow</span></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600; text-decoration: underline;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These values control the speed and delay of the output of the mix. </p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If Delay is not zero the actuation of the mix will be delayed by the specified amount of seconds.</p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If Slow is not zero then the speed of the mix will be set by the value specified -> the value states the number of seconds it takes to transit from -100 to 100.</p></body></html>
+
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -395,7 +385,7 @@ p, li { white-space: pre-wrap; }
- The curve used by the input
+ Curve applied to the source.
diff --git a/companion/src/modeledit/flightmode.ui b/companion/src/modeledit/flightmode.ui
index 6ed3d8769..b2ff04752 100644
--- a/companion/src/modeledit/flightmode.ui
+++ b/companion/src/modeledit/flightmode.ui
@@ -11,7 +11,7 @@
- Form
+
-
@@ -165,11 +165,11 @@
-
-
+
-
- trim1
+ trim1
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -277,7 +277,7 @@
-
- trim2
+ trim2
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -299,11 +299,11 @@
-
-
+
-
- trim4
+ trim4
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -313,7 +313,7 @@
-
- trim3
+ trim3
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -423,6 +423,19 @@
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
-
diff --git a/companion/src/modeledit/flightmodes.cpp b/companion/src/modeledit/flightmodes.cpp
index a5cd400a0..e8e93fb24 100644
--- a/companion/src/modeledit/flightmodes.cpp
+++ b/companion/src/modeledit/flightmodes.cpp
@@ -5,25 +5,24 @@
#include
#include
-FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, GeneralSettings & generalSettings):
- ModelPanel(parent, model),
+FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseIdx, GeneralSettings & generalSettings, FirmwareInterface * firmware):
+ ModelPanel(parent, model, generalSettings, firmware),
ui(new Ui::FlightMode),
- generalSettings(generalSettings),
phaseIdx(phaseIdx),
phase(model.phaseData[phaseIdx]),
- reCount(GetEepromInterface()->getCapability(RotaryEncoders)),
- gvCount(((!GetEepromInterface()->getCapability(HasVariants)) || (GetCurrentFirmwareVariant() & GVARS_VARIANT)) ?
- GetEepromInterface()->getCapability(Gvars) : 0)
+ reCount(firmware->getCapability(RotaryEncoders)),
+ gvCount(((!firmware->getCapability(HasVariants)) || (GetCurrentFirmwareVariant() & GVARS_VARIANT)) ?
+ firmware->getCapability(Gvars) : 0)
{
ui->setupUi(this);
- int modesCount = GetEepromInterface()->getCapability(FlightPhases);
+ int modesCount = firmware->getCapability(FlightModes);
// Phase name
QRegExp rx(CHAR_FOR_NAMES_REGEX);
if (modesCount) {
ui->name->setValidator(new QRegExpValidator(rx, this));
- ui->name->setMaxLength(GetEepromInterface()->getCapability(FlightModesName));
+ ui->name->setMaxLength(firmware->getCapability(FlightModesName));
connect(ui->name, SIGNAL(editingFinished()), this, SLOT(phaseName_editingFinished()));
}
else {
@@ -32,7 +31,7 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
// Phase switch
if (phaseIdx > 0) {
- populateSwitchCB(ui->swtch, phase.swtch);
+ populateSwitchCB(ui->swtch, phase.swtch, generalSettings);
connect(ui->swtch, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseSwitch_currentIndexChanged(int)));
}
else {
@@ -40,9 +39,9 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
}
// FadeIn / FadeOut
- if (GetEepromInterface()->getCapability(FlightPhasesHaveFades)) {
- int scale = GetEepromInterface()->getCapability(SlowScale);
- int range = GetEepromInterface()->getCapability(SlowRange);
+ if (firmware->getCapability(FlightModesHaveFades)) {
+ int scale = firmware->getCapability(SlowScale);
+ int range = firmware->getCapability(SlowRange);
ui->fadeIn->setMaximum(float(range)/scale);
ui->fadeIn->setSingleStep(1.0/scale);
ui->fadeIn->setDecimals((scale==1 ? 0 :1) );
@@ -131,7 +130,7 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
label->setText(tr("GVAR%1").arg(i+1));
gvLayout->addWidget(label, i, col++, 1, 1);
// GVar name
- int nameLen = GetEepromInterface()->getCapability(GvarsName);
+ int nameLen = firmware->getCapability(GvarsName);
if (nameLen > 0) {
gvNames[i] = new QLineEdit(ui->gvGB);
gvNames[i]->setProperty("index", i);
@@ -157,6 +156,15 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
gvValues[i]->setMinimum(-1024);
gvValues[i]->setMaximum(1024);
gvLayout->addWidget(gvValues[i], i, col++, 1, 1);
+
+ // Popups
+ if (IS_TARANIS(GetEepromInterface()->getBoard()) && (phaseIdx == 0)) {
+ gvPopups[i] = new QCheckBox(ui->gvGB);
+ gvPopups[i]->setProperty("index", i);
+ gvPopups[i]->setText(tr("Popup enabled"));
+ connect(gvPopups[i], SIGNAL(toggled(bool)), this, SLOT(phaseGVPopupToggled(bool)));
+ gvLayout->addWidget(gvPopups[i], i, col++, 1, 1);
+ }
}
}
else {
@@ -166,21 +174,21 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
update();
}
-FlightMode::~FlightMode()
+FlightModePanel::~FlightModePanel()
{
delete ui;
}
-void FlightMode::update()
+void FlightModePanel::update()
{
ui->name->setText(phase.name);
- int scale = GetEepromInterface()->getCapability(SlowScale);
+ int scale = firmware->getCapability(SlowScale);
ui->fadeIn->setValue(float(phase.fadeIn)/scale);
ui->fadeOut->setValue(float(phase.fadeOut)/scale);
for (int i=0; i<4; i++) {
- int trimsMax = GetEepromInterface()->getCapability(ExtendedTrims);
+ int trimsMax = firmware->getCapability(ExtendedTrims);
if (trimsMax == 0 || !model.extendedTrims) {
trimsMax = 125;
}
@@ -194,37 +202,37 @@ void FlightMode::update()
for (int i=0; isetText(model.gvars_names[i]);
- if (phase.gvars[i] < 1024) {
- gvValues[i]->setValue(phase.gvars[i]);
- gvValues[i]->setDisabled(false);
+ gvValues[i]->setDisabled(false);
+ int idx = phase.gvars[i];
+ PhaseData *phasegvar = &phase;
+ while (idx > 1024) {
+ idx -= 1025;
+ phasegvar = &model.phaseData[idx];
+ idx = phasegvar->gvars[i];
+ gvValues[i]->setDisabled(true);
}
- else {
- int idx = phase.gvars[i] - 1025;
- if (idx >= i) idx++;
- // TODO no!!!!
- PhaseData *phasegvar = &model.phaseData[idx];
+ if (IS_TARANIS(GetEepromInterface()->getBoard())) {
gvValues[i]->setValue(phasegvar->gvars[i]);
- gvValues[i]->setDisabled(true);
+ if (phaseIdx == 0)
+ gvPopups[i]->setChecked(model.gvars_popups[i]);
}
}
- for (int i=0; isetValue(phase.rotaryEncoders[i]);
- reValues[i]->setDisabled(false);
- }
- else {
- int idx = phase.rotaryEncoders[i] - 1025;
- if (idx >= i) idx++;
- // TODO no!!!!
- PhaseData *phasere = &model.phaseData[idx];
- reValues[i]->setValue(phasere->rotaryEncoders[i]);
+ for (int i=0; isetDisabled(false);
+ int idx = phase.rotaryEncoders[i];
+ PhaseData *phasere = &phase;
+ while (idx > 1024) {
+ idx -= 1025;
+ phasere = &model.phaseData[idx];
+ idx = phasere->rotaryEncoders[i];
reValues[i]->setDisabled(true);
}
+ reValues[i]->setValue(phasere->rotaryEncoders[i]);
}
}
-void FlightMode::phaseName_editingFinished()
+void FlightModePanel::phaseName_editingFinished()
{
QLineEdit *lineEdit = qobject_cast(sender());
strcpy(phase.name, lineEdit->text().toAscii());
@@ -232,30 +240,30 @@ void FlightMode::phaseName_editingFinished()
emit nameModified();
}
-void FlightMode::phaseSwitch_currentIndexChanged(int index)
+void FlightModePanel::phaseSwitch_currentIndexChanged(int index)
{
QComboBox *comboBox = qobject_cast(sender());
phase.swtch = RawSwitch(comboBox->itemData(index).toInt());
emit modified();
}
-void FlightMode::phaseFadeIn_editingFinished()
+void FlightModePanel::phaseFadeIn_editingFinished()
{
QDoubleSpinBox *spinBox = qobject_cast(sender());
- int scale = GetEepromInterface()->getCapability(SlowScale);
+ int scale = firmware->getCapability(SlowScale);
phase.fadeIn = round(spinBox->value()*scale);
emit modified();
}
-void FlightMode::phaseFadeOut_editingFinished()
+void FlightModePanel::phaseFadeOut_editingFinished()
{
QDoubleSpinBox *spinBox = qobject_cast(sender());
- int scale = GetEepromInterface()->getCapability(SlowScale);
+ int scale = firmware->getCapability(SlowScale);
phase.fadeOut = round(spinBox->value()*scale);
emit modified();
}
-void FlightMode::trimUpdate(unsigned int trim)
+void FlightModePanel::trimUpdate(unsigned int trim)
{
lock = true;
int chn = CONVERT_MODE(trim+1)-1;
@@ -275,7 +283,7 @@ void FlightMode::trimUpdate(unsigned int trim)
lock = false;
}
-void FlightMode::phaseGVValue_editingFinished()
+void FlightModePanel::phaseGVValue_editingFinished()
{
if (!lock) {
QSpinBox *spinBox = qobject_cast(sender());
@@ -285,7 +293,7 @@ void FlightMode::phaseGVValue_editingFinished()
}
}
-void FlightMode::GVName_editingFinished()
+void FlightModePanel::GVName_editingFinished()
{
if (!lock) {
QLineEdit *lineedit = qobject_cast(sender());
@@ -296,7 +304,7 @@ void FlightMode::GVName_editingFinished()
}
}
-void FlightMode::GVSource_currentIndexChanged(int index)
+void FlightModePanel::GVSource_currentIndexChanged(int index)
{
QComboBox *comboBox = qobject_cast(sender());
int gvar = comboBox->property("index").toInt();
@@ -304,34 +312,32 @@ void FlightMode::GVSource_currentIndexChanged(int index)
emit modified();
}
-void FlightMode::phaseGVUse_currentIndexChanged(int index)
+void FlightModePanel::phaseGVUse_currentIndexChanged(int index)
{
if (!lock) {
lock = true;
QComboBox *comboBox = qobject_cast(sender());
int gvar = comboBox->property("index").toInt();
if (index == 0) {
- int value = phase.gvars[gvar];
- if (value>1024) {
- value=0;
- }
- gvValues[gvar]->setValue(value);
- gvValues[gvar]->setEnabled(true);
- phase.gvars[gvar]=value;
+ phase.gvars[gvar]=0;
}
else {
- phase.gvars[gvar] = 1024+index;
- // TOTO it's wrong!!!
- int value = model.phaseData[index + (index>phaseIdx ? 0 :-1)].gvars[gvar];
- gvValues[gvar]->setValue(value);
- gvValues[gvar]->setDisabled(true);
+ phase.gvars[gvar] = 1024+index+(index>phaseIdx?1:0);
}
+ update();
emit modified();
lock = false;
}
}
-void FlightMode::phaseREValue_editingFinished()
+void FlightModePanel::phaseGVPopupToggled(bool checked)
+{
+ QCheckBox *cb = qobject_cast(sender());
+ int gvar = cb->property("index").toInt();
+ model.gvars_popups[gvar] = checked;
+}
+
+void FlightModePanel::phaseREValue_editingFinished()
{
if (!lock) {
QSpinBox *spinBox = qobject_cast(sender());
@@ -341,34 +347,25 @@ void FlightMode::phaseREValue_editingFinished()
}
}
-void FlightMode::phaseREUse_currentIndexChanged(int index)
+void FlightModePanel::phaseREUse_currentIndexChanged(int index)
{
if (!lock) {
lock = true;
QComboBox *comboBox = qobject_cast(sender());
int re = comboBox->property("index").toInt();
if (index == 0) {
- // TODO no!!!
- int value = phase.rotaryEncoders[re];
- if (value > 1024) {
- value = 0;
- }
- reValues[re]->setValue(value);
- reValues[re]->setEnabled(true);
- phase.rotaryEncoders[re] = value;
+ phase.rotaryEncoders[re] = 0;
}
else {
- phase.rotaryEncoders[re] = 1024 + index;
- int value = model.phaseData[index + (index>phaseIdx ? 0 :-1)].rotaryEncoders[re];
- reValues[re]->setValue(value);
- reValues[re]->setDisabled(true) ;
+ phase.rotaryEncoders[re] = 1024 + index; ;
}
+ update();
lock = false;
emit modified();
}
}
-void FlightMode::phaseTrimUse_currentIndexChanged(int index)
+void FlightModePanel::phaseTrimUse_currentIndexChanged(int index)
{
if (!lock) {
QComboBox *comboBox = qobject_cast(sender());
@@ -390,7 +387,7 @@ void FlightMode::phaseTrimUse_currentIndexChanged(int index)
}
}
-void FlightMode::phaseTrim_valueChanged()
+void FlightModePanel::phaseTrim_valueChanged()
{
if (!lock) {
QSpinBox *spinBox = qobject_cast(sender());
@@ -405,7 +402,7 @@ void FlightMode::phaseTrim_valueChanged()
}
}
-void FlightMode::phaseTrimSlider_valueChanged()
+void FlightModePanel::phaseTrimSlider_valueChanged()
{
if (!lock) {
QSlider *slider = qobject_cast(sender());
@@ -422,14 +419,14 @@ void FlightMode::phaseTrimSlider_valueChanged()
/**********************************************************/
-FlightModes::FlightModes(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
- ModelPanel(parent, model),
- modesCount(GetEepromInterface()->getCapability(FlightPhases))
+FlightModesPanel::FlightModesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
+ ModelPanel(parent, model, generalSettings, firmware),
+ modesCount(firmware->getCapability(FlightModes))
{
QGridLayout * gridLayout = new QGridLayout(this);
tabWidget = new QTabWidget(this);
for (int i=0; isetProperty("index", i);
panels << tab;
connect(tab, SIGNAL(modified()), this, SLOT(onPhaseModified()));
@@ -440,20 +437,20 @@ FlightModes::FlightModes(QWidget * parent, ModelData & model, GeneralSettings &
connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(on_tabWidget_currentChanged(int)));
}
-FlightModes::~FlightModes()
+FlightModesPanel::~FlightModesPanel()
{
}
-void FlightModes::onPhaseModified()
+void FlightModesPanel::onPhaseModified()
{
emit modified();
}
-QString FlightModes::getTabName(int index)
+QString FlightModesPanel::getTabName(int index)
{
QString result = tr("Flight Mode %1").arg(index);
const char *name = model.phaseData[index].name;
- if (GetEepromInterface()->getCapability(FlightModesName) && strlen(name) > 0) {
+ if (firmware->getCapability(FlightModesName) && strlen(name) > 0) {
result += tr(" (%1)").arg(name);
}
else if (index == 0) {
@@ -463,18 +460,18 @@ QString FlightModes::getTabName(int index)
return result;
}
-void FlightModes::onPhaseNameChanged()
+void FlightModesPanel::onPhaseNameChanged()
{
int index = sender()->property("index").toInt();
tabWidget->setTabText(index, getTabName(index));
}
-void FlightModes::update()
+void FlightModesPanel::update()
{
on_tabWidget_currentChanged(tabWidget->currentIndex());
}
-void FlightModes::on_tabWidget_currentChanged(int index)
+void FlightModesPanel::on_tabWidget_currentChanged(int index)
{
panels[index]->update();
}
diff --git a/companion/src/modeledit/flightmodes.h b/companion/src/modeledit/flightmodes.h
index 0a09f279b..e2127ac5c 100644
--- a/companion/src/modeledit/flightmodes.h
+++ b/companion/src/modeledit/flightmodes.h
@@ -7,18 +7,19 @@
#include
#include
#include
+#include
namespace Ui {
class FlightMode;
}
-class FlightMode : public ModelPanel
+class FlightModePanel : public ModelPanel
{
Q_OBJECT
public:
- FlightMode(QWidget *parent, ModelData &model, int modeIdx, GeneralSettings & generalSettings);
- virtual ~FlightMode();
+ FlightModePanel(QWidget *parent, ModelData &model, int modeIdx, GeneralSettings & generalSettings, FirmwareInterface * firmware);
+ virtual ~FlightModePanel();
virtual void update();
@@ -37,12 +38,12 @@ class FlightMode : public ModelPanel
void GVSource_currentIndexChanged(int index);
void phaseGVValue_editingFinished();
void phaseGVUse_currentIndexChanged(int index);
+ void phaseGVPopupToggled(bool checked);
void phaseREValue_editingFinished();
void phaseREUse_currentIndexChanged(int index);
private:
Ui::FlightMode *ui;
- GeneralSettings & generalSettings;
int phaseIdx;
PhaseData & phase;
int reCount;
@@ -50,6 +51,7 @@ class FlightMode : public ModelPanel
QVector trimsLabel;
QLineEdit * gvNames[C9X_MAX_GVARS];
QSpinBox * gvValues[C9X_MAX_GVARS];
+ QCheckBox * gvPopups[C9X_MAX_GVARS];
QSpinBox * reValues[C9X_MAX_ENCODERS];
QVector trimsUse;
QVector trimsValue;
@@ -59,13 +61,13 @@ class FlightMode : public ModelPanel
};
-class FlightModes : public ModelPanel
+class FlightModesPanel : public ModelPanel
{
Q_OBJECT
public:
- FlightModes(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
- virtual ~FlightModes();
+ FlightModesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
+ virtual ~FlightModesPanel();
virtual void update();
@@ -78,7 +80,7 @@ class FlightModes : public ModelPanel
int modesCount;
QTabWidget *tabWidget;
QString getTabName(int index);
- QVector panels;
+ QVector panels;
};
diff --git a/companion/src/modeledit/heli.cpp b/companion/src/modeledit/heli.cpp
index a6a97a1b9..3b56e19fb 100644
--- a/companion/src/modeledit/heli.cpp
+++ b/companion/src/modeledit/heli.cpp
@@ -2,8 +2,8 @@
#include "ui_heli.h"
#include "helpers.h"
-HeliPanel::HeliPanel(QWidget *parent, ModelData & model):
- ModelPanel(parent, model),
+HeliPanel::HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
+ ModelPanel(parent, model, generalSettings, firmware),
ui(new Ui::Heli)
{
ui->setupUi(this);
diff --git a/companion/src/modeledit/heli.h b/companion/src/modeledit/heli.h
index 7b5e3a73d..c04551b0f 100644
--- a/companion/src/modeledit/heli.h
+++ b/companion/src/modeledit/heli.h
@@ -12,7 +12,7 @@ class HeliPanel : public ModelPanel
Q_OBJECT
public:
- HeliPanel(QWidget *parent, ModelData & model);
+ HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
~HeliPanel();
void update();
diff --git a/companion/src/modeledit/heli.ui b/companion/src/modeledit/heli.ui
index c9741fde9..a248c9df7 100644
--- a/companion/src/modeledit/heli.ui
+++ b/companion/src/modeledit/heli.ui
@@ -11,7 +11,7 @@
- Form
+
diff --git a/companion/src/modeledit/inputs.cpp b/companion/src/modeledit/inputs.cpp
index a6e1f6eac..2b7a7b9e7 100644
--- a/companion/src/modeledit/inputs.cpp
+++ b/companion/src/modeledit/inputs.cpp
@@ -3,9 +3,8 @@
#include "expodialog.h"
#include "helpers.h"
-InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings):
- ModelPanel(parent, model),
- generalSettings(generalSettings),
+InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
+ ModelPanel(parent, model, generalSettings, firmware),
expoInserted(false)
{
QGridLayout * exposLayout = new QGridLayout(this);
@@ -21,7 +20,7 @@ InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & g
qbDown->setText(tr("Move Down"));
qbDown->setIcon(CompanionIcon("movedown.png"));
qbDown->setShortcut(QKeySequence(tr("Ctrl+Down")));
- qbClear->setText(tr("Clear All Settings"));
+ qbClear->setText(tr("Clear All Inputs"));
qbClear->setIcon(CompanionIcon("clear.png"));
exposLayout->addWidget(ExposlistWidget,1,1,1,3);
@@ -48,7 +47,7 @@ void InputsPanel::update()
{
lock = true;
- int inputsCount = GetEepromInterface()->getCapability(VirtualInputs);
+ int inputsCount = firmware->getCapability(VirtualInputs);
if (inputsCount == 0)
inputsCount = NUM_STICKS;
@@ -56,6 +55,7 @@ void InputsPanel::update()
// i -> mixer number
QByteArray qba;
ExposlistWidget->clear();
+ firstLine = true;
int curDest = -1;
for (int i=0; ichn-1) {
curDest++;
- str = getInputStr(model, curDest);
- qba.clear();
- qba.append((quint8)-curDest-1);
- QListWidgetItem *itm = new QListWidgetItem(str);
- itm->setData(Qt::UserRole,qba);
- ExposlistWidget->addItem(itm);
+ AddInputLine(-curDest-1);
+ }
+ if (AddInputLine(i)) {
+ curDest++;
}
- if (curDest!=(int)md->chn) {
- if (GetEepromInterface()->getCapability(VirtualInputs))
- str = QString("%1").arg(getInputStr(model, md->chn), -8, ' ');
+ }
+
+ while (curDest Input05)
+ if dest >=0 then create used input based on model input data from slot dest (dest=4 -> model expoData[4])
+
+ @retval true created input number is different from the previous list item
+ false created input number is the same as previous list item
+*/
+bool InputsPanel::AddInputLine(int dest)
+{
+ bool new_ch;
+ QString str = getInputText(dest, &new_ch);
+ QListWidgetItem *itm = new QListWidgetItem(str);
+ QByteArray qba(1, (quint8)dest);
+ if (dest >= 0) {
+ //add input data
+ ExpoData *md = &model.expoData[dest];
+ qba.append((const char*)md, sizeof(ExpoData));
+ }
+ itm->setData(Qt::UserRole, qba);
+#if MIX_ROW_HEIGHT_INCREASE > 0
+ if (new_ch && !firstLine) {
+ //increase size of this row
+ itm->setData(GroupHeaderRole, 1);
+ }
+#endif
+ ExposlistWidget->addItem(itm);
+ firstLine = false;
+ //qDebug() << "InputsPanel::AddInputLine(): dest" << dest << "text" << str;
+ return new_ch;
+}
+
+
+/**
+ @brief Returns HTML formated input representation
+
+ @param[in] dest defines which input line to create.
+ If dest < 0 then create empty input slot for input -dest ( dest=-6 -> Input05)
+ if dest >=0 then create used input based on model input data from slot dest (dest=4 -> model expoData[4])
+
+ @retval string input line in HTML
+*/
+QString InputsPanel::getInputText(int dest, bool * new_ch)
+{
+ QString str;
+ if (new_ch) *new_ch = 0;
+ if (dest < 0) {
+ str = getInputStr(model, -dest-1);
+ if (new_ch) *new_ch = 1;
+ }
+ else {
+ ExpoData *md = &model.expoData[dest];
+
+ if ((dest == 0) || (model.expoData[dest-1].chn != md->chn)) {
+ if (new_ch) *new_ch = 1;
+ if (firmware->getCapability(VirtualInputs))
+ str = QString("%1").arg(getInputStr(model, md->chn), -10, ' ');
else
str = getInputStr(model, md->chn);
- curDest = md->chn;
}
else {
- if (GetEepromInterface()->getCapability(VirtualInputs))
- str = " ";
+ if (firmware->getCapability(VirtualInputs))
+ str = " ";
else
str = " ";
}
- if (GetEepromInterface()->getCapability(VirtualInputs)) {
+ switch (md->mode) {
+ case (1): str += " <-"; break;
+ case (2): str += " ->"; break;
+ default: str += " "; break;
+ }
+
+ str += " " + tr("Weight(%1)").arg(getGVarString(md->weight));
+
+ if (firmware->getCapability(VirtualInputs)) {
str += " " + tr("Source(%1)").arg(md->srcRaw.toString());
if (md->carryTrim>0) {
- str += " " + tr("No Trim");
+ str += " " + tr("NoTrim");
}
else if (md->carryTrim<0) {
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
}
}
- else {
- switch (md->mode) {
- case (1): str += " <-"; break;
- case (2): str += " ->"; break;
- default: str += " "; break;
- };
- }
- str += " " + tr("Weight(%1)").arg(getGVarString(md->weight));
-
- if (md->curve.value) str += " " + md->curve.toString();
+ if (md->curve.value) str += " " + Qt::escape(md->curve.toString());
QString phasesStr = getPhasesStr(md->phases, model);
if (!phasesStr.isEmpty()) str += " " + phasesStr;
if (md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch(%1)").arg(md->swtch.toString());
- if (GetEepromInterface()->getCapability(HasExpoNames)) {
+ if (firmware->getCapability(HasExpoNames)) {
QString expoName = md->name;
if (!expoName.isEmpty()) str += QString(" [%1]").arg(expoName);
}
-
- qba.clear();
- qba.append((quint8)i);
- qba.append((const char*)md, sizeof(ExpoData));
- QListWidgetItem *itm = new QListWidgetItem(str);
- itm->setData(Qt::UserRole,qba); // expo number
- ExposlistWidget->addItem(itm); //(str);
}
-
- while (curDestsetData(Qt::UserRole,qba); // add new expo
- ExposlistWidget->addItem(itm);
- }
-
- lock = false;
+ return Qt::escape(str).replace(" ", " ");
}
-
bool InputsPanel::gm_insertExpo(int idx)
{
if (idx<0 || idx>=C9X_MAX_EXPOS || model.expoData[C9X_MAX_EXPOS-1].mode > 0) {
@@ -169,12 +215,18 @@ void InputsPanel::gm_openExpo(int index)
if(index<0 || index>=C9X_MAX_EXPOS) return;
ExpoData mixd(model.expoData[index]);
+ char inputName[4+1];
emit modified();
update();
+
+ if (firmware->getCapability(VirtualInputs))
+ strcpy(inputName, model.inputNames[mixd.chn]);
- ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings.stickMode);
+ ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings, firmware, inputName);
if (g->exec()) {
model.expoData[index] = mixd;
+ if (firmware->getCapability(VirtualInputs))
+ strcpy(model.inputNames[mixd.chn], inputName);
emit modified();
update();
}
diff --git a/companion/src/modeledit/inputs.h b/companion/src/modeledit/inputs.h
index 4164caac9..83db760a6 100644
--- a/companion/src/modeledit/inputs.h
+++ b/companion/src/modeledit/inputs.h
@@ -9,7 +9,7 @@ class InputsPanel : public ModelPanel
Q_OBJECT
public:
- InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
+ InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
virtual ~InputsPanel();
virtual void update();
@@ -31,9 +31,9 @@ class InputsPanel : public ModelPanel
void expoAdd();
private:
- GeneralSettings & generalSettings;
bool expoInserted;
MixersList *ExposlistWidget;
+ bool firstLine;
int getExpoIndex(unsigned int dch);
bool gm_insertExpo(int idx);
@@ -44,6 +44,8 @@ class InputsPanel : public ModelPanel
QList createExpoListFromSelected();
void setSelectedByExpoList(QList list);
void pasteExpoMimeData(const QMimeData * mimeData, int destIdx);
+ bool AddInputLine(int dest);
+ QString getInputText(int dest, bool * new_ch);
};
diff --git a/companion/src/modeledit/logicalswitches.cpp b/companion/src/modeledit/logicalswitches.cpp
index 1902a76ae..49d988946 100644
--- a/companion/src/modeledit/logicalswitches.cpp
+++ b/companion/src/modeledit/logicalswitches.cpp
@@ -7,33 +7,31 @@
#include
#include "helpers.h"
-LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
- ModelPanel(parent, model),
+LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
+ ModelPanel(parent, model, generalSettings, firmware),
selectedSwitch(0)
{
QGridLayout * gridLayout = new QGridLayout(this);
int col = 1;
- addLabel(gridLayout, tr("Condition"), col++);
+ addLabel(gridLayout, tr("Function"), col++);
addLabel(gridLayout, tr("V1"), col++);
addLabel(gridLayout, tr("V2"), col++);
- addLabel(gridLayout, tr("AND"), col++);
- if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
+ addLabel(gridLayout, tr("AND Switch"), col++);
+ if (firmware->getCapability(LogicalSwitchesExt)) {
addLabel(gridLayout, tr("Duration"), col++);
addLabel(gridLayout, tr("Delay"), col++);
}
lock = true;
- for (int i=0; igetCapability(LogicalSwitches); i++) {
+ for (int i=0; igetCapability(LogicalSwitches); i++) {
// The label
QLabel * label = new QLabel(this);
label->setProperty("index", i);
- if (i < 9)
- label->setText(tr("LS%1").arg(i+1));
- else
- label->setText(tr("LS%1").arg(QChar('A'+i-9)));
+ label->setText(tr("L%1").arg(i+1));
label->setContextMenuPolicy(Qt::CustomContextMenu);
label->setMouseTracking(true);
+ label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(csw_customContextMenuRequested(QPoint)));
gridLayout->addWidget(label, i+1, 0);
@@ -60,10 +58,11 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
cswitchValue[i]->setVisible(false);
// V2
+ QHBoxLayout *v2Layout = new QHBoxLayout();
cswitchSource2[i] = new QComboBox(this);
cswitchSource2[i]->setProperty("index", i);
connect(cswitchSource2[i], SIGNAL(currentIndexChanged(int)), this, SLOT(v2Edited(int)));
- gridLayout->addWidget(cswitchSource2[i], i+1, 3);
+ v2Layout->addWidget(cswitchSource2[i]);
cswitchSource2[i]->setVisible(false);
cswitchOffset[i] = new QDoubleSpinBox(this);
cswitchOffset[i]->setProperty("index",i);
@@ -72,8 +71,18 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
cswitchOffset[i]->setAccelerated(true);
cswitchOffset[i]->setDecimals(0);
connect(cswitchOffset[i], SIGNAL(editingFinished()), this, SLOT(edited()));
- gridLayout->addWidget(cswitchOffset[i], i+1, 3);
cswitchOffset[i]->setVisible(false);
+ v2Layout->addWidget(cswitchOffset[i]);
+ cswitchOffset2[i] = new QDoubleSpinBox(this);
+ cswitchOffset2[i]->setProperty("index",i);
+ cswitchOffset2[i]->setMaximum(125);
+ cswitchOffset2[i]->setMinimum(-125);
+ cswitchOffset2[i]->setAccelerated(true);
+ cswitchOffset2[i]->setDecimals(0);
+ connect(cswitchOffset2[i], SIGNAL(editingFinished()), this, SLOT(edited()));
+ cswitchOffset2[i]->setVisible(false);
+ v2Layout->addWidget(cswitchOffset2[i]);
+ gridLayout->addLayout(v2Layout, i+1, 3);
// AND
cswitchAnd[i] = new QComboBox(this);
@@ -81,7 +90,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int)));
gridLayout->addWidget(cswitchAnd[i], i+1, 4);
- if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
+ if (firmware->getCapability(LogicalSwitchesExt)) {
// Duration
cswitchDuration[i] = new QDoubleSpinBox(this);
cswitchDuration[i]->setProperty("index", i);
@@ -105,7 +114,8 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
gridLayout->addWidget(cswitchDelay[i], i+1, 6);
}
}
-
+ // Push rows upward
+ addVSpring(gridLayout,0,firmware->getCapability(LogicalSwitches)+1);
lock = false;
}
@@ -120,22 +130,12 @@ void LogicalSwitchesPanel::v1Edited(int value)
model.customSw[i].val1 = cswitchSource1[i]->itemData(value).toInt();
if (model.customSw[i].getFunctionFamily() == LS_FAMILY_VOFS) {
RawSource source = RawSource(model.customSw[i].val1, &model);
- if (source.type == SOURCE_TYPE_TELEMETRY) {
- if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
- model.customSw[i].val2 = 0;
- }
- else {
- model.customSw[i].val2 = -128;
- }
+ RawSourceRange range = source.getRange();
+ if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
+ model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
}
else {
- RawSourceRange range = source.getRange();
- if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
- 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)*/;
- }
+ model.customSw[i].val2 = (cswitchOffset[i]->value() - range.offset) / range.step/* TODO - source.getRawOffset(model)*/;
}
setSwitchWidgetVisibility(i);
}
@@ -205,19 +205,19 @@ void LogicalSwitchesPanel::edited()
switch (model.customSw[i].getFunctionFamily())
{
case LS_FAMILY_VOFS:
- {
- source = RawSource(model.customSw[i].val1, &model);
- RawSourceRange range = source.getRange();
- if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
- 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);
- }
+ {
+ source = RawSource(model.customSw[i].val1, &model);
+ RawSourceRange range = source.getRange();
+ if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
+ model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
+ cswitchOffset[i]->setValue(model.customSw[i].val2*range.step);
+ }
+ else {
+ model.customSw[i].val2 = round((cswitchOffset[i]->value()-range.offset)/range.step);
+ cswitchOffset[i]->setValue(model.customSw[i].val2*range.step + range.offset);
}
break;
+ }
case LS_FAMILY_TIMER:
model.customSw[i].val1 = TimToVal(cswitchValue[i]->value());
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
@@ -225,8 +225,14 @@ void LogicalSwitchesPanel::edited()
updateTimerParam(cswitchOffset[i], model.customSw[i].val2);
break;
case LS_FAMILY_STAY:
- model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
- updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
+ if (sender() == cswitchOffset[i]) {
+ model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
+ updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
+ }
+ else {
+ model.customSw[i].val3 = TimToVal(cswitchOffset2[i]->value()) - model.customSw[i].val2;
+ }
+ updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, true);
break;
default:
break;
@@ -243,92 +249,99 @@ void LogicalSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, bool
sb->setMinimum(allowZero ? 0.0 : 0.1);
sb->setMaximum(175);
float value = ValToTim(timer);
- if (value>60)
+ if (value>=60)
sb->setSingleStep(1);
- else if (value>2)
+ else if (value>=2)
sb->setSingleStep(0.5);
else
sb->setSingleStep(0.1);
sb->setValue(value);
}
+#define SOURCE1_VISIBLE 0x1
+#define SOURCE2_VISIBLE 0x2
+#define VALUE1_VISIBLE 0x4
+#define VALUE2_VISIBLE 0x8
+#define VALUE3_VISIBLE 0x10
+
void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
{
lock = true;
- RawSource source = RawSource(model.customSw[i].val1, &model);
- RawSourceRange range = source.getRange();
+ unsigned int mask = 0;
+ RawSource source = RawSource(model.customSw[i].val1, &model);
+ RawSourceRange range = source.getRange();
- switch (model.customSw[i].getFunctionFamily())
- {
- case LS_FAMILY_VOFS:
- cswitchSource1[i]->setVisible(true);
- cswitchSource2[i]->setVisible(false);
- 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(range.decimals);
- cswitchOffset[i]->setSingleStep(range.step);
- if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
- 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(range.min);
- cswitchOffset[i]->setMaximum(range.max);
- cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
- }
- break;
- case LS_FAMILY_VBOOL:
- case LS_FAMILY_STICKY:
- cswitchSource1[i]->setVisible(true);
- cswitchSource2[i]->setVisible(true);
- cswitchValue[i]->setVisible(false);
- cswitchOffset[i]->setVisible(false);
- populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
- populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2));
- break;
- case LS_FAMILY_STAY:
- cswitchSource1[i]->setVisible(true);
- cswitchSource2[i]->setVisible(false);
- cswitchValue[i]->setVisible(false);
- populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
- updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
- break;
- case LS_FAMILY_VCOMP:
- cswitchSource1[i]->setVisible(true);
- cswitchSource2[i]->setVisible(true);
- cswitchValue[i]->setVisible(false);
- cswitchOffset[i]->setVisible(false);
- populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
- populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
- break;
- case LS_FAMILY_TIMER:
- cswitchSource1[i]->setVisible(false);
- cswitchSource2[i]->setVisible(false);
- updateTimerParam(cswitchValue[i], model.customSw[i].val1);
- updateTimerParam(cswitchOffset[i], model.customSw[i].val2);
- break;
- }
+ switch (model.customSw[i].getFunctionFamily())
+ {
+ case LS_FAMILY_VOFS:
+ mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE;
+ populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
+ cswitchOffset[i]->setDecimals(range.decimals);
+ cswitchOffset[i]->setSingleStep(range.step);
+ if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
+ 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(range.min);
+ cswitchOffset[i]->setMaximum(range.max);
+ cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
+ }
+ break;
+ case LS_FAMILY_VBOOL:
+ case LS_FAMILY_STICKY:
+ mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
+ populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings);
+ populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2), generalSettings);
+ break;
+ case LS_FAMILY_STAY:
+ mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE | VALUE3_VISIBLE;
+ populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings);
+ updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
+ updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, true);
+ break;
+ case LS_FAMILY_VCOMP:
+ mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
+ populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
+ populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
+ break;
+ case LS_FAMILY_TIMER:
+ mask |= VALUE1_VISIBLE | VALUE2_VISIBLE;
+ updateTimerParam(cswitchValue[i], model.customSw[i].val1);
+ updateTimerParam(cswitchOffset[i], model.customSw[i].val2);
+ break;
+ }
- lock = false;
+ cswitchSource1[i]->setVisible(mask & SOURCE1_VISIBLE);
+ cswitchSource2[i]->setVisible(mask & SOURCE2_VISIBLE);
+ cswitchValue[i]->setVisible(mask & VALUE1_VISIBLE);
+ cswitchOffset[i]->setVisible(mask & VALUE2_VISIBLE);
+ cswitchOffset2[i]->setVisible(mask & VALUE3_VISIBLE);
+
+ lock = false;
+}
+
+void LogicalSwitchesPanel::updateLine(int i)
+{
+ lock = true;
+ populateCSWCB(csw[i], model.customSw[i].func);
+ lock = true;
+ setSwitchWidgetVisibility(i);
+ lock = true;
+ populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw));
+ if (firmware->getCapability(LogicalSwitchesExt)) {
+ cswitchDuration[i]->setValue(model.customSw[i].duration/10.0);
+ cswitchDelay[i]->setValue(model.customSw[i].delay/10.0);
+ }
+ lock = false;
}
void LogicalSwitchesPanel::update()
{
- for (int i=0; igetCapability(LogicalSwitches); i++) {
- lock = true;
- populateCSWCB(csw[i], model.customSw[i].func);
- lock = false;
- setSwitchWidgetVisibility(i);
- lock = true;
- populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw));
- if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
- cswitchDuration[i]->setValue(model.customSw[i].duration/10.0);
- cswitchDelay[i]->setValue(model.customSw[i].delay/10.0);
- }
- lock = false;
+ for (int i=0; igetCapability(LogicalSwitches); i++) {
+ updateLine(i);
}
}
@@ -338,36 +351,27 @@ void LogicalSwitchesPanel::cswPaste()
const QMimeData *mimeData = clipboard->mimeData();
if (mimeData->hasFormat("application/x-companion-csw")) {
QByteArray cswData = mimeData->data("application/x-companion-csw");
-
LogicalSwitchData *csw = &model.customSw[selectedSwitch];
memcpy(csw, cswData.mid(0, sizeof(LogicalSwitchData)).constData(), sizeof(LogicalSwitchData));
emit modified();
- updateSelectedSwitch();
+ updateLine(selectedSwitch);
}
}
void LogicalSwitchesPanel::cswDelete()
{
- model.customSw[selectedSwitch].clear();
- emit modified();
- updateSelectedSwitch();
+ model.customSw[selectedSwitch].clear();
+ emit modified();
+ updateLine(selectedSwitch);
}
void LogicalSwitchesPanel::cswCopy()
{
- QByteArray cswData;
- cswData.append((char*)&model.customSw[selectedSwitch],sizeof(LogicalSwitchData));
- QMimeData *mimeData = new QMimeData;
- mimeData->setData("application/x-companion-csw", cswData);
- QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
-}
-
-void LogicalSwitchesPanel::updateSelectedSwitch()
-{
- lock = true;
- populateCSWCB(csw[selectedSwitch], model.customSw[selectedSwitch].func);
- setSwitchWidgetVisibility(selectedSwitch);
- lock = false;
+ QByteArray cswData;
+ cswData.append((char*)&model.customSw[selectedSwitch],sizeof(LogicalSwitchData));
+ QMimeData *mimeData = new QMimeData;
+ mimeData->setData("application/x-companion-csw", cswData);
+ QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
}
void LogicalSwitchesPanel::cswCut()
diff --git a/companion/src/modeledit/logicalswitches.h b/companion/src/modeledit/logicalswitches.h
index ef7945afd..0741e087a 100644
--- a/companion/src/modeledit/logicalswitches.h
+++ b/companion/src/modeledit/logicalswitches.h
@@ -10,7 +10,7 @@ class LogicalSwitchesPanel : public ModelPanel
Q_OBJECT
public:
- LogicalSwitchesPanel(QWidget *parent, ModelData & model);
+ LogicalSwitchesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
virtual ~LogicalSwitchesPanel();
virtual void update();
@@ -32,6 +32,7 @@ class LogicalSwitchesPanel : public ModelPanel
QComboBox * csw[C9X_NUM_CSW];
QDoubleSpinBox * cswitchValue[C9X_NUM_CSW];
QDoubleSpinBox * cswitchOffset[C9X_NUM_CSW];
+ QDoubleSpinBox * cswitchOffset2[C9X_NUM_CSW];
QComboBox * cswitchAnd[C9X_NUM_CSW];
QDoubleSpinBox * cswitchDuration[C9X_NUM_CSW];
QDoubleSpinBox * cswitchDelay[C9X_NUM_CSW];
@@ -40,8 +41,7 @@ class LogicalSwitchesPanel : public ModelPanel
void setSwitchWidgetVisibility(int i);
int selectedSwitch;
- void updateSelectedSwitch();
- void updateV2(int index);
+ void updateLine(int index);
void updateTimerParam(QDoubleSpinBox *sb, int timer, bool allowZero=false);
};
diff --git a/companion/src/modeledit/mixerdialog.cpp b/companion/src/modeledit/mixerdialog.cpp
index 7ef03fdca..c1a7fc4cb 100644
--- a/companion/src/modeledit/mixerdialog.cpp
+++ b/companion/src/modeledit/mixerdialog.cpp
@@ -3,51 +3,48 @@
#include "eeprominterface.h"
#include "helpers.h"
-MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, int stickMode) :
- QDialog(parent),
- ui(new Ui::MixerDialog),
- model(model),
- md(mixdata),
- lock(false)
+MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, GeneralSettings & generalSettings, FirmwareInterface * firmware) :
+ QDialog(parent),
+ ui(new Ui::MixerDialog),
+ model(model),
+ generalSettings(generalSettings),
+ firmware(firmware),
+ md(mixdata),
+ lock(false)
{
ui->setupUi(this);
QRegExp rx(CHAR_FOR_NAMES_REGEX);
QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_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 };
- if (md->destCh > (unsigned int)GetEepromInterface()->getCapability(Outputs))
- this->setWindowTitle(tr("DEST -> X%1").arg(md->destCh-GetEepromInterface()->getCapability(Outputs)));
- else
- this->setWindowTitle(tr("DEST -> CH%1%2").arg(md->destCh/10).arg(md->destCh%10));
+ this->setWindowTitle(tr("DEST -> CH%1").arg(md->destCh));
populateSourceCB(ui->sourceCB, md->srcRaw, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
ui->sourceCB->removeItem(0);
- int limit = GetEepromInterface()->getCapability(OffsetWeight);
+ int limit = firmware->getCapability(OffsetWeight);
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, 100, -limit, limit);
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, 0, -limit, limit);
-
- if (GetEepromInterface()->getCapability(VirtualInputs)) {
- ui->trimLabel->hide();
- ui->trimCB->hide();
- }
-
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve);
ui->MixDR_CB->setChecked(md->noExpo==0);
- if (!GetEepromInterface()->getCapability(MixesWithoutExpo)) {
+
+ if (firmware->getCapability(VirtualInputs) || !firmware->getCapability(MixesWithoutExpo)) {
ui->MixDR_CB->hide();
ui->label_MixDR->hide();
}
- ui->trimCB->addItem(tr("Rud"), 1);
- ui->trimCB->addItem(tr("Ele"), 2);
- ui->trimCB->addItem(tr("Thr"), 3);
- ui->trimCB->addItem(tr("Ail"), 4);
+ if (!firmware->getCapability(VirtualInputs)) {
+ ui->trimCB->addItem(tr("Rud"));
+ ui->trimCB->addItem(tr("Ele"));
+ ui->trimCB->addItem(tr("Thr"));
+ ui->trimCB->addItem(tr("Ail"));
+ }
+
ui->trimCB->setCurrentIndex(1 - md->carryTrim);
- int namelength = GetEepromInterface()->getCapability(HasMixerNames);
+ int namelength = firmware->getCapability(HasMixerNames);
if (!namelength) {
ui->label_name->hide();
ui->mixerName->hide();
@@ -58,7 +55,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, i
ui->mixerName->setValidator(new QRegExpValidator(rx, this));
ui->mixerName->setText(md->name);
- if (!GetEepromInterface()->getCapability(FlightPhases)) {
+ if (!firmware->getCapability(FlightModes)) {
ui->label_phases->hide();
for (int i=0; i<9; i++) {
lb_fp[i]->hide();
@@ -73,17 +70,17 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, i
}
mask <<= 1;
}
- for (int i=GetEepromInterface()->getCapability(FlightPhases); i<9;i++) {
+ for (int i=firmware->getCapability(FlightModes); i<9;i++) {
lb_fp[i]->hide();
cb_fp[i]->hide();
}
}
- populateSwitchCB(ui->switchesCB,md->swtch);
+ populateSwitchCB(ui->switchesCB, md->swtch, generalSettings);
ui->warningCB->setCurrentIndex(md->mixWarn);
ui->mltpxCB->setCurrentIndex(md->mltpx);
- int scale=GetEepromInterface()->getCapability(SlowScale);
- float range=GetEepromInterface()->getCapability(SlowRange);
+ int scale=firmware->getCapability(SlowScale);
+ float range=firmware->getCapability(SlowRange);
ui->slowDownSB->setMaximum(range/scale);
ui->slowDownSB->setSingleStep(1.0/scale);
ui->slowDownSB->setDecimals((scale==1 ? 0 :1));
@@ -146,26 +143,17 @@ void MixerDialog::valuesChanged()
lock = true;
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 };
md->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt(), &model);
- if ((ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt()-65536)<4) {
- if (!GetEepromInterface()->getCapability(MixesWithoutExpo)) {
- ui->MixDR_CB->hide();
- ui->label_MixDR->hide();
- }
- else {
- ui->MixDR_CB->setVisible(true);
- ui->label_MixDR->setVisible(true);
- }
- }
- else {
- ui->MixDR_CB->setHidden(true);
- ui->label_MixDR->setHidden(true);
+ if (!firmware->getCapability(VirtualInputs) && firmware->getCapability(MixesWithoutExpo)) {
+ bool drVisible = (md->srcRaw.type == SOURCE_TYPE_STICK && md->srcRaw.index < NUM_STICKS);
+ ui->MixDR_CB->setEnabled(drVisible);
+ ui->label_MixDR->setEnabled(drVisible);
}
md->carryTrim = -(ui->trimCB->currentIndex()-1);
md->noExpo = ui->MixDR_CB->checkState() ? 0 : 1;
md->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
md->mixWarn = ui->warningCB->currentIndex();
md->mltpx = (MltpxValue)ui->mltpxCB->currentIndex();
- int scale=GetEepromInterface()->getCapability(SlowScale);
+ int scale=firmware->getCapability(SlowScale);
md->delayDown = round(ui->delayDownSB->value()*scale);
md->delayUp = round(ui->delayUpSB->value()*scale);
md->speedDown = round(ui->slowDownSB->value()*scale);
diff --git a/companion/src/modeledit/mixerdialog.h b/companion/src/modeledit/mixerdialog.h
index 437d9ca21..ccfebf58f 100644
--- a/companion/src/modeledit/mixerdialog.h
+++ b/companion/src/modeledit/mixerdialog.h
@@ -14,7 +14,7 @@ namespace Ui {
class MixerDialog : public QDialog {
Q_OBJECT
public:
- MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, int stickMode);
+ MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, GeneralSettings & generalSettings, FirmwareInterface * firmware);
~MixerDialog();
protected:
@@ -27,6 +27,8 @@ class MixerDialog : public QDialog {
private:
Ui::MixerDialog *ui;
ModelData & model;
+ GeneralSettings & generalSettings;
+ FirmwareInterface * firmware;
MixData *md;
bool lock;
GVarGroup * gvWeightGroup;
diff --git a/companion/src/modeledit/mixerdialog.ui b/companion/src/modeledit/mixerdialog.ui
index 04d876b80..4339313d8 100644
--- a/companion/src/modeledit/mixerdialog.ui
+++ b/companion/src/modeledit/mixerdialog.ui
@@ -204,7 +204,7 @@ p, li { white-space: pre-wrap; }
-
- 0
+ 0
Qt::AlignCenter
@@ -214,7 +214,7 @@ p, li { white-space: pre-wrap; }
-
- 1
+ 1
Qt::AlignCenter
@@ -224,7 +224,7 @@ p, li { white-space: pre-wrap; }
-
- 2
+ 2
Qt::AlignCenter
@@ -234,7 +234,7 @@ p, li { white-space: pre-wrap; }
-
- 3
+ 3
Qt::AlignCenter
@@ -244,7 +244,7 @@ p, li { white-space: pre-wrap; }
-
- 4
+ 4
Qt::AlignCenter
@@ -254,7 +254,7 @@ p, li { white-space: pre-wrap; }
-
- 5
+ 5
Qt::AlignCenter
@@ -264,7 +264,7 @@ p, li { white-space: pre-wrap; }
-
- 6
+ 6
Qt::AlignCenter
@@ -274,7 +274,7 @@ p, li { white-space: pre-wrap; }
-
- 7
+ 7
Qt::AlignCenter
@@ -284,7 +284,7 @@ p, li { white-space: pre-wrap; }
-
- 8
+ 8
Qt::AlignCenter
diff --git a/companion/src/modeledit/mixerslist.cpp b/companion/src/modeledit/mixerslist.cpp
index 06d8cd3f5..f1a368a03 100644
--- a/companion/src/modeledit/mixerslist.cpp
+++ b/companion/src/modeledit/mixerslist.cpp
@@ -10,6 +10,7 @@ MixersList::MixersList(QWidget *parent, bool expo) :
setDragEnabled(true);
setAcceptDrops(true);
setDropIndicatorShown(true);
+ setItemDelegate(new MixersDelegate(parent)); //set custom paint handler
}
void MixersList::keyPressEvent(QKeyEvent *event)
@@ -17,38 +18,110 @@ void MixersList::keyPressEvent(QKeyEvent *event)
emit keyWasPressed(event);
}
+
+/**
+ @brief Override to give us different mime type for mixers and inputs
+*/
+QStringList MixersList::mimeTypes () const
+{
+ QStringList types;
+ if (expo) types << "application/x-companion-expo-item";
+ else types << "application/x-companion-mix-item";
+ return types;
+}
+
bool MixersList::dropMimeData( int index, const QMimeData * data, Qt::DropAction action )
{
- QByteArray dropData = data->data("application/x-qabstractitemmodeldatalist");
+ // qDebug() << "MixersList::dropMimeData() index:" << index << "formats" << data->formats();
+ QByteArray dropData = data->data(expo ? "application/x-companion-expo-item" : "application/x-companion-mix-item");
+ if (dropData.isNull() ) return false;
QDataStream stream(&dropData, QIODevice::ReadOnly);
QByteArray qba;
- while (!stream.atEnd())
- {
+ while (!stream.atEnd()) {
int r,c;
QMap v;
stream >> r >> c >> v;
QList
|
|
|
| | |
| |
| | | |