Refactoring FirmwareInterface / EepromInterface

This commit is contained in:
bsongis
2014-04-18 16:27:27 +02:00
parent 7dd9e2d1e2
commit c5ac19a054
51 changed files with 810 additions and 1143 deletions
+1 -1
View File
@@ -327,7 +327,7 @@ void avrOutputDialog::errorWizard()
QMessageBox::warning(this, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease check advanced burn options to set the correct cpu type.").arg(DeviceStr)); QMessageBox::warning(this, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease check advanced burn options to set the correct cpu type.").arg(DeviceStr));
} }
else { else {
FirmwareInfo *firmware = GetCurrentFirmware(); FirmwareInterface *firmware = GetCurrentFirmware();
QMessageBox::warning(this, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease select an appropriate firmware type to program it.").arg(DeviceStr)+FwStr+tr("\nYou are currently using:\n %1").arg(firmware->name)); QMessageBox::warning(this, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease select an appropriate firmware type to program it.").arg(DeviceStr)+FwStr+tr("\nYou are currently using:\n %1").arg(firmware->name));
} }
} }
+1 -1
View File
@@ -445,7 +445,7 @@ void burnDialog::on_BurnFlashButton_clicked()
if (hexType==EEPROM_FILE_TYPE) { if (hexType==EEPROM_FILE_TYPE) {
QString calib = g.profile[g.id()].stickPotCalib(); QString calib = g.profile[g.id()].stickPotCalib();
QString trainercalib = g.profile[g.id()].trainerCalib(); QString trainercalib = g.profile[g.id()].trainerCalib();
int potsnum=GetEepromInterface()->getCapability(Pots); int potsnum=GetCurrentFirmware()->getCapability(Pots);
int8_t vBatCalib=(int8_t) g.profile[g.id()].vBatCalib(); int8_t vBatCalib=(int8_t) g.profile[g.id()].vBatCalib();
int8_t currentCalib=(int8_t) g.profile[g.id()].currentCalib(); int8_t currentCalib=(int8_t) g.profile[g.id()].currentCalib();
int8_t PPM_Multiplier=(int8_t) g.profile[g.id()].ppmMultiplier(); int8_t PPM_Multiplier=(int8_t) g.profile[g.id()].ppmMultiplier();
+3 -1
View File
@@ -104,7 +104,8 @@ int main(int argc, char *argv[])
QPixmap pixmap = QPixmap(g.profile[g.id()].fwType().contains("taranis") ? ":/images/splasht.png" : ":/images/splash.png"); QPixmap pixmap = QPixmap(g.profile[g.id()].fwType().contains("taranis") ? ":/images/splasht.png" : ":/images/splash.png");
QSplashScreen *splash = new QSplashScreen(pixmap); QSplashScreen *splash = new QSplashScreen(pixmap);
RegisterFirmwares(); RegisterEepromInterfaces();
registerOpenTxFirmwares();
current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType()); current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType());
@@ -124,6 +125,7 @@ int main(int argc, char *argv[])
delete mainWin; delete mainWin;
UnregisterFirmwares(); UnregisterFirmwares();
UnregisterEepromInterfaces();
return result; return result;
} }
+60 -60
View File
@@ -75,7 +75,7 @@ void compareDialog::printDiff()
{ {
te->clear(); te->clear();
printSetup(); printSetup();
if (GetEepromInterface()->getCapability(FlightPhases)) { if (GetCurrentFirmware()->getCapability(FlightPhases)) {
printPhases(); printPhases();
} }
printExpos(); printExpos();
@@ -308,7 +308,7 @@ void compareDialog::printPhases()
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(*g_model1, i))); str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(*g_model1, i)));
} }
str.append("</tr>"); str.append("</tr>");
for (i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) { for (i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
PhaseData *pd1=&g_model1->phaseData[i]; PhaseData *pd1=&g_model1->phaseData[i];
PhaseData *pd2=&g_model2->phaseData[i]; PhaseData *pd2=&g_model2->phaseData[i];
str.append("<tr><td><b>"+tr("FM")+QString("%1</b> ").arg(i)); str.append("<tr><td><b>"+tr("FM")+QString("%1</b> ").arg(i));
@@ -334,7 +334,7 @@ void compareDialog::printPhases()
str.append("</table>"); str.append("</table>");
int gvars=0; int gvars=0;
int gvarnum=0; int gvarnum=0;
if (GetEepromInterface()->getCapability(HasVariants)) { if (GetCurrentFirmware()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) { if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1; gvars=1;
} }
@@ -342,35 +342,35 @@ void compareDialog::printPhases()
gvars=1; gvars=1;
} }
if (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(GvarsFlightPhases)) || GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append("<br><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">"); str.append("<br><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
str.append("<tr><td style=\"border-style:none;\">&nbsp;</td>"); str.append("<tr><td style=\"border-style:none;\">&nbsp;</td>");
if (GetEepromInterface()->getCapability(GvarsFlightPhases)) { if (GetCurrentFirmware()->getCapability(GvarsFlightPhases)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</td>"); str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</td>");
} }
if (GetEepromInterface()->getCapability(RotaryEncoders)) { if (GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(GetEepromInterface()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+"</td>"); str.append(QString("<td colspan=%1 align=center><b>").arg(GetCurrentFirmware()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+"</td>");
} }
str.append("</tr><tr><td align=center><b>"+tr("Flight mode name")+"</b></td>"); str.append("</tr><tr><td align=center><b>"+tr("Flight mode name")+"</b></td>");
if (GetEepromInterface()->getCapability(GvarsFlightPhases)) { if (GetCurrentFirmware()->getCapability(GvarsFlightPhases)) {
for (i=0; i<gvarnum; i++) { for (i=0; i<gvarnum; i++) {
str.append(QString("<td width=\"40\" align=\"center\"><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model1->gvars_names[i])); str.append(QString("<td width=\"40\" align=\"center\"><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model1->gvars_names[i]));
} }
} }
for (i=0; i<GetEepromInterface()->getCapability(RotaryEncoders); i++) { for (i=0; i<GetCurrentFirmware()->getCapability(RotaryEncoders); i++) {
str.append(QString("<td align=\"center\"><b>RE%1</b></td>").arg((i==0 ? 'A': 'B'))); str.append(QString("<td align=\"center\"><b>RE%1</b></td>").arg((i==0 ? 'A': 'B')));
} }
str.append("</tr>"); str.append("</tr>");
for (i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) { for (i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
PhaseData *pd1=&g_model1->phaseData[i]; PhaseData *pd1=&g_model1->phaseData[i];
PhaseData *pd2=&g_model2->phaseData[i]; PhaseData *pd2=&g_model2->phaseData[i];
str.append("<tr><td><b>"+tr("FM")+QString("%1</b> ").arg(i)); str.append("<tr><td><b>"+tr("FM")+QString("%1</b> ").arg(i));
color=getColor1(pd1->name,pd2->name); color=getColor1(pd1->name,pd2->name);
str.append(QString("<font size=+1 face='Courier New' color=%2>%1</font></td>").arg(pd1->name).arg(color)); str.append(QString("<font size=+1 face='Courier New' color=%2>%1</font></td>").arg(pd1->name).arg(color));
if (GetEepromInterface()->getCapability(GvarsFlightPhases)) { if (GetCurrentFirmware()->getCapability(GvarsFlightPhases)) {
for (k=0; k<gvarnum; k++) { for (k=0; k<gvarnum; k++) {
color=getColor1(pd1->gvars[k],pd2->gvars[k]); color=getColor1(pd1->gvars[k],pd2->gvars[k]);
if (pd1->gvars[k]<=1024) { if (pd1->gvars[k]<=1024) {
@@ -383,7 +383,7 @@ void compareDialog::printPhases()
} }
} }
} }
for (k=0; k<GetEepromInterface()->getCapability(RotaryEncoders); k++) { for (k=0; k<GetCurrentFirmware()->getCapability(RotaryEncoders); k++) {
color=getColor1(pd1->rotaryEncoders[k],pd2->rotaryEncoders[k]); color=getColor1(pd1->rotaryEncoders[k],pd2->rotaryEncoders[k]);
if (pd1->rotaryEncoders[k]<=1024) { if (pd1->rotaryEncoders[k]<=1024) {
str.append(QString("<td align=\"right\"><font size=+1 face='Courier New' color=%2>%1").arg(pd1->rotaryEncoders[k]).arg(color)+"</font></td>"); str.append(QString("<td align=\"right\"><font size=+1 face='Courier New' color=%2>%1").arg(pd1->rotaryEncoders[k]).arg(color)+"</font></td>");
@@ -409,7 +409,7 @@ void compareDialog::printPhases()
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(*g_model1, i))); str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(*g_model1, i)));
} }
str.append("</tr>"); str.append("</tr>");
for (i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) { for (i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
PhaseData *pd1=&g_model1->phaseData[i]; PhaseData *pd1=&g_model1->phaseData[i];
PhaseData *pd2=&g_model2->phaseData[i]; PhaseData *pd2=&g_model2->phaseData[i];
str.append("<tr><td><b>"+tr("FM")+QString("%1</b> ").arg(i)); str.append("<tr><td><b>"+tr("FM")+QString("%1</b> ").arg(i));
@@ -434,32 +434,32 @@ void compareDialog::printPhases()
} }
str.append("</table>"); str.append("</table>");
if ((gvars==1 && GetEepromInterface()->getCapability(GvarsFlightPhases)) || GetEepromInterface()->getCapability(RotaryEncoders)) { if ((gvars==1 && GetCurrentFirmware()->getCapability(GvarsFlightPhases)) || GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append("<br><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">"); str.append("<br><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
str.append("<tr><td style=\"border-style:none;\">&nbsp;</td>"); str.append("<tr><td style=\"border-style:none;\">&nbsp;</td>");
if (GetEepromInterface()->getCapability(GvarsFlightPhases)) { if (GetCurrentFirmware()->getCapability(GvarsFlightPhases)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</td>"); str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</td>");
} }
if (GetEepromInterface()->getCapability(RotaryEncoders)) { if (GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(GetEepromInterface()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+"</td>"); str.append(QString("<td colspan=%1 align=center><b>").arg(GetCurrentFirmware()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+"</td>");
} }
str.append("</tr><tr><td align=center ><b>"+tr("Flight mode name")+"</b></td>"); str.append("</tr><tr><td align=center ><b>"+tr("Flight mode name")+"</b></td>");
if (GetEepromInterface()->getCapability(GvarsFlightPhases)) { if (GetCurrentFirmware()->getCapability(GvarsFlightPhases)) {
for (i=0; i<gvarnum; i++) { for (i=0; i<gvarnum; i++) {
str.append(QString("<td width=\"40\" align=\"center\"><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model2->gvars_names[i])); str.append(QString("<td width=\"40\" align=\"center\"><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model2->gvars_names[i]));
} }
} }
for (i=0; i<GetEepromInterface()->getCapability(RotaryEncoders); i++) { for (i=0; i<GetCurrentFirmware()->getCapability(RotaryEncoders); i++) {
str.append(QString("<td align=\"center\"><b>RE%1</b></td>").arg((i==0 ? 'A': 'B'))); str.append(QString("<td align=\"center\"><b>RE%1</b></td>").arg((i==0 ? 'A': 'B')));
} }
str.append("</tr>"); str.append("</tr>");
for (i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) { for (i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
PhaseData *pd1=&g_model1->phaseData[i]; PhaseData *pd1=&g_model1->phaseData[i];
PhaseData *pd2=&g_model2->phaseData[i]; PhaseData *pd2=&g_model2->phaseData[i];
str.append("<tr><td><b>"+tr("FM")+QString("%1</b> ").arg(i)); str.append("<tr><td><b>"+tr("FM")+QString("%1</b> ").arg(i));
color=getColor1(pd1->name,pd2->name); color=getColor1(pd1->name,pd2->name);
str.append(QString("<font size=+1 face='Courier New' color=%2>%1</font></td>").arg(pd2->name).arg(color)); str.append(QString("<font size=+1 face='Courier New' color=%2>%1</font></td>").arg(pd2->name).arg(color));
if (GetEepromInterface()->getCapability(GvarsFlightPhases)) { if (GetCurrentFirmware()->getCapability(GvarsFlightPhases)) {
for (k=0; k<gvarnum; k++) { for (k=0; k<gvarnum; k++) {
color=getColor1(pd1->gvars[k],pd2->gvars[k]); color=getColor1(pd1->gvars[k],pd2->gvars[k]);
if (pd2->gvars[k]<=1024) { if (pd2->gvars[k]<=1024) {
@@ -472,7 +472,7 @@ void compareDialog::printPhases()
} }
} }
} }
for (k=0; k<GetEepromInterface()->getCapability(RotaryEncoders); k++) { for (k=0; k<GetCurrentFirmware()->getCapability(RotaryEncoders); k++) {
color=getColor1(pd1->rotaryEncoders[k],pd2->rotaryEncoders[k]); color=getColor1(pd1->rotaryEncoders[k],pd2->rotaryEncoders[k]);
if (pd2->rotaryEncoders[k]<=1024) { if (pd2->rotaryEncoders[k]<=1024) {
str.append(QString("<td align=\"right\"><font size=+1 face='Courier New' color=%2>%1").arg(pd2->rotaryEncoders[k]).arg(color)+"</font></td>"); str.append(QString("<td align=\"right\"><font size=+1 face='Courier New' color=%2>%1").arg(pd2->rotaryEncoders[k]).arg(color)+"</font></td>");
@@ -497,14 +497,14 @@ void compareDialog::printLimits()
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-after:always;\" width=\"100%\">"; QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-after:always;\" width=\"100%\">";
str.append("<tr><td colspan=2><h2>"+tr("Limits")+"</h2></td></tr>"); str.append("<tr><td colspan=2><h2>"+tr("Limits")+"</h2></td></tr>");
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"50%\">"); str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"50%\">");
if (GetEepromInterface()->getCapability(HasChNames)) { if (GetCurrentFirmware()->getCapability(HasChNames)) {
str.append("<tr><td>"+tr("Name")+"</td><td align=center><b>"+tr("Offset")+"</b></td><td align=center><b>"+tr("Min")+"</b></td><td align=center><b>"+tr("Max")+"</b></td><td align=center><b>"+tr("Invert")+"</b></td></tr>"); str.append("<tr><td>"+tr("Name")+"</td><td align=center><b>"+tr("Offset")+"</b></td><td align=center><b>"+tr("Min")+"</b></td><td align=center><b>"+tr("Max")+"</b></td><td align=center><b>"+tr("Invert")+"</b></td></tr>");
} else { } else {
str.append("<tr><td></td><td align=center><b>"+tr("Offset")+"</b></td><td align=center><b>"+tr("Min")+"</b></td><td align=center><b>"+tr("Max")+"</b></td><td align=center><b>"+tr("Invert")+"</b></td></tr>"); str.append("<tr><td></td><td align=center><b>"+tr("Offset")+"</b></td><td align=center><b>"+tr("Min")+"</b></td><td align=center><b>"+tr("Max")+"</b></td><td align=center><b>"+tr("Invert")+"</b></td></tr>");
} }
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) { for(int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append("<tr>"); str.append("<tr>");
if (GetEepromInterface()->getCapability(HasChNames)) { if (GetCurrentFirmware()->getCapability(HasChNames)) {
QString name1=g_model1->limitData[i].name; QString name1=g_model1->limitData[i].name;
QString name2=g_model2->limitData[i].name; QString name2=g_model2->limitData[i].name;
color=getColor1(name1,name2); color=getColor1(name1,name2);
@@ -529,9 +529,9 @@ void compareDialog::printLimits()
str.append("</table></td>"); str.append("</table></td>");
str.append("<td><table border=1 cellspacing=0 cellpadding=1 width=\"50%\">"); str.append("<td><table border=1 cellspacing=0 cellpadding=1 width=\"50%\">");
str.append("<tr><td></td><td align=center><b>"+tr("Offset")+"</b></td><td align=center><b>"+tr("Min")+"</b></td><td align=center><b>"+tr("Max")+"</b></td><td align=center><b>"+tr("Invert")+"</b></td></tr>"); str.append("<tr><td></td><td align=center><b>"+tr("Offset")+"</b></td><td align=center><b>"+tr("Min")+"</b></td><td align=center><b>"+tr("Max")+"</b></td><td align=center><b>"+tr("Invert")+"</b></td></tr>");
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) { for(int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append("<tr>"); str.append("<tr>");
if (GetEepromInterface()->getCapability(HasChNames)) { if (GetCurrentFirmware()->getCapability(HasChNames)) {
QString name1=g_model1->limitData[i].name; QString name1=g_model1->limitData[i].name;
QString name2=g_model2->limitData[i].name; QString name2=g_model2->limitData[i].name;
color=getColor2(name1,name2); color=getColor2(name1,name2);
@@ -562,12 +562,12 @@ void compareDialog::printGvars()
QString color; QString color;
int gvars=0; int gvars=0;
int gvarnum=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; gvars=1;
gvarnum=GetEepromInterface()->getCapability(Gvars); gvarnum=GetCurrentFirmware()->getCapability(Gvars);
} }
if (!GetEepromInterface()->getCapability(GvarsFlightPhases) && (gvars==1 && GetEepromInterface()->getCapability(Gvars))) { if (!GetCurrentFirmware()->getCapability(GvarsFlightPhases) && (gvars==1 && GetCurrentFirmware()->getCapability(Gvars))) {
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">"; QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append("<tr><td colspan=2><h2>"+tr("Global Variables")+"</h2></td></tr>"); str.append("<tr><td colspan=2><h2>"+tr("Global Variables")+"</h2></td></tr>");
str.append("<tr><td width=50%>"); str.append("<tr><td width=50%>");
@@ -614,7 +614,7 @@ void compareDialog::printExpos()
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-after:always;\" width=\"100%\"><tr><td><h2>"; QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-after:always;\" width=\"100%\"><tr><td><h2>";
str.append(tr("Expo/Dr Settings")); str.append(tr("Expo/Dr Settings"));
str.append("</h2></td></tr><tr><td><table border=1 cellspacing=0 cellpadding=3>"); str.append("</h2></td></tr><tr><td><table border=1 cellspacing=0 cellpadding=3>");
for(uint8_t i=0; i<GetEepromInterface()->getCapability(Outputs); i++) { for(uint8_t i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
if (ChannelHasExpo(g_model1->expoData, i) || ChannelHasExpo(g_model2->expoData, i)) { if (ChannelHasExpo(g_model1->expoData, i) || ChannelHasExpo(g_model2->expoData, i)) {
str.append("<tr>"); str.append("<tr>");
str.append("<td width=\"45%\">"); str.append("<td width=\"45%\">");
@@ -651,12 +651,12 @@ void compareDialog::printExpos()
str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight)).rightJustified(6, ' '); str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight)).rightJustified(6, ' ');
str += ed->curve.toString().replace("<", "&lt;").replace(">", "&gt;"); str += ed->curve.toString().replace("<", "&lt;").replace(">", "&gt;");
if (GetEepromInterface()->getCapability(FlightPhases)) { if (GetCurrentFirmware()->getCapability(FlightPhases)) {
if(ed->phases) { if(ed->phases) {
if (ed->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) { if (ed->phases!=(unsigned int)(1<<GetCurrentFirmware()->getCapability(FlightPhases))-1) {
int mask=1; int mask=1;
int first=0; int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases);i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases);i++) {
if (!(ed->phases & mask)) { if (!(ed->phases & mask)) {
first++; first++;
} }
@@ -669,7 +669,7 @@ void compareDialog::printExpos()
} }
mask=1; mask=1;
first=1; first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) { for (int j=0; j<GetCurrentFirmware()->getCapability(FlightPhases);j++) {
if (!(ed->phases & mask)) { if (!(ed->phases & mask)) {
PhaseData *pd = &g_model1->phaseData[j]; PhaseData *pd = &g_model1->phaseData[j];
if (!first) { if (!first) {
@@ -729,12 +729,12 @@ void compareDialog::printExpos()
str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight)).rightJustified(6, ' '); str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight)).rightJustified(6, ' ');
str += ed->curve.toString().replace("<", "&lt;").replace(">", "&gt;"); str += ed->curve.toString().replace("<", "&lt;").replace(">", "&gt;");
if (GetEepromInterface()->getCapability(FlightPhases)) { if (GetCurrentFirmware()->getCapability(FlightPhases)) {
if(ed->phases) { if(ed->phases) {
if (ed->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) { if (ed->phases!=(unsigned int)(1<<GetCurrentFirmware()->getCapability(FlightPhases))-1) {
int mask=1; int mask=1;
int first=0; int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases);i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases);i++) {
if (!(ed->phases & mask)) { if (!(ed->phases & mask)) {
first++; first++;
} }
@@ -747,7 +747,7 @@ void compareDialog::printExpos()
} }
mask=1; mask=1;
first=1; first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) { for (int j=0; j<GetCurrentFirmware()->getCapability(FlightPhases);j++) {
if (!(ed->phases & mask)) { if (!(ed->phases & mask)) {
PhaseData *pd = &g_model2->phaseData[j]; PhaseData *pd = &g_model2->phaseData[j];
if (!first) { if (!first) {
@@ -784,15 +784,15 @@ void compareDialog::printMixers()
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-after:always;\" width=\"100%\"><tr><td><h2>"; QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-after:always;\" width=\"100%\"><tr><td><h2>";
str.append(tr("Mixers")); str.append(tr("Mixers"));
str.append("</h2></td></tr><tr><td><table border=1 cellspacing=0 cellpadding=3>"); str.append("</h2></td></tr><tr><td><table border=1 cellspacing=0 cellpadding=3>");
float scale=GetEepromInterface()->getCapability(SlowScale); float scale=GetCurrentFirmware()->getCapability(SlowScale);
bool mixused[64]={false}; bool mixused[64]={false};
bool mixused2[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)) { if (ChannelHasMix(g_model1->mixData, i) || ChannelHasMix(g_model2->mixData, i)) {
str.append("<tr>"); str.append("<tr>");
str.append("<td width=\"45%\">"); str.append("<td width=\"45%\">");
str.append("<table border=0 cellspacing=0 cellpadding=0>"); str.append("<table border=0 cellspacing=0 cellpadding=0>");
for (int j=0; j<GetEepromInterface()->getCapability(Mixes); j++) { for (int j=0; j<GetCurrentFirmware()->getCapability(Mixes); j++) {
if (g_model1->mixData[j].destCh==i) { if (g_model1->mixData[j].destCh==i) {
int mix=ModelHasMix(g_model2->mixData, g_model1->mixData[j], mixused); int mix=ModelHasMix(g_model2->mixData, g_model1->mixData[j], mixused);
if (mix>-1) { if (mix>-1) {
@@ -827,12 +827,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->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->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 (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn);
if (GetEepromInterface()->getCapability(FlightPhases)) { if (GetCurrentFirmware()->getCapability(FlightPhases)) {
if(md->phases) { if(md->phases) {
if (md->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) { if (md->phases!=(unsigned int)(1<<GetCurrentFirmware()->getCapability(FlightPhases))-1) {
int mask=1; int mask=1;
int first=0; int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases);i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases);i++) {
if (!(md->phases & mask)) { if (!(md->phases & mask)) {
first++; first++;
} }
@@ -845,7 +845,7 @@ void compareDialog::printMixers()
} }
mask=1; mask=1;
first=1; first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) { for (int j=0; j<GetCurrentFirmware()->getCapability(FlightPhases);j++) {
if (!(md->phases & mask)) { if (!(md->phases & mask)) {
PhaseData *pd = &g_model1->phaseData[j]; PhaseData *pd = &g_model1->phaseData[j];
if (!first) { if (!first) {
@@ -870,7 +870,7 @@ void compareDialog::printMixers()
str.append("<td width=\"10%\" align=\"center\" valign=\"middle\"><b>"+tr("CH")+QString("%1</b></td>").arg(i,2,10,QChar('0'))); str.append("<td width=\"10%\" align=\"center\" valign=\"middle\"><b>"+tr("CH")+QString("%1</b></td>").arg(i,2,10,QChar('0')));
str.append("<td width=\"45%\">"); str.append("<td width=\"45%\">");
str.append("<table border=0 cellspacing=0 cellpadding=0>"); str.append("<table border=0 cellspacing=0 cellpadding=0>");
for (int j=0; j<GetEepromInterface()->getCapability(Mixes); j++) { for (int j=0; j<GetCurrentFirmware()->getCapability(Mixes); j++) {
if (g_model2->mixData[j].destCh==i) { if (g_model2->mixData[j].destCh==i) {
int mix=ModelHasMix(g_model1->mixData, g_model2->mixData[j],mixused2); int mix=ModelHasMix(g_model1->mixData, g_model2->mixData[j],mixused2);
if (mix>-1) { if (mix>-1) {
@@ -906,12 +906,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->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->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 (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn);
if (GetEepromInterface()->getCapability(FlightPhases)) { if (GetCurrentFirmware()->getCapability(FlightPhases)) {
if(md->phases) { if(md->phases) {
if (md->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) { if (md->phases!=(unsigned int)(1<<GetCurrentFirmware()->getCapability(FlightPhases))-1) {
int mask=1; int mask=1;
int first=0; int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases);i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases);i++) {
if (!(md->phases & mask)) { if (!(md->phases & mask)) {
first++; first++;
} }
@@ -924,7 +924,7 @@ void compareDialog::printMixers()
} }
mask=1; mask=1;
first=1; first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) { for (int j=0; j<GetCurrentFirmware()->getCapability(FlightPhases);j++) {
if (!(md->phases & mask)) { if (!(md->phases & mask)) {
PhaseData *pd = &g_model2->phaseData[j]; PhaseData *pd = &g_model2->phaseData[j];
if (!first) { if (!first) {
@@ -1040,7 +1040,7 @@ void compareDialog::printSwitches()
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">"; QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>"); str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>");
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">"); str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
QString sw1 = g_model1->customSw[i].toString(*g_model1); QString sw1 = g_model1->customSw[i].toString(*g_model1);
QString sw2 = g_model2->customSw[i].toString(*g_model2); QString sw2 = g_model2->customSw[i].toString(*g_model2);
if (!(sw1.isEmpty() && sw2.isEmpty())) { if (!(sw1.isEmpty() && sw2.isEmpty())) {
@@ -1083,7 +1083,7 @@ void compareDialog::printFSwitches()
str.append("<td width=\"7%\" align=\"center\"><b>"+tr("Repeat")+"</b></td>"); str.append("<td width=\"7%\" align=\"center\"><b>"+tr("Repeat")+"</b></td>");
str.append("<td width=\"7%\" align=\"center\"><b>"+tr("Enable")+"</b></td>"); str.append("<td width=\"7%\" align=\"center\"><b>"+tr("Enable")+"</b></td>");
str.append("</tr>"); str.append("</tr>");
for(int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) for(int i=0; i<GetCurrentFirmware()->getCapability(CustomFunctions); i++)
{ {
if (g_model1->funcSw[i].swtch.type || g_model2->funcSw[i].swtch.type) { 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)) { 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)) {
@@ -1212,10 +1212,10 @@ void compareDialog::printFrSky()
str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd1->rssiAlarms[1].value,10)+"</td>"); str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd1->rssiAlarms[1].value,10)+"</td>");
str.append("</table>"); str.append("</table>");
#if 0 #if 0
if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) { if (GetCurrentFirmware()->getCapability(TelemetryBars) || GetCurrentFirmware()->getCapability(TelemetryCSFields)) {
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields); int cols=GetCurrentFirmware()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2; if (cols==0) cols=2;
for (int j=0; j<GetEepromInterface()->getCapability(TelemetryCSFields)/(4*cols); j++) { for (int j=0; j<GetCurrentFirmware()->getCapability(TelemetryCSFields)/(4*cols); j++) {
QString tcols; QString tcols;
QString cwidth; QString cwidth;
QString swidth; QString swidth;
@@ -1331,10 +1331,10 @@ void compareDialog::printFrSky()
str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd2->rssiAlarms[1].value,10)+"</td>"); str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd2->rssiAlarms[1].value,10)+"</td>");
str.append("</table></br>"); str.append("</table></br>");
#if 0 #if 0
if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) { if (GetCurrentFirmware()->getCapability(TelemetryBars) || GetCurrentFirmware()->getCapability(TelemetryCSFields)) {
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields); int cols=GetCurrentFirmware()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2; if (cols==0) cols=2;
for (int j=0; j<GetEepromInterface()->getCapability(TelemetryCSFields)/(4*cols); j++) { for (int j=0; j<GetCurrentFirmware()->getCapability(TelemetryCSFields)/(4*cols); j++) {
QString tcols; QString tcols;
QString cwidth; QString cwidth;
QString swidth; QString swidth;
+20 -28
View File
@@ -592,7 +592,7 @@ QString LogicalSwitchData::toString(const ModelData & model)
result += RawSwitch(andsw).toString(); result += RawSwitch(andsw).toString();
} }
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) { if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
if (delay) if (delay)
result += QObject::tr(" Delay %1 sec").arg(delay/10.0); result += QObject::tr(" Delay %1 sec").arg(delay/10.0);
if (duration) if (duration)
@@ -644,7 +644,7 @@ QStringList FuncSwData::toStringList()
result << item.toString(); result << item.toString();
} }
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) { else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
if ( GetEepromInterface()->getCapability(VoicesAsNumbers)) { if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
result << QString("%1").arg(param); result << QString("%1").arg(param);
} else { } else {
result << paramarm; result << paramarm;
@@ -774,7 +774,7 @@ QString FuncSwData::paramToString()
return item.toString(); return item.toString();
} }
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) { else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
if ( GetEepromInterface()->getCapability(VoicesAsNumbers)) { if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
return QString("%1").arg(param); return QString("%1").arg(param);
} else { } else {
return paramarm; return paramarm;
@@ -839,7 +839,7 @@ GeneralSettings::GeneralSettings()
stickMode = g.profile[g.id()].defaultMode(); stickMode = g.profile[g.id()].defaultMode();
QString t_calib=g.profile[g.id()].stickPotCalib(); QString t_calib=g.profile[g.id()].stickPotCalib();
int potsnum=GetEepromInterface()->getCapability(Pots); int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (t_calib.isEmpty()) { if (t_calib.isEmpty()) {
return; return;
} }
@@ -1186,13 +1186,13 @@ ModelData ModelData::removeGlobalVars()
QList<EEPROMInterface *> eepromInterfaces; QList<EEPROMInterface *> eepromInterfaces;
void RegisterEepromInterfaces() void RegisterEepromInterfaces()
{ {
eepromInterfaces.push_back(new OpenTxInterface(BOARD_STOCK)); eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_STOCK));
eepromInterfaces.push_back(new OpenTxInterface(BOARD_M128)); eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_M128));
eepromInterfaces.push_back(new OpenTxInterface(BOARD_GRUVIN9X)); eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_GRUVIN9X));
eepromInterfaces.push_back(new OpenTxInterface(BOARD_SKY9X)); eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_SKY9X));
eepromInterfaces.push_back(new OpenTxInterface(BOARD_TARANIS)); eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS));
if (g.rev4aSupport()) 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_STOCK));
eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_GRUVIN9X)); eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_GRUVIN9X));
eepromInterfaces.push_back(new Ersky9xInterface()); eepromInterfaces.push_back(new Ersky9xInterface());
@@ -1209,25 +1209,17 @@ void UnregisterEepromInterfaces()
OpenTxEepromCleanup(); OpenTxEepromCleanup();
} }
QList<FirmwareInfo *> firmwares; QList<FirmwareInterface *> firmwares;
FirmwareVariant default_firmware_variant; FirmwareVariant default_firmware_variant;
FirmwareVariant current_firmware_variant; FirmwareVariant current_firmware_variant;
void RegisterFirmwares()
{
RegisterOpen9xFirmwares();
default_firmware_variant = GetFirmwareVariant("opentx-9x-heli-templates-en");
current_firmware_variant = default_firmware_variant;
RegisterEepromInterfaces();
}
void UnregisterFirmwares() void UnregisterFirmwares()
{ {
UnregisterEepromInterfaces(); foreach (FirmwareInterface * f, firmwares) {
UnregisterOpen9xFirmwares(); delete f;
}
} }
bool LoadEeprom(RadioData &radioData, const uint8_t *eeprom, const int size) bool LoadEeprom(RadioData &radioData, const uint8_t *eeprom, const int size)
{ {
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) { foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
@@ -1264,7 +1256,7 @@ FirmwareVariant GetFirmwareVariant(QString id)
{ {
FirmwareVariant result; FirmwareVariant result;
foreach(FirmwareInfo * firmware, firmwares) { foreach(FirmwareInterface * firmware, firmwares) {
if (id.contains(firmware->id+"-") || (!id.contains("-") && id.contains(firmware->id))) { if (id.contains(firmware->id+"-") || (!id.contains("-") && id.contains(firmware->id))) {
result.id = id; result.id = id;
result.firmware = firmware; result.firmware = firmware;
@@ -1276,13 +1268,13 @@ FirmwareVariant GetFirmwareVariant(QString id)
return default_firmware_variant; 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 } }; Option options[] = { { option, tooltip, variant }, { NULL } };
addOptions(options); addOptions(options);
} }
unsigned int FirmwareInfo::getVariant(const QString & variantId) unsigned int FirmwareInterface::getVariant(const QString & variantId)
{ {
unsigned int variant = variantBase; unsigned int variant = variantBase;
QStringList options = variantId.mid(id.length()+1).split("-", QString::SkipEmptyParts); QStringList options = variantId.mid(id.length()+1).split("-", QString::SkipEmptyParts);
@@ -1298,17 +1290,17 @@ unsigned int FirmwareInfo::getVariant(const QString & variantId)
return variant; return variant;
} }
void FirmwareInfo::addLanguage(const char *lang) void FirmwareInterface::addLanguage(const char *lang)
{ {
languages.push_back(lang); languages.push_back(lang);
} }
void FirmwareInfo::addTTSLanguage(const char *lang) void FirmwareInterface::addTTSLanguage(const char *lang)
{ {
ttslanguages.push_back(lang); ttslanguages.push_back(lang);
} }
void FirmwareInfo::addOptions(Option options[]) void FirmwareInterface::addOptions(Option options[])
{ {
QList<Option> opts; QList<Option> opts;
for (int i=0; options[i].name; i++) { for (int i=0; options[i].name; i++) {
+75 -66
View File
@@ -1130,12 +1130,8 @@ class EEPROMInterface
virtual int getSize(GeneralSettings &) = 0; virtual int getSize(GeneralSettings &) = 0;
virtual int getCapability(const Capability) = 0;
virtual int isAvailable(Protocol proto, int port=0) = 0; virtual int isAvailable(Protocol proto, int port=0) = 0;
virtual SimulatorInterface * getSimulator() { return NULL; }
virtual const int getEEpromSize() = 0; virtual const int getEEpromSize() = 0;
virtual const int getMaxModels() = 0; virtual const int getMaxModels() = 0;
@@ -1244,8 +1240,9 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode)
model.swashRingData.collectiveSource.index = applyStickMode(model.swashRingData.collectiveSource.index + 1, mode) - 1; model.swashRingData.collectiveSource.index = applyStickMode(model.swashRingData.collectiveSource.index + 1, mode) - 1;
} }
void RegisterFirmwares(); void RegisterEepromInterfaces();
void UnregisterFirmwares(); void UnregisterFirmwares();
void registerOpenTxFirmwares();
bool LoadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index); bool LoadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index);
bool LoadEeprom(RadioData &radioData, const uint8_t *eeprom, int size); bool LoadEeprom(RadioData &radioData, const uint8_t *eeprom, int size);
@@ -1257,50 +1254,27 @@ struct Option {
uint32_t variant; uint32_t variant;
}; };
class FirmwareInfo { class FirmwareInterface {
public:
FirmwareInfo():
parent(NULL),
id(QString::null),
eepromInterface(NULL),
voice(false),
variantBase(0)
{
}
virtual ~FirmwareInfo() public:
virtual ~FirmwareInterface()
{ {
delete eepromInterface; delete eepromInterface;
} }
FirmwareInfo(const QString & id, const QString & name, EEPROMInterface * eepromInterface, const QString & url = QString(), const QString & stamp = QString(), const QString & rnurl = QString(), bool voice = false): FirmwareInterface(const QString & id, const QString & name, const BoardEnum board, EEPROMInterface * eepromInterface, bool voice = false):
parent(NULL),
id(id), id(id),
name(name), name(name),
board(board),
eepromInterface(eepromInterface), eepromInterface(eepromInterface),
url(url),
stamp(stamp),
rnurl(rnurl),
voice(voice), voice(voice),
variantBase(0) variantBase(0)
{ {
} }
FirmwareInfo(const QString & id, EEPROMInterface * eepromInterface, const QString & url, const QString & stamp = QString(), const QString & rnurl = QString(), bool voice=false): inline void setVariantBase(unsigned int variant)
parent(NULL),
id(id),
name(QString::null),
eepromInterface(eepromInterface),
url(url),
stamp(stamp),
rnurl(rnurl),
voice(voice),
variantBase(0)
{ {
} variantBase = variant;
void setVariantBase(unsigned int variant) {
this->variantBase = variant;
} }
unsigned int getVariant(const QString & id); unsigned int getVariant(const QString & id);
@@ -1313,71 +1287,104 @@ class FirmwareInfo {
virtual void addOptions(Option options[]); virtual void addOptions(Option options[]);
QStringList get_options() { inline int saveEEPROM(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, unsigned int version=0)
if (parent) {
return id.mid(parent->id.length()+1).split("-", QString::SkipEmptyParts);
else
return QStringList();
}
int saveEEPROM(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, unsigned int version=0) {
return eepromInterface->save(eeprom, radioData, variant, version); return eepromInterface->save(eeprom, radioData, variant, version);
} }
virtual QString getUrl(const QString &fwId) { virtual QString getStampUrl() = 0;
if (url.contains("%1"))
return url.arg(fwId); virtual QString getReleaseNotesUrl() = 0;
else
return url; virtual QString getFirmwareUrl(QString & id) = 0;
inline BoardEnum getBoard()
{
return board;
} }
virtual QString getRnUrl(const QString &fwId) { inline EEPROMInterface * getEepromInterface()
if (rnurl.contains("%1")) {
return rnurl.arg(fwId); return eepromInterface;
else
return rnurl;
} }
virtual int getCapability(const Capability) = 0;
virtual SimulatorInterface * getSimulator()
{
return NULL;
}
public:
QList<const char *> languages; QList<const char *> languages;
QList<const char *> ttslanguages; QList<const char *> ttslanguages;
QList< QList<Option> > opts; QList< QList<Option> > opts;
FirmwareInfo *parent;
QString id; QString id;
QString name; QString name;
protected:
BoardEnum board;
EEPROMInterface * eepromInterface; EEPROMInterface * eepromInterface;
QString url;
QString stamp; public:
QString rnurl;
bool voice; bool voice;
protected:
unsigned int variantBase; unsigned int variantBase;
private:
FirmwareInterface();
}; };
struct FirmwareVariant { class FirmwareVariant
QString id; {
FirmwareInfo *firmware; public:
unsigned int variant; FirmwareVariant():
firmware(NULL),
variant(0)
{
}
FirmwareVariant(QString & id, FirmwareInterface * firmware, unsigned int variant):
id(id),
firmware(firmware),
variant(variant)
{
}
QString getFirmwareUrl()
{
if (firmware)
return firmware->getFirmwareUrl(id);
else
return "";
}
QString id;
FirmwareInterface * firmware;
unsigned int variant;
}; };
extern QList<FirmwareInfo *> firmwares; extern QList<FirmwareInterface *> firmwares;
extern FirmwareVariant default_firmware_variant; extern FirmwareVariant default_firmware_variant;
extern FirmwareVariant current_firmware_variant; extern FirmwareVariant current_firmware_variant;
FirmwareVariant GetFirmwareVariant(QString id); FirmwareVariant GetFirmwareVariant(QString id);
inline FirmwareInfo * GetFirmware(QString id) inline FirmwareInterface * GetFirmware(QString id)
{ {
return GetFirmwareVariant(id).firmware; return GetFirmwareVariant(id).firmware;
} }
inline FirmwareInfo * GetCurrentFirmware() inline FirmwareInterface * GetCurrentFirmware()
{ {
return current_firmware_variant.firmware; return current_firmware_variant.firmware;
} }
inline EEPROMInterface * GetEepromInterface() inline EEPROMInterface * GetEepromInterface()
{ {
return GetCurrentFirmware()->eepromInterface; return GetCurrentFirmware()->getEepromInterface();
} }
inline unsigned int GetCurrentFirmwareVariant() inline unsigned int GetCurrentFirmwareVariant()
@@ -1385,6 +1392,8 @@ inline unsigned int GetCurrentFirmwareVariant()
return current_firmware_variant.variant; return current_firmware_variant.variant;
} }
void UnregisterEepromInterfaces();
inline int divRoundClosest(const int n, const int d) inline int divRoundClosest(const int n, const int d)
{ {
return ((n < 0) ^ (d < 0)) ? ((n - d/2)/d) : ((n + d/2)/d); return ((n < 0) ^ (d < 0)) ? ((n - d/2)/d) : ((n + d/2)/d);
@@ -200,75 +200,6 @@ int Er9xInterface::getSize(GeneralSettings &settings)
return 0; return 0;
} }
int Er9xInterface::getCapability(const Capability capability)
{
switch (capability) {
case FlightPhases:
return 4;
case Mixes:
return ER9X_MAX_MIXERS;
case PPMExtCtrl:
return 1;
case ModelTrainerEnable:
return 1;
case Timer2ThrTrig:
return 1;
case OffsetWeight:
return 125;
case SoundMod:
return 1;
case SoundPitch:
return 1;
case Haptic:
return 1;
case Timers:
return 1;
case Pots:
return 3;
case Switches:
return 7;
case SwitchesPositions:
return 9;
case CustomFunctions:
return 0;
case LogicalSwitches:
return 12;
case CustomAndSwitches:
return 5;
case CSFunc:
return 13;
case Outputs:
return 16;
case Simulation:
return 1;
case Telemetry:
return TM_HASTELEMETRY|TM_HASWSHH;
case TelemetryUnits:
return 1;
case TelemetryMaxMultiplier:
return 2;
case MaxVolume:
return 7;
case SlowScale:
return 1;
case SlowRange:
return 15;
case LCDWidth:
return 128;
case VoicesAsNumbers:
case HasAltitudeSel:
case HasContrast:
case HasVolume:
case ModelVoice:
case Gvars:
return 7;
case GetThrSwitch:
return DSW_THR;
default:
return 0;
}
}
int Er9xInterface::isAvailable(Protocol prot, int port) int Er9xInterface::isAvailable(Protocol prot, int port)
{ {
switch (prot) { switch (prot) {
@@ -282,13 +213,6 @@ int Er9xInterface::isAvailable(Protocol prot, int port)
} }
} }
SimulatorInterface * Er9xInterface::getSimulator()
{
return NULL; // new Er9xSimulator(this);
}
void Er9xInterface::appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value) void Er9xInterface::appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value)
{ {
QDomElement e = qdoc->createElement(name); QDomElement e = qdoc->createElement(name);
@@ -46,12 +46,8 @@ class Er9xInterface : public EEPROMInterface
virtual int getSize(GeneralSettings &settings); virtual int getSize(GeneralSettings &settings);
virtual int getCapability(const Capability);
virtual int isAvailable(Protocol proto, int port=0); virtual int isAvailable(Protocol proto, int port=0);
virtual SimulatorInterface * getSimulator();
protected: protected:
EFile *efile; EFile *efile;
@@ -244,74 +244,6 @@ int Ersky9xInterface::getSize(GeneralSettings &settings)
return 0; return 0;
} }
int Ersky9xInterface::getCapability(const Capability capability)
{
switch (capability) {
case Mixes:
return ERSKY9X_MAX_MIXERS_V11;
case PPMExtCtrl:
return 1;
case ModelTrainerEnable:
return 1;
case Timer2ThrTrig:
return 1;
case SoundMod:
return 1;
case SoundPitch:
return 1;
case Haptic:
return 1;
case ModelVoice:
return 1;
case Timers:
return 2;
case Pots:
return 3;
case Gvars:
return 7;
case Switches:
return 7;
case SwitchesPositions:
return 9;
case CustomFunctions:
return 0;
case LogicalSwitches:
return ERSKY9X_NUM_CSW_V11;
case CustomAndSwitches:
return 1;
case CSFunc:
return 13;
case Outputs:
return ERSKY9X_NUM_CHNOUT_V11;
case Simulation:
return 1;
case Telemetry:
return TM_HASTELEMETRY|TM_HASWSHH;
case TelemetryUnits:
return 1;
case OptrexDisplay:
return 1;
case HasAltitudeSel:
case HasCurrentCalibration:
case HasVolume:
case HasBrightness:
case HasContrast:
return 1;
case OffsetWeight:
return 125;
case MaxVolume:
return 23;
case TelemetryMaxMultiplier:
return 2;
case LCDWidth:
return 128;
case GetThrSwitch:
return DSW_THR;
default:
return 0;
}
}
int Ersky9xInterface::isAvailable(Protocol prot, int port) int Ersky9xInterface::isAvailable(Protocol prot, int port)
{ {
switch (prot) { switch (prot) {
@@ -325,13 +257,6 @@ int Ersky9xInterface::isAvailable(Protocol prot, int port)
} }
} }
SimulatorInterface * Ersky9xInterface::getSimulator()
{
return NULL; // new Ersky9xSimulator(this);
}
void Ersky9xInterface::appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value) void Ersky9xInterface::appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value)
{ {
QDomElement e = qdoc->createElement(name); QDomElement e = qdoc->createElement(name);
@@ -46,12 +46,8 @@ class Ersky9xInterface : public EEPROMInterface
virtual int getSize(GeneralSettings &settings); virtual int getSize(GeneralSettings &settings);
virtual int getCapability(const Capability);
virtual int isAvailable(Protocol proto, int port=0); virtual int isAvailable(Protocol proto, int port=0);
virtual SimulatorInterface * getSimulator();
protected: protected:
EFile *efile; EFile *efile;
@@ -216,59 +216,6 @@ int Gruvin9xInterface::getSize(GeneralSettings &settings)
return 0; return 0;
} }
int Gruvin9xInterface::getCapability(const Capability capability)
{
switch (capability) {
case Mixes:
return G9X_MAX_MIXERS;
case FlightPhases:
return G9X_MAX_PHASES;
case FlightPhasesHaveFades:
return 1;
case Timers:
return 2;
case Pots:
return 3;
case Switches:
return 7;
case SwitchesPositions:
return 9;
case CustomFunctions:
return 12;
case LogicalSwitches:
return 12;
case CSFunc:
return 13;
case Outputs:
return 16;
case ExtendedTrims:
return 500;
case Simulation:
return true;
case OffsetWeight:
return 125;
case HasContrast:
return true;
case Telemetry:
return TM_HASTELEMETRY|TM_HASWSHH;
case TelemetryMaxMultiplier:
return 1;
case SlowScale:
return 2;
case SlowRange:
return 15;
case LCDWidth:
return 128;
case HasSDLogs:
case Haptic:
return 1;
case GetThrSwitch:
return DSW_THR;
default:
return false;
}
}
int Gruvin9xInterface::isAvailable(Protocol proto, int port) int Gruvin9xInterface::isAvailable(Protocol proto, int port)
{ {
switch (proto) { switch (proto) {
@@ -283,8 +230,3 @@ int Gruvin9xInterface::isAvailable(Protocol proto, int port)
return 0; return 0;
} }
} }
SimulatorInterface * Gruvin9xInterface::getSimulator()
{
return NULL;
}
@@ -47,12 +47,8 @@ class Gruvin9xInterface : public EEPROMInterface
virtual int getSize(GeneralSettings &settings); virtual int getSize(GeneralSettings &settings);
virtual int getCapability(const Capability);
virtual int isAvailable(Protocol proto, int port=0); virtual int isAvailable(Protocol proto, int port=0);
virtual SimulatorInterface * getSimulator();
protected: protected:
template <class T> template <class T>
@@ -106,8 +106,7 @@ uint8_t getStickMode()
using namespace Open9xGruvin9x; using namespace Open9xGruvin9x;
Open9xGruvin9xSimulator::Open9xGruvin9xSimulator(OpenTxInterface * open9xInterface): Open9xGruvin9xSimulator::Open9xGruvin9xSimulator()
open9xInterface(open9xInterface)
{ {
} }
@@ -20,13 +20,13 @@
#include "simulatorinterface.h" #include "simulatorinterface.h"
class RadioData; class RadioData;
class OpenTxInterface; class OpenTxEepromInterface;
class Open9xGruvin9xSimulator : public SimulatorInterface { class Open9xGruvin9xSimulator : public SimulatorInterface {
public: public:
Open9xGruvin9xSimulator(OpenTxInterface *); Open9xGruvin9xSimulator();
virtual void start(QByteArray & eeprom, bool tests=true); virtual void start(QByteArray & eeprom, bool tests=true);
@@ -54,9 +54,6 @@ class Open9xGruvin9xSimulator : public SimulatorInterface {
virtual const char * getError(); virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
}; };
#endif #endif
@@ -104,8 +104,7 @@ uint8_t getStickMode()
using namespace Open9xM128; using namespace Open9xM128;
Open9xM128Simulator::Open9xM128Simulator(OpenTxInterface * open9xInterface): Open9xM128Simulator::Open9xM128Simulator()
open9xInterface(open9xInterface)
{ {
} }
@@ -20,13 +20,13 @@
#include "simulatorinterface.h" #include "simulatorinterface.h"
class RadioData; class RadioData;
class OpenTxInterface; class OpenTxEepromInterface;
class Open9xM128Simulator : public SimulatorInterface { class Open9xM128Simulator : public SimulatorInterface {
public: public:
Open9xM128Simulator(OpenTxInterface *); Open9xM128Simulator();
virtual void start(QByteArray & eeprom, bool tests=true); virtual void start(QByteArray & eeprom, bool tests=true);
@@ -54,9 +54,6 @@ class Open9xM128Simulator : public SimulatorInterface {
virtual const char * getError(); virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
}; };
#endif #endif
@@ -135,8 +135,7 @@ uint8_t getStickMode()
using namespace Open9xSky9x; using namespace Open9xSky9x;
Open9xSky9xSimulator::Open9xSky9xSimulator(OpenTxInterface * open9xInterface): Open9xSky9xSimulator::Open9xSky9xSimulator()
open9xInterface(open9xInterface)
{ {
QString path=g.profile[g.id()].sdPath()+"/"; QString path=g.profile[g.id()].sdPath()+"/";
int i=0; int i=0;
@@ -20,13 +20,13 @@
#include "simulatorinterface.h" #include "simulatorinterface.h"
class RadioData; class RadioData;
class OpenTxInterface; class OpenTxEepromInterface;
class Open9xSky9xSimulator : public SimulatorInterface { class Open9xSky9xSimulator : public SimulatorInterface {
public: public:
Open9xSky9xSimulator(OpenTxInterface *); Open9xSky9xSimulator();
virtual void start(QByteArray & eeprom, bool tests=true); virtual void start(QByteArray & eeprom, bool tests=true);
@@ -54,9 +54,6 @@ class Open9xSky9xSimulator : public SimulatorInterface {
virtual const char * getError(); virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
}; };
#endif #endif
@@ -176,8 +176,7 @@ void resetTrims()
using namespace Open9xX9D; using namespace Open9xX9D;
OpentxTaranisSimulator::OpentxTaranisSimulator(OpenTxInterface * open9xInterface): OpentxTaranisSimulator::OpentxTaranisSimulator()
open9xInterface(open9xInterface)
{ {
taranisSimulatorBoard = GetEepromInterface()->getBoard(); taranisSimulatorBoard = GetEepromInterface()->getBoard();
QString path=g.profile[g.id()].sdPath()+"/"; QString path=g.profile[g.id()].sdPath()+"/";
@@ -20,13 +20,13 @@
#include "simulatorinterface.h" #include "simulatorinterface.h"
class RadioData; class RadioData;
class OpenTxInterface; class OpenTxEepromInterface;
class OpentxTaranisSimulator : public SimulatorInterface { class OpentxTaranisSimulator : public SimulatorInterface {
public: public:
OpentxTaranisSimulator(OpenTxInterface *); OpentxTaranisSimulator();
virtual void start(QByteArray & eeprom, bool tests=true); virtual void start(QByteArray & eeprom, bool tests=true);
@@ -54,9 +54,6 @@ class OpentxTaranisSimulator : public SimulatorInterface {
virtual const char * getError(); virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
}; };
#endif #endif
@@ -2475,7 +2475,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
if (board==BOARD_SKY9X && version >= 216) { if (board==BOARD_SKY9X && version >= 216) {
internalField.Append(new UnsignedField<8>(modelData.nPotsToWarn)); internalField.Append(new UnsignedField<8>(modelData.nPotsToWarn));
for (int i=0; i < GetEepromInterface()->getCapability(Pots); i++) { for (int i=0; i < GetCurrentFirmware()->getCapability(Pots); i++) {
internalField.Append(new SignedField<8>(modelData.potPosition[i])); internalField.Append(new SignedField<8>(modelData.potPosition[i]));
} }
} }
@@ -2499,7 +2499,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
internalField.Append(new ZCharField<4>(modelData.inputNames[i])); internalField.Append(new ZCharField<4>(modelData.inputNames[i]));
} }
internalField.Append(new UnsignedField<8>(modelData.nPotsToWarn)); internalField.Append(new UnsignedField<8>(modelData.nPotsToWarn));
for (int i=0; i < GetEepromInterface()->getCapability(Pots); i++) { for (int i=0; i < GetCurrentFirmware()->getCapability(Pots); i++) {
internalField.Append(new SignedField<8>(modelData.potPosition[i])); internalField.Append(new SignedField<8>(modelData.potPosition[i]));
} }
} }
+311 -311
View File
@@ -43,18 +43,18 @@ size_t SizeOfArray( T(&)[ N ] )
return N; return N;
} }
OpenTxInterface::OpenTxInterface(BoardEnum board): OpenTxEepromInterface::OpenTxEepromInterface(BoardEnum board):
EEPROMInterface(board), EEPROMInterface(board),
efile(new EFile()) efile(new EFile())
{ {
} }
OpenTxInterface::~OpenTxInterface() OpenTxEepromInterface::~OpenTxEepromInterface()
{ {
delete efile; delete efile;
} }
const char * OpenTxInterface::getName() const char * OpenTxEepromInterface::getName()
{ {
switch (board) { switch (board) {
case BOARD_STOCK: case BOARD_STOCK:
@@ -74,7 +74,7 @@ const char * OpenTxInterface::getName()
} }
} }
const int OpenTxInterface::getEEpromSize() const int OpenTxEepromInterface::getEEpromSize()
{ {
switch (board) { switch (board) {
case BOARD_STOCK: case BOARD_STOCK:
@@ -94,7 +94,7 @@ const int OpenTxInterface::getEEpromSize()
} }
} }
const int OpenTxInterface::getMaxModels() const int OpenTxEepromInterface::getMaxModels()
{ {
if (IS_ARM(board)) if (IS_ARM(board))
return 60; return 60;
@@ -107,7 +107,7 @@ const int OpenTxInterface::getMaxModels()
} }
template <class T> template <class T>
bool OpenTxInterface::loadModel(ModelData &model, uint8_t *data, int index, unsigned int stickMode) bool OpenTxEepromInterface::loadModel(ModelData &model, uint8_t *data, int index, unsigned int stickMode)
{ {
T _model; T _model;
@@ -140,7 +140,7 @@ bool OpenTxInterface::loadModel(ModelData &model, uint8_t *data, int index, unsi
} }
template <class T> template <class T>
bool OpenTxInterface::loadModelVariant(unsigned int index, ModelData &model, uint8_t *data, unsigned int version, unsigned int variant) bool OpenTxEepromInterface::loadModelVariant(unsigned int index, ModelData &model, uint8_t *data, unsigned int version, unsigned int variant)
{ {
T open9xModel(model, board, version, variant); T open9xModel(model, board, version, variant);
@@ -167,7 +167,7 @@ bool OpenTxInterface::loadModelVariant(unsigned int index, ModelData &model, uin
return true; return true;
} }
bool OpenTxInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data, int index, unsigned int variant, unsigned int stickMode) bool OpenTxEepromInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data, int index, unsigned int variant, unsigned int stickMode)
{ {
if (version == 201) { if (version == 201) {
return loadModel<Open9xModelData_v201>(model, data, index, stickMode); return loadModel<Open9xModelData_v201>(model, data, index, stickMode);
@@ -248,7 +248,7 @@ bool OpenTxInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data
} }
template <class T> template <class T>
bool OpenTxInterface::loadGeneral(GeneralSettings &settings, unsigned int version) bool OpenTxEepromInterface::loadGeneral(GeneralSettings &settings, unsigned int version)
{ {
QByteArray eepromData(sizeof(settings), 0); // GeneralSettings should be always bigger than the EEPROM struct QByteArray eepromData(sizeof(settings), 0); // GeneralSettings should be always bigger than the EEPROM struct
T open9xSettings(settings, board, version); T open9xSettings(settings, board, version);
@@ -264,7 +264,7 @@ bool OpenTxInterface::loadGeneral(GeneralSettings &settings, unsigned int versio
} }
template <class T> template <class T>
bool OpenTxInterface::saveGeneral(GeneralSettings &settings, BoardEnum board, uint32_t version, uint32_t variant) bool OpenTxEepromInterface::saveGeneral(GeneralSettings &settings, BoardEnum board, uint32_t version, uint32_t variant)
{ {
T open9xSettings(settings, board, version, variant); T open9xSettings(settings, board, version, variant);
// open9xSettings.Dump(); // open9xSettings.Dump();
@@ -275,7 +275,7 @@ bool OpenTxInterface::saveGeneral(GeneralSettings &settings, BoardEnum board, ui
} }
template <class T> template <class T>
bool OpenTxInterface::saveModel(unsigned int index, ModelData &model, unsigned int version, unsigned int variant) bool OpenTxEepromInterface::saveModel(unsigned int index, ModelData &model, unsigned int version, unsigned int variant)
{ {
T open9xModel(model, board, version, variant); T open9xModel(model, board, version, variant);
// open9xModel.Dump(); // open9xModel.Dump();
@@ -285,12 +285,12 @@ bool OpenTxInterface::saveModel(unsigned int index, ModelData &model, unsigned i
return (sz == eeprom.size()); return (sz == eeprom.size());
} }
bool OpenTxInterface::loadxml(RadioData &radioData, QDomDocument &doc) bool OpenTxEepromInterface::loadxml(RadioData &radioData, QDomDocument &doc)
{ {
return false; return false;
} }
bool OpenTxInterface::load(RadioData &radioData, const uint8_t *eeprom, int size) bool OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
{ {
std::cout << "trying " << getName() << " import..."; std::cout << "trying " << getName() << " import...";
@@ -352,7 +352,7 @@ bool OpenTxInterface::load(RadioData &radioData, const uint8_t *eeprom, int size
return true; return true;
} }
int OpenTxInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version) int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
{ {
EEPROMWarnings.clear(); EEPROMWarnings.clear();
@@ -364,6 +364,7 @@ int OpenTxInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t varian
version = 216; version = 216;
break; break;
case BOARD_GRUVIN9X: case BOARD_GRUVIN9X:
case BOARD_MEGA2560:
version = 216; version = 216;
break; break;
case BOARD_M128: case BOARD_M128:
@@ -405,7 +406,7 @@ int OpenTxInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t varian
return size; return size;
} }
int OpenTxInterface::getSize(ModelData &model) int OpenTxEepromInterface::getSize(ModelData &model)
{ {
if (board == BOARD_SKY9X) if (board == BOARD_SKY9X)
return 0; return 0;
@@ -428,7 +429,7 @@ int OpenTxInterface::getSize(ModelData &model)
return efile->size(0); return efile->size(0);
} }
int OpenTxInterface::getSize(GeneralSettings &settings) int OpenTxEepromInterface::getSize(GeneralSettings &settings)
{ {
if (board == BOARD_SKY9X) if (board == BOARD_SKY9X)
return 0; return 0;
@@ -448,7 +449,7 @@ int OpenTxInterface::getSize(GeneralSettings &settings)
return efile->size(0); return efile->size(0);
} }
int OpenTxInterface::getCapability(const Capability capability) int OpenTxFirmware::getCapability(const Capability capability)
{ {
switch (capability) { switch (capability) {
case ModelImage: case ModelImage:
@@ -692,7 +693,7 @@ int OpenTxInterface::getCapability(const Capability capability)
} }
} }
int OpenTxInterface::isAvailable(Protocol proto, int port) int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
{ {
if (IS_TARANIS(board)) { if (IS_TARANIS(board)) {
switch (port) { switch (port) {
@@ -777,31 +778,14 @@ int OpenTxInterface::isAvailable(Protocol proto, int port)
} }
} }
SimulatorInterface * OpenTxInterface::getSimulator()
{
switch (board) {
case BOARD_STOCK:
return new Open9xSimulator(this);
case BOARD_M128:
return new Open9xM128Simulator(this);
case BOARD_GRUVIN9X:
return new Open9xGruvin9xSimulator(this);
case BOARD_SKY9X:
return new Open9xSky9xSimulator(this);
case BOARD_TARANIS:
case BOARD_TARANIS_REV4a:
return new OpentxTaranisSimulator(this);
default:
return NULL;
}
}
template<typename T, size_t SIZE> template<typename T, size_t SIZE>
size_t getSizeA(T (&)[SIZE]) { size_t getSizeA(T (&)[SIZE]) {
return SIZE; return SIZE;
} }
bool OpenTxInterface::checkVersion(unsigned int version) bool OpenTxEepromInterface::checkVersion(unsigned int version)
{ {
switch(version) { switch(version) {
case 201: case 201:
@@ -867,7 +851,7 @@ bool OpenTxInterface::checkVersion(unsigned int version)
return true; return true;
} }
bool OpenTxInterface::checkVariant(unsigned int version, unsigned int variant) bool OpenTxEepromInterface::checkVariant(unsigned int version, unsigned int variant)
{ {
if (board == BOARD_M128 && !(variant & 0x8000)) { if (board == BOARD_M128 && !(variant & 0x8000)) {
if (version == 212) { if (version == 212) {
@@ -889,7 +873,7 @@ bool OpenTxInterface::checkVariant(unsigned int version, unsigned int variant)
} }
} }
bool OpenTxInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
{ {
std::cout << "trying " << getName() << " backup import..."; std::cout << "trying " << getName() << " backup import...";
@@ -930,311 +914,327 @@ bool OpenTxInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esiz
return true; return true;
} }
QString geturl( int board) QString OpenTxFirmware::getFirmwareUrl(QString & id)
{ {
QString url = g.compileServer(); QString url = g.compileServer();
if (url.isEmpty()){ if (url.isEmpty()){
url= OPENTX_FIRMWARE_DOWNLOADS; url = OPENTX_FIRMWARE_DOWNLOADS;
g.compileServer(url); g.compileServer(url);
} }
switch(board) { switch(board) {
case BOARD_STOCK: case BOARD_STOCK:
case BOARD_M128: case BOARD_M128:
case BOARD_GRUVIN9X: case BOARD_GRUVIN9X:
url.append("/getfw.php?fw=%1.hex"); url.append(QString("/getfw.php?fw=%1.hex").arg(id));
break; break;
case BOARD_SKY9X: case BOARD_SKY9X:
case BOARD_TARANIS: case BOARD_TARANIS:
case BOARD_TARANIS_REV4a: case BOARD_TARANIS_REV4a:
url.append("/getfw.php?fw=%1.bin"); url.append(QString("/getfw.php?fw=%1.bin").arg(id));
break; break;
default: default:
url.clear(); url.clear();
break; break;
} }
return url; return url;
} }
QString getstamp( int board) QString OpenTxFirmware::getReleaseNotesUrl()
{ {
QString url = g.compileServer(); QString url = g.compileServer();
if (url.isEmpty()){ if (url.isEmpty()){
url= OPENTX_FIRMWARE_DOWNLOADS; url = OPENTX_FIRMWARE_DOWNLOADS;
g.compileServer(url); g.compileServer(url);
} }
url.append("/stamp-opentx-"); url.append("/releasenotes-");
switch(board) { switch(board) {
case BOARD_STOCK: case BOARD_STOCK:
url.append("9x.txt"); case BOARD_M128:
break; case BOARD_GRUVIN9X:
case BOARD_M128: case BOARD_SKY9X:
url.append("9x128.txt"); url.append("9x.txt");
break; break;
case BOARD_GRUVIN9X: case BOARD_TARANIS:
url.append("gruvin9x.txt"); case BOARD_TARANIS_REV4a:
break; url.append("taranis.txt");
case BOARD_SKY9X: break;
url.append("sky9x.txt"); default:
break; url.clear();
case BOARD_TARANIS: break;
case BOARD_TARANIS_REV4a: }
url.append("taranis.txt"); return url;
break;
default:
url.clear();
break;
}
return url;
} }
QString getrnurl( int board) QString OpenTxFirmware::getStampUrl()
{ {
QString url = g.compileServer(); QString url = g.compileServer();
if (url.isEmpty()){ if (url.isEmpty()){
url= OPENTX_FIRMWARE_DOWNLOADS; url= OPENTX_FIRMWARE_DOWNLOADS;
g.compileServer(url); g.compileServer(url);
} }
url.append("/releasenotes-"); url.append("/stamp-opentx-");
switch(board) { switch(board) {
case BOARD_STOCK: case BOARD_STOCK:
case BOARD_M128: url.append("9x.txt");
case BOARD_GRUVIN9X: break;
case BOARD_SKY9X: case BOARD_M128:
url.append("9x.txt"); url.append("9x128.txt");
break; break;
case BOARD_TARANIS: case BOARD_GRUVIN9X:
case BOARD_TARANIS_REV4a: url.append("gruvin9x.txt");
url.append("taranis.txt"); break;
break; case BOARD_SKY9X:
default: url.append("sky9x.txt");
url.clear(); break;
break; case BOARD_TARANIS:
} case BOARD_TARANIS_REV4a:
return url; url.append("taranis.txt");
break;
default:
url.clear();
break;
}
return url;
} }
void RegisterOpen9xFirmwares() SimulatorInterface * OpenTxFirmware::getSimulator()
{ {
Open9xFirmware * open9x; switch (board) {
case BOARD_STOCK:
return new Open9xSimulator();
case BOARD_M128:
return new Open9xM128Simulator();
case BOARD_GRUVIN9X:
return new Open9xGruvin9xSimulator();
case BOARD_SKY9X:
return new Open9xSky9xSimulator();
case BOARD_TARANIS:
case BOARD_TARANIS_REV4a:
return new OpentxTaranisSimulator();
default:
return NULL;
}
}
void registerOpenTxFirmwares()
{
OpenTxFirmware * openTx;
Option ext_options[] = { { "frsky", QObject::tr("Support for frsky telemetry mod"), FRSKY_VARIANT }, { "telemetrez", QObject::tr("Support for telemetry easy board"), FRSKY_VARIANT }, { "jeti", QObject::tr("Support for jeti telemetry mod"), 0 }, { "ardupilot", QObject::tr("Support for receiving ardupilot data"), 0 }, { "nmea", QObject::tr("Support for receiving NMEA data"), 0 }, { "mavlink", QObject::tr("Support for MAVLINK devices"), MAVLINK_VARIANT }, { NULL } }; Option ext_options[] = { { "frsky", QObject::tr("Support for frsky telemetry mod"), FRSKY_VARIANT }, { "telemetrez", QObject::tr("Support for telemetry easy board"), FRSKY_VARIANT }, { "jeti", QObject::tr("Support for jeti telemetry mod"), 0 }, { "ardupilot", QObject::tr("Support for receiving ardupilot data"), 0 }, { "nmea", QObject::tr("Support for receiving NMEA data"), 0 }, { "mavlink", QObject::tr("Support for MAVLINK devices"), MAVLINK_VARIANT }, { NULL } };
Option nav_options[] = { { "rotenc", QObject::tr("Rotary Encoder use in menus navigation") }, { "potscroll", QObject::tr("Pots use in menus navigation") }, { NULL } }; Option nav_options[] = { { "rotenc", QObject::tr("Rotary Encoder use in menus navigation") }, { "potscroll", QObject::tr("Pots use in menus navigation") }, { NULL } };
Option extr_options[] = { { "frsky", QObject::tr("Support for frsky telemetry mod"), FRSKY_VARIANT }, { "jeti", QObject::tr("Support for jeti telemetry mod"), 0 }, { "ardupilot", QObject::tr("Support for receiving ardupilot data"), 0 }, { "nmea", QObject::tr("Support for receiving NMEA data"), 0 }, { "mavlink", QObject::tr("Support for MAVLINK devices"), MAVLINK_VARIANT }, { NULL } }; Option extr_options[] = { { "frsky", QObject::tr("Support for frsky telemetry mod"), FRSKY_VARIANT }, { "jeti", QObject::tr("Support for jeti telemetry mod"), 0 }, { "ardupilot", QObject::tr("Support for receiving ardupilot data"), 0 }, { "nmea", QObject::tr("Support for receiving NMEA data"), 0 }, { "mavlink", QObject::tr("Support for MAVLINK devices"), MAVLINK_VARIANT }, { NULL } };
Option fai_options[] = { { "faichoice", QObject::tr("Possibility to enable FAI MODE at field") }, { "faimode", QObject::tr("FAI MODE always enabled") }, { NULL } }; Option fai_options[] = { { "faichoice", QObject::tr("Possibility to enable FAI MODE at field") }, { "faimode", QObject::tr("FAI MODE always enabled") }, { NULL } };
/* 9x board */ /* 9x board */
open9x = new Open9xFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), new OpenTxInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK), getrnurl(BOARD_STOCK), false); openTx = new OpenTxFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), BOARD_STOCK, false);
open9x->addOptions(ext_options); openTx->addOptions(ext_options);
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support")); openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu")); openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
open9x->addOption("nosplash", QObject::tr("No splash screen")); openTx->addOption("nosplash", QObject::tr("No splash screen"));
open9x->addOption("nofp", QObject::tr("No flight modes")); openTx->addOption("nofp", QObject::tr("No flight modes"));
open9x->addOption("nocurves", QObject::tr("Disable curves menus")); openTx->addOption("nocurves", QObject::tr("Disable curves menus"));
open9x->addOption("audio", QObject::tr("Support for radio modified with regular speaker")); openTx->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
open9x->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode")); openTx->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
open9x->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode")); openTx->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED open9x->addOption("PXX", QObject::tr("Support of FrSky PXX protocol")); // NOT TESTED openTx->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
open9x->addOption("DSM2", QObject::tr("Support for DSM2 modules")); openTx->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
open9x->addOption("ppmca", QObject::tr("PPM center adjustment in limits")); openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us")); openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT); openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
open9x->addOption("symlimits", QObject::tr("Symetrical Limits")); openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
open9x->addOptions(nav_options); openTx->addOptions(nav_options);
open9x->addOption("sp22", QObject::tr("SmartieParts 2.2 Backlight support")); openTx->addOption("sp22", QObject::tr("SmartieParts 2.2 Backlight support"));
open9x->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control")); openTx->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control")); openTx->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
open9x->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time")); openTx->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
open9x->addOption("nographics", QObject::tr("No graphical check boxes and sliders")); openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
open9x->addOption("battgraph", QObject::tr("Battery graph")); openTx->addOption("battgraph", QObject::tr("Battery graph"));
open9x->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items")); openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics")); openTx->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
open9x->addOption("pgbar", QObject::tr("EEprom write progress bar")); openTx->addOption("pgbar", QObject::tr("EEprom write progress bar"));
open9x->addOption("imperial", QObject::tr("Imperial units")); openTx->addOption("imperial", QObject::tr("Imperial units"));
open9x->addOption("nowshh", QObject::tr("No Winged Shadow How High support")); openTx->addOption("nowshh", QObject::tr("No Winged Shadow How High support"));
open9x->addOption("novario", QObject::tr("No vario support")); openTx->addOption("novario", QObject::tr("No vario support"));
open9x->addOption("nogps", QObject::tr("No GPS support")); openTx->addOption("nogps", QObject::tr("No GPS support"));
open9x->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen")); openTx->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
open9x->addOption("fasoffset", QObject::tr("Allow compensating for offset errors in FrSky FAS current sensors")); openTx->addOption("fasoffset", QObject::tr("Allow compensating for offset errors in FrSky FAS current sensors"));
open9x->addOptions(fai_options); openTx->addOptions(fai_options);
firmwares.push_back(open9x); firmwares.push_back(openTx);
/* 9x board with M128 chip */ /* 9x board with M128 chip */
open9x = new Open9xFirmware("opentx-9x128", QObject::tr("OpenTX for M128 / 9X board"), new OpenTxInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false); openTx = new OpenTxFirmware("opentx-9x128", QObject::tr("OpenTX for M128 / 9X board"), BOARD_M128, false);
open9x->addOptions(ext_options); openTx->addOptions(ext_options);
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support")); openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu")); openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
open9x->addOption("nosplash", QObject::tr("No splash screen")); openTx->addOption("nosplash", QObject::tr("No splash screen"));
open9x->addOption("nofp", QObject::tr("No flight modes")); openTx->addOption("nofp", QObject::tr("No flight modes"));
open9x->addOption("nocurves", QObject::tr("Disable curves menus")); openTx->addOption("nocurves", QObject::tr("Disable curves menus"));
open9x->addOption("audio", QObject::tr("Support for radio modified with regular speaker")); openTx->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
open9x->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode")); openTx->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
open9x->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode")); openTx->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED open9x->addOption("PXX", QObject::tr("Support of FrSky PXX protocol")); // NOT TESTED openTx->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
open9x->addOption("DSM2", QObject::tr("Support for DSM2 modules")); openTx->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
open9x->addOption("ppmca", QObject::tr("PPM center adjustment in limits")); openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us")); openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT); openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
open9x->addOption("symlimits", QObject::tr("Symetrical Limits")); openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
open9x->addOptions(nav_options); openTx->addOptions(nav_options);
open9x->addOption("sp22", QObject::tr("SmartieParts 2.2 Backlight support")); openTx->addOption("sp22", QObject::tr("SmartieParts 2.2 Backlight support"));
open9x->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control")); openTx->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control")); openTx->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
open9x->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time")); openTx->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
open9x->addOption("nographics", QObject::tr("No graphical check boxes and sliders")); openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
open9x->addOption("battgraph", QObject::tr("Battery graph")); openTx->addOption("battgraph", QObject::tr("Battery graph"));
open9x->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items")); openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics")); openTx->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
open9x->addOption("pgbar", QObject::tr("EEprom write Progress bar")); openTx->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
open9x->addOption("imperial", QObject::tr("Imperial units")); openTx->addOption("imperial", QObject::tr("Imperial units"));
open9x->addOptions(fai_options); openTx->addOptions(fai_options);
firmwares.push_back(open9x); firmwares.push_back(openTx);
/* 9XR board */ /* 9XR board */
open9x = new Open9xFirmware("opentx-9xr", QObject::tr("OpenTX for 9XR"), new OpenTxInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK),getrnurl(BOARD_STOCK), false); openTx = new OpenTxFirmware("opentx-9xr", QObject::tr("OpenTX for 9XR"), BOARD_STOCK, false);
open9x->addOptions(extr_options); openTx->addOptions(extr_options);
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support")); openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu")); openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
open9x->addOption("nosplash", QObject::tr("No splash screen")); openTx->addOption("nosplash", QObject::tr("No splash screen"));
open9x->addOption("nofp", QObject::tr("No flight modes")); openTx->addOption("nofp", QObject::tr("No flight modes"));
open9x->addOption("nocurves", QObject::tr("Disable curves menus")); openTx->addOption("nocurves", QObject::tr("Disable curves menus"));
open9x->addOption("audio", QObject::tr("Support for radio modified with regular speaker")); openTx->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
open9x->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode")); openTx->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
open9x->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode")); openTx->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED open9x->addOption("PXX", QObject::tr("Support of FrSky PXX protocol")); // NOT TESTED openTx->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
open9x->addOption("DSM2", QObject::tr("Support for DSM2 modules")); openTx->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
open9x->addOption("ppmca", QObject::tr("PPM center adjustment in limits")); openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us")); openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT); openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
open9x->addOption("symlimits", QObject::tr("Symetrical Limits")); openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
open9x->addOption("potscroll", QObject::tr("Pots use in menus navigation")); openTx->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
open9x->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control")); openTx->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control")); openTx->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
open9x->addOption("nographics", QObject::tr("No graphical check boxes and sliders")); openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
open9x->addOption("battgraph", QObject::tr("Battery graph")); openTx->addOption("battgraph", QObject::tr("Battery graph"));
open9x->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items")); openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics")); openTx->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
open9x->addOption("pgbar", QObject::tr("EEprom write Progress bar")); openTx->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
open9x->addOption("imperial", QObject::tr("Imperial units")); openTx->addOption("imperial", QObject::tr("Imperial units"));
open9x->addOption("nowshh", QObject::tr("No Winged Shadow How High support")); openTx->addOption("nowshh", QObject::tr("No Winged Shadow How High support"));
open9x->addOption("novario", QObject::tr("No vario support")); openTx->addOption("novario", QObject::tr("No vario support"));
open9x->addOption("nogps", QObject::tr("No GPS support")); openTx->addOption("nogps", QObject::tr("No GPS support"));
open9x->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen")); openTx->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
open9x->addOptions(fai_options); openTx->addOptions(fai_options);
firmwares.push_back(open9x); firmwares.push_back(openTx);
/* 9XR board with M128 chip */ /* 9XR board with M128 chip */
open9x = new Open9xFirmware("opentx-9xr128", QObject::tr("OpenTX for 9XR with M128 chip"), new OpenTxInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false); openTx = new OpenTxFirmware("opentx-9xr128", QObject::tr("OpenTX for 9XR with M128 chip"), BOARD_M128, false);
open9x->addOptions(extr_options); openTx->addOptions(extr_options);
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support")); openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu")); openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
open9x->addOption("nosplash", QObject::tr("No splash screen")); openTx->addOption("nosplash", QObject::tr("No splash screen"));
open9x->addOption("nofp", QObject::tr("No flight modes")); openTx->addOption("nofp", QObject::tr("No flight modes"));
open9x->addOption("nocurves", QObject::tr("Disable curves menus")); openTx->addOption("nocurves", QObject::tr("Disable curves menus"));
open9x->addOption("audio", QObject::tr("Support for radio modified with regular speaker")); openTx->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
open9x->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode")); openTx->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
open9x->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode")); openTx->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED open9x->addOption("PXX", QObject::tr("Support of FrSky PXX protocol")); // NOT TESTED openTx->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
open9x->addOption("DSM2", QObject::tr("Support for DSM2 modules")); openTx->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
open9x->addOption("ppmca", QObject::tr("PPM center adjustment in limits")); openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us")); openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT); openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
open9x->addOption("symlimits", QObject::tr("Symetrical Limits")); openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
open9x->addOption("potscroll", QObject::tr("Pots use in menus navigation")); openTx->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
open9x->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control")); openTx->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control")); openTx->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
open9x->addOption("nographics", QObject::tr("No graphical check boxes and sliders")); openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
open9x->addOption("battgraph", QObject::tr("Battery graph")); openTx->addOption("battgraph", QObject::tr("Battery graph"));
open9x->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items")); openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics")); openTx->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
open9x->addOption("pgbar", QObject::tr("EEprom write Progress bar")); openTx->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
open9x->addOption("imperial", QObject::tr("Imperial units")); openTx->addOption("imperial", QObject::tr("Imperial units"));
open9x->addOptions(fai_options); openTx->addOptions(fai_options);
firmwares.push_back(open9x); firmwares.push_back(openTx);
/* Gruvin9x board */ /* Gruvin9x board */
open9x = new Open9xFirmware("opentx-gruvin9x", QObject::tr("OpenTX for Gruvin9x board / 9X"), new OpenTxInterface(BOARD_GRUVIN9X), geturl(BOARD_GRUVIN9X), getstamp(BOARD_GRUVIN9X),getrnurl(BOARD_GRUVIN9X), false); openTx = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("OpenTX for Gruvin9x board / 9X"), BOARD_GRUVIN9X, false);
open9x->setVariantBase(FRSKY_VARIANT); openTx->setVariantBase(FRSKY_VARIANT);
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support")); openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu")); openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
open9x->addOption("nofp", QObject::tr("No flight modes")); openTx->addOption("nofp", QObject::tr("No flight modes"));
open9x->addOption("nocurves", QObject::tr("Disable curves menus")); openTx->addOption("nocurves", QObject::tr("Disable curves menus"));
open9x->addOption("sdcard", QObject::tr("Support for SD memory card")); openTx->addOption("sdcard", QObject::tr("Support for SD memory card"));
open9x->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode")); openTx->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
open9x->addOption("PXX", QObject::tr("Support of FrSky PXX protocol")); openTx->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
Option dsm2_options[] = { { "DSM2", QObject::tr("Support for DSM2 modules"), 0 }, { "DSM2PPM", QObject::tr("Support for DSM2 modules using ppm instead of true serial"), 0 }, { NULL } }; Option dsm2_options[] = { { "DSM2", QObject::tr("Support for DSM2 modules"), 0 }, { "DSM2PPM", QObject::tr("Support for DSM2 modules using ppm instead of true serial"), 0 }, { NULL } };
open9x->addOptions(dsm2_options); openTx->addOptions(dsm2_options);
open9x->addOption("ppmca", QObject::tr("PPM center adjustment in limits")); openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us")); openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT); openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
open9x->addOption("symlimits", QObject::tr("Symetrical Limits")); openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
open9x->addOption("potscroll", QObject::tr("Pots use in menus navigation")); openTx->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
open9x->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control")); openTx->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control")); openTx->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
open9x->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time")); openTx->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
open9x->addOption("nographics", QObject::tr("No graphical check boxes and sliders")); openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
open9x->addOption("battgraph", QObject::tr("Battery graph")); openTx->addOption("battgraph", QObject::tr("Battery graph"));
open9x->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items")); openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOption("pgbar", QObject::tr("EEprom write Progress bar")); openTx->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
open9x->addOption("imperial", QObject::tr("Imperial units")); openTx->addOption("imperial", QObject::tr("Imperial units"));
open9x->addOptions(fai_options); openTx->addOptions(fai_options);
firmwares.push_back(open9x); firmwares.push_back(openTx);
#ifndef __APPLE__ #ifndef __APPLE__
/* SKY9X board */ /* SKY9X board */
open9x = new Open9xFirmware("opentx-sky9x", QObject::tr("OpenTX for Sky9x board / 9X"), new OpenTxInterface(BOARD_SKY9X), geturl(BOARD_SKY9X), getstamp(BOARD_SKY9X),getrnurl(BOARD_SKY9X), true); openTx = new OpenTxFirmware("opentx-sky9x", QObject::tr("OpenTX for Sky9x board / 9X"), BOARD_SKY9X, true);
open9x->setVariantBase(FRSKY_VARIANT); openTx->setVariantBase(FRSKY_VARIANT);
open9x->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support")); openTx->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu")); openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
open9x->addOption("nofp", QObject::tr("No flight modes")); openTx->addOption("nofp", QObject::tr("No flight modes"));
open9x->addOption("nocurves", QObject::tr("Disable curves menus")); openTx->addOption("nocurves", QObject::tr("Disable curves menus"));
open9x->addOption("ppmca", QObject::tr("PPM center adjustment in limits")); openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us")); openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT); openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
open9x->addOption("symlimits", QObject::tr("Symetrical Limits")); openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
open9x->addOption("potscroll", QObject::tr("Pots use in menus navigation")); openTx->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
open9x->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control")); openTx->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
open9x->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control")); openTx->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
open9x->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time")); openTx->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
open9x->addOption("nographics", QObject::tr("No graphical check boxes and sliders")); openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
open9x->addOption("battgraph", QObject::tr("Battery graph")); openTx->addOption("battgraph", QObject::tr("Battery graph"));
open9x->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items")); openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOption("tsticks", QObject::tr("Use FrSky Taranis sticks in a 9X/9XR")); openTx->addOption("tsticks", QObject::tr("Use FrSky Taranis sticks in a 9X/9XR"));
open9x->addOption("bluetooth", QObject::tr("Bluetooth interface")); openTx->addOption("bluetooth", QObject::tr("Bluetooth interface"));
open9x->addOptions(fai_options); openTx->addOptions(fai_options);
firmwares.push_back(open9x); firmwares.push_back(openTx);
#endif #endif
/* Taranis board */ /* Taranis board */
open9x = new Open9xFirmware("opentx-taranis", QObject::tr("OpenTX for FrSky Taranis"), new OpenTxInterface(BOARD_TARANIS), geturl(BOARD_TARANIS), getstamp(BOARD_TARANIS),getrnurl(BOARD_TARANIS), true); openTx = new OpenTxFirmware("opentx-taranis", QObject::tr("OpenTX for FrSky Taranis"), BOARD_TARANIS, true);
open9x->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support")); openTx->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
open9x->addOption("notemplates", QObject::tr("Disable TEMPLATES menu")); openTx->addOption("notemplates", QObject::tr("Disable TEMPLATES menu"));
open9x->addOption("nogvars", QObject::tr("Disable Global variables")); openTx->addOption("nogvars", QObject::tr("Disable Global variables"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us")); openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOptions(fai_options); openTx->addOptions(fai_options);
firmwares.push_back(open9x); firmwares.push_back(openTx);
if (g.rev4aSupport()) { if (g.rev4aSupport()) {
open9x = new Open9xFirmware("opentx-taranisrev4a", QObject::tr("OpenTX for FrSky Taranis Rev4a"), new OpenTxInterface(BOARD_TARANIS_REV4a), geturl(BOARD_TARANIS_REV4a), getstamp(BOARD_TARANIS_REV4a),getrnurl(BOARD_TARANIS), true); openTx = new OpenTxFirmware("opentx-taranisrev4a", QObject::tr("OpenTX for FrSky Taranis Rev4a"), BOARD_TARANIS_REV4a, true);
open9x->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support")); openTx->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
open9x->addOption("notemplates", QObject::tr("Disable TEMPLATES menu")); openTx->addOption("notemplates", QObject::tr("Disable TEMPLATES menu"));
open9x->addOption("nogvars", QObject::tr("Disable Global variables")); openTx->addOption("nogvars", QObject::tr("Disable Global variables"));
open9x->addOption("ppmus", QObject::tr("Channel values displayed in us")); openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
open9x->addOption("sqt5font", QObject::tr("Use alternative SQT5 font")); openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
open9x->addOptions(fai_options); openTx->addOptions(fai_options);
firmwares.push_back(open9x); firmwares.push_back(openTx);
} }
default_firmware_variant = GetFirmwareVariant("opentx-9x-heli-templates-en");
current_firmware_variant = default_firmware_variant;
} }
void UnregisterOpen9xFirmwares()
{
foreach (FirmwareInfo * f, firmwares) {
qDebug() << "UnregisterOpen9xFirmwares(): deleting " << QString::number(reinterpret_cast<uint64_t>(f), 16 );
delete f;
}
}
@@ -23,13 +23,13 @@
class EFile; class EFile;
class OpenTxInterface : public EEPROMInterface class OpenTxEepromInterface : public EEPROMInterface
{ {
public: public:
OpenTxInterface(BoardEnum board); OpenTxEepromInterface(BoardEnum board);
virtual ~OpenTxInterface(); virtual ~OpenTxEepromInterface();
virtual const char * getName(); virtual const char * getName();
@@ -49,12 +49,8 @@ class OpenTxInterface : public EEPROMInterface
virtual int getSize(GeneralSettings &); virtual int getSize(GeneralSettings &);
virtual int getCapability(const Capability);
virtual int isAvailable(Protocol proto, int port=0); virtual int isAvailable(Protocol proto, int port=0);
virtual SimulatorInterface * getSimulator();
protected: protected:
bool checkVersion(unsigned int version); bool checkVersion(unsigned int version);
@@ -82,10 +78,10 @@ class OpenTxInterface : public EEPROMInterface
}; };
class Open9xFirmware: public FirmwareInfo { class OpenTxFirmware: public FirmwareInterface {
public: public:
Open9xFirmware(const QString & id, const QString & name, EEPROMInterface * eepromInterface, const QString & url = QString(), const QString & stamp = QString(), const QString & rnurl = QString(), bool voice = false): OpenTxFirmware(const QString & id, const QString & name, const BoardEnum board, bool voice = false):
FirmwareInfo(id, name, eepromInterface, url, stamp, rnurl, voice) FirmwareInterface(id, name, board, new OpenTxEepromInterface(board), voice)
{ {
addLanguage("en"); addLanguage("en");
addLanguage("fr"); addLanguage("fr");
@@ -109,61 +105,19 @@ class Open9xFirmware: public FirmwareInfo {
addTTSLanguage("es"); addTTSLanguage("es");
} }
virtual unsigned int getEepromVersion(unsigned int revision) { virtual QString getStampUrl();
switch(this->eepromInterface->getBoard()) {
case BOARD_SKY9X: virtual QString getReleaseNotesUrl();
if (revision == 0)
return 212; virtual QString getFirmwareUrl(QString & id);
if (revision >= 1217)
return 212; virtual int getCapability(const Capability);
if (revision >= 1174)
return 211; virtual SimulatorInterface * getSimulator();
if (revision >= 1031)
return 210;
if (revision >= 791)
return 209;
if (revision >= 641)
return 208;
break;
case BOARD_GRUVIN9X:
if (revision == 0)
return 211;
if (revision >= 1217)
return 211;
if (revision >= 1174)
return 210;
if (revision >= 791)
return 209;
if (revision >= 641)
return 208;
if (revision >= 547)
return 207;
break;
default:
if (revision == 0)
return 211;
if (revision >= 1217)
return 211;
if (revision >= 1174)
return 210;
if (revision >= 791)
return 209;
if (revision >= 641)
return 208;
break;
}
if (revision >= 321)
return 205;
else if (revision >= 217)
return 204;
else if (revision >= 184)
return 203;
else
return 202;
}
}; };
void RegisterOpen9xFirmwares(); void registerOpenTxFirmwares();
void UnregisterOpen9xFirmwares();
#endif #endif
@@ -110,8 +110,7 @@ uint8_t getStickMode()
using namespace Open9x; using namespace Open9x;
Open9xSimulator::Open9xSimulator(OpenTxInterface * open9xInterface): Open9xSimulator::Open9xSimulator()
open9xInterface(open9xInterface)
{ {
#define INIT_IMPORT #define INIT_IMPORT
#include "simulatorimport.h" #include "simulatorimport.h"
@@ -144,7 +143,6 @@ void Open9xSimulator::start(QByteArray & eeprom, bool tests)
void Open9xSimulator::start(const char * filename, bool tests) void Open9xSimulator::start(const char * filename, bool tests)
{ {
// open9xInterface->save(&Open9x::eeprom[0], radioData, SIMU_STOCK_VARIANTS);
StartEepromThread(filename); StartEepromThread(filename);
StartMainThread(tests); StartMainThread(tests);
} }
@@ -19,13 +19,13 @@
#include "simulatorinterface.h" #include "simulatorinterface.h"
class OpenTxInterface; class OpenTxEepromInterface;
class Open9xSimulator : public SimulatorInterface { class Open9xSimulator : public SimulatorInterface {
public: public:
Open9xSimulator(OpenTxInterface *); Open9xSimulator();
virtual void start(QByteArray & eeprom, bool tests=true); virtual void start(QByteArray & eeprom, bool tests=true);
@@ -53,10 +53,6 @@ class Open9xSimulator : public SimulatorInterface {
virtual const char * getError(); virtual const char * getError();
protected:
OpenTxInterface * open9xInterface;
}; };
#endif #endif
@@ -140,45 +140,6 @@ int Th9xInterface::getSize(GeneralSettings &settings)
return 0; return 0;
} }
int Th9xInterface::getCapability(const Capability capability)
{
switch (capability) {
case Mixes:
return TH9X_MAX_MIXERS;
case Timers:
return 1;
case Pots:
return 3;
case Switches:
return 7;
case SwitchesPositions:
return 9;
case CustomFunctions:
return 0;
case LogicalSwitches:
return TH9X_MAX_SWITCHES;
case Outputs:
return 8;
case OffsetWeight:
return 125;
case Simulation:
return 1;
case HasContrast:
case CSFunc:
return 13;
case SlowScale:
return 1;
case SlowRange:
return 10;
case LCDWidth:
return 128;
case GetThrSwitch:
return DSW_THR;
default:
return 0;
}
}
int Th9xInterface::isAvailable(Protocol proto, int port) int Th9xInterface::isAvailable(Protocol proto, int port)
{ {
switch (proto) { switch (proto) {
@@ -192,9 +153,3 @@ int Th9xInterface::isAvailable(Protocol proto, int port)
return 0; return 0;
} }
} }
SimulatorInterface * Th9xInterface::getSimulator()
{
return NULL; // new Th9xSimulator(this);
}
@@ -46,12 +46,8 @@ class Th9xInterface : public EEPROMInterface
virtual int getSize(GeneralSettings &); virtual int getSize(GeneralSettings &);
virtual int getCapability(const Capability);
virtual int isAvailable(Protocol proto, int port=0); virtual int isAvailable(Protocol proto, int port=0);
virtual SimulatorInterface * getSimulator();
protected: protected:
EFile *efile; EFile *efile;
+17 -16
View File
@@ -82,7 +82,7 @@ void fwPreferencesDialog::baseFirmwareChanged()
{ {
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex()); QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
voice=NULL; voice=NULL;
foreach(FirmwareInfo * firmware, firmwares) { foreach(FirmwareInterface * firmware, firmwares) {
if (firmware->id == selected_firmware) { if (firmware->id == selected_firmware) {
showVoice(firmware->voice); showVoice(firmware->voice);
populateFirmwareOptions(firmware); populateFirmwareOptions(firmware);
@@ -96,7 +96,7 @@ FirmwareVariant fwPreferencesDialog::getFirmwareVariant()
{ {
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex()); QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
bool voice=false; bool voice=false;
foreach(FirmwareInfo * firmware, firmwares) { foreach(FirmwareInterface * firmware, firmwares) {
if (firmware->id == selected_firmware) { if (firmware->id == selected_firmware) {
QString id = firmware->id; QString id = firmware->id;
foreach(QCheckBox *cb, optionsCheckBoxes) { foreach(QCheckBox *cb, optionsCheckBoxes) {
@@ -106,7 +106,7 @@ FirmwareVariant fwPreferencesDialog::getFirmwareVariant()
id += QString("-") + cb->text(); id += QString("-") + cb->text();
} }
} }
if (! firmware->eepromInterface->getCapability(MultiLangVoice)) { if (!firmware->getCapability(MultiLangVoice)) {
if (ui->voiceCombo->count() && (voice || firmware->voice)) if (ui->voiceCombo->count() && (voice || firmware->voice))
id += QString("-tts") + ui->voiceCombo->currentText(); id += QString("-tts") + ui->voiceCombo->currentText();
} }
@@ -124,7 +124,7 @@ FirmwareVariant fwPreferencesDialog::getFirmwareVariant()
void fwPreferencesDialog::firmwareOptionChanged(bool state) void fwPreferencesDialog::firmwareOptionChanged(bool state)
{ {
QCheckBox *cb = qobject_cast<QCheckBox*>(sender()); QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
FirmwareInfo * firmware=NULL; FirmwareInterface * firmware=NULL;
if (cb && state) { if (cb && state) {
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex()); QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
foreach(firmware, firmwares) { foreach(firmware, firmwares) {
@@ -176,15 +176,15 @@ void fwPreferencesDialog::firmwareChanged()
return; return;
FirmwareVariant variant = getFirmwareVariant(); FirmwareVariant variant = getFirmwareVariant();
QString stamp; QString stamp = variant.firmware->getStampUrl();
stamp.append(variant.firmware->stamp); ui->fw_dnld->setEnabled(!variant.getFirmwareUrl().isNull());
ui->fw_dnld->setEnabled(!variant.firmware->getUrl(variant.id).isNull()); QString url = variant.getFirmwareUrl();
QString url=variant.firmware->getUrl(variant.id);
// B-Plan // B-Plan
if (false) { if (false) {
ui->CPU_ID_LE->show(); ui->CPU_ID_LE->show();
ui->CPU_ID_LABEL->show(); ui->CPU_ID_LABEL->show();
} else { }
else {
ui->CPU_ID_LE->hide(); ui->CPU_ID_LE->hide();
ui->CPU_ID_LABEL->hide(); ui->CPU_ID_LABEL->hide();
} }
@@ -193,7 +193,8 @@ void fwPreferencesDialog::firmwareChanged()
ui->FwInfo->setText(tr("Last downloaded release: %1").arg(fwrev)); ui->FwInfo->setText(tr("Last downloaded release: %1").arg(fwrev));
if (!stamp.isEmpty()) { if (!stamp.isEmpty()) {
ui->checkFWUpdates->show(); ui->checkFWUpdates->show();
} else { }
else {
ui->checkFWUpdates->hide(); ui->checkFWUpdates->hide();
} }
} }
@@ -216,9 +217,9 @@ void fwPreferencesDialog::writeValues()
g.profile[g.id()].fwType( current_firmware_variant.id ); g.profile[g.id()].fwType( current_firmware_variant.id );
} }
void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware) void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInterface * firmware)
{ {
const FirmwareInfo * parent = firmware->parent ? firmware->parent : firmware; const FirmwareInterface * parent = /*firmware->parent ? firmware->parent : */firmware;
updateLock = true; updateLock = true;
@@ -272,9 +273,9 @@ void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
void fwPreferencesDialog::initSettings() void fwPreferencesDialog::initSettings()
{ {
ui->CPU_ID_LE->setText(g.cpuId()); ui->CPU_ID_LE->setText(g.cpuId());
FirmwareInfo * current_firmware = GetCurrentFirmware(); FirmwareInterface * current_firmware = GetCurrentFirmware();
foreach(FirmwareInfo * firmware, firmwares) { foreach(FirmwareInterface * firmware, firmwares) {
ui->downloadVerCB->addItem(firmware->name, firmware->id); ui->downloadVerCB->addItem(firmware->name, firmware->id);
if (current_firmware == firmware) { if (current_firmware == firmware) {
ui->downloadVerCB->setCurrentIndex(ui->downloadVerCB->count() - 1); ui->downloadVerCB->setCurrentIndex(ui->downloadVerCB->count() - 1);
@@ -302,12 +303,12 @@ void fwPreferencesDialog::on_fw_dnld_clicked()
MainWindow * mw = (MainWindow *)this->parent(); MainWindow * mw = (MainWindow *)this->parent();
FirmwareVariant variant = getFirmwareVariant(); FirmwareVariant variant = getFirmwareVariant();
writeValues(); writeValues();
if (!variant.firmware->getUrl(variant.id).isNull()) { if (!variant.getFirmwareUrl().isNull()) {
if (g.profile[g.id()].burnFirmware()) { if (g.profile[g.id()].burnFirmware()) {
current_firmware_variant = getFirmwareVariant(); current_firmware_variant = getFirmwareVariant();
g.profile[g.id()].fwType( current_firmware_variant.id ); g.profile[g.id()].fwType( current_firmware_variant.id );
} }
mw->downloadLatestFW(current_firmware_variant.firmware, current_firmware_variant.id); mw->downloadLatestFW(current_firmware_variant);
} }
firmwareChanged(); firmwareChanged();
} }
+1 -1
View File
@@ -28,7 +28,7 @@ private:
void showVoice(); void showVoice();
void hideVoice(); void hideVoice();
void populateLocale(); void populateLocale();
void populateFirmwareOptions(const FirmwareInfo *); void populateFirmwareOptions(const FirmwareInterface *);
FirmwareVariant getFirmwareVariant(); FirmwareVariant getFirmwareVariant();
void initSettings(); void initSettings();
QCheckBox * voice; QCheckBox * voice;
+22 -22
View File
@@ -83,7 +83,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
switchDefPosEditLock=true; switchDefPosEditLock=true;
populateBacklightCB(ui->backlightswCB, g_eeGeneral.backlightMode); populateBacklightCB(ui->backlightswCB, g_eeGeneral.backlightMode);
bool voice = current_firmware_variant.id.contains("voice"); bool voice = current_firmware_variant.id.contains("voice");
if (!GetEepromInterface()->getCapability(MultiLangVoice)) { if (!GetCurrentFirmware()->getCapability(MultiLangVoice)) {
ui->VoiceLang_label->hide(); ui->VoiceLang_label->hide();
ui->voiceLang_CB->hide(); ui->voiceLang_CB->hide();
} else { } else {
@@ -102,11 +102,11 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
mavbaudEditLock=false; mavbaudEditLock=false;
} }
if (!GetEepromInterface()->getCapability(HasContrast)) { if (!GetCurrentFirmware()->getCapability(HasContrast)) {
ui->contrastSB->hide(); ui->contrastSB->hide();
ui->label_contrast->hide(); ui->label_contrast->hide();
} }
if (!GetEepromInterface()->getCapability(HasSoundMixer)) { if (!GetCurrentFirmware()->getCapability(HasSoundMixer)) {
ui->beepVolume_SL->hide(); ui->beepVolume_SL->hide();
ui->beepVolume_label->hide(); ui->beepVolume_label->hide();
ui->varioVolume_SL->hide(); ui->varioVolume_SL->hide();
@@ -131,28 +131,28 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->varioPMax_SB->setValue(700+(g_eeGeneral.varioPitch*10)+1000+(g_eeGeneral.varioRange*10)); ui->varioPMax_SB->setValue(700+(g_eeGeneral.varioPitch*10)+1000+(g_eeGeneral.varioRange*10));
ui->varioR0_SB->setValue(500+(g_eeGeneral.varioRepeat*10)); ui->varioR0_SB->setValue(500+(g_eeGeneral.varioRepeat*10));
} }
if (!GetEepromInterface()->getCapability(HasFAIMode)) { if (!GetCurrentFirmware()->getCapability(HasFAIMode)) {
ui->faimode_CB->hide(); ui->faimode_CB->hide();
ui->label_faimode->hide(); ui->label_faimode->hide();
} }
else { else {
ui->faimode_CB->setChecked(g_eeGeneral.fai); ui->faimode_CB->setChecked(g_eeGeneral.fai);
} }
if (!GetEepromInterface()->getCapability( HasPxxCountry)) { if (!GetCurrentFirmware()->getCapability( HasPxxCountry)) {
ui->countrycode_label->hide(); ui->countrycode_label->hide();
ui->countrycode_CB->hide(); ui->countrycode_CB->hide();
layout()->removeItem(ui->pxxCountry); layout()->removeItem(ui->pxxCountry);
} else { } else {
ui->countrycode_CB->setCurrentIndex(g_eeGeneral.countryCode); ui->countrycode_CB->setCurrentIndex(g_eeGeneral.countryCode);
} }
if (!GetEepromInterface()->getCapability( HasGeneralUnits)) { if (!GetCurrentFirmware()->getCapability( HasGeneralUnits)) {
ui->units_label->hide(); ui->units_label->hide();
ui->units_CB->hide(); ui->units_CB->hide();
} else { } else {
ui->units_CB->setCurrentIndex(g_eeGeneral.imperial); ui->units_CB->setCurrentIndex(g_eeGeneral.imperial);
} }
if (!GetEepromInterface()->getCapability(TelemetryTimeshift)) { if (!GetCurrentFirmware()->getCapability(TelemetryTimeshift)) {
ui->label_timezone->hide(); ui->label_timezone->hide();
ui->timezoneSB->hide(); ui->timezoneSB->hide();
ui->timezoneSB->setDisabled(true); ui->timezoneSB->setDisabled(true);
@@ -162,24 +162,24 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->gpsFormatCB->setCurrentIndex(g_eeGeneral.gpsFormat); ui->gpsFormatCB->setCurrentIndex(g_eeGeneral.gpsFormat);
ui->timezoneSB->setValue(g_eeGeneral.timezone); ui->timezoneSB->setValue(g_eeGeneral.timezone);
if (!GetEepromInterface()->getCapability(OptrexDisplay)) { if (!GetCurrentFirmware()->getCapability(OptrexDisplay)) {
ui->label_displayType->hide(); ui->label_displayType->hide();
ui->displayTypeCB->setDisabled(true); ui->displayTypeCB->setDisabled(true);
ui->displayTypeCB->hide(); ui->displayTypeCB->hide();
} }
if (!GetEepromInterface()->getCapability(HasVolume) && !voice) { if (!GetCurrentFirmware()->getCapability(HasVolume) && !voice) {
ui->volume_SB->hide(); ui->volume_SB->hide();
ui->volume_SB->setDisabled(true); ui->volume_SB->setDisabled(true);
ui->label_volume->hide(); ui->label_volume->hide();
} else { } 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->hide();
ui->BLBright_SB->setDisabled(true); ui->BLBright_SB->setDisabled(true);
ui->label_BLBright->hide(); ui->label_BLBright->hide();
} }
if (!GetEepromInterface()->getCapability(HasCurrentCalibration)) { if (!GetCurrentFirmware()->getCapability(HasCurrentCalibration)) {
ui->CurrentCalib_SB->hide(); ui->CurrentCalib_SB->hide();
ui->CurrentCalib_SB->setDisabled(true); ui->CurrentCalib_SB->setDisabled(true);
ui->label_CurrentCalib->hide(); ui->label_CurrentCalib->hide();
@@ -187,31 +187,31 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->tabWidget->setCurrentIndex(0); ui->tabWidget->setCurrentIndex(0);
if (!GetEepromInterface()->getCapability(SoundMod)) { if (!GetCurrentFirmware()->getCapability(SoundMod)) {
ui->soundModeCB->setDisabled(true); ui->soundModeCB->setDisabled(true);
ui->label_soundMode->hide(); ui->label_soundMode->hide();
ui->soundModeCB->hide(); ui->soundModeCB->hide();
} }
if (!GetEepromInterface()->getCapability(SoundPitch)) { if (!GetCurrentFirmware()->getCapability(SoundPitch)) {
ui->speakerPitchSB->setDisabled(true); ui->speakerPitchSB->setDisabled(true);
ui->label_speakerPitch->hide(); ui->label_speakerPitch->hide();
ui->speakerPitchSB->hide(); ui->speakerPitchSB->hide();
} }
if (!GetEepromInterface()->getCapability(Haptic)) { if (!GetCurrentFirmware()->getCapability(Haptic)) {
ui->hapticStrengthSB->setDisabled(true); ui->hapticStrengthSB->setDisabled(true);
ui->hapticStrengthSB->hide(); ui->hapticStrengthSB->hide();
ui->label_hapticStrengthSB->hide(); ui->label_hapticStrengthSB->hide();
} }
if (!GetEepromInterface()->getCapability(HapticMode)) { if (!GetCurrentFirmware()->getCapability(HapticMode)) {
ui->hapticmodeCB->setDisabled(true); ui->hapticmodeCB->setDisabled(true);
ui->hapticmodeCB->hide(); ui->hapticmodeCB->hide();
ui->label_hapticmode->hide(); ui->label_hapticmode->hide();
} }
int renumber=GetEepromInterface()->getCapability(RotaryEncoders); int renumber=GetCurrentFirmware()->getCapability(RotaryEncoders);
if (renumber==0) { if (renumber==0) {
ui->re_label->hide(); ui->re_label->hide();
ui->re_CB->hide(); ui->re_CB->hide();
@@ -247,7 +247,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->trnMode_4->setCurrentIndex(g_eeGeneral.trainer.mix[3].mode); ui->trnMode_4->setCurrentIndex(g_eeGeneral.trainer.mix[3].mode);
ui->trnChn_4->setCurrentIndex(g_eeGeneral.trainer.mix[3].src); ui->trnChn_4->setCurrentIndex(g_eeGeneral.trainer.mix[3].src);
ui->trnWeight_4->setValue(g_eeGeneral.trainer.mix[3].weight); ui->trnWeight_4->setValue(g_eeGeneral.trainer.mix[3].weight);
int potsnum=GetEepromInterface()->getCapability(Pots); int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (potsnum==3) { if (potsnum==3) {
ui->label_pot4->hide(); ui->label_pot4->hide();
ui->ana8Neg->hide(); ui->ana8Neg->hide();
@@ -261,7 +261,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(unlockSwitchEdited())); 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->pot1Type->setCurrentIndex(g_eeGeneral.potsType[0]);
ui->pot2Type->setCurrentIndex(g_eeGeneral.potsType[1]); ui->pot2Type->setCurrentIndex(g_eeGeneral.potsType[1]);
ui->pot3Type->setCurrentIndex(g_eeGeneral.potsType[2]); ui->pot3Type->setCurrentIndex(g_eeGeneral.potsType[2]);
@@ -334,7 +334,7 @@ void GeneralEdit::setValues()
ui->beeperCB->setCurrentIndex(g_eeGeneral.beeperMode+2); ui->beeperCB->setCurrentIndex(g_eeGeneral.beeperMode+2);
ui->channelorderCB->setCurrentIndex(g_eeGeneral.templateSetup); ui->channelorderCB->setCurrentIndex(g_eeGeneral.templateSetup);
ui->stickmodeCB->setCurrentIndex(g_eeGeneral.stickMode); ui->stickmodeCB->setCurrentIndex(g_eeGeneral.stickMode);
if (!GetEepromInterface()->getCapability(HapticLength)) { if (!GetCurrentFirmware()->getCapability(HapticLength)) {
ui->label_HL->hide(); ui->label_HL->hide();
ui->hapticLengthCB->hide(); ui->hapticLengthCB->hide();
} else { } else {
@@ -911,7 +911,7 @@ void GeneralEdit::on_calretrieve_PB_clicked()
{ {
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt(); int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
QString calib=g.profile[profile_id].stickPotCalib(); QString calib=g.profile[profile_id].stickPotCalib();
int potsnum=GetEepromInterface()->getCapability(Pots); int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (calib.isEmpty()) { if (calib.isEmpty()) {
return; return;
} else { } else {
@@ -1021,7 +1021,7 @@ void GeneralEdit::on_calstore_PB_clicked()
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt(); int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
QString name=g.profile[profile_id].name(); QString name=g.profile[profile_id].name();
int potsnum=GetEepromInterface()->getCapability(Pots); int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (name.isEmpty()) { if (name.isEmpty()) {
ui->calstore_PB->setDisabled(true); ui->calstore_PB->setDisabled(true);
return; return;
+34 -34
View File
@@ -62,7 +62,7 @@ QString getInputStr(ModelData & model, int index)
{ {
QString result; QString result;
if (GetEepromInterface()->getCapability(VirtualInputs)) { if (GetCurrentFirmware()->getCapability(VirtualInputs)) {
result = model.inputNames[index]; result = model.inputNames[index];
if (result.isEmpty()) { if (result.isEmpty()) {
result = QObject::tr("Input%1").arg(index+1, 2, 10, QChar('0')); result = QObject::tr("Input%1").arg(index+1, 2, 10, QChar('0'));
@@ -126,7 +126,7 @@ QString getProtocolStr(const int proto)
void populatePhasesCB(QComboBox *b, int value) void populatePhasesCB(QComboBox *b, int value)
{ {
for (int i=-GetEepromInterface()->getCapability(FlightPhases); i<=GetEepromInterface()->getCapability(FlightPhases); i++) { for (int i=-GetCurrentFirmware()->getCapability(FlightPhases); i<=GetCurrentFirmware()->getCapability(FlightPhases); i++) {
if (i < 0) if (i < 0)
b->addItem(QObject::tr("!Flight mode %1").arg(-i-1), i); b->addItem(QObject::tr("!Flight mode %1").arg(-i-1), i);
else if (i > 0) else if (i > 0)
@@ -134,13 +134,13 @@ void populatePhasesCB(QComboBox *b, int value)
else else
b->addItem(QObject::tr("----"), 0); b->addItem(QObject::tr("----"), 0);
} }
b->setCurrentIndex(value + GetEepromInterface()->getCapability(FlightPhases)); b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightPhases));
} }
bool gvarsEnabled() bool gvarsEnabled()
{ {
int gvars=0; int gvars=0;
if (GetEepromInterface()->getCapability(HasVariants)) { if (GetCurrentFirmware()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) { if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1; gvars=1;
} }
@@ -278,7 +278,7 @@ void CurveGroup::update()
break; break;
case CurveReference::CURVE_REF_CUSTOM: case CurveReference::CURVE_REF_CUSTOM:
{ {
int numcurves = GetEepromInterface()->getCapability(NumCurves); int numcurves = GetCurrentFirmware()->getCapability(NumCurves);
if (lastType != curve.type) { if (lastType != curve.type) {
lastType = curve.type; lastType = curve.type;
curveValueCB->clear(); curveValueCB->clear();
@@ -330,7 +330,7 @@ void CurveGroup::valuesChanged()
curve = CurveReference(CurveReference::CURVE_REF_FUNC, curveValueCB->currentIndex()); curve = CurveReference(CurveReference::CURVE_REF_FUNC, curveValueCB->currentIndex());
break; break;
case 3: 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; break;
} }
@@ -341,7 +341,7 @@ void CurveGroup::valuesChanged()
void populateGvarUseCB(QComboBox *b, unsigned int phase) void populateGvarUseCB(QComboBox *b, unsigned int phase)
{ {
b->addItem(QObject::tr("Own value")); b->addItem(QObject::tr("Own value"));
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
if (i != (int)phase) { if (i != (int)phase) {
b->addItem(QObject::tr("Flight mode %1 value").arg(i)); b->addItem(QObject::tr("Flight mode %1 value").arg(i));
} }
@@ -376,7 +376,7 @@ void populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); 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); item = RawSwitch(SWITCH_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
@@ -402,13 +402,13 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
if (item == value) b->setCurrentIndex(b->count()-1); 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); item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); 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); item = RawSwitch(SWITCH_TYPE_ROTARY_ENCODER, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
@@ -420,17 +420,17 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
} }
for (int i=GetEepromInterface()->getCapability(MultiposPots)-1; i>=0; i--) { for (int i=GetCurrentFirmware()->getCapability(MultiposPots)-1; i>=0; i--) {
if (generalSettings.potsType[i] == 2/* TODO constant*/) { if (generalSettings.potsType[i] == 2/* TODO constant*/) {
for (int j=-GetEepromInterface()->getCapability(MultiposPotsPositions); j<0; j++) { for (int j=-GetCurrentFirmware()->getCapability(MultiposPotsPositions); j<0; j++) {
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i*GetEepromInterface()->getCapability(MultiposPotsPositions)+j); item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i*GetCurrentFirmware()->getCapability(MultiposPotsPositions)+j);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); 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); item = RawSwitch(SWITCH_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
@@ -449,16 +449,16 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
if (item == value) b->setCurrentIndex(b->count()-1); 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); item = RawSwitch(SWITCH_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
} }
for (int i=0; i<GetEepromInterface()->getCapability(MultiposPots); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(MultiposPots); i++) {
if (generalSettings.potsType[i] == 2/* TODO constant*/) { if (generalSettings.potsType[i] == 2/* TODO constant*/) {
for (int j=1; j<=GetEepromInterface()->getCapability(MultiposPotsPositions); j++) { for (int j=1; j<=GetCurrentFirmware()->getCapability(MultiposPotsPositions); j++) {
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i*GetEepromInterface()->getCapability(MultiposPotsPositions)+j); item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i*GetCurrentFirmware()->getCapability(MultiposPotsPositions)+j);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
} }
@@ -471,13 +471,13 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
if (item == value) b->setCurrentIndex(b->count()-1); 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); item = RawSwitch(SWITCH_TYPE_ROTARY_ENCODER, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); 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); item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
@@ -499,7 +499,7 @@ void populateGVCB(QComboBox *b, int value)
b->clear(); b->clear();
int pgvars = GetEepromInterface()->getCapability(Gvars); int pgvars = GetCurrentFirmware()->getCapability(Gvars);
for (int i=-pgvars; i<=-1; i++) { for (int i=-pgvars; i<=-1; i++) {
int16_t gval = (int16_t)(-10000+i); int16_t gval = (int16_t)(-10000+i);
b->addItem(QObject::tr("-GV%1").arg(-i), gval); b->addItem(QObject::tr("-GV%1").arg(-i), gval);
@@ -543,7 +543,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
} }
if (flags & POPULATE_VIRTUAL_INPUTS) { if (flags & POPULATE_VIRTUAL_INPUTS) {
int virtualInputs = GetEepromInterface()->getCapability(VirtualInputs); int virtualInputs = GetCurrentFirmware()->getCapability(VirtualInputs);
for (int i=0; i<virtualInputs; i++) { for (int i=0; i<virtualInputs; i++) {
item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, &model); item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, &model);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
@@ -552,12 +552,12 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
} }
if (flags & POPULATE_SOURCES) { 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); item = RawSource(SOURCE_TYPE_STICK, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
} }
for (int i=0; i<GetEepromInterface()->getCapability(RotaryEncoders); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(RotaryEncoders); i++) {
item = RawSource(SOURCE_TYPE_ROTARY_ENCODER, i); item = RawSource(SOURCE_TYPE_ROTARY_ENCODER, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
@@ -579,13 +579,13 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
} }
if (flags & POPULATE_SWITCHES) { if (flags & POPULATE_SWITCHES) {
for (int i=0; i<GetEepromInterface()->getCapability(Switches); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(Switches); i++) {
item = RawSource(SOURCE_TYPE_SWITCH, i); item = RawSource(SOURCE_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
} }
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
item = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i); item = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
@@ -599,13 +599,13 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
} }
for (int i=0; i<GetEepromInterface()->getCapability(TrainerInputs); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(TrainerInputs); i++) {
item = RawSource(SOURCE_TYPE_PPM, i); item = RawSource(SOURCE_TYPE_PPM, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
} }
for (int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
item = RawSource(SOURCE_TYPE_CH, i); item = RawSource(SOURCE_TYPE_CH, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
@@ -628,7 +628,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
} }
if (flags & POPULATE_GVARS) { if (flags & POPULATE_GVARS) {
for (int i=0; i<GetEepromInterface()->getCapability(Gvars); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(Gvars); i++) {
item = RawSource(SOURCE_TYPE_GVAR, i); item = RawSource(SOURCE_TYPE_GVAR, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
@@ -775,7 +775,7 @@ QString getFrSkyProtocol(int protocol)
{ {
switch(protocol) { switch(protocol) {
case 2: case 2:
if ((GetEepromInterface()->getCapability(Telemetry) & TM_HASWSHH)) if ((GetCurrentFirmware()->getCapability(Telemetry) & TM_HASWSHH))
return QObject::tr("Winged Shadow How High"); return QObject::tr("Winged Shadow How High");
else else
return QObject::tr("Winged Shadow How High (not supported)"); return QObject::tr("Winged Shadow How High (not supported)");
@@ -830,7 +830,7 @@ QString getProtocol(ModelData * g_model)
QString getPhasesStr(unsigned int phases, ModelData & model) QString getPhasesStr(unsigned int phases, ModelData & model)
{ {
int numphases = GetEepromInterface()->getCapability(FlightPhases); int numphases = GetCurrentFirmware()->getCapability(FlightPhases);
if (numphases && phases) { if (numphases && phases) {
QString str; QString str;
@@ -906,7 +906,7 @@ CompanionIcon::CompanionIcon(QString baseimage)
void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx) void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
{ {
SimulatorInterface * si = GetEepromInterface()->getSimulator(); SimulatorInterface * si = GetCurrentFirmware()->getSimulator();
if (si) { if (si) {
delete si; delete si;
RadioData * simuData = new RadioData(radioData); RadioData * simuData = new RadioData(radioData);
@@ -918,14 +918,14 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
if (radioData.generalSettings.stickMode & 1) { if (radioData.generalSettings.stickMode & 1) {
flags |= SIMULATOR_FLAGS_STICK_MODE_LEFT; flags |= SIMULATOR_FLAGS_STICK_MODE_LEFT;
} }
BoardEnum board = GetEepromInterface()->getBoard(); BoardEnum board = GetCurrentFirmware()->getBoard();
SimulatorDialog * sd; SimulatorDialog * sd;
if (IS_TARANIS(board)) if (IS_TARANIS(board))
sd = new SimulatorDialogTaranis(parent, flags); sd = new SimulatorDialogTaranis(parent, flags);
else else
sd = new SimulatorDialog9X(parent, flags); sd = new SimulatorDialog9X(parent, flags);
QByteArray eeprom(GetEepromInterface()->getEEpromSize(), 0); 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; delete simuData;
sd->start(eeprom); sd->start(eeprom);
sd->exec(); sd->exec();
+1 -1
View File
@@ -6,7 +6,7 @@
extern const QColor colors[C9X_MAX_CURVES]; extern const QColor colors[C9X_MAX_CURVES];
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetEepromInterface()->getCapability(LogicalSwitches)-1) #define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetCurrentFirmware()->getCapability(LogicalSwitches)-1)
//convert from mode 1 to mode generalSettings.stickMode //convert from mode 1 to mode generalSettings.stickMode
//NOTICE! => 1..4 -> 1..4 //NOTICE! => 1..4 -> 1..4
+16 -17
View File
@@ -198,7 +198,7 @@ void MainWindow::checkForUpdates(bool ignoreSettings, QString & fwId)
check1done = true; check1done = true;
check2done = true; check2done = true;
fwToUpdate = fwId; fwToUpdate = fwId;
QString stamp = GetFirmware(fwToUpdate)->stamp; QString stamp = GetFirmware(fwToUpdate)->getStampUrl();
if (!stamp.isEmpty()) { if (!stamp.isEmpty()) {
if (g.autoCheckFw() || ignoreSettings) { if (g.autoCheckFw() || ignoreSettings) {
@@ -299,15 +299,15 @@ void MainWindow::updateDownloaded()
} }
} }
void MainWindow::downloadLatestFW(FirmwareInfo * firmware, const QString & firmwareId) void MainWindow::downloadLatestFW(FirmwareVariant & firmware)
{ {
QString url, ext, cpuid; QString url, ext, cpuid;
url = firmware->getUrl(firmwareId); url = firmware.getFirmwareUrl();
cpuid=g.cpuId(); cpuid=g.cpuId();
ext = url.mid(url.lastIndexOf(".")); 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()) { if (!fileName.isEmpty()) {
downloadedFW = firmwareId; downloadedFW = firmware.id;
needRename=true; needRename=true;
g.profile[g.id()].fwName( fileName ); g.profile[g.id()].fwName( fileName );
if (!cpuid.isEmpty()) { if (!cpuid.isEmpty()) {
@@ -468,7 +468,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
if (OldFwRev == 0) { if (OldFwRev == 0) {
showcheckForUpdatesResult = false; // update is available - do not show dialog showcheckForUpdatesResult = false; // update is available - do not show dialog
QString rn = GetFirmware(fwToUpdate)->rnurl; QString rn = GetFirmware(fwToUpdate)->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL; QAbstractButton *rnButton = NULL;
msgBox.setWindowTitle("Companion"); 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)); 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));
@@ -495,9 +495,10 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
} else { } else {
ignore = true; ignore = true;
} }
} else if (NewFwRev > OldFwRev) { }
else if (NewFwRev > OldFwRev) {
showcheckForUpdatesResult = false; // update is available - do not show dialog showcheckForUpdatesResult = false; // update is available - do not show dialog
QString rn = GetFirmware(fwToUpdate)->rnurl; QString rn = GetFirmware(fwToUpdate)->getReleaseNotesUrl();
QAbstractButton *rnButton; QAbstractButton *rnButton;
msgBox.setText("Companion"); 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)); 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));
@@ -536,7 +537,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
} }
} else if (download == true) { } else if (download == true) {
if (warning>0) { if (warning>0) {
QString rn = GetFirmware(fwToUpdate)->rnurl; QString rn = GetFirmware(fwToUpdate)->getReleaseNotesUrl();
if (!rn.isEmpty()) { 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); 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) { if (ret2 == QMessageBox::Yes) {
@@ -546,7 +547,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
} }
} }
downloadedFW = fwToUpdate; downloadedFW = fwToUpdate;
QString url = GetFirmware(fwToUpdate)->getUrl(fwToUpdate); QString url = GetFirmwareVariant(fwToUpdate).getFirmwareUrl();
QString ext = url.mid(url.lastIndexOf(".")); QString ext = url.mid(url.lastIndexOf("."));
needRename=false; needRename=false;
bool addversion=g.profile[g.id()].renameFwFiles(); bool addversion=g.profile[g.id()].renameFwFiles();
@@ -746,11 +747,12 @@ void MainWindow::changelog()
void MainWindow::fwchangelog() void MainWindow::fwchangelog()
{ {
FirmwareInfo *currfirm = GetCurrentFirmware(); FirmwareInterface *currfirm = GetCurrentFirmware();
QString rn=currfirm->rnurl; QString rn=currfirm->getReleaseNotesUrl();
if (rn.isEmpty()) { if (rn.isEmpty()) {
QMessageBox::information(this, tr("Firmware updates"), tr("Current firmware does not provide release notes informations.")); QMessageBox::information(this, tr("Firmware updates"), tr("Current firmware does not provide release notes informations."));
} else { }
else {
contributorsDialog *cd = new contributorsDialog(this,2, rn); contributorsDialog *cd = new contributorsDialog(this,2, rn);
cd->exec(); cd->exec();
} }
@@ -1257,7 +1259,7 @@ bool MainWindow::isValidEEPROM(QString eepromfile)
bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString flashFile) bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString flashFile)
{ {
FirmwareInfo *firmware = GetCurrentFirmware(); FirmwareInterface *firmware = GetCurrentFirmware();
FlashInterface flash(flashFile); FlashInterface flash(flashFile);
if (!flash.isValid()) if (!flash.isValid())
return false; return false;
@@ -1290,9 +1292,6 @@ bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString
version = fwEEprom.toInt(); version = fwEEprom.toInt();
} }
} }
else {
version = ((Open9xFirmware *)firmware)->getEepromVersion(revision);
}
} }
QFile file(backupFile); QFile file(backupFile);
+6 -6
View File
@@ -68,19 +68,19 @@ class MainWindow : public QMainWindow
Q_OBJECT Q_OBJECT
public: public:
MainWindow(); MainWindow();
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
void dragEnterEvent(QDragEnterEvent *event); void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event); void dropEvent(QDropEvent *event);
public slots: public slots:
void downloadLatestFW(FirmwareInfo *firmware, const QString & firmwareId); void downloadLatestFW(FirmwareVariant & firmware);
private slots: private slots:
void openDocURL(); void openDocURL();
void setLanguage(QString langString); void setLanguage(QString langString);
@@ -157,7 +157,7 @@ private slots:
QMenu * createProfilesMenu(); QMenu * createProfilesMenu();
void autoClose(); void autoClose();
private: private:
void createActions(); void createActions();
QAction * addAct(QString, QString, QString, QKeySequence::StandardKey, const char *, QObject *slotObj=NULL); QAction * addAct(QString, QString, QString, QKeySequence::StandardKey, const char *, QObject *slotObj=NULL);
QAction * addAct(QActionGroup *, QString, QString, const char *); QAction * addAct(QActionGroup *, QString, QString, const char *);
+1 -1
View File
@@ -103,7 +103,7 @@ void MdiChild::qSleep(int ms)
void MdiChild::eepromInterfaceChanged() void MdiChild::eepromInterfaceChanged()
{ {
ui->modelsList->refreshList(); ui->modelsList->refreshList();
ui->SimulateTxButton->setEnabled(GetEepromInterface()->getCapability(Simulation)); ui->SimulateTxButton->setEnabled(GetCurrentFirmware()->getCapability(Simulation));
updateTitle(); updateTitle();
} }
+10 -10
View File
@@ -13,7 +13,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
bool minimize = false; bool minimize = false;
int col = 1; int col = 1;
if (GetEepromInterface()->getCapability(ChannelsName)) if (GetCurrentFirmware()->getCapability(ChannelsName))
{ {
minimize=true; minimize=true;
addLabel(gridLayout, tr("Name"), col++); addLabel(gridLayout, tr("Name"), col++);
@@ -24,12 +24,12 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
addLabel(gridLayout, tr("Direction"), col++, minimize); addLabel(gridLayout, tr("Direction"), col++, minimize);
if (IS_TARANIS(GetEepromInterface()->getBoard())) if (IS_TARANIS(GetEepromInterface()->getBoard()))
addLabel(gridLayout, tr("Curve"), col++, minimize); addLabel(gridLayout, tr("Curve"), col++, minimize);
if (GetEepromInterface()->getCapability(PPMCenter)) if (GetCurrentFirmware()->getCapability(PPMCenter))
addLabel(gridLayout, tr("PPM Center"), col++, minimize); addLabel(gridLayout, tr("PPM Center"), col++, minimize);
if (GetEepromInterface()->getCapability(SYMLimits)) if (GetCurrentFirmware()->getCapability(SYMLimits))
addLabel(gridLayout, tr("Linear Subtrim"), col++, true); addLabel(gridLayout, tr("Linear Subtrim"), col++, true);
for (int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
col = 0; col = 0;
// Channel label // Channel label
@@ -39,7 +39,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
gridLayout->addWidget(label, i+1, col++, 1, 1); gridLayout->addWidget(label, i+1, col++, 1, 1);
// Channel name // Channel name
int nameLen = GetEepromInterface()->getCapability(ChannelsName); int nameLen = GetCurrentFirmware()->getCapability(ChannelsName);
if (nameLen > 0) { if (nameLen > 0) {
QLineEdit * name = new QLineEdit(this); QLineEdit * name = new QLineEdit(this);
name->setProperty("index", i); name->setProperty("index", i);
@@ -103,7 +103,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
if (IS_TARANIS(GetEepromInterface()->getBoard())) { if (IS_TARANIS(GetEepromInterface()->getBoard())) {
QComboBox * curveCB = new QComboBox(this); QComboBox * curveCB = new QComboBox(this);
curveCB->setProperty("index", i); curveCB->setProperty("index", i);
int numcurves = GetEepromInterface()->getCapability(NumCurves); int numcurves = GetCurrentFirmware()->getCapability(NumCurves);
for (int j=-numcurves; j<=numcurves; j++) { for (int j=-numcurves; j<=numcurves; j++) {
curveCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, j).toString(), j); curveCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, j).toString(), j);
} }
@@ -113,7 +113,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
} }
// PPM center // PPM center
if (GetEepromInterface()->getCapability(PPMCenter)) { if (GetCurrentFirmware()->getCapability(PPMCenter)) {
QSpinBox * center = new QSpinBox(this); QSpinBox * center = new QSpinBox(this);
center->setProperty("index", i); center->setProperty("index", i);
center->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); center->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
@@ -126,7 +126,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
} }
// Symetrical limits // Symetrical limits
if (GetEepromInterface()->getCapability(SYMLimits)) { if (GetCurrentFirmware()->getCapability(SYMLimits)) {
QCheckBox * symlimits = new QCheckBox(this); QCheckBox * symlimits = new QCheckBox(this);
symlimits->setProperty("index", i); symlimits->setProperty("index", i);
symlimits->setChecked(model.limitData[i].symetrical); symlimits->setChecked(model.limitData[i].symetrical);
@@ -135,7 +135,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
} }
} }
// Push the rows up // Push the rows up
addVSpring(gridLayout, 0,GetEepromInterface()->getCapability(Outputs)+1); addVSpring(gridLayout, 0,GetCurrentFirmware()->getCapability(Outputs)+1);
} }
Channels::~Channels() Channels::~Channels()
@@ -188,7 +188,7 @@ void Channels::maxEdited()
void Channels::refreshExtendedLimits() void Channels::refreshExtendedLimits()
{ {
for (int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
QDoubleSpinBox * minDSB = minSpins[i]; QDoubleSpinBox * minDSB = minSpins[i];
QDoubleSpinBox * maxDSB = maxSpins[i]; QDoubleSpinBox * maxDSB = maxSpins[i];
+8 -8
View File
@@ -101,7 +101,7 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
lock = true; lock = true;
if (!GetEepromInterface()->getCapability(HasCvNames)) { if (!GetCurrentFirmware()->getCapability(HasCvNames)) {
ui->curveName->hide(); ui->curveName->hide();
ui->curveNameLabel->hide(); ui->curveNameLabel->hide();
} }
@@ -110,7 +110,7 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
scene->setItemIndexMethod(QGraphicsScene::NoIndex); scene->setItemIndexMethod(QGraphicsScene::NoIndex);
ui->curvePreview->setScene(scene); ui->curvePreview->setScene(scene);
for (int i=0; i<GetEepromInterface()->getCapability(NumCurves); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(NumCurves); i++) {
visibleCurves[i] = false; visibleCurves[i] = false;
// The reset curve button // The reset curve button
@@ -164,7 +164,7 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
ui->pointsLayout->addWidget(spnx[i], i, 1, 1, 1); ui->pointsLayout->addWidget(spnx[i], i, 1, 1, 1);
bool insert; bool insert;
if (GetEepromInterface()->getCapability(EnhancedCurves)) { if (GetCurrentFirmware()->getCapability(EnhancedCurves)) {
insert = (i >= 1); insert = (i >= 1);
} }
else { else {
@@ -220,7 +220,7 @@ void Curves::update()
{ {
lock = true; lock = true;
if (GetEepromInterface()->getCapability(HasCvNames)) { if (GetCurrentFirmware()->getCapability(HasCvNames)) {
ui->curveName->setText(model.curves[currentCurve].name); ui->curveName->setText(model.curves[currentCurve].name);
} }
@@ -242,7 +242,7 @@ void Curves::updateCurveType()
int index = 0; int index = 0;
if (GetEepromInterface()->getCapability(EnhancedCurves)) { if (GetCurrentFirmware()->getCapability(EnhancedCurves)) {
index = model.curves[currentCurve].count - 2; index = model.curves[currentCurve].count - 2;
} }
else { else {
@@ -288,7 +288,7 @@ void Curves::updateCurve()
pen.setWidth(1); pen.setWidth(1);
pen.setStyle(Qt::SolidLine); pen.setStyle(Qt::SolidLine);
int numcurves = GetEepromInterface()->getCapability(NumCurves); int numcurves = GetCurrentFirmware()->getCapability(NumCurves);
for (int k=0; k<numcurves; k++) { for (int k=0; k<numcurves; k++) {
pen.setColor(colors[k]); pen.setColor(colors[k]);
if (currentCurve!=k && visibleCurves[k]) { if (currentCurve!=k && visibleCurves[k]) {
@@ -406,7 +406,7 @@ void Curves::onNodeUnfocus()
bool Curves::allowCurveType(int points, CurveData::CurveType type) bool Curves::allowCurveType(int points, CurveData::CurveType type)
{ {
int numcurves = GetEepromInterface()->getCapability(NumCurves); int numcurves = GetCurrentFirmware()->getCapability(NumCurves);
int totalpoints = 0; int totalpoints = 0;
for (int i=0; i<numcurves; i++) { for (int i=0; i<numcurves; i++) {
@@ -415,7 +415,7 @@ bool Curves::allowCurveType(int points, CurveData::CurveType type)
totalpoints += cvPoints + (cvType==CurveData::CURVE_TYPE_CUSTOM ? cvPoints-2 : 0); totalpoints += cvPoints + (cvType==CurveData::CURVE_TYPE_CUSTOM ? cvPoints-2 : 0);
} }
int fwpoints = GetEepromInterface()->getCapability(NumCurvePoints); int fwpoints = GetCurrentFirmware()->getCapability(NumCurvePoints);
if (totalpoints > fwpoints) { if (totalpoints > fwpoints) {
QMessageBox::warning(this, "companion", tr("Not enough free points in EEPROM to store the curve.")); QMessageBox::warning(this, "companion", tr("Not enough free points in EEPROM to store the curve."));
return false; return false;
+14 -14
View File
@@ -66,9 +66,9 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
addEmptyLabel(gridLayout, 5 ); addEmptyLabel(gridLayout, 5 );
lock = true; lock = true;
int num_fsw = GetEepromInterface()->getCapability(CustomFunctions); int num_fsw = GetCurrentFirmware()->getCapability(CustomFunctions);
if (!GetEepromInterface()->getCapability(VoicesAsNumbers)) { if (!GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
for (int i=0; i<num_fsw; i++) { for (int i=0; i<num_fsw; i++) {
if (model.funcSw[i].func==FuncPlayPrompt || model.funcSw[i].func==FuncBackgroundMusic) { if (model.funcSw[i].func==FuncPlayPrompt || model.funcSw[i].func==FuncBackgroundMusic) {
QString temp = model.funcSw[i].paramarm; QString temp = model.funcSw[i].paramarm;
@@ -87,7 +87,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
lang="en"; lang="en";
path.append(lang); path.append(lang);
QDir qd(path); QDir qd(path);
int vml= GetEepromInterface()->getCapability(VoicesMaxLength)+4; int vml= GetCurrentFirmware()->getCapability(VoicesMaxLength)+4;
if (qd.exists()) { if (qd.exists()) {
QStringList filters; QStringList filters;
filters << "*.wav" << "*.WAV"; filters << "*.wav" << "*.WAV";
@@ -227,7 +227,7 @@ void CustomFunctionsPanel::playMusic()
QDir qd(path); QDir qd(path);
QString track; QString track;
if (qd.exists()) { if (qd.exists()) {
if (GetEepromInterface()->getCapability(VoicesAsNumbers)) { if (GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
track = path + QString("/%1.wav").arg(int(fswtchParam[index]->value()), 4, 10, (const QChar)'0'); track = path + QString("/%1.wav").arg(int(fswtchParam[index]->value()), 4, 10, (const QChar)'0');
} }
else { else {
@@ -360,7 +360,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_ENABLE; widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_ENABLE;
} }
else if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) { else if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
if (index != FuncBackgroundMusic && GetEepromInterface()->getCapability(HasFuncRepeat)) { if (index != FuncBackgroundMusic && GetCurrentFirmware()->getCapability(HasFuncRepeat)) {
widgetsMask |= CUSTOM_FUNCTION_REPEAT; widgetsMask |= CUSTOM_FUNCTION_REPEAT;
fswtchRepeat[i]->update(); fswtchRepeat[i]->update();
} }
@@ -370,7 +370,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_REPEAT; widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_REPEAT;
} }
else if (index==FuncPlayPrompt || index==FuncPlayBoth) { else if (index==FuncPlayPrompt || index==FuncPlayBoth) {
if (GetEepromInterface()->getCapability(VoicesAsNumbers)) { if (GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
fswtchParam[i]->setDecimals(0); fswtchParam[i]->setDecimals(0);
fswtchParam[i]->setSingleStep(1); fswtchParam[i]->setSingleStep(1);
fswtchParam[i]->setMinimum(0); fswtchParam[i]->setMinimum(0);
@@ -407,7 +407,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM; widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
if (modified) { if (modified) {
memset(model.funcSw[i].paramarm, 0, sizeof(model.funcSw[i].paramarm)); memset(model.funcSw[i].paramarm, 0, sizeof(model.funcSw[i].paramarm));
int vml = GetEepromInterface()->getCapability(VoicesMaxLength); int vml = GetCurrentFirmware()->getCapability(VoicesMaxLength);
if (fswtchParamArmT[i]->currentText() != "----") { if (fswtchParamArmT[i]->currentText() != "----") {
widgetsMask |= CUSTOM_FUNCTION_PLAY; widgetsMask |= CUSTOM_FUNCTION_PLAY;
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(), vml); j++) { for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(), vml); j++) {
@@ -427,7 +427,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM; widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
if (modified) { if (modified) {
memset(model.funcSw[i].paramarm, 0, sizeof(model.funcSw[i].paramarm)); memset(model.funcSw[i].paramarm, 0, sizeof(model.funcSw[i].paramarm));
int vml=GetEepromInterface()->getCapability(VoicesMaxLength); int vml=GetCurrentFirmware()->getCapability(VoicesMaxLength);
if (fswtchParamArmT[i]->currentText() != "----") { if (fswtchParamArmT[i]->currentText() != "----") {
widgetsMask |= CUSTOM_FUNCTION_PLAY; widgetsMask |= CUSTOM_FUNCTION_PLAY;
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(),vml); j++) { for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(),vml); j++) {
@@ -476,7 +476,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
void CustomFunctionsPanel::update() void CustomFunctionsPanel::update()
{ {
lock = true; lock = true;
for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(CustomFunctions); i++) {
if (!initialized) { if (!initialized) {
populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, generalSettings, POPULATE_ONOFF); populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, generalSettings, POPULATE_ONOFF);
populateFuncCB(fswtchFunc[i], model.funcSw[i].func); populateFuncCB(fswtchFunc[i], model.funcSw[i].func);
@@ -562,24 +562,24 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
b->clear(); b->clear();
for (unsigned int i=0; i<FuncCount; i++) { for (unsigned int i=0; i<FuncCount; i++) {
b->addItem(FuncSwData(AssignFunc(i)).funcToString()); b->addItem(FuncSwData(AssignFunc(i)).funcToString());
if (!GetEepromInterface()->getCapability(HasVolume)) { if (!GetCurrentFirmware()->getCapability(HasVolume)) {
if (i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) { if (i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) {
QModelIndex index = b->model()->index(i, 0); QModelIndex index = b->model()->index(i, 0);
QVariant v(0); QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1); b->model()->setData(index, v, Qt::UserRole - 1);
} }
} }
if ((i==FuncPlayHaptic) && !GetEepromInterface()->getCapability(Haptic)) { if ((i==FuncPlayHaptic) && !GetCurrentFirmware()->getCapability(Haptic)) {
QModelIndex index = b->model()->index(i, 0); QModelIndex index = b->model()->index(i, 0);
QVariant v(0); QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1); b->model()->setData(index, v, Qt::UserRole - 1);
} }
if ((i==FuncPlayBoth) && !GetEepromInterface()->getCapability(HasBeeper)) { if ((i==FuncPlayBoth) && !GetCurrentFirmware()->getCapability(HasBeeper)) {
QModelIndex index = b->model()->index(i, 0); QModelIndex index = b->model()->index(i, 0);
QVariant v(0); QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1); b->model()->setData(index, v, Qt::UserRole - 1);
} }
if ((i==FuncLogs) && !GetEepromInterface()->getCapability(HasSDLogs)) { if ((i==FuncLogs) && !GetCurrentFirmware()->getCapability(HasSDLogs)) {
QModelIndex index = b->model()->index(i, 0); QModelIndex index = b->model()->index(i, 0);
QVariant v(0); QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1); b->model()->setData(index, v, Qt::UserRole - 1);
@@ -640,7 +640,7 @@ void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, const ModelData & m
qs.append( QObject::tr("Timer2")); qs.append( QObject::tr("Timer2"));
qs.append( QObject::tr("All")); qs.append( QObject::tr("All"));
qs.append( QObject::tr("Telemetry")); qs.append( QObject::tr("Telemetry"));
int reCount = GetEepromInterface()->getCapability(RotaryEncoders); int reCount = GetCurrentFirmware()->getCapability(RotaryEncoders);
if (reCount == 1) { if (reCount == 1) {
qs.append( QObject::tr("Rotary Encoder")); qs.append( QObject::tr("Rotary Encoder"));
} }
+10 -10
View File
@@ -28,7 +28,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
ui->sideCB->setCurrentIndex(ed->mode-1); ui->sideCB->setCurrentIndex(ed->mode-1);
if (!GetEepromInterface()->getCapability(FlightPhases)) { if (!GetCurrentFirmware()->getCapability(FlightPhases)) {
ui->label_phases->hide(); ui->label_phases->hide();
for (int i=0; i<9; i++) { for (int i=0; i<9; i++) {
lb_fp[i]->hide(); lb_fp[i]->hide();
@@ -43,13 +43,13 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
} }
mask <<= 1; mask <<= 1;
} }
for (int i=GetEepromInterface()->getCapability(FlightPhases); i<9;i++) { for (int i=GetCurrentFirmware()->getCapability(FlightPhases); i<9;i++) {
lb_fp[i]->hide(); lb_fp[i]->hide();
cb_fp[i]->hide(); cb_fp[i]->hide();
} }
} }
if (GetEepromInterface()->getCapability(VirtualInputs)) { if (GetCurrentFirmware()->getCapability(VirtualInputs)) {
ui->inputName->setMaxLength(4); ui->inputName->setMaxLength(4);
populateSourceCB(ui->sourceCB, ed->srcRaw, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY); populateSourceCB(ui->sourceCB, ed->srcRaw, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
ui->sourceCB->removeItem(0); ui->sourceCB->removeItem(0);
@@ -69,7 +69,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
ui->trimCB->addItem(tr("Ail"), 4); ui->trimCB->addItem(tr("Ail"), 4);
ui->trimCB->setCurrentIndex(1 - ed->carryTrim); ui->trimCB->setCurrentIndex(1 - ed->carryTrim);
int expolength = GetEepromInterface()->getCapability(HasExpoNames); int expolength = GetCurrentFirmware()->getCapability(HasExpoNames);
if (!expolength) { if (!expolength) {
ui->lineNameLabel->hide(); ui->lineNameLabel->hide();
ui->lineName->hide(); ui->lineName->hide();
@@ -96,7 +96,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
for (int i=0; i<9; i++) { for (int i=0; i<9; i++) {
connect(cb_fp[i], SIGNAL(toggled(bool)), this, SLOT(valuesChanged())); connect(cb_fp[i], SIGNAL(toggled(bool)), this, SLOT(valuesChanged()));
} }
if (GetEepromInterface()->getCapability(VirtualInputs)) if (GetCurrentFirmware()->getCapability(VirtualInputs))
connect(ui->inputName, SIGNAL(editingFinished()), this, SLOT(valuesChanged())); connect(ui->inputName, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
QTimer::singleShot(0, this, SLOT(shrink())); QTimer::singleShot(0, this, SLOT(shrink()));
@@ -111,7 +111,7 @@ ExpoDialog::~ExpoDialog()
void ExpoDialog::updateScale() void ExpoDialog::updateScale()
{ {
if (GetEepromInterface()->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) { if (GetCurrentFirmware()->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) {
RawSourceRange range = ed->srcRaw.getRange(); RawSourceRange range = ed->srcRaw.getRange();
ui->scaleLabel->show(); ui->scaleLabel->show();
ui->scale->show(); ui->scale->show();
@@ -153,11 +153,11 @@ void ExpoDialog::valuesChanged()
ed->phases<<=1; ed->phases<<=1;
} }
ed->phases>>=1; ed->phases>>=1;
if (GetEepromInterface()->getCapability(FlightPhases)) { if (GetCurrentFirmware()->getCapability(FlightPhases)) {
int zeros=0; int zeros=0;
int ones=0; int ones=0;
int phtemp=ed->phases; int phtemp=ed->phases;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
if (phtemp & 1) { if (phtemp & 1) {
ones++; ones++;
} }
@@ -168,7 +168,7 @@ void ExpoDialog::valuesChanged()
} }
if (zeros==1) { if (zeros==1) {
phtemp=ed->phases; phtemp=ed->phases;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
if ((phtemp & 1)==0) { if ((phtemp & 1)==0) {
break; break;
} }
@@ -177,7 +177,7 @@ void ExpoDialog::valuesChanged()
} }
else if (ones==1) { else if (ones==1) {
phtemp=ed->phases; phtemp=ed->phases;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
if (phtemp & 1) { if (phtemp & 1) {
break; break;
} }
+15 -15
View File
@@ -10,19 +10,19 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
ui(new Ui::FlightMode), ui(new Ui::FlightMode),
phaseIdx(phaseIdx), phaseIdx(phaseIdx),
phase(model.phaseData[phaseIdx]), phase(model.phaseData[phaseIdx]),
reCount(GetEepromInterface()->getCapability(RotaryEncoders)), reCount(GetCurrentFirmware()->getCapability(RotaryEncoders)),
gvCount(((!GetEepromInterface()->getCapability(HasVariants)) || (GetCurrentFirmwareVariant() & GVARS_VARIANT)) ? gvCount(((!GetCurrentFirmware()->getCapability(HasVariants)) || (GetCurrentFirmwareVariant() & GVARS_VARIANT)) ?
GetEepromInterface()->getCapability(Gvars) : 0) GetCurrentFirmware()->getCapability(Gvars) : 0)
{ {
ui->setupUi(this); ui->setupUi(this);
int modesCount = GetEepromInterface()->getCapability(FlightPhases); int modesCount = GetCurrentFirmware()->getCapability(FlightPhases);
// Phase name // Phase name
QRegExp rx(CHAR_FOR_NAMES_REGEX); QRegExp rx(CHAR_FOR_NAMES_REGEX);
if (modesCount) { if (modesCount) {
ui->name->setValidator(new QRegExpValidator(rx, this)); ui->name->setValidator(new QRegExpValidator(rx, this));
ui->name->setMaxLength(GetEepromInterface()->getCapability(FlightModesName)); ui->name->setMaxLength(GetCurrentFirmware()->getCapability(FlightModesName));
connect(ui->name, SIGNAL(editingFinished()), this, SLOT(phaseName_editingFinished())); connect(ui->name, SIGNAL(editingFinished()), this, SLOT(phaseName_editingFinished()));
} }
else { else {
@@ -39,9 +39,9 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
} }
// FadeIn / FadeOut // FadeIn / FadeOut
if (GetEepromInterface()->getCapability(FlightPhasesHaveFades)) { if (GetCurrentFirmware()->getCapability(FlightPhasesHaveFades)) {
int scale = GetEepromInterface()->getCapability(SlowScale); int scale = GetCurrentFirmware()->getCapability(SlowScale);
int range = GetEepromInterface()->getCapability(SlowRange); int range = GetCurrentFirmware()->getCapability(SlowRange);
ui->fadeIn->setMaximum(float(range)/scale); ui->fadeIn->setMaximum(float(range)/scale);
ui->fadeIn->setSingleStep(1.0/scale); ui->fadeIn->setSingleStep(1.0/scale);
ui->fadeIn->setDecimals((scale==1 ? 0 :1) ); ui->fadeIn->setDecimals((scale==1 ? 0 :1) );
@@ -130,7 +130,7 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
label->setText(tr("GVAR%1").arg(i+1)); label->setText(tr("GVAR%1").arg(i+1));
gvLayout->addWidget(label, i, col++, 1, 1); gvLayout->addWidget(label, i, col++, 1, 1);
// GVar name // GVar name
int nameLen = GetEepromInterface()->getCapability(GvarsName); int nameLen = GetCurrentFirmware()->getCapability(GvarsName);
if (nameLen > 0) { if (nameLen > 0) {
gvNames[i] = new QLineEdit(ui->gvGB); gvNames[i] = new QLineEdit(ui->gvGB);
gvNames[i]->setProperty("index", i); gvNames[i]->setProperty("index", i);
@@ -183,12 +183,12 @@ void FlightMode::update()
{ {
ui->name->setText(phase.name); ui->name->setText(phase.name);
int scale = GetEepromInterface()->getCapability(SlowScale); int scale = GetCurrentFirmware()->getCapability(SlowScale);
ui->fadeIn->setValue(float(phase.fadeIn)/scale); ui->fadeIn->setValue(float(phase.fadeIn)/scale);
ui->fadeOut->setValue(float(phase.fadeOut)/scale); ui->fadeOut->setValue(float(phase.fadeOut)/scale);
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
int trimsMax = GetEepromInterface()->getCapability(ExtendedTrims); int trimsMax = GetCurrentFirmware()->getCapability(ExtendedTrims);
if (trimsMax == 0 || !model.extendedTrims) { if (trimsMax == 0 || !model.extendedTrims) {
trimsMax = 125; trimsMax = 125;
} }
@@ -249,7 +249,7 @@ void FlightMode::phaseSwitch_currentIndexChanged(int index)
void FlightMode::phaseFadeIn_editingFinished() void FlightMode::phaseFadeIn_editingFinished()
{ {
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender()); QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
int scale = GetEepromInterface()->getCapability(SlowScale); int scale = GetCurrentFirmware()->getCapability(SlowScale);
phase.fadeIn = round(spinBox->value()*scale); phase.fadeIn = round(spinBox->value()*scale);
emit modified(); emit modified();
} }
@@ -257,7 +257,7 @@ void FlightMode::phaseFadeIn_editingFinished()
void FlightMode::phaseFadeOut_editingFinished() void FlightMode::phaseFadeOut_editingFinished()
{ {
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender()); QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
int scale = GetEepromInterface()->getCapability(SlowScale); int scale = GetCurrentFirmware()->getCapability(SlowScale);
phase.fadeOut = round(spinBox->value()*scale); phase.fadeOut = round(spinBox->value()*scale);
emit modified(); emit modified();
} }
@@ -420,7 +420,7 @@ void FlightMode::phaseTrimSlider_valueChanged()
FlightModes::FlightModes(QWidget * parent, ModelData & model, GeneralSettings & generalSettings): FlightModes::FlightModes(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings), ModelPanel(parent, model, generalSettings),
modesCount(GetEepromInterface()->getCapability(FlightPhases)) modesCount(GetCurrentFirmware()->getCapability(FlightPhases))
{ {
QGridLayout * gridLayout = new QGridLayout(this); QGridLayout * gridLayout = new QGridLayout(this);
tabWidget = new QTabWidget(this); tabWidget = new QTabWidget(this);
@@ -449,7 +449,7 @@ QString FlightModes::getTabName(int index)
{ {
QString result = tr("Flight Mode %1").arg(index); QString result = tr("Flight Mode %1").arg(index);
const char *name = model.phaseData[index].name; const char *name = model.phaseData[index].name;
if (GetEepromInterface()->getCapability(FlightModesName) && strlen(name) > 0) { if (GetCurrentFirmware()->getCapability(FlightModesName) && strlen(name) > 0) {
result += tr(" (%1)").arg(name); result += tr(" (%1)").arg(name);
} }
else if (index == 0) { else if (index == 0) {
+7 -7
View File
@@ -47,7 +47,7 @@ void InputsPanel::update()
{ {
lock = true; lock = true;
int inputsCount = GetEepromInterface()->getCapability(VirtualInputs); int inputsCount = GetCurrentFirmware()->getCapability(VirtualInputs);
if (inputsCount == 0) if (inputsCount == 0)
inputsCount = NUM_STICKS; inputsCount = NUM_STICKS;
@@ -75,20 +75,20 @@ void InputsPanel::update()
} }
if (curDest!=(int)md->chn) { if (curDest!=(int)md->chn) {
if (GetEepromInterface()->getCapability(VirtualInputs)) if (GetCurrentFirmware()->getCapability(VirtualInputs))
str = QString("%1").arg(getInputStr(model, md->chn), -8, ' '); str = QString("%1").arg(getInputStr(model, md->chn), -8, ' ');
else else
str = getInputStr(model, md->chn); str = getInputStr(model, md->chn);
curDest = md->chn; curDest = md->chn;
} }
else { else {
if (GetEepromInterface()->getCapability(VirtualInputs)) if (GetCurrentFirmware()->getCapability(VirtualInputs))
str = " "; str = " ";
else else
str = " "; str = " ";
} }
if (GetEepromInterface()->getCapability(VirtualInputs)) { if (GetCurrentFirmware()->getCapability(VirtualInputs)) {
str += " " + tr("Source(%1)").arg(md->srcRaw.toString()); str += " " + tr("Source(%1)").arg(md->srcRaw.toString());
if (md->carryTrim>0) { if (md->carryTrim>0) {
str += " " + tr("No Trim"); str += " " + tr("No Trim");
@@ -113,7 +113,7 @@ void InputsPanel::update()
if (md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch(%1)").arg(md->swtch.toString()); if (md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch(%1)").arg(md->swtch.toString());
if (GetEepromInterface()->getCapability(HasExpoNames)) { if (GetCurrentFirmware()->getCapability(HasExpoNames)) {
QString expoName = md->name; QString expoName = md->name;
if (!expoName.isEmpty()) str += QString(" [%1]").arg(expoName); if (!expoName.isEmpty()) str += QString(" [%1]").arg(expoName);
} }
@@ -171,13 +171,13 @@ void InputsPanel::gm_openExpo(int index)
emit modified(); emit modified();
update(); update();
if (GetEepromInterface()->getCapability(VirtualInputs)) if (GetCurrentFirmware()->getCapability(VirtualInputs))
strcpy(inputName, model.inputNames[mixd.chn]); strcpy(inputName, model.inputNames[mixd.chn]);
ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings, inputName); ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings, inputName);
if (g->exec()) { if (g->exec()) {
model.expoData[index] = mixd; model.expoData[index] = mixd;
if (GetEepromInterface()->getCapability(VirtualInputs)) if (GetCurrentFirmware()->getCapability(VirtualInputs))
strcpy(model.inputNames[mixd.chn], inputName); strcpy(model.inputNames[mixd.chn], inputName);
emit modified(); emit modified();
update(); update();
+9 -9
View File
@@ -18,13 +18,13 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
addLabel(gridLayout, tr("V1"), col++); addLabel(gridLayout, tr("V1"), col++);
addLabel(gridLayout, tr("V2"), col++); addLabel(gridLayout, tr("V2"), col++);
addLabel(gridLayout, tr("AND Switch"), col++); addLabel(gridLayout, tr("AND Switch"), col++);
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) { if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
addLabel(gridLayout, tr("Duration"), col++); addLabel(gridLayout, tr("Duration"), col++);
addLabel(gridLayout, tr("Delay"), col++); addLabel(gridLayout, tr("Delay"), col++);
} }
lock = true; lock = true;
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
// The label // The label
QLabel * label = new QLabel(this); QLabel * label = new QLabel(this);
label->setProperty("index", i); label->setProperty("index", i);
@@ -90,7 +90,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int))); connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int)));
gridLayout->addWidget(cswitchAnd[i], i+1, 4); gridLayout->addWidget(cswitchAnd[i], i+1, 4);
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) { if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
// Duration // Duration
cswitchDuration[i] = new QDoubleSpinBox(this); cswitchDuration[i] = new QDoubleSpinBox(this);
cswitchDuration[i]->setProperty("index", i); cswitchDuration[i]->setProperty("index", i);
@@ -115,7 +115,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
} }
} }
// Push rows upward // Push rows upward
addVSpring(gridLayout,0,GetEepromInterface()->getCapability(LogicalSwitches)+1); addVSpring(gridLayout,0,GetCurrentFirmware()->getCapability(LogicalSwitches)+1);
lock = false; lock = false;
} }
@@ -276,7 +276,7 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
{ {
case LS_FAMILY_VOFS: case LS_FAMILY_VOFS:
mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE; mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE;
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0)); populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetCurrentFirmware()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
cswitchOffset[i]->setDecimals(range.decimals); cswitchOffset[i]->setDecimals(range.decimals);
cswitchOffset[i]->setSingleStep(range.step); cswitchOffset[i]->setSingleStep(range.step);
if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) { if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
@@ -304,8 +304,8 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
break; break;
case LS_FAMILY_VCOMP: case LS_FAMILY_VCOMP:
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE; mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0)); populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetCurrentFirmware()->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)); populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetCurrentFirmware()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
break; break;
case LS_FAMILY_TIMER: case LS_FAMILY_TIMER:
mask |= VALUE1_VISIBLE | VALUE2_VISIBLE; mask |= VALUE1_VISIBLE | VALUE2_VISIBLE;
@@ -331,7 +331,7 @@ void LogicalSwitchesPanel::updateLine(int i)
setSwitchWidgetVisibility(i); setSwitchWidgetVisibility(i);
lock = true; lock = true;
populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw)); populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw));
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) { if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
cswitchDuration[i]->setValue(model.customSw[i].duration/10.0); cswitchDuration[i]->setValue(model.customSw[i].duration/10.0);
cswitchDelay[i]->setValue(model.customSw[i].delay/10.0); cswitchDelay[i]->setValue(model.customSw[i].delay/10.0);
} }
@@ -340,7 +340,7 @@ void LogicalSwitchesPanel::updateLine(int i)
void LogicalSwitchesPanel::update() void LogicalSwitchesPanel::update()
{ {
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
updateLine(i); updateLine(i);
} }
} }
+10 -10
View File
@@ -21,7 +21,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
populateSourceCB(ui->sourceCB, md->srcRaw, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS); populateSourceCB(ui->sourceCB, md->srcRaw, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
ui->sourceCB->removeItem(0); ui->sourceCB->removeItem(0);
int limit = GetEepromInterface()->getCapability(OffsetWeight); int limit = GetCurrentFirmware()->getCapability(OffsetWeight);
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, 100, -limit, limit); 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); gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, 0, -limit, limit);
@@ -29,12 +29,12 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
ui->MixDR_CB->setChecked(md->noExpo==0); ui->MixDR_CB->setChecked(md->noExpo==0);
if (GetEepromInterface()->getCapability(VirtualInputs) || !GetEepromInterface()->getCapability(MixesWithoutExpo)) { if (GetCurrentFirmware()->getCapability(VirtualInputs) || !GetCurrentFirmware()->getCapability(MixesWithoutExpo)) {
ui->MixDR_CB->hide(); ui->MixDR_CB->hide();
ui->label_MixDR->hide(); ui->label_MixDR->hide();
} }
if (!GetEepromInterface()->getCapability(VirtualInputs)) { if (!GetCurrentFirmware()->getCapability(VirtualInputs)) {
ui->trimCB->addItem(tr("Rud")); ui->trimCB->addItem(tr("Rud"));
ui->trimCB->addItem(tr("Ele")); ui->trimCB->addItem(tr("Ele"));
ui->trimCB->addItem(tr("Thr")); ui->trimCB->addItem(tr("Thr"));
@@ -43,7 +43,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
ui->trimCB->setCurrentIndex(1 - md->carryTrim); ui->trimCB->setCurrentIndex(1 - md->carryTrim);
int namelength = GetEepromInterface()->getCapability(HasMixerNames); int namelength = GetCurrentFirmware()->getCapability(HasMixerNames);
if (!namelength) { if (!namelength) {
ui->label_name->hide(); ui->label_name->hide();
ui->mixerName->hide(); ui->mixerName->hide();
@@ -54,7 +54,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
ui->mixerName->setValidator(new QRegExpValidator(rx, this)); ui->mixerName->setValidator(new QRegExpValidator(rx, this));
ui->mixerName->setText(md->name); ui->mixerName->setText(md->name);
if (!GetEepromInterface()->getCapability(FlightPhases)) { if (!GetCurrentFirmware()->getCapability(FlightPhases)) {
ui->label_phases->hide(); ui->label_phases->hide();
for (int i=0; i<9; i++) { for (int i=0; i<9; i++) {
lb_fp[i]->hide(); lb_fp[i]->hide();
@@ -69,7 +69,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
} }
mask <<= 1; mask <<= 1;
} }
for (int i=GetEepromInterface()->getCapability(FlightPhases); i<9;i++) { for (int i=GetCurrentFirmware()->getCapability(FlightPhases); i<9;i++) {
lb_fp[i]->hide(); lb_fp[i]->hide();
cb_fp[i]->hide(); cb_fp[i]->hide();
} }
@@ -78,8 +78,8 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
populateSwitchCB(ui->switchesCB, md->swtch, generalSettings); populateSwitchCB(ui->switchesCB, md->swtch, generalSettings);
ui->warningCB->setCurrentIndex(md->mixWarn); ui->warningCB->setCurrentIndex(md->mixWarn);
ui->mltpxCB->setCurrentIndex(md->mltpx); ui->mltpxCB->setCurrentIndex(md->mltpx);
int scale=GetEepromInterface()->getCapability(SlowScale); int scale=GetCurrentFirmware()->getCapability(SlowScale);
float range=GetEepromInterface()->getCapability(SlowRange); float range=GetCurrentFirmware()->getCapability(SlowRange);
ui->slowDownSB->setMaximum(range/scale); ui->slowDownSB->setMaximum(range/scale);
ui->slowDownSB->setSingleStep(1.0/scale); ui->slowDownSB->setSingleStep(1.0/scale);
ui->slowDownSB->setDecimals((scale==1 ? 0 :1)); ui->slowDownSB->setDecimals((scale==1 ? 0 :1));
@@ -142,7 +142,7 @@ void MixerDialog::valuesChanged()
lock = true; 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 }; 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); md->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt(), &model);
if (!GetEepromInterface()->getCapability(VirtualInputs) && GetEepromInterface()->getCapability(MixesWithoutExpo)) { if (!GetCurrentFirmware()->getCapability(VirtualInputs) && GetCurrentFirmware()->getCapability(MixesWithoutExpo)) {
bool drVisible = (md->srcRaw.type == SOURCE_TYPE_STICK && md->srcRaw.index < NUM_STICKS); bool drVisible = (md->srcRaw.type == SOURCE_TYPE_STICK && md->srcRaw.index < NUM_STICKS);
ui->MixDR_CB->setEnabled(drVisible); ui->MixDR_CB->setEnabled(drVisible);
ui->label_MixDR->setEnabled(drVisible); ui->label_MixDR->setEnabled(drVisible);
@@ -152,7 +152,7 @@ void MixerDialog::valuesChanged()
md->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt()); md->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
md->mixWarn = ui->warningCB->currentIndex(); md->mixWarn = ui->warningCB->currentIndex();
md->mltpx = (MltpxValue)ui->mltpxCB->currentIndex(); md->mltpx = (MltpxValue)ui->mltpxCB->currentIndex();
int scale=GetEepromInterface()->getCapability(SlowScale); int scale=GetCurrentFirmware()->getCapability(SlowScale);
md->delayDown = round(ui->delayDownSB->value()*scale); md->delayDown = round(ui->delayDownSB->value()*scale);
md->delayUp = round(ui->delayUpSB->value()*scale); md->delayUp = round(ui->delayUpSB->value()*scale);
md->speedDown = round(ui->slowDownSB->value()*scale); md->speedDown = round(ui->slowDownSB->value()*scale);
+17 -17
View File
@@ -46,10 +46,10 @@ MixesPanel::~MixesPanel()
QString MixesPanel::getChannelLabel(int curDest) QString MixesPanel::getChannelLabel(int curDest)
{ {
QString str; QString str;
int outputs = GetEepromInterface()->getCapability(Outputs);
str = QObject::tr("CH%1").arg(curDest); str = QObject::tr("CH%1").arg(curDest);
// TODO not nice, Qt brings a function for that, I don't remember right now
(str.length() < 4) ? str.append(" ") : str.append(" "); (str.length() < 4) ? str.append(" ") : str.append(" ");
if (GetEepromInterface()->getCapability(HasChNames)) { if (GetCurrentFirmware()->getCapability(HasChNames)) {
QString name = model.limitData[curDest-1].name; QString name = model.limitData[curDest-1].name;
if (!name.isEmpty()) { if (!name.isEmpty()) {
name = QString("(") + name + QString(")"); name = QString("(") + name + QString(")");
@@ -68,9 +68,9 @@ void MixesPanel::update()
MixerlistWidget->clear(); MixerlistWidget->clear();
unsigned int curDest = 0; unsigned int curDest = 0;
int i; int i;
unsigned int outputs = GetEepromInterface()->getCapability(Outputs); unsigned int outputs = GetCurrentFirmware()->getCapability(Outputs);
for (i=0; i<GetEepromInterface()->getCapability(Mixes); i++) { for (i=0; i<GetCurrentFirmware()->getCapability(Mixes); i++) {
MixData *md = &model.mixData[i]; MixData *md = &model.mixData[i];
// qDebug() << "md->destCh: " << md->destCh; // qDebug() << "md->destCh: " << md->destCh;
if (md->destCh==0 || md->destCh>outputs) continue; if (md->destCh==0 || md->destCh>outputs) continue;
@@ -185,7 +185,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
if (md->sOffset) str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(md->sOffset))); if (md->sOffset) str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(md->sOffset)));
if (md->curve.value) str += " " + Qt::escape(md->curve.toString()); if (md->curve.value) str += " " + Qt::escape(md->curve.toString());
int scale = GetEepromInterface()->getCapability(SlowScale); int scale = GetCurrentFirmware()->getCapability(SlowScale);
if (scale == 0) if (scale == 0)
scale = 1; scale = 1;
if (md->delayDown || md->delayUp) if (md->delayDown || md->delayUp)
@@ -193,7 +193,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
if (md->speedDown || md->speedUp) if (md->speedDown || md->speedUp)
str += Qt::escape(tr(" Slow(u%1:d%2)").arg((double)md->speedUp/scale).arg((double)md->speedDown/scale)); str += Qt::escape(tr(" Slow(u%1:d%2)").arg((double)md->speedUp/scale).arg((double)md->speedDown/scale));
if (md->mixWarn) str += Qt::escape(tr(" Warn(%1)").arg(md->mixWarn)); if (md->mixWarn) str += Qt::escape(tr(" Warn(%1)").arg(md->mixWarn));
if (GetEepromInterface()->getCapability(HasMixerNames)) { if (GetCurrentFirmware()->getCapability(HasMixerNames)) {
QString MixerName; QString MixerName;
MixerName.append(md->name); MixerName.append(md->name);
if (!MixerName.isEmpty()) { if (!MixerName.isEmpty()) {
@@ -206,14 +206,14 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
bool MixesPanel::gm_insertMix(int idx) bool MixesPanel::gm_insertMix(int idx)
{ {
if (idx<0 || idx>=GetEepromInterface()->getCapability(Mixes) || model.mixData[GetEepromInterface()->getCapability(Mixes)-1].destCh > 0) { if (idx<0 || idx>=GetCurrentFirmware()->getCapability(Mixes) || model.mixData[GetCurrentFirmware()->getCapability(Mixes)-1].destCh > 0) {
QMessageBox::information(this, "companion", tr("Not enough available mixers!")); QMessageBox::information(this, "companion", tr("Not enough available mixers!"));
return false; return false;
} }
int i = model.mixData[idx].destCh; int i = model.mixData[idx].destCh;
memmove(&model.mixData[idx+1],&model.mixData[idx], memmove(&model.mixData[idx+1],&model.mixData[idx],
(GetEepromInterface()->getCapability(Mixes)-(idx+1))*sizeof(MixData) ); (GetCurrentFirmware()->getCapability(Mixes)-(idx+1))*sizeof(MixData) );
memset(&model.mixData[idx],0,sizeof(MixData)); memset(&model.mixData[idx],0,sizeof(MixData));
model.mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE); model.mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE);
model.mixData[idx].destCh = i; model.mixData[idx].destCh = i;
@@ -224,13 +224,13 @@ bool MixesPanel::gm_insertMix(int idx)
void MixesPanel::gm_deleteMix(int index) void MixesPanel::gm_deleteMix(int index)
{ {
memmove(&model.mixData[index],&model.mixData[index+1], memmove(&model.mixData[index],&model.mixData[index+1],
(GetEepromInterface()->getCapability(Mixes)-(index+1))*sizeof(MixData)); (GetCurrentFirmware()->getCapability(Mixes)-(index+1))*sizeof(MixData));
memset(&model.mixData[GetEepromInterface()->getCapability(Mixes)-1],0,sizeof(MixData)); memset(&model.mixData[GetCurrentFirmware()->getCapability(Mixes)-1],0,sizeof(MixData));
} }
void MixesPanel::gm_openMix(int index) void MixesPanel::gm_openMix(int index)
{ {
if(index<0 || index>=GetEepromInterface()->getCapability(Mixes)) return; if(index<0 || index>=GetCurrentFirmware()->getCapability(Mixes)) return;
MixData mixd(model.mixData[index]); MixData mixd(model.mixData[index]);
emit modified(); emit modified();
@@ -254,8 +254,8 @@ void MixesPanel::gm_openMix(int index)
int MixesPanel::getMixerIndex(unsigned int dch) int MixesPanel::getMixerIndex(unsigned int dch)
{ {
int i = 0; int i = 0;
while ((model.mixData[i].destCh<=dch) && (model.mixData[i].destCh) && (i<GetEepromInterface()->getCapability(Mixes))) i++; while ((model.mixData[i].destCh<=dch) && (model.mixData[i].destCh) && (i<GetCurrentFirmware()->getCapability(Mixes))) i++;
if(i==GetEepromInterface()->getCapability(Mixes)) return -1; if(i==GetCurrentFirmware()->getCapability(Mixes)) return -1;
return i; return i;
} }
@@ -291,7 +291,7 @@ QList<int> MixesPanel::createMixListFromSelected()
QList<int> list; QList<int> list;
foreach(QListWidgetItem *item, MixerlistWidget->selectedItems()) { foreach(QListWidgetItem *item, MixerlistWidget->selectedItems()) {
int idx= item->data(Qt::UserRole).toByteArray().at(0); int idx= item->data(Qt::UserRole).toByteArray().at(0);
if(idx>=0 && idx<GetEepromInterface()->getCapability(Mixes)) list << idx; if(idx>=0 && idx<GetCurrentFirmware()->getCapability(Mixes)) list << idx;
} }
return list; return list;
} }
@@ -364,7 +364,7 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
int i = 0; int i = 0;
while(i<mxData.size()) { while(i<mxData.size()) {
idx++; idx++;
if(idx==GetEepromInterface()->getCapability(Mixes)) break; if(idx==GetCurrentFirmware()->getCapability(Mixes)) break;
if (!gm_insertMix(idx)) if (!gm_insertMix(idx))
break; break;
@@ -510,7 +510,7 @@ void MixesPanel::mixerlistWidget_KeyPress(QKeyEvent *event)
int MixesPanel::gm_moveMix(int idx, bool dir) //true=inc=down false=dec=up int MixesPanel::gm_moveMix(int idx, bool dir) //true=inc=down false=dec=up
{ {
if(idx>GetEepromInterface()->getCapability(Mixes) || (idx==GetEepromInterface()->getCapability(Mixes) && dir)) return idx; if(idx>GetCurrentFirmware()->getCapability(Mixes) || (idx==GetCurrentFirmware()->getCapability(Mixes) && dir)) return idx;
int tdx = dir ? idx+1 : idx-1; int tdx = dir ? idx+1 : idx-1;
MixData &src=model.mixData[idx]; MixData &src=model.mixData[idx];
@@ -519,7 +519,7 @@ int MixesPanel::gm_moveMix(int idx, bool dir) //true=inc=down false=dec=up
if (src.destCh == 1 && !dir) if (src.destCh == 1 && !dir)
return idx; return idx;
unsigned int outputs = GetEepromInterface()->getCapability(Outputs); unsigned int outputs = GetCurrentFirmware()->getCapability(Outputs);
if((src.destCh==0) || (src.destCh>outputs) || (tgt.destCh>outputs)) return idx; if((src.destCh==0) || (src.destCh>outputs) || (tgt.destCh>outputs)) return idx;
if (tgt.destCh!=src.destCh) { if (tgt.destCh!=src.destCh) {
+2 -2
View File
@@ -35,9 +35,9 @@ ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool i
addTab(chnPanel, tr("Servos")); addTab(chnPanel, tr("Servos"));
addTab(new Curves(this, model, generalSettings), tr("Curves")); addTab(new Curves(this, model, generalSettings), tr("Curves"));
addTab(new LogicalSwitchesPanel(this, model, generalSettings), tr("Logical Switches")); addTab(new LogicalSwitchesPanel(this, model, generalSettings), tr("Logical Switches"));
if (GetEepromInterface()->getCapability(CustomFunctions)) if (GetCurrentFirmware()->getCapability(CustomFunctions))
addTab(new CustomFunctionsPanel(this, model, generalSettings), tr("Special Functions")); addTab(new CustomFunctionsPanel(this, model, generalSettings), tr("Special Functions"));
if (GetEepromInterface()->getCapability(Telemetry) & TM_HASTELEMETRY) if (GetCurrentFirmware()->getCapability(Telemetry) & TM_HASTELEMETRY)
addTab(new TelemetryPanel(this, model, generalSettings), tr("Telemetry")); addTab(new TelemetryPanel(this, model, generalSettings), tr("Telemetry"));
connect(setupPanel, SIGNAL(extendedLimitsToggled()), chnPanel, SLOT(refreshExtendedLimits())); connect(setupPanel, SIGNAL(extendedLimitsToggled()), chnPanel, SLOT(refreshExtendedLimits()));
+17 -17
View File
@@ -17,7 +17,7 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge
// Mode // Mode
populateSwitchCB(ui->mode, timer.mode, generalSettings, POPULATE_TIMER_MODES); populateSwitchCB(ui->mode, timer.mode, generalSettings, POPULATE_TIMER_MODES);
if (!GetEepromInterface()->getCapability(PermTimers)) { if (!GetCurrentFirmware()->getCapability(PermTimers)) {
ui->persistent->hide(); ui->persistent->hide();
ui->persistentValue->hide(); ui->persistentValue->hide();
} }
@@ -41,7 +41,7 @@ void TimerPanel::update()
int sec = timer.val % 60; int sec = timer.val % 60;
ui->value->setTime(QTime(0, min, sec)); ui->value->setTime(QTime(0, min, sec));
if (GetEepromInterface()->getCapability(PermTimers)) { if (GetCurrentFirmware()->getCapability(PermTimers)) {
int sign = 1; int sign = 1;
int pvalue = timer.pvalue; int pvalue = timer.pvalue;
if (pvalue < 0) { if (pvalue < 0) {
@@ -112,7 +112,7 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
else { else {
ui->label_trainerMode->hide(); ui->label_trainerMode->hide();
ui->trainerMode->hide(); ui->trainerMode->hide();
if (GetEepromInterface()->getCapability(NumModules) > 1) { if (GetCurrentFirmware()->getCapability(NumModules) > 1) {
if (moduleIdx == 0) if (moduleIdx == 0)
label = tr("Internal Radio System"); label = tr("Internal Radio System");
else else
@@ -132,7 +132,7 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
} }
} }
if (GetEepromInterface()->getCapability(HasFailsafe)) { if (GetCurrentFirmware()->getCapability(HasFailsafe)) {
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
QLabel * label = new QLabel(this); QLabel * label = new QLabel(this);
label->setText(QString::number(i+1)); label->setText(QString::number(i+1));
@@ -211,7 +211,7 @@ void ModulePanel::update()
ui->channelsCount->setVisible(mask & MASK_CHANNELS_RANGE); ui->channelsCount->setVisible(mask & MASK_CHANNELS_RANGE);
ui->channelsCount->setEnabled(mask & MASK_CHANNELS_COUNT); ui->channelsCount->setEnabled(mask & MASK_CHANNELS_COUNT);
ui->channelsCount->setValue(module.channelsCount); ui->channelsCount->setValue(module.channelsCount);
ui->channelsCount->setSingleStep(GetEepromInterface()->getCapability(HasPPMStart) ? 1 : 2); ui->channelsCount->setSingleStep(GetCurrentFirmware()->getCapability(HasPPMStart) ? 1 : 2);
// PPM settings fields // PPM settings fields
ui->label_ppmPolarity->setVisible(mask & MASK_PPM_FIELDS); ui->label_ppmPolarity->setVisible(mask & MASK_PPM_FIELDS);
@@ -223,10 +223,10 @@ void ModulePanel::update()
ui->label_ppmFrameLength->setVisible(mask & MASK_PPM_FIELDS); ui->label_ppmFrameLength->setVisible(mask & MASK_PPM_FIELDS);
ui->ppmFrameLength->setVisible(mask & MASK_PPM_FIELDS); ui->ppmFrameLength->setVisible(mask & MASK_PPM_FIELDS);
ui->ppmFrameLength->setMinimum(module.channelsCount*(model.extendedLimits ? 2.250 :2)+3.5); ui->ppmFrameLength->setMinimum(module.channelsCount*(model.extendedLimits ? 2.250 :2)+3.5);
ui->ppmFrameLength->setMaximum(GetEepromInterface()->getCapability(PPMFrameLength)); ui->ppmFrameLength->setMaximum(GetCurrentFirmware()->getCapability(PPMFrameLength));
ui->ppmFrameLength->setValue(22.5+((double)module.ppmFrameLength)*0.5); ui->ppmFrameLength->setValue(22.5+((double)module.ppmFrameLength)*0.5);
if (GetEepromInterface()->getCapability(HasFailsafe)) { if (GetCurrentFirmware()->getCapability(HasFailsafe)) {
ui->label_failsafeMode->setVisible(mask & MASK_FAILSAFES); ui->label_failsafeMode->setVisible(mask & MASK_FAILSAFES);
ui->failsafeMode->setVisible(mask & MASK_FAILSAFES); ui->failsafeMode->setVisible(mask & MASK_FAILSAFES);
ui->failsafeMode->setCurrentIndex(module.failsafeMode); ui->failsafeMode->setCurrentIndex(module.failsafeMode);
@@ -341,18 +341,18 @@ Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettin
connect(timers[i], SIGNAL(modified()), this, SLOT(onChildModified())); connect(timers[i], SIGNAL(modified()), this, SLOT(onChildModified()));
} }
for (int i=0; i<GetEepromInterface()->getCapability(NumModules); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(NumModules); i++) {
modules[i] = new ModulePanel(this, model, model.moduleData[i], generalSettings, i); modules[i] = new ModulePanel(this, model, model.moduleData[i], generalSettings, i);
ui->modulesLayout->addWidget(modules[i]); ui->modulesLayout->addWidget(modules[i]);
connect(modules[i], SIGNAL(modified()), this, SLOT(onChildModified())); connect(modules[i], SIGNAL(modified()), this, SLOT(onChildModified()));
} }
if (GetEepromInterface()->getCapability(ModelTrainerEnable)) { if (GetCurrentFirmware()->getCapability(ModelTrainerEnable)) {
modules[C9X_NUM_MODULES] = new ModulePanel(this, model, model.moduleData[C9X_NUM_MODULES], generalSettings, -1); modules[C9X_NUM_MODULES] = new ModulePanel(this, model, model.moduleData[C9X_NUM_MODULES], generalSettings, -1);
ui->modulesLayout->addWidget(modules[C9X_NUM_MODULES]); ui->modulesLayout->addWidget(modules[C9X_NUM_MODULES]);
} }
if (GetEepromInterface()->getCapability(ModelImage)) { if (GetCurrentFirmware()->getCapability(ModelImage)) {
QStringList items; QStringList items;
items.append(""); items.append("");
QString path = g.profile[g.id()].sdPath(); QString path = g.profile[g.id()].sdPath();
@@ -399,13 +399,13 @@ Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettin
ui->imagePreview->hide(); ui->imagePreview->hide();
} }
if (!GetEepromInterface()->getCapability(HasDisplayText)) { if (!GetCurrentFirmware()->getCapability(HasDisplayText)) {
ui->displayText->hide(); ui->displayText->hide();
} }
// Beep Center checkboxes // Beep Center checkboxes
int analogs = 4 + GetEepromInterface()->getCapability(Pots); int analogs = 4 + GetCurrentFirmware()->getCapability(Pots);
for (int i=0; i<analogs+GetEepromInterface()->getCapability(RotaryEncoders); i++) { for (int i=0; i<analogs+GetCurrentFirmware()->getCapability(RotaryEncoders); i++) {
QCheckBox * checkbox = new QCheckBox(this); QCheckBox * checkbox = new QCheckBox(this);
checkbox->setProperty("index", i); checkbox->setProperty("index", i);
checkbox->setText(i<analogs ? AnalogString(i) : RotaryEncoderString(i-analogs)); checkbox->setText(i<analogs ? AnalogString(i) : RotaryEncoderString(i-analogs));
@@ -415,7 +415,7 @@ Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettin
} }
// Startup switches warnings // Startup switches warnings
for (int i=0; i<GetEepromInterface()->getCapability(Switches)-1; i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(Switches)-1; i++) {
QLabel * label = new QLabel(this); QLabel * label = new QLabel(this);
QSlider * slider = new QSlider(this); QSlider * slider = new QSlider(this);
QCheckBox * cb = new QCheckBox(this); QCheckBox * cb = new QCheckBox(this);
@@ -449,11 +449,11 @@ Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettin
startupSwitchesSliders << slider; startupSwitchesSliders << slider;
startupSwitchesCheckboxes << cb; startupSwitchesCheckboxes << cb;
} }
ui->switchesStartupLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, GetEepromInterface()->getCapability(Switches)); ui->switchesStartupLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, GetCurrentFirmware()->getCapability(Switches));
// Pot warnings // Pot warnings
if(IS_TARANIS(GetEepromInterface()->getBoard())) { if(IS_TARANIS(GetEepromInterface()->getBoard())) {
for (int i=0; i<GetEepromInterface()->getCapability(Pots); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(Pots); i++) {
QCheckBox * cb = new QCheckBox(this); QCheckBox * cb = new QCheckBox(this);
cb->setProperty("index", i+1); cb->setProperty("index", i+1);
cb->setText(AnalogString(i+4)); cb->setText(AnalogString(i+4));
@@ -628,7 +628,7 @@ void Setup::updateStartupSwitches()
unsigned int switchStates = model.switchWarningStates; unsigned int switchStates = model.switchWarningStates;
for (int i=0; i<GetEepromInterface()->getCapability(Switches)-1; i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(Switches)-1; i++) {
QSlider * slider = startupSwitchesSliders[i]; QSlider * slider = startupSwitchesSliders[i];
QCheckBox * cb = startupSwitchesCheckboxes[i]; QCheckBox * cb = startupSwitchesCheckboxes[i];
bool enabled = !(model.nSwToWarn & (1 << i)); bool enabled = !(model.nSwToWarn & (1 << i));
+19 -19
View File
@@ -17,11 +17,11 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
if (analog.type==0 || analog.type==1 || analog.type==2) { if (analog.type==0 || analog.type==1 || analog.type==2) {
ui->RatioSB->setDecimals(1); ui->RatioSB->setDecimals(1);
ui->RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier)); ui->RatioSB->setMaximum(25.5*GetCurrentFirmware()->getCapability(TelemetryMaxMultiplier));
} }
else { else {
ui->RatioSB->setDecimals(0); ui->RatioSB->setDecimals(0);
ui->RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier)); ui->RatioSB->setMaximum(255*GetCurrentFirmware()->getCapability(TelemetryMaxMultiplier));
} }
ui->RatioSB->setValue(ratio); ui->RatioSB->setValue(ratio);
@@ -43,7 +43,7 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
ui->alarm2Label->setText(tr("Critical Alarm")); ui->alarm2Label->setText(tr("Critical Alarm"));
} }
if (!(GetEepromInterface()->getCapability(Telemetry) & TM_HASOFFSET)) { if (!(GetCurrentFirmware()->getCapability(Telemetry) & TM_HASOFFSET)) {
ui->CalibSB->hide(); ui->CalibSB->hide();
ui->CalibLabel->hide(); ui->CalibLabel->hide();
} }
@@ -87,11 +87,11 @@ void TelemetryAnalog::on_UnitCB_currentIndexChanged(int index)
case 1: case 1:
case 2: case 2:
ui->RatioSB->setDecimals(1); ui->RatioSB->setDecimals(1);
ui->RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier)); ui->RatioSB->setMaximum(25.5*GetCurrentFirmware()->getCapability(TelemetryMaxMultiplier));
break; break;
default: default:
ui->RatioSB->setDecimals(0); ui->RatioSB->setDecimals(0);
ui->RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier)); ui->RatioSB->setMaximum(255*GetCurrentFirmware()->getCapability(TelemetryMaxMultiplier));
break; break;
} }
ui->RatioSB->setValue(ratio); ui->RatioSB->setValue(ratio);
@@ -288,7 +288,7 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
ui->setupUi(this); ui->setupUi(this);
for (int l=0; l<4; l++) { for (int l=0; l<4; l++) {
for (int c=0; c<GetEepromInterface()->getCapability(TelemetryCustomScreensFieldsPerLine); c++) { for (int c=0; c<GetCurrentFirmware()->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
fieldsCB[l][c] = new QComboBox(this); fieldsCB[l][c] = new QComboBox(this);
fieldsCB[l][c]->setProperty("index", c + (l<<8)); fieldsCB[l][c]->setProperty("index", c + (l<<8));
populateTelemetrySourceCB(fieldsCB[l][c], screen.body.lines[l].source[c], l==3, model.frsky.usrProto); populateTelemetrySourceCB(fieldsCB[l][c], screen.body.lines[l].source[c], l==3, model.frsky.usrProto);
@@ -366,7 +366,7 @@ void TelemetryCustomScreen::update()
if (screen.type == 0) { if (screen.type == 0) {
for (int l=0; l<4; l++) { for (int l=0; l<4; l++) {
for (int c=0; c<GetEepromInterface()->getCapability(TelemetryCustomScreensFieldsPerLine); c++) { for (int c=0; c<GetCurrentFirmware()->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
fieldsCB[l][c]->setCurrentIndex(screen.body.lines[l].source[c]); fieldsCB[l][c]->setCurrentIndex(screen.body.lines[l].source[c]);
} }
} }
@@ -471,7 +471,7 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
{ {
ui->setupUi(this); ui->setupUi(this);
if (GetEepromInterface()->getCapability(NoTelemetryProtocol)) { if (GetCurrentFirmware()->getCapability(NoTelemetryProtocol)) {
model.frsky.usrProto = 1; model.frsky.usrProto = 1;
} }
@@ -483,7 +483,7 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
ui->A2Layout->addWidget(analogs[1]); ui->A2Layout->addWidget(analogs[1]);
connect(analogs[1], SIGNAL(modified()), this, SLOT(onAnalogModified())); connect(analogs[1], SIGNAL(modified()), this, SLOT(onAnalogModified()));
for (int i=0; i<GetEepromInterface()->getCapability(TelemetryCustomScreens); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(TelemetryCustomScreens); i++) {
TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i], generalSettings); TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i], generalSettings);
ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1)); ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1));
} }
@@ -508,7 +508,7 @@ void TelemetryPanel::setup()
lock=true; lock=true;
//frsky Settings //frsky Settings
if (!GetEepromInterface()->getCapability(TelemetryRSSIModel) ) { if (!GetCurrentFirmware()->getCapability(TelemetryRSSIModel) ) {
ui->RSSIGB->hide(); ui->RSSIGB->hide();
} }
ui->rssiAlarm1SB->setValue(model.frsky.rssiAlarms[0].value); ui->rssiAlarm1SB->setValue(model.frsky.rssiAlarms[0].value);
@@ -524,7 +524,7 @@ void TelemetryPanel::setup()
ui->rssiAlarm2Label->setText(tr("Critical Alarm")); ui->rssiAlarm2Label->setText(tr("Critical Alarm"));
} }
if (!GetEepromInterface()->getCapability(HasAltitudeSel)) { if (!GetCurrentFirmware()->getCapability(HasAltitudeSel)) {
ui->AltitudeGPS_ChkB->hide(); ui->AltitudeGPS_ChkB->hide();
} }
else { else {
@@ -538,7 +538,7 @@ void TelemetryPanel::setup()
ui->AltitudeToolbar_ChkB->hide(); ui->AltitudeToolbar_ChkB->hide();
} }
int varioCap = GetEepromInterface()->getCapability(HasVario); int varioCap = GetCurrentFirmware()->getCapability(HasVario);
if (!varioCap) { if (!varioCap) {
ui->varioLimitMax_DSB->hide(); ui->varioLimitMax_DSB->hide();
ui->varioLimitMinOff_ChkB->hide(); ui->varioLimitMinOff_ChkB->hide();
@@ -554,7 +554,7 @@ void TelemetryPanel::setup()
ui->varioSource_label->hide(); ui->varioSource_label->hide();
} }
else { else {
if (!GetEepromInterface()->getCapability(HasVarioSink)) { if (!GetCurrentFirmware()->getCapability(HasVarioSink)) {
ui->varioLimitMinOff_ChkB->hide(); ui->varioLimitMinOff_ChkB->hide();
ui->varioLimitMin_DSB->hide(); ui->varioLimitMin_DSB->hide();
ui->varioLimitCenterMin_DSB->hide(); ui->varioLimitCenterMin_DSB->hide();
@@ -584,18 +584,18 @@ void TelemetryPanel::setup()
} }
} }
if (!(GetEepromInterface()->getCapability(HasAltitudeSel)||GetEepromInterface()->getCapability(HasVario))) { if (!(GetCurrentFirmware()->getCapability(HasAltitudeSel)||GetCurrentFirmware()->getCapability(HasVario))) {
ui->altimetryGB->hide(); ui->altimetryGB->hide();
} }
if (GetEepromInterface()->getCapability(NoTelemetryProtocol)) { if (GetCurrentFirmware()->getCapability(NoTelemetryProtocol)) {
ui->frskyProtoCB->setDisabled(true); ui->frskyProtoCB->setDisabled(true);
} }
else { else {
ui->frskyProtoCB->setEnabled(true); ui->frskyProtoCB->setEnabled(true);
} }
if (!GetEepromInterface()->getCapability(TelemetryUnits)) { if (!GetCurrentFirmware()->getCapability(TelemetryUnits)) {
ui->frskyUnitsCB->setDisabled(true); ui->frskyUnitsCB->setDisabled(true);
int index=0; int index=0;
if (firmware_id.contains("imperial")) { if (firmware_id.contains("imperial")) {
@@ -604,7 +604,7 @@ void TelemetryPanel::setup()
ui->frskyUnitsCB->setCurrentIndex(index); ui->frskyUnitsCB->setCurrentIndex(index);
} }
if ((GetEepromInterface()->getCapability(Telemetry)&TM_HASWSHH)) { if ((GetCurrentFirmware()->getCapability(Telemetry)&TM_HASWSHH)) {
ui->frskyProtoCB->addItem(tr("Winged Shadow How High")); ui->frskyProtoCB->addItem(tr("Winged Shadow How High"));
} }
else { else {
@@ -612,7 +612,7 @@ void TelemetryPanel::setup()
} }
ui->variousGB->hide(); ui->variousGB->hide();
if (!(GetEepromInterface()->getCapability(HasFasOffset)) && !(firmware_id.contains("fasoffset"))) { if (!(GetCurrentFirmware()->getCapability(HasFasOffset)) && !(firmware_id.contains("fasoffset"))) {
ui->fasOffset_label->hide(); ui->fasOffset_label->hide();
ui->fasOffset_DSB->hide(); ui->fasOffset_DSB->hide();
} }
@@ -621,7 +621,7 @@ void TelemetryPanel::setup()
ui->variousGB->show(); ui->variousGB->show();
} }
if (!(GetEepromInterface()->getCapability(HasMahPersistent))) { if (!(GetCurrentFirmware()->getCapability(HasMahPersistent))) {
ui->mahCount_label->hide(); ui->mahCount_label->hide();
ui->mahCount_SB->hide(); ui->mahCount_SB->hide();
ui->mahCount_ChkB->hide(); ui->mahCount_ChkB->hide();
+8 -8
View File
@@ -10,7 +10,7 @@ void ModelEdit::setCurve(uint8_t c, int8_t ar[])
{ {
int len=sizeof(ar)/sizeof(int8_t); int len=sizeof(ar)/sizeof(int8_t);
if (GetEepromInterface()->getCapability(NumCurves)>c) { if (GetCurrentFirmware()->getCapability(NumCurves)>c) {
if (len<9) { if (len<9) {
model.curves[c].count=5; model.curves[c].count=5;
model.curves[c].custom=false; model.curves[c].custom=false;
@@ -100,7 +100,7 @@ void Templates::applyNumericTemplate(uint64_t tpl)
for (int i=0; i<10 ; i++) { for (int i=0; i<10 ; i++) {
rx[i]=false; rx[i]=false;
} }
int thrsw=GetEepromInterface()->getCapability(GetThrSwitch); int thrsw=GetCurrentFirmware()->getCapability(GetThrSwitch);
MixData *md = &model.mixData[0]; MixData *md = &model.mixData[0];
uint8_t spo2ch=(tpl & 0x0F); uint8_t spo2ch=(tpl & 0x0F);
tpl>>=4; tpl>>=4;
@@ -554,7 +554,7 @@ void Templates::applyTemplate(uint8_t idx)
int8_t heli_ar4[] = {-30, -15, 0, 50, 100}; int8_t heli_ar4[] = {-30, -15, 0, 50, 100};
int8_t heli_ar5[] = {-100, -50, 0, 50, 100}; int8_t heli_ar5[] = {-100, -50, 0, 50, 100};
int thrsw=GetEepromInterface()->getCapability(GetThrSwitch); int thrsw=GetCurrentFirmware()->getCapability(GetThrSwitch);
MixData *md = &model.mixData[0]; MixData *md = &model.mixData[0];
//CC(STK) -> vSTK //CC(STK) -> vSTK
@@ -715,7 +715,7 @@ void Templates::applyTemplate(uint8_t idx)
bool found=true; bool found=true;
while (found) { while (found) {
found=false; found=false;
for (int i=0; i< GetEepromInterface()->getCapability(Mixes); i++) { for (int i=0; i< GetCurrentFirmware()->getCapability(Mixes); i++) {
if (model.mixData[i].destCh==6) { if (model.mixData[i].destCh==6) {
gm_deleteMix(i); gm_deleteMix(i);
found=true; found=true;
@@ -827,7 +827,7 @@ void Templates::applyTemplate(uint8_t idx)
bool found=true; bool found=true;
while (found) { while (found) {
found=false; found=false;
for (int i=0; i< GetEepromInterface()->getCapability(Mixes); i++) { for (int i=0; i< GetCurrentFirmware()->getCapability(Mixes); i++) {
if (model.mixData[i].destCh==5) { if (model.mixData[i].destCh==5) {
gm_deleteMix(i); gm_deleteMix(i);
found=true; found=true;
@@ -867,11 +867,11 @@ void Templates::applyTemplate(uint8_t idx)
MixData* Templates::setDest(uint8_t dch) MixData* Templates::setDest(uint8_t dch)
{ {
uint8_t i = 0; uint8_t i = 0;
while ((g_model.mixData[i].destCh<=dch) && (g_model.mixData[i].destCh) && (i<GetEepromInterface()->getCapability(Mixes))) i++; while ((g_model.mixData[i].destCh<=dch) && (g_model.mixData[i].destCh) && (i<GetCurrentFirmware()->getCapability(Mixes))) i++;
if(i==GetEepromInterface()->getCapability(Mixes)) return &g_model.mixData[0]; if(i==GetCurrentFirmware()->getCapability(Mixes)) return &g_model.mixData[0];
memmove(&g_model.mixData[i+1],&g_model.mixData[i], memmove(&g_model.mixData[i+1],&g_model.mixData[i],
(GetEepromInterface()->getCapability(Mixes)-(i+1))*sizeof(MixData) ); (GetCurrentFirmware()->getCapability(Mixes)-(i+1))*sizeof(MixData) );
memset(&g_model.mixData[i],0,sizeof(MixData)); memset(&g_model.mixData[i],0,sizeof(MixData));
g_model.mixData[i].destCh = dch; g_model.mixData[i].destCh = dch;
return &g_model.mixData[i]; return &g_model.mixData[i];
+52 -52
View File
@@ -38,7 +38,7 @@ printDialog::printDialog(QWidget *parent, GeneralSettings *gg, ModelData *gm, QS
} }
printSetup(); printSetup();
int gvars=0; int gvars=0;
if (GetEepromInterface()->getCapability(HasVariants)) { if (GetCurrentFirmware()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) { if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1; gvars=1;
} }
@@ -115,7 +115,7 @@ QString printDialog::fv(const QString name, const QString value)
void printDialog::printSetup() void printDialog::printSetup()
{ {
int gvars=0; int gvars=0;
if (GetEepromInterface()->getCapability(HasVariants)) { if (GetCurrentFirmware()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) { if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1; gvars=1;
} }
@@ -123,7 +123,7 @@ void printDialog::printSetup()
gvars=1; gvars=1;
} }
QString str = "<a name=1></a><table border=1 cellspacing=0 cellpadding=3 width=\"100%\">"; QString str = "<a name=1></a><table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append(QString("<tr><td colspan=%1 ><table border=0 width=\"100%\"><tr><td><h1>").arg((GetEepromInterface()->getCapability(FlightPhases) && gvars==0) ? 2 : 1)); str.append(QString("<tr><td colspan=%1 ><table border=0 width=\"100%\"><tr><td><h1>").arg((GetCurrentFirmware()->getCapability(FlightPhases) && gvars==0) ? 2 : 1));
str.append(g_model->name); str.append(g_model->name);
str.append("&nbsp;("); str.append("&nbsp;(");
str.append(eepromInterface->getName()); str.append(eepromInterface->getName());
@@ -155,15 +155,15 @@ QString printDialog::printPhases()
{ {
int gvars=0; int gvars=0;
int gvarnum=0; int gvarnum=0;
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT ) || (!GetEepromInterface()->getCapability(HasVariants) && GetEepromInterface()->getCapability(Gvars))) { if ((GetCurrentFirmwareVariant() & GVARS_VARIANT ) || (!GetCurrentFirmware()->getCapability(HasVariants) && GetCurrentFirmware()->getCapability(Gvars))) {
if (GetEepromInterface()->getCapability(GvarsFlightPhases)) { if (GetCurrentFirmware()->getCapability(GvarsFlightPhases)) {
gvars=1; gvars=1;
gvarnum=GetEepromInterface()->getCapability(Gvars); gvarnum=GetCurrentFirmware()->getCapability(Gvars);
} }
} }
QString str=""; QString str="";
str.append(QString("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=%1><h2>").arg(gvars==0 ? 8+GetEepromInterface()->getCapability(RotaryEncoders) : 8+gvarnum+GetEepromInterface()->getCapability(RotaryEncoders))); str.append(QString("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=%1><h2>").arg(gvars==0 ? 8+GetCurrentFirmware()->getCapability(RotaryEncoders) : 8+gvarnum+GetCurrentFirmware()->getCapability(RotaryEncoders)));
str.append(tr("Flight modes Settings")); str.append(tr("Flight modes Settings"));
str.append("</h2></td></tr><tr><td style=\"border-style:none;\">&nbsp;</td><td colspan=2 align=center><b>"); str.append("</h2></td></tr><tr><td style=\"border-style:none;\">&nbsp;</td><td colspan=2 align=center><b>");
str.append(tr("Fades")+"</b></td>"); str.append(tr("Fades")+"</b></td>");
@@ -171,8 +171,8 @@ QString printDialog::printPhases()
if (gvars) { if (gvars) {
str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</b></td>"); str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</b></td>");
} }
if (GetEepromInterface()->getCapability(RotaryEncoders)) { if (GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(GetEepromInterface()->getCapability(RotaryEncoders))+tr("Rot.Enc.")+"</b></td>"); str.append(QString("<td colspan=%1 align=center><b>").arg(GetCurrentFirmware()->getCapability(RotaryEncoders))+tr("Rot.Enc.")+"</b></td>");
} }
str.append("<td rowspan=2 align=\"center\" valign=\"bottom\"><b>"+tr("Switch")+"</b></td></tr><tr><td align=center width=\"90\"><b>"+tr("Flight mode name")); str.append("<td rowspan=2 align=\"center\" valign=\"bottom\"><b>"+tr("Switch")+"</b></td></tr><tr><td align=center width=\"90\"><b>"+tr("Flight mode name"));
str.append("</b></td><td align=center width=\"30\"><b>"+tr("IN")+"</b></td><td align=center width=\"30\"><b>"+tr("OUT")+"</b></td>"); str.append("</b></td><td align=center width=\"30\"><b>"+tr("IN")+"</b></td><td align=center width=\"30\"><b>"+tr("OUT")+"</b></td>");
@@ -184,11 +184,11 @@ QString printDialog::printPhases()
str.append(QString("<td width=\"40\" align=\"center\"><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model->gvars_names[i])); str.append(QString("<td width=\"40\" align=\"center\"><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model->gvars_names[i]));
} }
} }
for (int i=0; i<GetEepromInterface()->getCapability(RotaryEncoders); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(RotaryEncoders); i++) {
str.append(QString("<td align=\"center\"><b>RE%1</b></td>").arg((i==0 ? 'A': 'B'))); str.append(QString("<td align=\"center\"><b>RE%1</b></td>").arg((i==0 ? 'A': 'B')));
} }
str.append("</tr>"); str.append("</tr>");
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
PhaseData *pd=&g_model->phaseData[i]; PhaseData *pd=&g_model->phaseData[i];
str.append("<tr><td><b>"+tr("FM")+QString("%1</b> <font size=+1 face='Courier New' color=green>%2</font></td><td width=\"30\" align=\"right\"><font size=+1 face='Courier New' color=green>%3</font></td><td width=\"30\" align=\"right\"><font size=+1 face='Courier New' color=green>%4</font></td>").arg(i).arg(pd->name).arg(pd->fadeIn).arg(pd->fadeOut)); str.append("<tr><td><b>"+tr("FM")+QString("%1</b> <font size=+1 face='Courier New' color=green>%2</font></td><td width=\"30\" align=\"right\"><font size=+1 face='Courier New' color=green>%3</font></td><td width=\"30\" align=\"right\"><font size=+1 face='Courier New' color=green>%4</font></td>").arg(i).arg(pd->name).arg(pd->fadeIn).arg(pd->fadeOut));
for (int k=0; k<4; k++) { for (int k=0; k<4; k++) {
@@ -210,7 +210,7 @@ QString printDialog::printPhases()
} }
} }
} }
for (int k=0; k<GetEepromInterface()->getCapability(RotaryEncoders); k++) { for (int k=0; k<GetCurrentFirmware()->getCapability(RotaryEncoders); k++) {
if (pd->rotaryEncoders[k]<=1024) { if (pd->rotaryEncoders[k]<=1024) {
str.append(QString("<td align=\"right\"><font size=+1 face='Courier New' color=green>%1").arg(pd->rotaryEncoders[k])+"</font></td>"); str.append(QString("<td align=\"right\"><font size=+1 face='Courier New' color=green>%1").arg(pd->rotaryEncoders[k])+"</font></td>");
} }
@@ -264,12 +264,12 @@ void printDialog::printExpo()
str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight,true)).rightJustified(6, ' '); str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight,true)).rightJustified(6, ' ');
str += ed->curve.toString().replace("<", "&lt;").replace(">", "&gt;"); str += ed->curve.toString().replace("<", "&lt;").replace(">", "&gt;");
if (GetEepromInterface()->getCapability(FlightPhases)) { if (GetCurrentFirmware()->getCapability(FlightPhases)) {
if(ed->phases) { if(ed->phases) {
if (ed->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) { if (ed->phases!=(unsigned int)(1<<GetCurrentFirmware()->getCapability(FlightPhases))-1) {
int mask=1; int mask=1;
int first=0; int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases);i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases);i++) {
if (!(ed->phases & mask)) { if (!(ed->phases & mask)) {
first++; first++;
} }
@@ -282,7 +282,7 @@ void printDialog::printExpo()
} }
mask=1; mask=1;
first=1; first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) { for (int j=0; j<GetCurrentFirmware()->getCapability(FlightPhases);j++) {
if (!(ed->phases & mask)) { if (!(ed->phases & mask)) {
PhaseData *pd = &g_model->phaseData[j]; PhaseData *pd = &g_model->phaseData[j];
if (!first) { if (!first) {
@@ -303,7 +303,7 @@ void printDialog::printExpo()
if (ed->swtch.type) if (ed->swtch.type)
str += " " + tr("Switch") + QString("(%1)").arg(ed->swtch.toString()); str += " " + tr("Switch") + QString("(%1)").arg(ed->swtch.toString());
str += ed->curve.toString().replace("<", "&lt;").replace(">", "&gt;"); str += ed->curve.toString().replace("<", "&lt;").replace(">", "&gt;");
if (GetEepromInterface()->getCapability(HasExpoNames)) { if (GetCurrentFirmware()->getCapability(HasExpoNames)) {
QString ExpoName; QString ExpoName;
ExpoName.append(ed->name); ExpoName.append(ed->name);
if (!ExpoName.isEmpty()) { if (!ExpoName.isEmpty()) {
@@ -325,14 +325,14 @@ void printDialog::printMixes()
str.append("</h2></td></tr><tr><td><table border=0 cellspacing=0 cellpadding=3>"); str.append("</h2></td></tr><tr><td><table border=0 cellspacing=0 cellpadding=3>");
unsigned int lastCHN = 255; unsigned int lastCHN = 255;
for(int i=0; i<GetEepromInterface()->getCapability(Mixes); i++) { for(int i=0; i<GetCurrentFirmware()->getCapability(Mixes); i++) {
MixData *md = &g_model->mixData[i]; MixData *md = &g_model->mixData[i];
if(!md->destCh || md->destCh>(unsigned int)GetEepromInterface()->getCapability(Outputs) ) break; if(!md->destCh || md->destCh>(unsigned int)GetCurrentFirmware()->getCapability(Outputs) ) break;
str.append("<tr><td><font size=+1 face='Courier New'><b>"); str.append("<tr><td><font size=+1 face='Courier New'><b>");
if(lastCHN!=md->destCh) { if(lastCHN!=md->destCh) {
lastCHN=md->destCh; lastCHN=md->destCh;
QString chname=tr("CH")+QString("%1 ").arg(lastCHN,2,10,QChar('0')); QString chname=tr("CH")+QString("%1 ").arg(lastCHN,2,10,QChar('0'));
if (GetEepromInterface()->getCapability(HasChNames)) { if (GetCurrentFirmware()->getCapability(HasChNames)) {
QString name=g_model->limitData[md->destCh-1].name; QString name=g_model->limitData[md->destCh-1].name;
if (!name.isEmpty()) { if (!name.isEmpty()) {
name.append(" "); name.append(" ");
@@ -356,16 +356,16 @@ void printDialog::printMixes()
if (md->carryTrim) str += " " + tr("noTrim"); if (md->carryTrim) str += " " + tr("noTrim");
if (md->sOffset) str += " "+ tr("Offset") + QString(" %1").arg(getGVarString(md->sOffset)); if (md->sOffset) str += " "+ tr("Offset") + QString(" %1").arg(getGVarString(md->sOffset));
str += md->curve.toString().replace("<", "&lt;").replace(">", "&gt;"); str += md->curve.toString().replace("<", "&lt;").replace(">", "&gt;");
float scale=GetEepromInterface()->getCapability(SlowScale); float scale=GetCurrentFirmware()->getCapability(SlowScale);
if (md->delayDown || md->delayUp) str += tr(" Delay(u%1:d%2)").arg(md->delayUp/scale).arg(md->delayDown/scale); 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->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 (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn);
if (GetEepromInterface()->getCapability(FlightPhases)) { if (GetCurrentFirmware()->getCapability(FlightPhases)) {
if(md->phases) { if(md->phases) {
if (md->phases!=(unsigned int)(1<<GetEepromInterface()->getCapability(FlightPhases))-1) { if (md->phases!=(unsigned int)(1<<GetCurrentFirmware()->getCapability(FlightPhases))-1) {
int mask=1; int mask=1;
int first=0; int first=0;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
if (!(md->phases & mask)) { if (!(md->phases & mask)) {
first++; first++;
} }
@@ -378,7 +378,7 @@ void printDialog::printMixes()
} }
mask=1; mask=1;
first=1; first=1;
for (int j=0; j<GetEepromInterface()->getCapability(FlightPhases);j++) { for (int j=0; j<GetCurrentFirmware()->getCapability(FlightPhases);j++) {
if (!(md->phases & mask)) { if (!(md->phases & mask)) {
PhaseData *pd = &g_model->phaseData[j]; PhaseData *pd = &g_model->phaseData[j];
if (!first) { if (!first) {
@@ -396,7 +396,7 @@ void printDialog::printMixes()
} }
} }
} }
if (GetEepromInterface()->getCapability(HasMixerNames)) { if (GetCurrentFirmware()->getCapability(HasMixerNames)) {
QString MixerName; QString MixerName;
MixerName.append(md->name); MixerName.append(md->name);
if (!MixerName.isEmpty()) { if (!MixerName.isEmpty()) {
@@ -413,37 +413,37 @@ void printDialog::printLimits()
{ {
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">"; QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
int numcol; int numcol;
numcol=(GetEepromInterface()->getCapability(Outputs)+1)>17 ? 17:GetEepromInterface()->getCapability(Outputs)+1; numcol=(GetCurrentFirmware()->getCapability(Outputs)+1)>17 ? 17:GetCurrentFirmware()->getCapability(Outputs)+1;
str.append(QString("<tr><td colspan=%1><h2>").arg(numcol)+tr("Limits")+"</h2></td></tr>"); str.append(QString("<tr><td colspan=%1><h2>").arg(numcol)+tr("Limits")+"</h2></td></tr>");
str.append("<tr><td>&nbsp;</td>"); str.append("<tr><td>&nbsp;</td>");
if (GetEepromInterface()->getCapability(Outputs)<17) { if (GetCurrentFirmware()->getCapability(Outputs)<17) {
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) { for(int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true)); str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true));
} }
str.append("</tr>"); str.append("</tr>");
if (GetEepromInterface()->getCapability(HasChNames)) { if (GetCurrentFirmware()->getCapability(HasChNames)) {
str.append("<tr><td><b>"+tr("Name")+"</b></td>"); str.append("<tr><td><b>"+tr("Name")+"</b></td>");
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) { for(int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append(doTR(g_model->limitData[i].name,"green")); str.append(doTR(g_model->limitData[i].name,"green"));
} }
} }
str.append("<tr><td><b>"+tr("Offset")+"</b></td>"); str.append("<tr><td><b>"+tr("Offset")+"</b></td>");
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) { for(int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append(doTR(QString::number((qreal)g_model->limitData[i].offset/10, 'f', 1),"green")); str.append(doTR(QString::number((qreal)g_model->limitData[i].offset/10, 'f', 1),"green"));
} }
str.append("</tr>"); str.append("</tr>");
str.append("<tr><td><b>"+tr("Min")+"</b></td>"); str.append("<tr><td><b>"+tr("Min")+"</b></td>");
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) { for(int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append(doTR(QString::number(g_model->limitData[i].min),"green")); str.append(doTR(QString::number(g_model->limitData[i].min),"green"));
} }
str.append("</tr>"); str.append("</tr>");
str.append("<tr><td><b>"+tr("Max")+"</b></td>"); str.append("<tr><td><b>"+tr("Max")+"</b></td>");
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) { for(int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append(doTR(QString::number(g_model->limitData[i].max),"green")); str.append(doTR(QString::number(g_model->limitData[i].max),"green"));
} }
str.append("</tr>"); str.append("</tr>");
str.append("<tr><td><b>"+tr("Invert")+"</b></td>"); str.append("<tr><td><b>"+tr("Invert")+"</b></td>");
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) { for(int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append(doTR(QString(g_model->limitData[i].revert ? tr("INV") : tr("NOR")),"green")); str.append(doTR(QString(g_model->limitData[i].revert ? tr("INV") : tr("NOR")),"green"));
} }
} else { } else {
@@ -451,7 +451,7 @@ void printDialog::printLimits()
str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true)); str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true));
} }
str.append("</tr>"); str.append("</tr>");
if (GetEepromInterface()->getCapability(HasChNames)) { if (GetCurrentFirmware()->getCapability(HasChNames)) {
str.append("<tr><td><b>"+tr("Name")+"</b></td>"); str.append("<tr><td><b>"+tr("Name")+"</b></td>");
for(int i=0; i<16; i++) { for(int i=0; i<16; i++) {
str.append(doTR(g_model->limitData[i].name,"green")); str.append(doTR(g_model->limitData[i].name,"green"));
@@ -479,33 +479,33 @@ void printDialog::printLimits()
str.append("</tr>"); str.append("</tr>");
str.append(QString("<tr><td colspan=%1>&nbsp;").arg(numcol)+"</td></tr>"); str.append(QString("<tr><td colspan=%1>&nbsp;").arg(numcol)+"</td></tr>");
str.append("<tr><td>&nbsp;</td>"); str.append("<tr><td>&nbsp;</td>");
for(int i=16; i<GetEepromInterface()->getCapability(Outputs); i++) { for(int i=16; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true)); str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true));
} }
str.append("</tr>"); str.append("</tr>");
if (GetEepromInterface()->getCapability(HasChNames)) { if (GetCurrentFirmware()->getCapability(HasChNames)) {
str.append("<tr><td><b>"+tr("Name")+"</b></td>"); str.append("<tr><td><b>"+tr("Name")+"</b></td>");
for(int i=16; i<GetEepromInterface()->getCapability(Outputs); i++) { for(int i=16; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append(doTR(g_model->limitData[i].name,"green")); str.append(doTR(g_model->limitData[i].name,"green"));
} }
} }
str.append("<tr><td><b>"+tr("Offset")+"</b></td>"); str.append("<tr><td><b>"+tr("Offset")+"</b></td>");
for(int i=16; i<GetEepromInterface()->getCapability(Outputs); i++) { for(int i=16; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append(doTR(QString::number((qreal)g_model->limitData[i].offset/10, 'f', 1),"green")); str.append(doTR(QString::number((qreal)g_model->limitData[i].offset/10, 'f', 1),"green"));
} }
str.append("</tr>"); str.append("</tr>");
str.append("<tr><td><b>"+tr("Min")+"</b></td>"); str.append("<tr><td><b>"+tr("Min")+"</b></td>");
for(int i=16; i<GetEepromInterface()->getCapability(Outputs); i++) { for(int i=16; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append(doTR(QString::number(g_model->limitData[i].min),"green")); str.append(doTR(QString::number(g_model->limitData[i].min),"green"));
} }
str.append("</tr>"); str.append("</tr>");
str.append("<tr><td><b>"+tr("Max")+"</b></td>"); str.append("<tr><td><b>"+tr("Max")+"</b></td>");
for(int i=16; i<GetEepromInterface()->getCapability(Outputs); i++) { for(int i=16; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append(doTR(QString::number(g_model->limitData[i].max),"green")); str.append(doTR(QString::number(g_model->limitData[i].max),"green"));
} }
str.append("</tr>"); str.append("</tr>");
str.append("<tr><td><b>"+tr("Invert")+"</b></td>"); str.append("<tr><td><b>"+tr("Invert")+"</b></td>");
for(int i=16; i<GetEepromInterface()->getCapability(Outputs); i++) { for(int i=16; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
str.append(doTR(QString(g_model->limitData[i].revert ? tr("INV") : tr("NOR")),"green")); str.append(doTR(QString(g_model->limitData[i].revert ? tr("INV") : tr("NOR")),"green"));
} }
} }
@@ -524,7 +524,7 @@ void printDialog::printCurves()
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-before:auto;\" width=\"100%\"><tr><td><h2>"; QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-before:auto;\" width=\"100%\"><tr><td><h2>";
str.append(tr("Curves")); str.append(tr("Curves"));
str.append("</h2></td></tr><tr><td>"); str.append("</h2></td></tr><tr><td>");
int numcurves=GetEepromInterface()->getCapability(NumCurves); int numcurves=GetCurrentFirmware()->getCapability(NumCurves);
if (numcurves==0) { if (numcurves==0) {
numcurves=16; numcurves=16;
} }
@@ -629,7 +629,7 @@ void printDialog::printSwitches()
str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>"); str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>");
str.append("<tr><td><table border=0 cellspacing=0 cellpadding=3>"); str.append("<tr><td><table border=0 cellspacing=0 cellpadding=3>");
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
if (g_model->customSw[i].func) { if (g_model->customSw[i].func) {
str.append("<tr>"); str.append("<tr>");
if (i<9) { if (i<9) {
@@ -653,11 +653,11 @@ void printDialog::printGvars()
{ {
int gvars=0; int gvars=0;
int gvarnum=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; gvars=1;
gvarnum=GetEepromInterface()->getCapability(Gvars); gvarnum=GetCurrentFirmware()->getCapability(Gvars);
} }
if (!GetEepromInterface()->getCapability(GvarsFlightPhases) && (gvars==1 && GetEepromInterface()->getCapability(Gvars))) { if (!GetCurrentFirmware()->getCapability(GvarsFlightPhases) && (gvars==1 && GetCurrentFirmware()->getCapability(Gvars))) {
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">"; QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append("<tr><td><h2>"+tr("Global Variables")+"</h2></td></tr>"); str.append("<tr><td><h2>"+tr("Global Variables")+"</h2></td></tr>");
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=3 width=100>"); str.append("<tr><td><table border=1 cellspacing=0 cellpadding=3 width=100>");
@@ -691,7 +691,7 @@ void printDialog::printFSwitches()
str.append(doTL(tr("Repeat"), "", true)); str.append(doTL(tr("Repeat"), "", true));
str.append(doTL(tr("Enabled"), "", true)); str.append(doTL(tr("Enabled"), "", true));
str.append("</tr>"); str.append("</tr>");
for(int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) { for(int i=0; i<GetCurrentFirmware()->getCapability(CustomFunctions); i++) {
if (g_model->funcSw[i].swtch.type!=SWITCH_TYPE_NONE) { if (g_model->funcSw[i].swtch.type!=SWITCH_TYPE_NONE) {
str.append("<tr>"); str.append("<tr>");
str.append(doTC(g_model->funcSw[i].swtch.toString(),"green")); str.append(doTC(g_model->funcSw[i].swtch.toString(),"green"));
@@ -756,10 +756,10 @@ void printDialog::printFrSky()
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Blades")+"</b></td><td colspan=8 align=\"left\">"+fd->blades+"</td></tr>"); str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Blades")+"</b></td><td colspan=8 align=\"left\">"+fd->blades+"</td></tr>");
str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr></table>"); str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr></table>");
#if 0 #if 0
if (GetEepromInterface()->getCapability(TelemetryBars) || (GetEepromInterface()->getCapability(TelemetryCSFields))) { if (GetCurrentFirmware()->getCapability(TelemetryBars) || (GetCurrentFirmware()->getCapability(TelemetryCSFields))) {
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields); int cols=GetCurrentFirmware()->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2; if (cols==0) cols=2;
for (int j=0; j<GetEepromInterface()->getCapability(TelemetryCSFields)/(4*cols); j++ ) { for (int j=0; j<GetCurrentFirmware()->getCapability(TelemetryCSFields)/(4*cols); j++ ) {
if (fd->screens[j].type==0) { if (fd->screens[j].type==0) {
if (cols==2) { if (cols==2) {
str.append("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=3 align=\"Left\"><b>"+tr("Custom Telemetry View")+"</b></td></tr>"); str.append("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=3 align=\"Left\"><b>"+tr("Custom Telemetry View")+"</b></td></tr>");
+5 -5
View File
@@ -335,7 +335,7 @@ void SimulatorDialog::initUi(T * ui)
windowName = tr("Simulating Radio (%1)").arg(txInterface->getName()); windowName = tr("Simulating Radio (%1)").arg(txInterface->getName());
setWindowTitle(windowName); setWindowTitle(windowName);
simulator = txInterface->getSimulator(); simulator = GetCurrentFirmware()->getSimulator();
lcd->setData(simulator->getLcd(), lcdWidth, 64, lcdDepth); lcd->setData(simulator->getLcd(), lcdWidth, 64, lcdDepth);
if (flags & SIMULATOR_FLAGS_STICK_MODE_LEFT) { if (flags & SIMULATOR_FLAGS_STICK_MODE_LEFT) {
@@ -349,7 +349,7 @@ void SimulatorDialog::initUi(T * ui)
setTrims(); setTrims();
int outputs = std::min(16, txInterface->getCapability(Outputs)); int outputs = std::min(16, GetCurrentFirmware()->getCapability(Outputs));
for (int i=0; i<outputs; i++) { for (int i=0; i<outputs; i++) {
int column = i / (outputs/2); int column = i / (outputs/2);
int line = i % (outputs/2); int line = i % (outputs/2);
@@ -390,7 +390,7 @@ void SimulatorDialog::initUi(T * ui)
channelsLayout->addWidget(value, line, column == 0 ? 2 : 3, 1, 1); channelsLayout->addWidget(value, line, column == 0 ? 2 : 3, 1, 1);
} }
int switches = txInterface->getCapability(LogicalSwitches); int switches = GetCurrentFirmware()->getCapability(LogicalSwitches);
for (int i=0; i<switches; i++) { for (int i=0; i<switches; i++) {
QFrame * swtch = new QFrame(tabWidget); QFrame * swtch = new QFrame(tabWidget);
swtch->setAutoFillBackground(true); swtch->setAutoFillBackground(true);
@@ -689,7 +689,7 @@ void SimulatorDialog::setValues()
Trims trims; Trims trims;
simulator->getTrims(trims); simulator->getTrims(trims);
for (int i=0; i<std::min(16, GetEepromInterface()->getCapability(Outputs)); i++) { for (int i=0; i<std::min(16, GetCurrentFirmware()->getCapability(Outputs)); i++) {
channelSliders[i]->setValue(chVal(outputs.chans[i])); channelSliders[i]->setValue(chVal(outputs.chans[i]));
channelValues[i]->setText(QString("%1").arg((qreal)outputs.chans[i]*100/1024, 0, 'f', 1)); channelValues[i]->setText(QString("%1").arg((qreal)outputs.chans[i]*100/1024, 0, 'f', 1));
} }
@@ -703,7 +703,7 @@ void SimulatorDialog::setValues()
QString CSWITCH_ON = "QLabel { background-color: #4CC417 }"; QString CSWITCH_ON = "QLabel { background-color: #4CC417 }";
QString CSWITCH_OFF = "QLabel { }"; QString CSWITCH_OFF = "QLabel { }";
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) { for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
logicalSwitchLabels[i]->setStyleSheet(outputs.vsw[i] ? CSWITCH_ON : CSWITCH_OFF); logicalSwitchLabels[i]->setStyleSheet(outputs.vsw[i] ? CSWITCH_ON : CSWITCH_OFF);
} }
+3 -1
View File
@@ -99,7 +99,9 @@ int main(int argc, char *argv[])
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
RegisterFirmwares(); RegisterEepromInterfaces();
registerOpenTxFirmwares();
SimulatorDialog *dialog; SimulatorDialog *dialog;
const char * eepromFileName; const char * eepromFileName;
QString fileName; QString fileName;