diff options
Diffstat (limited to 'spaghetti-monster/fsm-ramping.h')
| -rw-r--r-- | spaghetti-monster/fsm-ramping.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/spaghetti-monster/fsm-ramping.h b/spaghetti-monster/fsm-ramping.h index 7b3722d..3003ecb 100644 --- a/spaghetti-monster/fsm-ramping.h +++ b/spaghetti-monster/fsm-ramping.h @@ -109,6 +109,13 @@ void gradual_tick(); if (PWM < TARGET) PWM ++; \ else if (PWM > TARGET) PWM --; +// tick to a specific value, except when immediate 0 to 255 is needed +#define GRADUAL_ADJUST_STACKED(TARGET,PWM,TOP) \ + if ( ((PWM == 0) && (TARGET == TOP)) \ + || ((PWM == TOP) && (TARGET == 0))) \ + PWM = TOP; \ + else GRADUAL_ADJUST_SIMPLE(TARGET,PWM) + // tick the top layer of the stack #define GRADUAL_ADJUST_1CH(TABLE,PWM) \ target = PWM_GET(TABLE, gt); \ |
