@@ -487,7 +487,7 @@ bool I2cController::PublishI2cDeviceAddedorReplaced(
487487bool I2cController::Handle_I2cDeviceRemove (pb_istream_t *stream) {
488488 // Attempt to decode an I2cDeviceRemove message
489489 WS_DEBUG_PRINTLN (" [i2c] Decoding I2cDeviceRemove message..." );
490- if (!_i2c_model->DecodeI2cDeviceRemove (stream)) {
490+ if (! _i2c_model->DecodeI2cDeviceRemove (stream)) {
491491 WS_DEBUG_PRINTLN (" [i2c] ERROR: Unable to decode I2cDeviceRemove message!" );
492492 return false ;
493493 }
@@ -624,6 +624,9 @@ bool I2cController::Handle_I2cBusScan(pb_istream_t *stream) {
624624 // Case 1: Scan the default I2C bus
625625 if (_i2c_model->GetI2cBusScanMsg ()->scan_default_bus ) {
626626 // Was the default bus initialized correctly and ready to scan?
627+ WS_DEBUG_PRINT (" Bus State: " );
628+ WS_DEBUG_PRINTLN (_i2c_bus_default->GetBusStatus ());
629+ WS_DEBUG_PRINTLN (IsBusStatusOK ());
627630 if (IsBusStatusOK ()) {
628631 if (!_i2c_bus_default->ScanBus (scan_results)) {
629632 WS_DEBUG_PRINTLN (" [i2c] ERROR: Failed to scan default I2C bus!" );
@@ -890,6 +893,7 @@ void I2cController::ConfigureMuxChannel(uint32_t mux_channel, bool is_alt_bus) {
890893*/
891894/* **********************************************************************/
892895void I2cController::update () {
896+ // WS_DEBUG_PRINTLN("[i2c] Updating I2C controller...");
893897 if (_i2c_drivers.size () == 0 )
894898 return ; // bail out if no drivers exist
895899
@@ -901,11 +905,13 @@ void I2cController::update() {
901905
902906 // Did driver's period elapse yet?
903907 ulong cur_time = millis ();
904- if (cur_time - drv->GetSensorPeriodPrv () < drv->GetSensorPeriod ())
908+ if (cur_time - drv->GetSensorPeriodPrv () < drv->GetSensorPeriod ()) {
905909 continue ; // bail out if the period hasn't elapsed yet
910+ }
906911
907912 // Optionally configure the I2C MUX
908913 uint32_t mux_channel = drv->GetMuxChannel ();
914+ WS_DEBUG_PRINTLN (mux_channel);
909915 if (drv->HasMux ())
910916 ConfigureMuxChannel (mux_channel, drv->HasAltI2CBus ());
911917
0 commit comments