From 41befc99b19da06c4b420997e40dd680e9f84cb9 Mon Sep 17 00:00:00 2001 From: peteGSX <97784652+peteGSX@users.noreply.github.com> Date: Wed, 17 Jan 2024 08:26:07 +1000 Subject: [PATCH] Current diags and no wire.available --- I2CManager_Wire.h | 6 ++++-- IO_EXIOExpander.h | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/I2CManager_Wire.h b/I2CManager_Wire.h index b8a6427..1af1a68 100644 --- a/I2CManager_Wire.h +++ b/I2CManager_Wire.h @@ -189,9 +189,11 @@ uint8_t I2CManagerClass::read(I2CAddress address, uint8_t readBuffer[], uint8_t DIAG(F("NO timeout")); Wire.requestFrom(address, (size_t)readSize); DIAG(F("address=%x, nBytes=%d, readSize=%d"),address,nBytes,readSize); - while (Wire.available() && nBytes < readSize) + DIAG(F("Wire.available()=%d"),Wire.available()); + // while (Wire.available() && nBytes < readSize) + while (nBytes < readSize) readBuffer[nBytes++] = Wire.read(); - DIAG(F("nBytes=%d,readBuffer[nBytes]=%d"),nBytes-1,readBuffer[nBytes-1]); + // DIAG(F("nBytes=%d,readBuffer[nBytes]=%d"),nBytes-1,readBuffer[nBytes-1]); if (nBytes < readSize) status = I2C_STATUS_TRUNCATED; DIAG(F("status=%d"),status); #endif diff --git a/IO_EXIOExpander.h b/IO_EXIOExpander.h index fc59935..c449156 100644 --- a/IO_EXIOExpander.h +++ b/IO_EXIOExpander.h @@ -213,7 +213,6 @@ private: // Main loop, collect both digital and analogue pin states continuously (faster sensor/input reads) void _loop(unsigned long currentMicros) override { - DIAG(F("EXIO _loop()")); if (_deviceState == DEVSTATE_FAILED) return; // If device failed, return // Request block is used for analogue and digital reads from the IOExpander, which are performed @@ -259,9 +258,9 @@ private: } else if (currentMicros - _lastAnalogueRead > _analogueRefresh && _numAnaloguePins>0) { // Delay for analogue read refresh // Issue new read for analogue input states _readCommandBuffer[0] = EXIORDAN; - DIAG(F("EXIORDAN address=%x, aBuffer=%d, bytes=%d"),_I2CAddress,_analogueInputBuffer,_numAnaloguePins*2); - I2CManager.read(_I2CAddress, _analogueInputBuffer, - _numAnaloguePins * 2, _readCommandBuffer, 1, &_i2crb); + // DIAG(F("EXIORDAN address=%x, aBuffer=%d, bytes=%d"),_I2CAddress,_analogueInputBuffer,_numAnaloguePins*2); + // I2CManager.read(_I2CAddress, _analogueInputBuffer, + // _numAnaloguePins * 2, _readCommandBuffer, 1, &_i2crb); _lastAnalogueRead = currentMicros; _readState = RDS_ANALOGUE; }