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:
parent
3af9cee9ad
commit
964364e51c
|
@ -193,7 +193,9 @@ 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;
|
||||||
readBuffer[nBytes++] = Wire.read();
|
readBuffer[nBytes++] = Wire.read();
|
||||||
|
DIAG(F("nBytes=%d, readBuffer[nBytes]=%d"), temp, readBuffer[temp]);
|
||||||
} else {
|
} else {
|
||||||
delay(1);
|
delay(1);
|
||||||
}
|
}
|
||||||
|
@ -229,11 +231,12 @@ uint8_t I2CManagerClass::read(I2CAddress address, uint8_t readBuffer[], uint8_t
|
||||||
* the non-blocking version.
|
* the non-blocking version.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void I2CManagerClass::queueRequest(I2CRB *req) {
|
void I2CManagerClass::queueRequest(I2CRB *req) {
|
||||||
|
DIAG(F("I2CManagerClass::queueRequest() hit"));
|
||||||
if (req==NULL) {
|
if (req==NULL) {
|
||||||
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);
|
||||||
|
|
|
@ -134,12 +134,14 @@ private:
|
||||||
// We now need to retrieve the analogue pin map if there are analogue pins
|
// We now need to retrieve the analogue pin map if there are analogue pins
|
||||||
if (status == I2C_STATUS_OK && _numAnaloguePins>0) {
|
if (status == I2C_STATUS_OK && _numAnaloguePins>0) {
|
||||||
commandBuffer[0] = EXIOINITA;
|
commandBuffer[0] = EXIOINITA;
|
||||||
|
DIAG(F("EXIOINITA"));
|
||||||
status = I2CManager.read(_I2CAddress, _analoguePinMap, _numAnaloguePins, commandBuffer, 1);
|
status = I2CManager.read(_I2CAddress, _analoguePinMap, _numAnaloguePins, commandBuffer, 1);
|
||||||
}
|
}
|
||||||
if (status == I2C_STATUS_OK) {
|
if (status == I2C_STATUS_OK) {
|
||||||
// Attempt to get version, if we don't get it, we don't care, don't go offline
|
// Attempt to get version, if we don't get it, we don't care, don't go offline
|
||||||
uint8_t versionBuffer[3];
|
uint8_t versionBuffer[3];
|
||||||
commandBuffer[0] = EXIOVER;
|
commandBuffer[0] = EXIOVER;
|
||||||
|
DIAG(F("EXIOVER"));
|
||||||
if (I2CManager.read(_I2CAddress, versionBuffer, sizeof(versionBuffer), commandBuffer, 1) == I2C_STATUS_OK) {
|
if (I2CManager.read(_I2CAddress, versionBuffer, sizeof(versionBuffer), commandBuffer, 1) == I2C_STATUS_OK) {
|
||||||
_majorVer = versionBuffer[0];
|
_majorVer = versionBuffer[0];
|
||||||
_minorVer = versionBuffer[1];
|
_minorVer = versionBuffer[1];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user