1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-24 00:26:13 +01:00

More diags

This commit is contained in:
peteGSX 2024-01-17 13:02:35 +10:00
parent 3af9cee9ad
commit 964364e51c
2 changed files with 6 additions and 1 deletions

View File

@ -193,7 +193,9 @@ 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]);
} else {
delay(1);
}
@ -229,11 +231,12 @@ uint8_t I2CManagerClass::read(I2CAddress address, uint8_t readBuffer[], uint8_t
* the non-blocking version.
***************************************************************************/
void I2CManagerClass::queueRequest(I2CRB *req) {
DIAG(F("I2CManagerClass::queueRequest() hit"));
if (req==NULL) {
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);

View File

@ -134,12 +134,14 @@ private:
// We now need to retrieve the analogue pin map if there are analogue pins
if (status == I2C_STATUS_OK && _numAnaloguePins>0) {
commandBuffer[0] = EXIOINITA;
DIAG(F("EXIOINITA"));
status = I2CManager.read(_I2CAddress, _analoguePinMap, _numAnaloguePins, commandBuffer, 1);
}
if (status == I2C_STATUS_OK) {
// Attempt to get version, if we don't get it, we don't care, don't go offline
uint8_t versionBuffer[3];
commandBuffer[0] = EXIOVER;
DIAG(F("EXIOVER"));
if (I2CManager.read(_I2CAddress, versionBuffer, sizeof(versionBuffer), commandBuffer, 1) == I2C_STATUS_OK) {
_majorVer = versionBuffer[0];
_minorVer = versionBuffer[1];