Telescope Control Library
Diff: StepOut.cpp
- Revision:
- 17:7e47bc1630c0
- Parent:
- 0:6cb2eaf8b133
- Child:
- 19:fd854309cb4c
--- a/StepOut.cpp Fri Sep 14 03:05:47 2018 -0400 +++ b/StepOut.cpp Fri Sep 14 21:09:02 2018 -0400 @@ -9,6 +9,8 @@ #include "mbed.h" #include <StepOut.h> +#define MAX_PERIOD 1000000 + void StepOut::start() { if (status == IDLE && freq > 0) // Start only when idle and frequency is not zero @@ -38,10 +40,10 @@ if (frequency > 0) { int64_t us_period = ceil(1.0E6 / frequency); /*Ceil to the next microsecond*/ - if (us_period > INT_MAX) + if (us_period > MAX_PERIOD) { // Prevent overflow - us_period = INT_MAX; + us_period = MAX_PERIOD; } if (status == IDLE) this->period_us(us_period);