mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-23 16:16:13 +01:00
Current diags and no wire.available
This commit is contained in:
parent
5579a9aa49
commit
41befc99b1
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user