Skip to content

Commit

Permalink
GUI Ignore Mag if board is XIAO
Browse files Browse the repository at this point in the history
Will be properly done in the HW_Feat branch
  • Loading branch information
dlktdr committed May 28, 2023
1 parent 716a988 commit 20db704
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 14 additions & 1 deletion gui/src/calibrateble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ void CalibrateBLE::setButtonText()
} else {
ui->cmdNext->setText("Save");
}
if(hasMagnetometer == false && step == STEP_ACCELCAL) {
ui->cmdPrevious->setText("Cancel");
}
ui->cmdPrevious->setDisabled(false);
ui->cmdNext->setDisabled(false);
}
Expand All @@ -159,6 +162,16 @@ void CalibrateBLE::showEvent(QShowEvent *event)
{
Q_UNUSED(event);
ui->chkUseMagnetometer->setChecked(!trkset->getDisMag());
if(trkset->hardware().contains("XIAO")) {
hasMagnetometer = false;
if(step == STEP_MAGINTRO || step == STEP_MAGCAL) {
step = STEP_ACCELCAL;
ui->stackedWidget->setCurrentIndex(step);
setButtonText();
}
}
else
hasMagnetometer = true;
}

void CalibrateBLE::nextClicked()
Expand Down Expand Up @@ -200,7 +213,7 @@ void CalibrateBLE::nextClicked()

void CalibrateBLE::prevClicked()
{
if(step == 0) {
if(step == 0 || (step == STEP_ACCELCAL && hasMagnetometer==false)) {
emit calibrationCancel();
hide();
}
Expand Down
2 changes: 2 additions & 0 deletions gui/src/calibrateble.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class CalibrateBLE : public QDialog
enum ACCSTEP {ZP,ZM,YP,YM,XP,XM,ACCCOMPLETE};
int accStep;

bool hasMagnetometer=true;

void setButtonText();
void showEvent(QShowEvent *event) override;

Expand Down

0 comments on commit 20db704

Please sign in to comment.