From 3462beeeacf9b5729a009153e33ce78d3366f778 Mon Sep 17 00:00:00 2001 From: peteGSX <97784652+peteGSX@users.noreply.github.com> Date: Thu, 18 Jan 2024 07:52:58 +1000 Subject: [PATCH] More diags --- I2CManager_Wire.h | 11 +++++++---- IO_EXIOExpander.h | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/I2CManager_Wire.h b/I2CManager_Wire.h index 6d8cf3d..e248c2b 100644 --- a/I2CManager_Wire.h +++ b/I2CManager_Wire.h @@ -193,9 +193,12 @@ uint8_t I2CManagerClass::read(I2CAddress address, uint8_t readBuffer[], uint8_t // while (Wire.available() && nBytes < readSize) while (nBytes < readSize) if (Wire.available()) { - uint8_t temp=nBytes; - readBuffer[nBytes++] = Wire.read(); - DIAG(F("nBytes=%d, readBuffer[nBytes]=%d"), temp, readBuffer[temp]); + // uint8_t temp=nBytes; + char readByte=Wire.read(); + DIAG(F("nBytes=%d, readByte=%d"),nBytes,readByte); + // readBuffer[nBytes++] = Wire.read(); + readBuffer[nBytes++]=readByte; + // DIAG(F("nBytes=%d, readBuffer[nBytes]=%d"), temp, readBuffer[temp]); } else { delay(1); } @@ -236,7 +239,7 @@ void I2CManagerClass::queueRequest(I2CRB *req) { DIAG(F("NOOOOOOOOOOO")); return; } - req->dump(); + // req->dump(); switch (req->operation & OPERATION_MASK) { case OPERATION_READ: read(req->i2cAddress, req->readBuffer, req->readLen, NULL, 0, req); diff --git a/IO_EXIOExpander.h b/IO_EXIOExpander.h index 2115b90..ca67319 100644 --- a/IO_EXIOExpander.h +++ b/IO_EXIOExpander.h @@ -260,9 +260,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; }