[Companion] Fixes

This commit is contained in:
Bertrand Songis
2017-01-18 15:25:43 +01:00
parent 38c7f1c7d3
commit 1924d28be3
34 changed files with 297 additions and 325 deletions
+2 -2
View File
@@ -101,7 +101,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
headerLabels << tr("Name");
}
headerLabels << tr("Subtrim") << tr("Min") << tr("Max") << tr("Direction");
if (IS_TARANIS(GetEepromInterface()->getBoard()))
if (IS_TARANIS(firmware->getBoard()))
headerLabels << tr("Curve");
if (firmware->getCapability(PPMCenter))
headerLabels << tr("PPM Center");
@@ -150,7 +150,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
tableLayout->addWidget(i, col++, invCB);
// Curve
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
if (IS_TARANIS(firmware->getBoard())) {
QComboBox * curveCB = new QComboBox(this);
curveCB->setProperty("index", i);
int numcurves = firmware->getCapability(NumCurves);
+4 -4
View File
@@ -26,7 +26,7 @@ RepeatComboBox::RepeatComboBox(QWidget *parent, int & repeatParam):
QComboBox(parent),
repeatParam(repeatParam)
{
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 1 : 10;
unsigned int step = IS_ARM(getCurrentBoard()) ? 1 : 10;
int value = repeatParam/step;
if (step == 1) {
@@ -53,7 +53,7 @@ void RepeatComboBox::onIndexChanged(int index)
void RepeatComboBox::update()
{
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 1 : 10;
unsigned int step = IS_ARM(getCurrentBoard()) ? 1 : 10;
int value = repeatParam/step;
if (step == 1) {
value++;
@@ -395,7 +395,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
if (modified) cfn.param = fswtchParam[i]->value();
fswtchParam[i]->setDecimals(0);
fswtchParam[i]->setSingleStep(1);
if (IS_ARM(GetEepromInterface()->getBoard())) {
if (IS_ARM(getCurrentBoard())) {
fswtchParam[i]->setMinimum(-500);
fswtchParam[i]->setMaximum(500);
}
@@ -515,7 +515,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
}
populateFileComboBox(fswtchParamArmT[i], scriptsSet, cfn.paramarm);
}
else if (func==FuncBacklight && IS_TARANIS_PLUS(GetEepromInterface()->getBoard())) {
else if (func==FuncBacklight && IS_TARANIS_PLUS(getCurrentBoard())) {
if (modified) cfn.param = (uint8_t)fswtchBLcolor[i]->value();
fswtchBLcolor[i]->setValue(cfn.param);
widgetsMask |= CUSTOM_FUNCTION_BL_COLOR;
+1 -1
View File
@@ -40,7 +40,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
setWindowTitle(tr("Edit %1").arg(modelPrinter.printInputName(ed->chn)));
QRegExp rx(CHAR_FOR_NAMES_REGEX);
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
if (IS_TARANIS(getCurrentBoard())) {
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, model, 100, -100, 100);
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, ed->offset, model, 0, -100, 100);
}
+2 -2
View File
@@ -238,7 +238,7 @@ void FlightModePanel::update()
}
gvValues[i]->setDisabled(model->isGVarLinked(phaseIdx, i));
gvValues[i]->setValue(model->getGVarFieldValue(phaseIdx, i));
if (IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard()) && phaseIdx == 0) {
if (IS_HORUS_OR_TARANIS(getCurrentBoard()) && phaseIdx == 0) {
gvPopups[i]->setChecked(model->gvars_popups[i]);
}
}
@@ -471,7 +471,7 @@ void FlightModePanel::fmClear()
if (res == QMessageBox::Yes) {
phase.clear(phaseIdx);
if (phaseIdx == 0) {
if (IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard())) {
if (IS_HORUS_OR_TARANIS(getCurrentBoard())) {
for (int i=0; i < gvCount; ++i) {
memset(&model->gvars_names[i], 0, sizeof(model->gvars_names[i]));
model->gvars_popups[i] = 0;
+4 -5
View File
@@ -867,7 +867,6 @@ void SetupPanel::populateThrottleSourceCB()
void SetupPanel::update()
{
ui->name->setText(model->name);
ui->throttleReverse->setChecked(model->throttleReversed);
populateThrottleSourceCB();
ui->throttleWarning->setChecked(!model->disableThrottleWarning);
@@ -881,7 +880,7 @@ void SetupPanel::update()
updateBeepCenter();
updateStartupSwitches();
if(IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard())) {
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
updatePotWarnings();
}
@@ -915,7 +914,7 @@ void SetupPanel::updateStartupSwitches()
QCheckBox * cb = startupSwitchesCheckboxes[i];
int index = slider->property("index").toInt();
bool enabled = !(model->switchWarningEnable & (1 << index));
if (IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard())) {
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
value = (switchStates >> 2*index) & 0x03;
if (generalSettings.switchConfig[index] != GeneralSettings::SWITCH_3POS && value == 2) {
value = 1;
@@ -940,7 +939,7 @@ void SetupPanel::startupSwitchEdited(int value)
uint64_t mask;
int index = sender()->property("index").toInt();
if (IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard())) {
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
shift = index * 2;
mask = 0x03ul << shift;
}
@@ -956,7 +955,7 @@ void SetupPanel::startupSwitchEdited(int value)
model->switchWarningStates &= ~mask;
if (IS_HORUS_OR_TARANIS(GetEepromInterface()->getBoard()) && generalSettings.switchConfig[index] != GeneralSettings::SWITCH_3POS) {
if (IS_HORUS_OR_TARANIS(firmware->getBoard()) && generalSettings.switchConfig[index] != GeneralSettings::SWITCH_3POS) {
if (value == 1) {
value = 2;
}
+4 -4
View File
@@ -409,7 +409,7 @@ void TelemetryCustomScreen::updateBar(int line)
RawSource source = screen.body.bars[line].source;
if (source.type != SOURCE_TYPE_NONE) {
RawSourceRange range = source.getRange(model, generalSettings, RANGE_SINGLE_PRECISION);
if (!IS_ARM(GetCurrentFirmware()->getBoard())) {
if (!IS_ARM(getCurrentBoard())) {
int max = round((range.max - range.min) / range.step);
if (int(255-screen.body.bars[line].barMax) > max) {
screen.body.bars[line].barMax = 255 - max;
@@ -426,7 +426,7 @@ void TelemetryCustomScreen::updateBar(int line)
maxSB[line]->setMinimum(range.min);
maxSB[line]->setMaximum(range.max);
maxSB[line]->setSingleStep(range.step);
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
if (IS_ARM(getCurrentBoard())) {
maxSB[line]->setValue(range.getValue(screen.body.bars[line].barMax));
}
else {
@@ -486,7 +486,7 @@ void TelemetryCustomScreen::barMinChanged(double value)
{
if (!lock) {
int line = sender()->property("index").toInt();
if (IS_ARM(GetCurrentFirmware()->getBoard()))
if (IS_ARM(getCurrentBoard()))
screen.body.bars[line].barMin = round(value / minSB[line]->singleStep());
else
screen.body.bars[line].barMin = round((value-minSB[line]->minimum()) / minSB[line]->singleStep());
@@ -499,7 +499,7 @@ void TelemetryCustomScreen::barMaxChanged(double value)
{
if (!lock) {
int line = sender()->property("index").toInt();
if (IS_ARM(GetCurrentFirmware()->getBoard()))
if (IS_ARM(getCurrentBoard()))
screen.body.bars[line].barMax = round((value) / maxSB[line]->singleStep());
else
screen.body.bars[line].barMax = 255 - round((value-minSB[line]->minimum()) / maxSB[line]->singleStep());