mirror of https://github.com/joan2937/pigpio
Fix issue#397 gpioSetTimerFunc NULL cancel error
This commit is contained in:
parent
55608548fc
commit
2220e497bd
3
pigpio.c
3
pigpio.c
|
@ -12488,8 +12488,11 @@ int gpioSetTimerFunc(unsigned id, unsigned millis, gpioTimerFunc_t f)
|
||||||
if (id > PI_MAX_TIMER)
|
if (id > PI_MAX_TIMER)
|
||||||
SOFT_ERROR(PI_BAD_TIMER, "bad timer id (%d)", id);
|
SOFT_ERROR(PI_BAD_TIMER, "bad timer id (%d)", id);
|
||||||
|
|
||||||
|
if (f)
|
||||||
|
{
|
||||||
if ((millis < PI_MIN_MS) || (millis > PI_MAX_MS))
|
if ((millis < PI_MIN_MS) || (millis > PI_MAX_MS))
|
||||||
SOFT_ERROR(PI_BAD_MS, "timer %d, bad millis (%d)", id, millis);
|
SOFT_ERROR(PI_BAD_MS, "timer %d, bad millis (%d)", id, millis);
|
||||||
|
}
|
||||||
|
|
||||||
intGpioSetTimerFunc(id, millis, f, 0, NULL);
|
intGpioSetTimerFunc(id, millis, f, 0, NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue