aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-ramping.h
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-04-25 01:07:15 -0600
committerSelene ToyKeeper2023-04-25 01:07:15 -0600
commit5f6bb2bda2dd4eccbdfba94e5d35cedc8c0c42dc (patch)
tree37ceff579db3293ea44947d6426873afd04e2065 /spaghetti-monster/fsm-ramping.h
parentadded stepped tint ramping (diff)
downloadanduril-5f6bb2bda2dd4eccbdfba94e5d35cedc8c0c42dc.tar.gz
anduril-5f6bb2bda2dd4eccbdfba94e5d35cedc8c0c42dc.tar.bz2
anduril-5f6bb2bda2dd4eccbdfba94e5d35cedc8c0c42dc.zip
updated D4Sv2-tintramp -> Emisar 2-channel build target ...
... and reworked how gradual_tick() works ... and updated LT1S Pro to use new method
Diffstat (limited to 'spaghetti-monster/fsm-ramping.h')
-rw-r--r--spaghetti-monster/fsm-ramping.h13
1 files changed, 1 insertions, 12 deletions
diff --git a/spaghetti-monster/fsm-ramping.h b/spaghetti-monster/fsm-ramping.h
index a9e333e..7b3722d 100644
--- a/spaghetti-monster/fsm-ramping.h
+++ b/spaghetti-monster/fsm-ramping.h
@@ -32,7 +32,7 @@ SetLevelFuncPtr channel_modes[NUM_CHANNEL_MODES];
#ifdef USE_SET_LEVEL_GRADUALLY
// the gradual tick mechanism may be different per channel
-typedef void GradualTickFunc();
+typedef bool GradualTickFunc(uint8_t gt);
typedef GradualTickFunc * GradualTickFuncPtr;
// TODO: move to progmem
GradualTickFuncPtr gradual_tick_modes[NUM_CHANNEL_MODES];
@@ -101,12 +101,7 @@ inline void set_level_gradually(uint8_t lvl);
void gradual_tick();
// reduce repetition with macros
-// common code at the beginning of every gradual tick handler
#define GRADUAL_TICK_SETUP() \
- uint8_t gt = gradual_target; \
- if (gt < actual_level) gt = actual_level - 1; \
- else if (gt > actual_level) gt = actual_level + 1; \
- gt --; \
PWM_DATATYPE target;
// tick to a specific value
@@ -132,12 +127,6 @@ void gradual_tick();
if (PWM < target) PWM ++; \
else if (PWM > target) PWM --;
-// do this when output exactly matches a ramp level
-#define GRADUAL_IS_ACTUAL() \
- uint8_t orig = gradual_target; \
- set_level(gt + 1); \
- gradual_target = orig;
-
#endif // ifdef USE_SET_LEVEL_GRADUALLY
// auto-detect the data type for PWM tables