@@ -705,12 +705,6 @@ bool I2cController::Handle_I2cDeviceAddOrReplace(pb_istream_t *stream) {
705705 // I2cDeviceAddorReplace message
706706 if (device_descriptor.i2c_mux_address != 0x00 ) {
707707 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);
714708 ConfigureMuxChannel (device_descriptor.i2c_mux_channel , use_alt_bus);
715709 did_set_mux_ch = true ;
716710 } else {
@@ -772,31 +766,24 @@ bool I2cController::Handle_I2cDeviceAddOrReplace(pb_istream_t *stream) {
772766 // Create new driver
773767 WS_DEBUG_PRINT (" [i2c] Creating driver: " );
774768 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-
779769 drv = CreateI2CDriverByName (
780770 device_name, bus, device_descriptor.i2c_device_address ,
781771 device_descriptor.i2c_mux_channel , device_status);
782772 if (drv == nullptr ) {
783773 WS_DEBUG_PRINTLN (" [i2c] ERROR: I2C driver type not found or unsupported!" );
774+ return false ;
784775 }
785776
786777 // Configure MUX and bus
787778 if (did_set_mux_ch) {
788- WS_DEBUG_PRINT (" Configuring driver's MUX address: " );
789- WS_DEBUG_PRINTLN (device_descriptor.i2c_mux_address );
790779 drv->SetMuxAddress (device_descriptor.i2c_mux_address );
791- WS_DEBUG_PRINTLN (" [i2c] Set driver to use MUX" );
792780 }
793781
794782 if (use_alt_bus) {
795783 drv->EnableAltI2CBus (_i2c_model->GetI2cDeviceAddOrReplaceMsg ()
796784 ->i2c_device_description .i2c_bus_scl ,
797785 _i2c_model->GetI2cDeviceAddOrReplaceMsg ()
798786 ->i2c_device_description .i2c_bus_sda );
799- WS_DEBUG_PRINTLN (" [i2c] Set driver to use Alt I2C bus" );
800787 }
801788 // Configure the driver
802789 drv->SetSensorTypes (
@@ -919,7 +906,6 @@ void I2cController::ConfigureMuxChannel(uint32_t mux_channel, bool is_alt_bus) {
919906 _i2c_bus_alt->SelectMuxChannel (mux_channel);
920907 return ;
921908 }
922- WS_DEBUG_PRINTLN (" [i2c] ConfigureMuxChannel() normal bus" );
923909 _i2c_bus_default->ClearMuxChannel (); // sanity-check
924910 _i2c_bus_default->SelectMuxChannel (mux_channel);
925911}
0 commit comments