mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 00:26:13 +01:00
Compare commits
3 Commits
95bf5aae38
...
657c08c653
Author | SHA1 | Date | |
---|---|---|---|
|
657c08c653 | ||
|
bc37a2d2cf | ||
|
3c0704dbd1 |
|
@ -1 +1 @@
|
||||||
#define GITHUB_SHA "devel-202401101409Z"
|
#define GITHUB_SHA "devel-202401180721Z"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* © 2022, Peter Cole. All rights reserved.
|
* © 2022, Peter Cole. All rights reserved.
|
||||||
|
* © 2022, Harald Barth. All rights reserved.
|
||||||
*
|
*
|
||||||
* This file is part of EX-CommandStation
|
* This file is part of EX-CommandStation
|
||||||
*
|
*
|
||||||
|
@ -100,8 +101,14 @@ 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);
|
if ((_digitalInputStates = (byte*) calloc(digitalBytesNeeded, 1)) != NULL) {
|
||||||
_digitalPinBytes = digitalBytesNeeded;
|
_digitalPinBytes = digitalBytesNeeded;
|
||||||
|
} else {
|
||||||
|
DIAG(F("EX-IOExpander I2C:%s ERROR alloc %d bytes"), _I2CAddress.toString(), digitalBytesNeeded);
|
||||||
|
_deviceState = DEVSTATE_FAILED;
|
||||||
|
_digitalPinBytes = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +124,16 @@ private:
|
||||||
_analogueInputStates = (uint8_t*) calloc(analogueBytesNeeded, 1);
|
_analogueInputStates = (uint8_t*) calloc(analogueBytesNeeded, 1);
|
||||||
_analogueInputBuffer = (uint8_t*) calloc(analogueBytesNeeded, 1);
|
_analogueInputBuffer = (uint8_t*) calloc(analogueBytesNeeded, 1);
|
||||||
_analoguePinMap = (uint8_t*) calloc(_numAnaloguePins, 1);
|
_analoguePinMap = (uint8_t*) calloc(_numAnaloguePins, 1);
|
||||||
_analoguePinBytes = analogueBytesNeeded;
|
if (_analogueInputStates != NULL &&
|
||||||
|
_analogueInputBuffer != NULL &&
|
||||||
|
_analoguePinMap != NULL) {
|
||||||
|
_analoguePinBytes = analogueBytesNeeded;
|
||||||
|
} else {
|
||||||
|
DIAG(F("EX-IOExpander I2C:%s ERROR alloc analog pin bytes"), _I2CAddress.toString());
|
||||||
|
_deviceState = DEVSTATE_FAILED;
|
||||||
|
_analoguePinBytes = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -364,14 +380,14 @@ private:
|
||||||
uint8_t _minorVer = 0;
|
uint8_t _minorVer = 0;
|
||||||
uint8_t _patchVer = 0;
|
uint8_t _patchVer = 0;
|
||||||
|
|
||||||
uint8_t* _digitalInputStates;
|
uint8_t* _digitalInputStates = NULL;
|
||||||
uint8_t* _analogueInputStates;
|
uint8_t* _analogueInputStates = NULL;
|
||||||
uint8_t* _analogueInputBuffer; // buffer for I2C input transfers
|
uint8_t* _analogueInputBuffer = NULL; // buffer for I2C input transfers
|
||||||
uint8_t _readCommandBuffer[1];
|
uint8_t _readCommandBuffer[1];
|
||||||
|
|
||||||
uint8_t _digitalPinBytes = 0; // Size of allocated memory buffer (may be longer than needed)
|
uint8_t _digitalPinBytes = 0; // Size of allocated memory buffer (may be longer than needed)
|
||||||
uint8_t _analoguePinBytes = 0; // Size of allocated memory buffers (may be longer than needed)
|
uint8_t _analoguePinBytes = 0; // Size of allocated memory buffer (may be longer than needed)
|
||||||
uint8_t* _analoguePinMap;
|
uint8_t* _analoguePinMap = NULL;
|
||||||
I2CRB _i2crb;
|
I2CRB _i2crb;
|
||||||
|
|
||||||
enum {RDS_IDLE, RDS_DIGITAL, RDS_ANALOGUE}; // Read operation states
|
enum {RDS_IDLE, RDS_DIGITAL, RDS_ANALOGUE}; // Read operation states
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
#define VERSION "5.2.26"
|
#define VERSION "5.2.27"
|
||||||
|
// 5.2.27 - Bugfix: IOExpander memory allocation
|
||||||
// 5.2.26 - Silently ignore overridden HAL defaults
|
// 5.2.26 - Silently ignore overridden HAL defaults
|
||||||
// - include HAL_IGNORE_DEFAULTS macro in EXRAIL
|
// - include HAL_IGNORE_DEFAULTS macro in EXRAIL
|
||||||
// 5.2.25 - Fix bug causing <X> after working <D commands
|
// 5.2.25 - Fix bug causing <X> after working <D commands
|
||||||
|
|
Loading…
Reference in New Issue
Block a user