From 3b6472f41e6016a740a1ec5bae82d31594e7b806 Mon Sep 17 00:00:00 2001 From: Christopher Liebman Date: Sat, 3 Mar 2018 06:13:51 -0800 Subject: [PATCH] missed update logging change for WireUtils --- WireUtils.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/WireUtils.cpp b/WireUtils.cpp index 295c2fc..f0ecf31 100644 --- a/WireUtils.cpp +++ b/WireUtils.cpp @@ -23,7 +23,8 @@ #include "WireUtils.h" #define DEBUG -#include "Logger.h" +#include "Log.h" +const char* TAG = "wire_utils"; WireUtilsC::WireUtilsC() { @@ -42,7 +43,7 @@ WireUtilsC::WireUtilsC() */ int WireUtilsC::clearBus() { - dbprintln("WireUtils::ClearBus: attempting to clean i2c bus"); + logger.warning(TAG, "WireUtils::ClearBus: attempting to clean i2c bus"); #if defined(TWCR) && defined(TWEN) TWCR &= ~(_BV(TWEN)); //Disable the Atmel 2-Wire interface so we can control the SDA and SCL pins directly #endif @@ -52,7 +53,7 @@ int WireUtilsC::clearBus() boolean SCL_LOW = (digitalRead(SCL) == LOW); // Check is SCL is Low. if (SCL_LOW) { //If it is held low Arduno cannot become the I2C master. - dbprintln("WireUtils::ClearBus: Failed! SCL held low!"); + logger.error(TAG, "WireUtils::ClearBus: Failed! SCL held low!"); return 1; //I2C bus error. Could not clear SCL clock line held low } @@ -81,14 +82,14 @@ int WireUtilsC::clearBus() } if (SCL_LOW) { // still low after 2 sec error - dbprintln("WireUtils::ClearBus: Failed! SCL clock line held low by slave clock stretch for >2sec"); + logger.error(TAG, "WireUtils::ClearBus: Failed! SCL clock line held low by slave clock stretch for >2sec"); return 2; // I2C bus error. Could not clear. SCL clock line held low by slave clock stretch for >2sec } SDA_LOW = (digitalRead(SDA) == LOW); // and check SDA input again and loop } if (SDA_LOW) { // still low - dbprintln("WireUtils::ClearBus: Failed! SDA data line still held low"); + logger.error(TAG, "WireUtils::ClearBus: Failed! SDA data line still held low"); return 3; // I2C bus error. Could not clear. SDA data line held low } @@ -103,7 +104,7 @@ int WireUtilsC::clearBus() delayMicroseconds(10); // x. wait >5uS pinMode(SDA, INPUT); // and reset pins as tri-state inputs which is the default state on reset pinMode(SCL, INPUT); - dbprintln("WireUtils::ClearBus: Success!"); + logger.info(TAG, "WireUtils::ClearBus: Success!"); return 0; // all ok }