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
+10 -10
View File
@@ -13,7 +13,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
bool minimize = false;
int col = 1;
if (GetEepromInterface()->getCapability(ChannelsName))
if (GetCurrentFirmware()->getCapability(ChannelsName))
{
minimize=true;
addLabel(gridLayout, tr("Name"), col++);
@@ -24,12 +24,12 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
addLabel(gridLayout, tr("Direction"), col++, minimize);
if (IS_TARANIS(GetEepromInterface()->getBoard()))
addLabel(gridLayout, tr("Curve"), col++, minimize);
if (GetEepromInterface()->getCapability(PPMCenter))
if (GetCurrentFirmware()->getCapability(PPMCenter))
addLabel(gridLayout, tr("PPM Center"), col++, minimize);
if (GetEepromInterface()->getCapability(SYMLimits))
if (GetCurrentFirmware()->getCapability(SYMLimits))
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;
// Channel label
@@ -39,7 +39,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
gridLayout->addWidget(label, i+1, col++, 1, 1);
// Channel name
int nameLen = GetEepromInterface()->getCapability(ChannelsName);
int nameLen = GetCurrentFirmware()->getCapability(ChannelsName);
if (nameLen > 0) {
QLineEdit * name = new QLineEdit(this);
name->setProperty("index", i);
@@ -103,7 +103,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
QComboBox * curveCB = new QComboBox(this);
curveCB->setProperty("index", i);
int numcurves = GetEepromInterface()->getCapability(NumCurves);
int numcurves = GetCurrentFirmware()->getCapability(NumCurves);
for (int j=-numcurves; j<=numcurves; 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
if (GetEepromInterface()->getCapability(PPMCenter)) {
if (GetCurrentFirmware()->getCapability(PPMCenter)) {
QSpinBox * center = new QSpinBox(this);
center->setProperty("index", i);
center->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
@@ -126,7 +126,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
}
// Symetrical limits
if (GetEepromInterface()->getCapability(SYMLimits)) {
if (GetCurrentFirmware()->getCapability(SYMLimits)) {
QCheckBox * symlimits = new QCheckBox(this);
symlimits->setProperty("index", i);
symlimits->setChecked(model.limitData[i].symetrical);
@@ -135,7 +135,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
}
}
// Push the rows up
addVSpring(gridLayout, 0,GetEepromInterface()->getCapability(Outputs)+1);
addVSpring(gridLayout, 0,GetCurrentFirmware()->getCapability(Outputs)+1);
}
Channels::~Channels()
@@ -188,7 +188,7 @@ void Channels::maxEdited()
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 * maxDSB = maxSpins[i];
+8 -8
View File
@@ -101,7 +101,7 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
lock = true;
if (!GetEepromInterface()->getCapability(HasCvNames)) {
if (!GetCurrentFirmware()->getCapability(HasCvNames)) {
ui->curveName->hide();
ui->curveNameLabel->hide();
}
@@ -110,7 +110,7 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
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;
// 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);
bool insert;
if (GetEepromInterface()->getCapability(EnhancedCurves)) {
if (GetCurrentFirmware()->getCapability(EnhancedCurves)) {
insert = (i >= 1);
}
else {
@@ -220,7 +220,7 @@ void Curves::update()
{
lock = true;
if (GetEepromInterface()->getCapability(HasCvNames)) {
if (GetCurrentFirmware()->getCapability(HasCvNames)) {
ui->curveName->setText(model.curves[currentCurve].name);
}
@@ -242,7 +242,7 @@ void Curves::updateCurveType()
int index = 0;
if (GetEepromInterface()->getCapability(EnhancedCurves)) {
if (GetCurrentFirmware()->getCapability(EnhancedCurves)) {
index = model.curves[currentCurve].count - 2;
}
else {
@@ -288,7 +288,7 @@ void Curves::updateCurve()
pen.setWidth(1);
pen.setStyle(Qt::SolidLine);
int numcurves = GetEepromInterface()->getCapability(NumCurves);
int numcurves = GetCurrentFirmware()->getCapability(NumCurves);
for (int k=0; k<numcurves; k++) {
pen.setColor(colors[k]);
if (currentCurve!=k && visibleCurves[k]) {
@@ -406,7 +406,7 @@ void Curves::onNodeUnfocus()
bool Curves::allowCurveType(int points, CurveData::CurveType type)
{
int numcurves = GetEepromInterface()->getCapability(NumCurves);
int numcurves = GetCurrentFirmware()->getCapability(NumCurves);
int totalpoints = 0;
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);
}
int fwpoints = GetEepromInterface()->getCapability(NumCurvePoints);
int fwpoints = GetCurrentFirmware()->getCapability(NumCurvePoints);
if (totalpoints > fwpoints) {
QMessageBox::warning(this, "companion", tr("Not enough free points in EEPROM to store the curve."));
return false;
+14 -14
View File
@@ -66,9 +66,9 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
addEmptyLabel(gridLayout, 5 );
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++) {
if (model.funcSw[i].func==FuncPlayPrompt || model.funcSw[i].func==FuncBackgroundMusic) {
QString temp = model.funcSw[i].paramarm;
@@ -87,7 +87,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
lang="en";
path.append(lang);
QDir qd(path);
int vml= GetEepromInterface()->getCapability(VoicesMaxLength)+4;
int vml= GetCurrentFirmware()->getCapability(VoicesMaxLength)+4;
if (qd.exists()) {
QStringList filters;
filters << "*.wav" << "*.WAV";
@@ -227,7 +227,7 @@ void CustomFunctionsPanel::playMusic()
QDir qd(path);
QString track;
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');
}
else {
@@ -360,7 +360,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_ENABLE;
}
else if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
if (index != FuncBackgroundMusic && GetEepromInterface()->getCapability(HasFuncRepeat)) {
if (index != FuncBackgroundMusic && GetCurrentFirmware()->getCapability(HasFuncRepeat)) {
widgetsMask |= CUSTOM_FUNCTION_REPEAT;
fswtchRepeat[i]->update();
}
@@ -370,7 +370,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_REPEAT;
}
else if (index==FuncPlayPrompt || index==FuncPlayBoth) {
if (GetEepromInterface()->getCapability(VoicesAsNumbers)) {
if (GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
fswtchParam[i]->setDecimals(0);
fswtchParam[i]->setSingleStep(1);
fswtchParam[i]->setMinimum(0);
@@ -407,7 +407,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
if (modified) {
memset(model.funcSw[i].paramarm, 0, sizeof(model.funcSw[i].paramarm));
int vml = GetEepromInterface()->getCapability(VoicesMaxLength);
int vml = GetCurrentFirmware()->getCapability(VoicesMaxLength);
if (fswtchParamArmT[i]->currentText() != "----") {
widgetsMask |= CUSTOM_FUNCTION_PLAY;
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;
if (modified) {
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() != "----") {
widgetsMask |= CUSTOM_FUNCTION_PLAY;
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()
{
lock = true;
for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(CustomFunctions); i++) {
if (!initialized) {
populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, generalSettings, POPULATE_ONOFF);
populateFuncCB(fswtchFunc[i], model.funcSw[i].func);
@@ -562,24 +562,24 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
b->clear();
for (unsigned int i=0; i<FuncCount; i++) {
b->addItem(FuncSwData(AssignFunc(i)).funcToString());
if (!GetEepromInterface()->getCapability(HasVolume)) {
if (!GetCurrentFirmware()->getCapability(HasVolume)) {
if (i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
}
if ((i==FuncPlayHaptic) && !GetEepromInterface()->getCapability(Haptic)) {
if ((i==FuncPlayHaptic) && !GetCurrentFirmware()->getCapability(Haptic)) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
if ((i==FuncPlayBoth) && !GetEepromInterface()->getCapability(HasBeeper)) {
if ((i==FuncPlayBoth) && !GetCurrentFirmware()->getCapability(HasBeeper)) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
if ((i==FuncLogs) && !GetEepromInterface()->getCapability(HasSDLogs)) {
if ((i==FuncLogs) && !GetCurrentFirmware()->getCapability(HasSDLogs)) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
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("All"));
qs.append( QObject::tr("Telemetry"));
int reCount = GetEepromInterface()->getCapability(RotaryEncoders);
int reCount = GetCurrentFirmware()->getCapability(RotaryEncoders);
if (reCount == 1) {
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);
if (!GetEepromInterface()->getCapability(FlightPhases)) {
if (!GetCurrentFirmware()->getCapability(FlightPhases)) {
ui->label_phases->hide();
for (int i=0; i<9; i++) {
lb_fp[i]->hide();
@@ -43,13 +43,13 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
}
mask <<= 1;
}
for (int i=GetEepromInterface()->getCapability(FlightPhases); i<9;i++) {
for (int i=GetCurrentFirmware()->getCapability(FlightPhases); i<9;i++) {
lb_fp[i]->hide();
cb_fp[i]->hide();
}
}
if (GetEepromInterface()->getCapability(VirtualInputs)) {
if (GetCurrentFirmware()->getCapability(VirtualInputs)) {
ui->inputName->setMaxLength(4);
populateSourceCB(ui->sourceCB, ed->srcRaw, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
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->setCurrentIndex(1 - ed->carryTrim);
int expolength = GetEepromInterface()->getCapability(HasExpoNames);
int expolength = GetCurrentFirmware()->getCapability(HasExpoNames);
if (!expolength) {
ui->lineNameLabel->hide();
ui->lineName->hide();
@@ -96,7 +96,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
for (int i=0; i<9; i++) {
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()));
QTimer::singleShot(0, this, SLOT(shrink()));
@@ -111,7 +111,7 @@ ExpoDialog::~ExpoDialog()
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();
ui->scaleLabel->show();
ui->scale->show();
@@ -153,11 +153,11 @@ void ExpoDialog::valuesChanged()
ed->phases<<=1;
}
ed->phases>>=1;
if (GetEepromInterface()->getCapability(FlightPhases)) {
if (GetCurrentFirmware()->getCapability(FlightPhases)) {
int zeros=0;
int ones=0;
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) {
ones++;
}
@@ -168,7 +168,7 @@ void ExpoDialog::valuesChanged()
}
if (zeros==1) {
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) {
break;
}
@@ -177,7 +177,7 @@ void ExpoDialog::valuesChanged()
}
else if (ones==1) {
phtemp=ed->phases;
for (int i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(FlightPhases); i++) {
if (phtemp & 1) {
break;
}
+15 -15
View File
@@ -10,19 +10,19 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
ui(new Ui::FlightMode),
phaseIdx(phaseIdx),
phase(model.phaseData[phaseIdx]),
reCount(GetEepromInterface()->getCapability(RotaryEncoders)),
gvCount(((!GetEepromInterface()->getCapability(HasVariants)) || (GetCurrentFirmwareVariant() & GVARS_VARIANT)) ?
GetEepromInterface()->getCapability(Gvars) : 0)
reCount(GetCurrentFirmware()->getCapability(RotaryEncoders)),
gvCount(((!GetCurrentFirmware()->getCapability(HasVariants)) || (GetCurrentFirmwareVariant() & GVARS_VARIANT)) ?
GetCurrentFirmware()->getCapability(Gvars) : 0)
{
ui->setupUi(this);
int modesCount = GetEepromInterface()->getCapability(FlightPhases);
int modesCount = GetCurrentFirmware()->getCapability(FlightPhases);
// Phase name
QRegExp rx(CHAR_FOR_NAMES_REGEX);
if (modesCount) {
ui->name->setValidator(new QRegExpValidator(rx, this));
ui->name->setMaxLength(GetEepromInterface()->getCapability(FlightModesName));
ui->name->setMaxLength(GetCurrentFirmware()->getCapability(FlightModesName));
connect(ui->name, SIGNAL(editingFinished()), this, SLOT(phaseName_editingFinished()));
}
else {
@@ -39,9 +39,9 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
}
// FadeIn / FadeOut
if (GetEepromInterface()->getCapability(FlightPhasesHaveFades)) {
int scale = GetEepromInterface()->getCapability(SlowScale);
int range = GetEepromInterface()->getCapability(SlowRange);
if (GetCurrentFirmware()->getCapability(FlightPhasesHaveFades)) {
int scale = GetCurrentFirmware()->getCapability(SlowScale);
int range = GetCurrentFirmware()->getCapability(SlowRange);
ui->fadeIn->setMaximum(float(range)/scale);
ui->fadeIn->setSingleStep(1.0/scale);
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));
gvLayout->addWidget(label, i, col++, 1, 1);
// GVar name
int nameLen = GetEepromInterface()->getCapability(GvarsName);
int nameLen = GetCurrentFirmware()->getCapability(GvarsName);
if (nameLen > 0) {
gvNames[i] = new QLineEdit(ui->gvGB);
gvNames[i]->setProperty("index", i);
@@ -183,12 +183,12 @@ void FlightMode::update()
{
ui->name->setText(phase.name);
int scale = GetEepromInterface()->getCapability(SlowScale);
int scale = GetCurrentFirmware()->getCapability(SlowScale);
ui->fadeIn->setValue(float(phase.fadeIn)/scale);
ui->fadeOut->setValue(float(phase.fadeOut)/scale);
for (int i=0; i<4; i++) {
int trimsMax = GetEepromInterface()->getCapability(ExtendedTrims);
int trimsMax = GetCurrentFirmware()->getCapability(ExtendedTrims);
if (trimsMax == 0 || !model.extendedTrims) {
trimsMax = 125;
}
@@ -249,7 +249,7 @@ void FlightMode::phaseSwitch_currentIndexChanged(int index)
void FlightMode::phaseFadeIn_editingFinished()
{
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
int scale = GetEepromInterface()->getCapability(SlowScale);
int scale = GetCurrentFirmware()->getCapability(SlowScale);
phase.fadeIn = round(spinBox->value()*scale);
emit modified();
}
@@ -257,7 +257,7 @@ void FlightMode::phaseFadeIn_editingFinished()
void FlightMode::phaseFadeOut_editingFinished()
{
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
int scale = GetEepromInterface()->getCapability(SlowScale);
int scale = GetCurrentFirmware()->getCapability(SlowScale);
phase.fadeOut = round(spinBox->value()*scale);
emit modified();
}
@@ -420,7 +420,7 @@ void FlightMode::phaseTrimSlider_valueChanged()
FlightModes::FlightModes(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
ModelPanel(parent, model, generalSettings),
modesCount(GetEepromInterface()->getCapability(FlightPhases))
modesCount(GetCurrentFirmware()->getCapability(FlightPhases))
{
QGridLayout * gridLayout = new QGridLayout(this);
tabWidget = new QTabWidget(this);
@@ -449,7 +449,7 @@ QString FlightModes::getTabName(int index)
{
QString result = tr("Flight Mode %1").arg(index);
const char *name = model.phaseData[index].name;
if (GetEepromInterface()->getCapability(FlightModesName) && strlen(name) > 0) {
if (GetCurrentFirmware()->getCapability(FlightModesName) && strlen(name) > 0) {
result += tr(" (%1)").arg(name);
}
else if (index == 0) {
+7 -7
View File
@@ -47,7 +47,7 @@ void InputsPanel::update()
{
lock = true;
int inputsCount = GetEepromInterface()->getCapability(VirtualInputs);
int inputsCount = GetCurrentFirmware()->getCapability(VirtualInputs);
if (inputsCount == 0)
inputsCount = NUM_STICKS;
@@ -75,20 +75,20 @@ void InputsPanel::update()
}
if (curDest!=(int)md->chn) {
if (GetEepromInterface()->getCapability(VirtualInputs))
if (GetCurrentFirmware()->getCapability(VirtualInputs))
str = QString("%1").arg(getInputStr(model, md->chn), -8, ' ');
else
str = getInputStr(model, md->chn);
curDest = md->chn;
}
else {
if (GetEepromInterface()->getCapability(VirtualInputs))
if (GetCurrentFirmware()->getCapability(VirtualInputs))
str = " ";
else
str = " ";
}
if (GetEepromInterface()->getCapability(VirtualInputs)) {
if (GetCurrentFirmware()->getCapability(VirtualInputs)) {
str += " " + tr("Source(%1)").arg(md->srcRaw.toString());
if (md->carryTrim>0) {
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 (GetEepromInterface()->getCapability(HasExpoNames)) {
if (GetCurrentFirmware()->getCapability(HasExpoNames)) {
QString expoName = md->name;
if (!expoName.isEmpty()) str += QString(" [%1]").arg(expoName);
}
@@ -171,13 +171,13 @@ void InputsPanel::gm_openExpo(int index)
emit modified();
update();
if (GetEepromInterface()->getCapability(VirtualInputs))
if (GetCurrentFirmware()->getCapability(VirtualInputs))
strcpy(inputName, model.inputNames[mixd.chn]);
ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings, inputName);
if (g->exec()) {
model.expoData[index] = mixd;
if (GetEepromInterface()->getCapability(VirtualInputs))
if (GetCurrentFirmware()->getCapability(VirtualInputs))
strcpy(model.inputNames[mixd.chn], inputName);
emit modified();
update();
+9 -9
View File
@@ -18,13 +18,13 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
addLabel(gridLayout, tr("V1"), col++);
addLabel(gridLayout, tr("V2"), col++);
addLabel(gridLayout, tr("AND Switch"), col++);
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
addLabel(gridLayout, tr("Duration"), col++);
addLabel(gridLayout, tr("Delay"), col++);
}
lock = true;
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
// The label
QLabel * label = new QLabel(this);
label->setProperty("index", i);
@@ -90,7 +90,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int)));
gridLayout->addWidget(cswitchAnd[i], i+1, 4);
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
// Duration
cswitchDuration[i] = new QDoubleSpinBox(this);
cswitchDuration[i]->setProperty("index", i);
@@ -115,7 +115,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
}
}
// Push rows upward
addVSpring(gridLayout,0,GetEepromInterface()->getCapability(LogicalSwitches)+1);
addVSpring(gridLayout,0,GetCurrentFirmware()->getCapability(LogicalSwitches)+1);
lock = false;
}
@@ -276,7 +276,7 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
{
case LS_FAMILY_VOFS:
mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE;
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (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]->setSingleStep(range.step);
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;
case LS_FAMILY_VCOMP:
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
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 | (GetCurrentFirmware()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
break;
case LS_FAMILY_TIMER:
mask |= VALUE1_VISIBLE | VALUE2_VISIBLE;
@@ -331,7 +331,7 @@ void LogicalSwitchesPanel::updateLine(int i)
setSwitchWidgetVisibility(i);
lock = true;
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);
cswitchDelay[i]->setValue(model.customSw[i].delay/10.0);
}
@@ -340,7 +340,7 @@ void LogicalSwitchesPanel::updateLine(int i)
void LogicalSwitchesPanel::update()
{
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); 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);
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);
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);
if (GetEepromInterface()->getCapability(VirtualInputs) || !GetEepromInterface()->getCapability(MixesWithoutExpo)) {
if (GetCurrentFirmware()->getCapability(VirtualInputs) || !GetCurrentFirmware()->getCapability(MixesWithoutExpo)) {
ui->MixDR_CB->hide();
ui->label_MixDR->hide();
}
if (!GetEepromInterface()->getCapability(VirtualInputs)) {
if (!GetCurrentFirmware()->getCapability(VirtualInputs)) {
ui->trimCB->addItem(tr("Rud"));
ui->trimCB->addItem(tr("Ele"));
ui->trimCB->addItem(tr("Thr"));
@@ -43,7 +43,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
ui->trimCB->setCurrentIndex(1 - md->carryTrim);
int namelength = GetEepromInterface()->getCapability(HasMixerNames);
int namelength = GetCurrentFirmware()->getCapability(HasMixerNames);
if (!namelength) {
ui->label_name->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->setText(md->name);
if (!GetEepromInterface()->getCapability(FlightPhases)) {
if (!GetCurrentFirmware()->getCapability(FlightPhases)) {
ui->label_phases->hide();
for (int i=0; i<9; i++) {
lb_fp[i]->hide();
@@ -69,7 +69,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
}
mask <<= 1;
}
for (int i=GetEepromInterface()->getCapability(FlightPhases); i<9;i++) {
for (int i=GetCurrentFirmware()->getCapability(FlightPhases); i<9;i++) {
lb_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);
ui->warningCB->setCurrentIndex(md->mixWarn);
ui->mltpxCB->setCurrentIndex(md->mltpx);
int scale=GetEepromInterface()->getCapability(SlowScale);
float range=GetEepromInterface()->getCapability(SlowRange);
int scale=GetCurrentFirmware()->getCapability(SlowScale);
float range=GetCurrentFirmware()->getCapability(SlowRange);
ui->slowDownSB->setMaximum(range/scale);
ui->slowDownSB->setSingleStep(1.0/scale);
ui->slowDownSB->setDecimals((scale==1 ? 0 :1));
@@ -142,7 +142,7 @@ void MixerDialog::valuesChanged()
lock = true;
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
md->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt(), &model);
if (!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);
ui->MixDR_CB->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->mixWarn = ui->warningCB->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->delayUp = round(ui->delayUpSB->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 str;
int outputs = GetEepromInterface()->getCapability(Outputs);
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(" ");
if (GetEepromInterface()->getCapability(HasChNames)) {
if (GetCurrentFirmware()->getCapability(HasChNames)) {
QString name = model.limitData[curDest-1].name;
if (!name.isEmpty()) {
name = QString("(") + name + QString(")");
@@ -68,9 +68,9 @@ void MixesPanel::update()
MixerlistWidget->clear();
unsigned int curDest = 0;
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];
// qDebug() << "md->destCh: " << md->destCh;
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->curve.value) str += " " + Qt::escape(md->curve.toString());
int scale = GetEepromInterface()->getCapability(SlowScale);
int scale = GetCurrentFirmware()->getCapability(SlowScale);
if (scale == 0)
scale = 1;
if (md->delayDown || md->delayUp)
@@ -193,7 +193,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
if (md->speedDown || md->speedUp)
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 (GetEepromInterface()->getCapability(HasMixerNames)) {
if (GetCurrentFirmware()->getCapability(HasMixerNames)) {
QString MixerName;
MixerName.append(md->name);
if (!MixerName.isEmpty()) {
@@ -206,14 +206,14 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
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!"));
return false;
}
int i = model.mixData[idx].destCh;
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));
model.mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE);
model.mixData[idx].destCh = i;
@@ -224,13 +224,13 @@ bool MixesPanel::gm_insertMix(int idx)
void MixesPanel::gm_deleteMix(int index)
{
memmove(&model.mixData[index],&model.mixData[index+1],
(GetEepromInterface()->getCapability(Mixes)-(index+1))*sizeof(MixData));
memset(&model.mixData[GetEepromInterface()->getCapability(Mixes)-1],0,sizeof(MixData));
(GetCurrentFirmware()->getCapability(Mixes)-(index+1))*sizeof(MixData));
memset(&model.mixData[GetCurrentFirmware()->getCapability(Mixes)-1],0,sizeof(MixData));
}
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]);
emit modified();
@@ -254,8 +254,8 @@ void MixesPanel::gm_openMix(int index)
int MixesPanel::getMixerIndex(unsigned int dch)
{
int i = 0;
while ((model.mixData[i].destCh<=dch) && (model.mixData[i].destCh) && (i<GetEepromInterface()->getCapability(Mixes))) i++;
if(i==GetEepromInterface()->getCapability(Mixes)) return -1;
while ((model.mixData[i].destCh<=dch) && (model.mixData[i].destCh) && (i<GetCurrentFirmware()->getCapability(Mixes))) i++;
if(i==GetCurrentFirmware()->getCapability(Mixes)) return -1;
return i;
}
@@ -291,7 +291,7 @@ QList<int> MixesPanel::createMixListFromSelected()
QList<int> list;
foreach(QListWidgetItem *item, MixerlistWidget->selectedItems()) {
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;
}
@@ -364,7 +364,7 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
int i = 0;
while(i<mxData.size()) {
idx++;
if(idx==GetEepromInterface()->getCapability(Mixes)) break;
if(idx==GetCurrentFirmware()->getCapability(Mixes)) break;
if (!gm_insertMix(idx))
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
{
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;
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)
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 (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(new Curves(this, model, generalSettings), tr("Curves"));
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"));
if (GetEepromInterface()->getCapability(Telemetry) & TM_HASTELEMETRY)
if (GetCurrentFirmware()->getCapability(Telemetry) & TM_HASTELEMETRY)
addTab(new TelemetryPanel(this, model, generalSettings), tr("Telemetry"));
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
populateSwitchCB(ui->mode, timer.mode, generalSettings, POPULATE_TIMER_MODES);
if (!GetEepromInterface()->getCapability(PermTimers)) {
if (!GetCurrentFirmware()->getCapability(PermTimers)) {
ui->persistent->hide();
ui->persistentValue->hide();
}
@@ -41,7 +41,7 @@ void TimerPanel::update()
int sec = timer.val % 60;
ui->value->setTime(QTime(0, min, sec));
if (GetEepromInterface()->getCapability(PermTimers)) {
if (GetCurrentFirmware()->getCapability(PermTimers)) {
int sign = 1;
int pvalue = timer.pvalue;
if (pvalue < 0) {
@@ -112,7 +112,7 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
else {
ui->label_trainerMode->hide();
ui->trainerMode->hide();
if (GetEepromInterface()->getCapability(NumModules) > 1) {
if (GetCurrentFirmware()->getCapability(NumModules) > 1) {
if (moduleIdx == 0)
label = tr("Internal Radio System");
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++) {
QLabel * label = new QLabel(this);
label->setText(QString::number(i+1));
@@ -211,7 +211,7 @@ void ModulePanel::update()
ui->channelsCount->setVisible(mask & MASK_CHANNELS_RANGE);
ui->channelsCount->setEnabled(mask & MASK_CHANNELS_COUNT);
ui->channelsCount->setValue(module.channelsCount);
ui->channelsCount->setSingleStep(GetEepromInterface()->getCapability(HasPPMStart) ? 1 : 2);
ui->channelsCount->setSingleStep(GetCurrentFirmware()->getCapability(HasPPMStart) ? 1 : 2);
// PPM settings 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->ppmFrameLength->setVisible(mask & MASK_PPM_FIELDS);
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);
if (GetEepromInterface()->getCapability(HasFailsafe)) {
if (GetCurrentFirmware()->getCapability(HasFailsafe)) {
ui->label_failsafeMode->setVisible(mask & MASK_FAILSAFES);
ui->failsafeMode->setVisible(mask & MASK_FAILSAFES);
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()));
}
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);
ui->modulesLayout->addWidget(modules[i]);
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);
ui->modulesLayout->addWidget(modules[C9X_NUM_MODULES]);
}
if (GetEepromInterface()->getCapability(ModelImage)) {
if (GetCurrentFirmware()->getCapability(ModelImage)) {
QStringList items;
items.append("");
QString path = g.profile[g.id()].sdPath();
@@ -399,13 +399,13 @@ Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettin
ui->imagePreview->hide();
}
if (!GetEepromInterface()->getCapability(HasDisplayText)) {
if (!GetCurrentFirmware()->getCapability(HasDisplayText)) {
ui->displayText->hide();
}
// Beep Center checkboxes
int analogs = 4 + GetEepromInterface()->getCapability(Pots);
for (int i=0; i<analogs+GetEepromInterface()->getCapability(RotaryEncoders); i++) {
int analogs = 4 + GetCurrentFirmware()->getCapability(Pots);
for (int i=0; i<analogs+GetCurrentFirmware()->getCapability(RotaryEncoders); i++) {
QCheckBox * checkbox = new QCheckBox(this);
checkbox->setProperty("index", i);
checkbox->setText(i<analogs ? AnalogString(i) : RotaryEncoderString(i-analogs));
@@ -415,7 +415,7 @@ Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettin
}
// 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);
QSlider * slider = new QSlider(this);
QCheckBox * cb = new QCheckBox(this);
@@ -449,11 +449,11 @@ Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettin
startupSwitchesSliders << slider;
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
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);
cb->setProperty("index", i+1);
cb->setText(AnalogString(i+4));
@@ -628,7 +628,7 @@ void Setup::updateStartupSwitches()
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];
QCheckBox * cb = startupSwitchesCheckboxes[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) {
ui->RatioSB->setDecimals(1);
ui->RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
ui->RatioSB->setMaximum(25.5*GetCurrentFirmware()->getCapability(TelemetryMaxMultiplier));
}
else {
ui->RatioSB->setDecimals(0);
ui->RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
ui->RatioSB->setMaximum(255*GetCurrentFirmware()->getCapability(TelemetryMaxMultiplier));
}
ui->RatioSB->setValue(ratio);
@@ -43,7 +43,7 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
ui->alarm2Label->setText(tr("Critical Alarm"));
}
if (!(GetEepromInterface()->getCapability(Telemetry) & TM_HASOFFSET)) {
if (!(GetCurrentFirmware()->getCapability(Telemetry) & TM_HASOFFSET)) {
ui->CalibSB->hide();
ui->CalibLabel->hide();
}
@@ -87,11 +87,11 @@ void TelemetryAnalog::on_UnitCB_currentIndexChanged(int index)
case 1:
case 2:
ui->RatioSB->setDecimals(1);
ui->RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
ui->RatioSB->setMaximum(25.5*GetCurrentFirmware()->getCapability(TelemetryMaxMultiplier));
break;
default:
ui->RatioSB->setDecimals(0);
ui->RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
ui->RatioSB->setMaximum(255*GetCurrentFirmware()->getCapability(TelemetryMaxMultiplier));
break;
}
ui->RatioSB->setValue(ratio);
@@ -288,7 +288,7 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
ui->setupUi(this);
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]->setProperty("index", c + (l<<8));
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) {
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]);
}
}
@@ -471,7 +471,7 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
{
ui->setupUi(this);
if (GetEepromInterface()->getCapability(NoTelemetryProtocol)) {
if (GetCurrentFirmware()->getCapability(NoTelemetryProtocol)) {
model.frsky.usrProto = 1;
}
@@ -483,7 +483,7 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
ui->A2Layout->addWidget(analogs[1]);
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);
ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1));
}
@@ -508,7 +508,7 @@ void TelemetryPanel::setup()
lock=true;
//frsky Settings
if (!GetEepromInterface()->getCapability(TelemetryRSSIModel) ) {
if (!GetCurrentFirmware()->getCapability(TelemetryRSSIModel) ) {
ui->RSSIGB->hide();
}
ui->rssiAlarm1SB->setValue(model.frsky.rssiAlarms[0].value);
@@ -524,7 +524,7 @@ void TelemetryPanel::setup()
ui->rssiAlarm2Label->setText(tr("Critical Alarm"));
}
if (!GetEepromInterface()->getCapability(HasAltitudeSel)) {
if (!GetCurrentFirmware()->getCapability(HasAltitudeSel)) {
ui->AltitudeGPS_ChkB->hide();
}
else {
@@ -538,7 +538,7 @@ void TelemetryPanel::setup()
ui->AltitudeToolbar_ChkB->hide();
}
int varioCap = GetEepromInterface()->getCapability(HasVario);
int varioCap = GetCurrentFirmware()->getCapability(HasVario);
if (!varioCap) {
ui->varioLimitMax_DSB->hide();
ui->varioLimitMinOff_ChkB->hide();
@@ -554,7 +554,7 @@ void TelemetryPanel::setup()
ui->varioSource_label->hide();
}
else {
if (!GetEepromInterface()->getCapability(HasVarioSink)) {
if (!GetCurrentFirmware()->getCapability(HasVarioSink)) {
ui->varioLimitMinOff_ChkB->hide();
ui->varioLimitMin_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();
}
if (GetEepromInterface()->getCapability(NoTelemetryProtocol)) {
if (GetCurrentFirmware()->getCapability(NoTelemetryProtocol)) {
ui->frskyProtoCB->setDisabled(true);
}
else {
ui->frskyProtoCB->setEnabled(true);
}
if (!GetEepromInterface()->getCapability(TelemetryUnits)) {
if (!GetCurrentFirmware()->getCapability(TelemetryUnits)) {
ui->frskyUnitsCB->setDisabled(true);
int index=0;
if (firmware_id.contains("imperial")) {
@@ -604,7 +604,7 @@ void TelemetryPanel::setup()
ui->frskyUnitsCB->setCurrentIndex(index);
}
if ((GetEepromInterface()->getCapability(Telemetry)&TM_HASWSHH)) {
if ((GetCurrentFirmware()->getCapability(Telemetry)&TM_HASWSHH)) {
ui->frskyProtoCB->addItem(tr("Winged Shadow How High"));
}
else {
@@ -612,7 +612,7 @@ void TelemetryPanel::setup()
}
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_DSB->hide();
}
@@ -621,7 +621,7 @@ void TelemetryPanel::setup()
ui->variousGB->show();
}
if (!(GetEepromInterface()->getCapability(HasMahPersistent))) {
if (!(GetCurrentFirmware()->getCapability(HasMahPersistent))) {
ui->mahCount_label->hide();
ui->mahCount_SB->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);
if (GetEepromInterface()->getCapability(NumCurves)>c) {
if (GetCurrentFirmware()->getCapability(NumCurves)>c) {
if (len<9) {
model.curves[c].count=5;
model.curves[c].custom=false;
@@ -100,7 +100,7 @@ void Templates::applyNumericTemplate(uint64_t tpl)
for (int i=0; i<10 ; i++) {
rx[i]=false;
}
int thrsw=GetEepromInterface()->getCapability(GetThrSwitch);
int thrsw=GetCurrentFirmware()->getCapability(GetThrSwitch);
MixData *md = &model.mixData[0];
uint8_t spo2ch=(tpl & 0x0F);
tpl>>=4;
@@ -554,7 +554,7 @@ void Templates::applyTemplate(uint8_t idx)
int8_t heli_ar4[] = {-30, -15, 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];
//CC(STK) -> vSTK
@@ -715,7 +715,7 @@ void Templates::applyTemplate(uint8_t idx)
bool found=true;
while (found) {
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) {
gm_deleteMix(i);
found=true;
@@ -827,7 +827,7 @@ void Templates::applyTemplate(uint8_t idx)
bool found=true;
while (found) {
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) {
gm_deleteMix(i);
found=true;
@@ -867,11 +867,11 @@ void Templates::applyTemplate(uint8_t idx)
MixData* Templates::setDest(uint8_t dch)
{
uint8_t i = 0;
while ((g_model.mixData[i].destCh<=dch) && (g_model.mixData[i].destCh) && (i<GetEepromInterface()->getCapability(Mixes))) i++;
if(i==GetEepromInterface()->getCapability(Mixes)) return &g_model.mixData[0];
while ((g_model.mixData[i].destCh<=dch) && (g_model.mixData[i].destCh) && (i<GetCurrentFirmware()->getCapability(Mixes))) i++;
if(i==GetCurrentFirmware()->getCapability(Mixes)) return &g_model.mixData[0];
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));
g_model.mixData[i].destCh = dch;
return &g_model.mixData[i];