From 7315575b2e7506417c2f2e81846e378d09949b5e Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 9 Sep 2017 22:58:26 -0600 Subject: Made thermal regulation adjust smoothly (1 PWM step at a time) to make adjustments less noticeable. Added set_level_gradually() and gradual_tick() to ramping lib. Not terribly happy with it yet, but it at least works in practice. Added extra thermal regulation checks because I was running into stupid behavior in edge cases. Increased lowest thermal stepdown level to MAX_LEVEL/3 because it was going down way too low before. (is still pretty low, but not quite as bad) --- spaghetti-monster/fsm-ramping.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spaghetti-monster/fsm-ramping.h') diff --git a/spaghetti-monster/fsm-ramping.h b/spaghetti-monster/fsm-ramping.h index b4054bf..ac4e58c 100644 --- a/spaghetti-monster/fsm-ramping.h +++ b/spaghetti-monster/fsm-ramping.h @@ -26,6 +26,13 @@ // actual_level: last ramp level set by set_level() volatile uint8_t actual_level = 0; +#ifdef USE_SET_LEVEL_GRADUALLY +// adjust brightness very smoothly +volatile uint8_t gradual_target; +inline void set_level_gradually(uint8_t lvl); +void gradual_tick(); +#endif + // ramp tables #if PWM_CHANNELS == 1 #if RAMP_LENGTH == 50 -- cgit v1.2.3