From 20db704e951b1066073b9078bf7aed3d2ea83891 Mon Sep 17 00:00:00 2001 From: dlktdr Date: Sat, 27 May 2023 22:13:48 -0700 Subject: [PATCH] GUI Ignore Mag if board is XIAO Will be properly done in the HW_Feat branch --- gui/src/calibrateble.cpp | 15 ++++++++++++++- gui/src/calibrateble.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gui/src/calibrateble.cpp b/gui/src/calibrateble.cpp index 45fd73f7..32233947 100644 --- a/gui/src/calibrateble.cpp +++ b/gui/src/calibrateble.cpp @@ -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); } @@ -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() @@ -200,7 +213,7 @@ void CalibrateBLE::nextClicked() void CalibrateBLE::prevClicked() { - if(step == 0) { + if(step == 0 || (step == STEP_ACCELCAL && hasMagnetometer==false)) { emit calibrationCancel(); hide(); } diff --git a/gui/src/calibrateble.h b/gui/src/calibrateble.h index 3e7bcba9..aec6dbbf 100644 --- a/gui/src/calibrateble.h +++ b/gui/src/calibrateble.h @@ -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;