mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-27 18:16:13 +01:00
Compare commits
2 Commits
964364e51c
...
5959a8655c
Author | SHA1 | Date | |
---|---|---|---|
|
5959a8655c | ||
|
3462beeeac |
|
@ -193,9 +193,12 @@ uint8_t I2CManagerClass::read(I2CAddress address, uint8_t readBuffer[], uint8_t
|
||||||
// while (Wire.available() && nBytes < readSize)
|
// while (Wire.available() && nBytes < readSize)
|
||||||
while (nBytes < readSize)
|
while (nBytes < readSize)
|
||||||
if (Wire.available()) {
|
if (Wire.available()) {
|
||||||
uint8_t temp=nBytes;
|
// uint8_t temp=nBytes;
|
||||||
readBuffer[nBytes++] = Wire.read();
|
char readByte=Wire.read();
|
||||||
DIAG(F("nBytes=%d, readBuffer[nBytes]=%d"), temp, readBuffer[temp]);
|
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 {
|
} else {
|
||||||
delay(1);
|
delay(1);
|
||||||
}
|
}
|
||||||
|
@ -236,7 +239,7 @@ void I2CManagerClass::queueRequest(I2CRB *req) {
|
||||||
DIAG(F("NOOOOOOOOOOO"));
|
DIAG(F("NOOOOOOOOOOO"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
req->dump();
|
// req->dump();
|
||||||
switch (req->operation & OPERATION_MASK) {
|
switch (req->operation & OPERATION_MASK) {
|
||||||
case OPERATION_READ:
|
case OPERATION_READ:
|
||||||
read(req->i2cAddress, req->readBuffer, req->readLen, NULL, 0, req);
|
read(req->i2cAddress, req->readBuffer, req->readLen, NULL, 0, req);
|
||||||
|
|
|
@ -105,8 +105,8 @@ private:
|
||||||
if (_digitalPinBytes < digitalBytesNeeded) {
|
if (_digitalPinBytes < digitalBytesNeeded) {
|
||||||
// Not enough space, free any existing buffer and allocate a new one
|
// Not enough space, free any existing buffer and allocate a new one
|
||||||
if (_digitalPinBytes > 0) free(_digitalInputStates);
|
if (_digitalPinBytes > 0) free(_digitalInputStates);
|
||||||
_digitalInputStates = (byte*) calloc(_digitalPinBytes, 1);
|
|
||||||
_digitalPinBytes = digitalBytesNeeded;
|
_digitalPinBytes = digitalBytesNeeded;
|
||||||
|
_digitalInputStates = (byte*) calloc(_digitalPinBytes, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,9 +260,9 @@ private:
|
||||||
} else if (currentMicros - _lastAnalogueRead > _analogueRefresh && _numAnaloguePins>0) { // Delay for analogue read refresh
|
} else if (currentMicros - _lastAnalogueRead > _analogueRefresh && _numAnaloguePins>0) { // Delay for analogue read refresh
|
||||||
// Issue new read for analogue input states
|
// Issue new read for analogue input states
|
||||||
_readCommandBuffer[0] = EXIORDAN;
|
_readCommandBuffer[0] = EXIORDAN;
|
||||||
// DIAG(F("EXIORDAN address=%x, aBuffer=%d, bytes=%d"),_I2CAddress,_analogueInputBuffer,_numAnaloguePins*2);
|
DIAG(F("EXIORDAN address=%x, aBuffer=%d, bytes=%d"),_I2CAddress,_analogueInputBuffer,_numAnaloguePins*2);
|
||||||
// I2CManager.read(_I2CAddress, _analogueInputBuffer,
|
I2CManager.read(_I2CAddress, _analogueInputBuffer,
|
||||||
// _numAnaloguePins * 2, _readCommandBuffer, 1, &_i2crb);
|
_numAnaloguePins * 2, _readCommandBuffer, 1, &_i2crb);
|
||||||
_lastAnalogueRead = currentMicros;
|
_lastAnalogueRead = currentMicros;
|
||||||
_readState = RDS_ANALOGUE;
|
_readState = RDS_ANALOGUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user