mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 21:01:25 +01:00
Servo profile - avoid overrun of array bounds.
This commit is contained in:
parent
5932b4d101
commit
f86a14ceab
@ -129,7 +129,7 @@ void PCA9685::_write(VPIN vpin, int value) {
|
||||
s->numSteps = profile==Fast ? 10 :
|
||||
profile==Medium ? 20 :
|
||||
profile==Slow ? 40 :
|
||||
profile==Bounce ? sizeof(_bounceProfile) :
|
||||
profile==Bounce ? sizeof(_bounceProfile)-1 :
|
||||
1;
|
||||
s->state = value;
|
||||
s->stepNumber = 0;
|
||||
@ -163,7 +163,7 @@ void PCA9685::_writeAnalogue(VPIN vpin, int value, int profile) {
|
||||
s->numSteps = profile==Fast ? 10 :
|
||||
profile==Medium ? 20 :
|
||||
profile==Slow ? 40 :
|
||||
profile==Bounce ? sizeof(_bounceProfile) :
|
||||
profile==Bounce ? sizeof(_bounceProfile)-1 :
|
||||
1;
|
||||
s->stepNumber = 0;
|
||||
s->toPosition = min(value, 4095);
|
||||
|
Loading…
Reference in New Issue
Block a user