@@ -705,12 +705,6 @@ bool I2cController::Handle_I2cDeviceAddOrReplace(pb_istream_t *stream) {
705
705
// I2cDeviceAddorReplace message
706
706
if (device_descriptor.i2c_mux_address != 0x00 ) {
707
707
if (_i2c_bus_alt->HasMux () || _i2c_bus_default->HasMux ()) {
708
- WS_DEBUG_PRINTLN (" [i2c] Scanning MUX!" );
709
- _i2c_bus_default->ScanMux ();
710
- WS_DEBUG_PRINT (" [i2c] Configuring MUX channel: " );
711
- WS_DEBUG_PRINTLN (device_descriptor.i2c_mux_channel );
712
- WS_DEBUG_PRINT (" [i2c] use_alt_bus: " );
713
- WS_DEBUG_PRINTLN (use_alt_bus);
714
708
ConfigureMuxChannel (device_descriptor.i2c_mux_channel , use_alt_bus);
715
709
did_set_mux_ch = true ;
716
710
} else {
@@ -772,31 +766,24 @@ bool I2cController::Handle_I2cDeviceAddOrReplace(pb_istream_t *stream) {
772
766
// Create new driver
773
767
WS_DEBUG_PRINT (" [i2c] Creating driver: " );
774
768
WS_DEBUG_PRINTLN (device_name);
775
- WS_DEBUG_PRINTLN (device_descriptor.i2c_device_address , HEX);
776
- WS_DEBUG_PRINTLN (device_descriptor.i2c_mux_channel );
777
- WS_DEBUG_PRINTLN (device_status);
778
-
779
769
drv = CreateI2CDriverByName (
780
770
device_name, bus, device_descriptor.i2c_device_address ,
781
771
device_descriptor.i2c_mux_channel , device_status);
782
772
if (drv == nullptr ) {
783
773
WS_DEBUG_PRINTLN (" [i2c] ERROR: I2C driver type not found or unsupported!" );
774
+ return false ;
784
775
}
785
776
786
777
// Configure MUX and bus
787
778
if (did_set_mux_ch) {
788
- WS_DEBUG_PRINT (" Configuring driver's MUX address: " );
789
- WS_DEBUG_PRINTLN (device_descriptor.i2c_mux_address );
790
779
drv->SetMuxAddress (device_descriptor.i2c_mux_address );
791
- WS_DEBUG_PRINTLN (" [i2c] Set driver to use MUX" );
792
780
}
793
781
794
782
if (use_alt_bus) {
795
783
drv->EnableAltI2CBus (_i2c_model->GetI2cDeviceAddOrReplaceMsg ()
796
784
->i2c_device_description .i2c_bus_scl ,
797
785
_i2c_model->GetI2cDeviceAddOrReplaceMsg ()
798
786
->i2c_device_description .i2c_bus_sda );
799
- WS_DEBUG_PRINTLN (" [i2c] Set driver to use Alt I2C bus" );
800
787
}
801
788
// Configure the driver
802
789
drv->SetSensorTypes (
@@ -919,7 +906,6 @@ void I2cController::ConfigureMuxChannel(uint32_t mux_channel, bool is_alt_bus) {
919
906
_i2c_bus_alt->SelectMuxChannel (mux_channel);
920
907
return ;
921
908
}
922
- WS_DEBUG_PRINTLN (" [i2c] ConfigureMuxChannel() normal bus" );
923
909
_i2c_bus_default->ClearMuxChannel (); // sanity-check
924
910
_i2c_bus_default->SelectMuxChannel (mux_channel);
925
911
}
0 commit comments