From 20b3e9064cc463e9e0ae313b2c3f7dcbb0559afa Mon Sep 17 00:00:00 2001 From: peteGSX Date: Mon, 23 Jan 2023 21:35:22 +1000 Subject: [PATCH] Analogue inputs functioning --- IO_EXIOExpander.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/IO_EXIOExpander.h b/IO_EXIOExpander.h index 9fc6876..54b186e 100644 --- a/IO_EXIOExpander.h +++ b/IO_EXIOExpander.h @@ -143,14 +143,13 @@ private: int _readAnalogue(VPIN vpin) override { if (vpin < _firstVpin + _numDigitalPins) return false; - int pin = vpin - _firstVpin; + int pin = vpin - _firstVpin - _numDigitalPins; // _analogueOutBuffer[0] = EXIORDAN; // _analogueOutBuffer[1] = pin; // I2CManager.read(_i2cAddress, _analogueInBuffer, 2, _analogueOutBuffer, 2); // return (_analogueInBuffer[1] << 8) + _analogueInBuffer[0]; uint8_t _pinLSBByte = pin * 2; uint8_t _pinMSBByte = _pinLSBByte + 1; - // DIAG(F("Vpin %d LSB %d MSB %d"), vpin, _analogueInputStates[_pinLSBByte], _analogueInputStates[_pinMSBByte]); return (_analogueInputStates[_pinMSBByte] << 8) + _analogueInputStates[_pinLSBByte]; }