mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-24 21:21:24 +01:00
Add more state checking
This commit is contained in:
parent
d36ac7dcfd
commit
f1c17c3606
@ -178,6 +178,7 @@ private:
|
|||||||
|
|
||||||
// Obtain the correct analogue input value
|
// Obtain the correct analogue input value
|
||||||
int _readAnalogue(VPIN vpin) override {
|
int _readAnalogue(VPIN vpin) override {
|
||||||
|
if (_deviceState == DEVSTATE_FAILED) return 0;
|
||||||
int pin = vpin - _firstVpin;
|
int pin = vpin - _firstVpin;
|
||||||
uint8_t _pinLSBByte;
|
uint8_t _pinLSBByte;
|
||||||
for (uint8_t aPin = 0; aPin < _numAnaloguePins; aPin++) {
|
for (uint8_t aPin = 0; aPin < _numAnaloguePins; aPin++) {
|
||||||
@ -232,6 +233,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _writeAnalogue(VPIN vpin, int value, uint8_t profile, uint16_t duration) override {
|
void _writeAnalogue(VPIN vpin, int value, uint8_t profile, uint16_t duration) override {
|
||||||
|
if (_deviceState == DEVSTATE_FAILED) return;
|
||||||
int pin = vpin - _firstVpin;
|
int pin = vpin - _firstVpin;
|
||||||
#ifdef DIAG_IO
|
#ifdef DIAG_IO
|
||||||
DIAG(F("Servo: WriteAnalogue Vpin:%d Value:%d Profile:%d Duration:%d %S"),
|
DIAG(F("Servo: WriteAnalogue Vpin:%d Value:%d Profile:%d Duration:%d %S"),
|
||||||
@ -345,7 +347,6 @@ private:
|
|||||||
uint16_t duration; // time (tenths of a second) for animation to complete.
|
uint16_t duration; // time (tenths of a second) for animation to complete.
|
||||||
}; // 14 bytes per element, i.e. per pin in use
|
}; // 14 bytes per element, i.e. per pin in use
|
||||||
|
|
||||||
// struct ServoData *_servoData[256];
|
|
||||||
ServoData** _servoData;
|
ServoData** _servoData;
|
||||||
|
|
||||||
static const uint8_t _catchupSteps = 5; // number of steps to wait before switching servo off
|
static const uint8_t _catchupSteps = 5; // number of steps to wait before switching servo off
|
||||||
|
Loading…
Reference in New Issue
Block a user