From 775a114098b9db17fe52ddff5ed080e0b24e5a38 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 30 Jul 2019 20:15:06 -0600 Subject: fsm-ramping: turn opamp chip on and off automatically based on ramp level --- spaghetti-monster/fsm-ramping.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'spaghetti-monster/fsm-ramping.c') diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c index 69e20bc..52a7246 100644 --- a/spaghetti-monster/fsm-ramping.c +++ b/spaghetti-monster/fsm-ramping.c @@ -65,9 +65,18 @@ void set_level(uint8_t level) { #if PWM_CHANNELS >= 4 PWM4_LVL = 0; #endif + // disable the power channel, if relevant + #ifdef LED_ENABLE_PIN + LED_ENABLE_PORT &= ~(1 << LED_ENABLE_PIN); + #endif } else { level --; + // enable the power channel, if relevant + #ifdef LED_ENABLE_PIN + LED_ENABLE_PORT |= (1 << LED_ENABLE_PIN); + #endif + #ifdef USE_TINT_RAMPING // calculate actual PWM levels based on a single-channel ramp // and a global tint value -- cgit v1.2.3