If, for whatever reason, fastPeriodic needs to be disabled, changing when/where the work is performed should be a very minor change.
Currently, fastPeriodic does work.
void fastPeriodic() {
// Do work...
}
Instead, a separate function should do work, and fastPeriodic calls out to that function to perform work.
void fastPeriodic() {
doWork();
}
void doWork() {
// Do work...
}
Then, if fastPeriodic is disabled, the work can be performed in periodic instead.
void periodic() {
doWork();
}
void doWork() {
// Do work...
}
If, for whatever reason,
fastPeriodicneeds to be disabled, changing when/where the work is performed should be a very minor change.Currently,
fastPeriodicdoes work.Instead, a separate function should do work, and
fastPeriodiccalls out to that function to perform work.Then, if
fastPeriodicis disabled, the work can be performed inperiodicinstead.