From 7ab5f556d9c9e3b76239b4becb968d276bfe1bdc Mon Sep 17 00:00:00 2001 From: peteGSX Date: Tue, 21 Mar 2023 05:30:33 +1000 Subject: [PATCH 1/5] Using correct size for memcpy --- IO_EXIOExpander.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IO_EXIOExpander.h b/IO_EXIOExpander.h index f4705f9..675d66c 100644 --- a/IO_EXIOExpander.h +++ b/IO_EXIOExpander.h @@ -116,6 +116,7 @@ private: _analogueInputStates = (uint8_t*) calloc(analogueBytesNeeded, 1); _analogueInputBuffer = (uint8_t*) calloc(analogueBytesNeeded, 1); _analoguePinMap = (uint8_t*) calloc(_numAnaloguePins, 1); + _analoguePinBytes = analogueBytesNeeded; } } else { DIAG(F("EX-IOExpander I2C:%s ERROR configuring device"), _I2CAddress.toString()); @@ -222,7 +223,7 @@ private: // Here we need to copy the values from input buffer to the analogue value array. We need to // do this to avoid tearing of the values (i.e. one byte of a two-byte value being changed // while the value is being read). - memcpy(_analogueInputStates, _analogueInputBuffer, sizeof(_analogueInputBuffer)); // Copy I2C input buffer to states + memcpy(_analogueInputStates, _analogueInputBuffer, _analoguePinBytes); // Copy I2C input buffer to states } else if (_readState == RDS_DIGITAL) { // Read of digital states was in progress, so process received values From a75ca00e3c8b24e4c9576dac49d94c1210c6b45f Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 20 Mar 2023 21:22:48 +0100 Subject: [PATCH 2/5] exchange pin number to track letter part 2 --- Display.cpp | 2 +- MotorDriver.h | 4 +++- TrackManager.cpp | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Display.cpp b/Display.cpp index ecb4216..d581149 100644 --- a/Display.cpp +++ b/Display.cpp @@ -216,4 +216,4 @@ uint8_t Display::countNonBlankRows() { } return count; } - \ No newline at end of file + diff --git a/MotorDriver.h b/MotorDriver.h index 77b2ec8..990fd71 100644 --- a/MotorDriver.h +++ b/MotorDriver.h @@ -182,7 +182,9 @@ class MotorDriver { isProgTrack = on; } void checkPowerOverload(bool useProgLimit, byte trackno); - void setTrackLetter(char c); + inline void setTrackLetter(char c) { + trackLetter = c; + }; #ifdef ANALOG_READ_INTERRUPT bool sampleCurrentFromHW(); void startCurrentFromHW(); diff --git a/TrackManager.cpp b/TrackManager.cpp index 633ed06..fcd0c10 100644 --- a/TrackManager.cpp +++ b/TrackManager.cpp @@ -129,6 +129,7 @@ void TrackManager::addTrack(byte t, MotorDriver* driver) { track[t]=driver; if (driver) { track[t]->setPower(POWERMODE::OFF); + track[t]->setTrackLetter('A'+t); lastTrack=t; } } From d51281f1f2fa0554d56037c39ffcec54db16b53c Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 20 Mar 2023 21:24:42 +0100 Subject: [PATCH 3/5] github tag --- GITHUB_SHA.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index ee808a7..46d55b9 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "devel-202303200910Z" +#define GITHUB_SHA "devel-202303202024Z" From b183439a5b798a956e5d5c37648fb0ce9b33b8c1 Mon Sep 17 00:00:00 2001 From: peteGSX Date: Tue, 21 Mar 2023 05:30:33 +1000 Subject: [PATCH 4/5] Using correct size for memcpy --- IO_EXIOExpander.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IO_EXIOExpander.h b/IO_EXIOExpander.h index f4705f9..675d66c 100644 --- a/IO_EXIOExpander.h +++ b/IO_EXIOExpander.h @@ -116,6 +116,7 @@ private: _analogueInputStates = (uint8_t*) calloc(analogueBytesNeeded, 1); _analogueInputBuffer = (uint8_t*) calloc(analogueBytesNeeded, 1); _analoguePinMap = (uint8_t*) calloc(_numAnaloguePins, 1); + _analoguePinBytes = analogueBytesNeeded; } } else { DIAG(F("EX-IOExpander I2C:%s ERROR configuring device"), _I2CAddress.toString()); @@ -222,7 +223,7 @@ private: // Here we need to copy the values from input buffer to the analogue value array. We need to // do this to avoid tearing of the values (i.e. one byte of a two-byte value being changed // while the value is being read). - memcpy(_analogueInputStates, _analogueInputBuffer, sizeof(_analogueInputBuffer)); // Copy I2C input buffer to states + memcpy(_analogueInputStates, _analogueInputBuffer, _analoguePinBytes); // Copy I2C input buffer to states } else if (_readState == RDS_DIGITAL) { // Read of digital states was in progress, so process received values From a3d03ac68c17fca97ad44f3719dc603e87787d63 Mon Sep 17 00:00:00 2001 From: peteGSX <97784652+peteGSX@users.noreply.github.com> Date: Tue, 21 Mar 2023 07:04:08 +1000 Subject: [PATCH 5/5] Fix validated, update version --- version.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/version.h b/version.h index b1704de..259dbaa 100644 --- a/version.h +++ b/version.h @@ -4,7 +4,8 @@ #include "StringFormatter.h" -#define VERSION "4.2.33" +#define VERSION "4.2.34" +// 4.2.34 - Completely fix EX-IOExpander analogue inputs // 4.2.33 - Fix EX-IOExpander non-working analogue inputs // 4.2.32 - Fix LCD/Display bugfixes from 4.2.29 // 4.2.31 - Removes EXRAIL statup from top of file. (BREAKING CHANGE !!)