Skip to content
This repository was archived by the owner on Feb 25, 2021. It is now read-only.

Commit 24c03b5

Browse files
committed
If Fxos8700Fxas21002 is used as inclinometer, the status gets updated now
1 parent 2bb28b1 commit 24c03b5

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

src/sensor.cpp

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -731,17 +731,19 @@ void initSensors() {
731731
Control* handle = ESPUI.getControl( labelStatusInclino );
732732

733733
if ( mma.begin() ) {
734+
initialisation.inclinoType = SteerConfig::InclinoType::MMA8451;
735+
734736
handle->value = "MMA8451 found & initialized";
735737
handle->color = ControlColor::Emerald;
736-
initialisation.inclinoType = SteerConfig::InclinoType::MMA8451;
737738

738739
mma.setRange( MMA8451_RANGE_2_G );
739740
mma.setDataRate( MMA8451_DATARATE_200_HZ );
740741
mma.setFifoSettings( MMA8451_FIFO_CIRCULAR );
741742
} else {
743+
initialisation.inclinoType = SteerConfig::InclinoType::None;
744+
742745
handle->value = "MMA8451 not found";
743746
handle->color = ControlColor::Alizarin;
744-
initialisation.inclinoType = SteerConfig::InclinoType::None;
745747
}
746748

747749
ESPUI.updateControl( handle );
@@ -751,9 +753,10 @@ void initSensors() {
751753
Control* handle = ESPUI.getControl( labelStatusImu );
752754

753755
if ( bno.begin() ) {
756+
initialisation.imuType = SteerConfig::ImuType::BNO055;
757+
754758
handle->value = "BNO055 found & initialized";
755759
handle->color = ControlColor::Emerald;
756-
initialisation.imuType = SteerConfig::ImuType::BNO055;
757760

758761
displaySensorOffsets( bno055CalibrationData );
759762

@@ -763,47 +766,61 @@ void initSensors() {
763766

764767
bno.setExtCrystalUse( true );
765768
} else {
769+
initialisation.imuType = SteerConfig::ImuType::None;
770+
766771
handle->value = "BNO055 not found";
767772
handle->color = ControlColor::Alizarin;
768-
initialisation.imuType = SteerConfig::ImuType::None;
769773
}
770774

771775
ESPUI.updateControl( handle );
772776
}
773777

774778
if ( steerConfig.inclinoType == SteerConfig::InclinoType::Fxos8700Fxas21002 ||
775-
steerConfig.imuType == SteerConfig::ImuType::Fxos8700Fxas21002
776-
) {
777-
Control* handle = ESPUI.getControl( labelStatusImu );
779+
steerConfig.imuType == SteerConfig::ImuType::Fxos8700Fxas21002 ) {
778780

779781
if ( fxas2100.begin() && fxos8700.begin( ACCEL_RANGE_2G ) ) {
780782

781-
handle->value = "FXAS2100/FXOS8700 found & initialized";
782-
handle->color = ControlColor::Emerald;
783-
784783
if ( steerConfig.imuType == SteerConfig::ImuType::Fxos8700Fxas21002 ) {
785784
initialisation.imuType = steerConfig.imuType;
785+
786+
Control* handle = ESPUI.getControl( labelStatusImu );
787+
handle->value = "FXAS2100/FXOS8700 found & initialized";
788+
handle->color = ControlColor::Emerald;
789+
ESPUI.updateControl( handle );
786790
}
787791

788792
if ( steerConfig.inclinoType == SteerConfig::InclinoType::Fxos8700Fxas21002 ) {
789793
initialisation.inclinoType = steerConfig.inclinoType;
794+
795+
Control* handle = ESPUI.getControl( labelStatusInclino );
796+
handle->value = "FXAS2100/FXOS8700 found & initialized";
797+
handle->color = ControlColor::Emerald;
798+
ESPUI.updateControl( handle );
790799
}
791800

792801
ahrs.begin( 100 );
793802
} else {
794-
handle->value = "FXAS2100/FXOS8700 not found";
795-
handle->color = ControlColor::Alizarin;
803+
796804

797805
if ( steerConfig.imuType == SteerConfig::ImuType::Fxos8700Fxas21002 ) {
798806
initialisation.imuType = SteerConfig::ImuType::None;
807+
808+
Control* handle = ESPUI.getControl( labelStatusImu );
809+
handle->value = "FXAS2100/FXOS8700 not found";
810+
handle->color = ControlColor::Alizarin;
811+
ESPUI.updateControl( handle );
799812
}
800813

801814
if ( steerConfig.inclinoType == SteerConfig::InclinoType::Fxos8700Fxas21002 ) {
802815
initialisation.inclinoType = SteerConfig::InclinoType::None;
816+
817+
Control* handle = ESPUI.getControl( labelStatusInclino );
818+
handle->value = "FXAS2100/FXOS8700 not found";
819+
handle->color = ControlColor::Alizarin;
820+
ESPUI.updateControl( handle );
803821
}
804822
}
805823

806-
ESPUI.updateControl( handle );
807824
}
808825

809826
// initialise ads1115 everytime, even if not avaible (no answer in the init -> just sending)

0 commit comments

Comments
 (0)