Catching out of range preset monitor in EL737

This commit is contained in:
2014-08-28 09:51:16 +02:00
parent 41689d97b4
commit 07cd8a0215

View File

@ -354,6 +354,10 @@ static int EL737Start(struct __COUNTER *self)
fixMode(pPriv);
pPriv->readErrorCount = 0;
if (self->eMode == ePreset) {
if (self->fPreset < 1. || self->fPreset >= 2147483647.) {
self->iErrorCode = BADTRANGE;
return HWFault;
}
snprintf(pCommand, 49, "MP %d\r", (int) self->fPreset);
} else {
if (self->fPreset < .1 || self->fPreset > 200000) {