1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-24 13:21:23 +01:00

Servo profile - avoid overrun of array bounds.

This commit is contained in:
Neil McKechnie 2021-08-12 21:17:40 +01:00
parent 5932b4d101
commit f86a14ceab

View File

@ -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);