From 49f4475b2e45b2110b46cd6d44cc967f637c07fc Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Wed, 8 Sep 2021 17:14:53 -0600 Subject: got D4Sv2 tint ramping to work, with dynamic PWM (PFM) and (maybe) thermal regulation (untested) (also broke BLF LT1 in the process; need to fix that now) Rewrote how tint ramping works, so it provides a virtual "PWM1_LVL" for other code to use, and it translates that internally into actual hardware controls. This should, in theory, allow smooth thermal regulation (gradual_tick) to work on tint-ramp lights. --- spaghetti-monster/fsm-ramping.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spaghetti-monster/fsm-ramping.h') diff --git a/spaghetti-monster/fsm-ramping.h b/spaghetti-monster/fsm-ramping.h index 7a4fa3b..d8aad18 100644 --- a/spaghetti-monster/fsm-ramping.h +++ b/spaghetti-monster/fsm-ramping.h @@ -42,6 +42,10 @@ inline void set_level_gradually(uint8_t lvl); void gradual_tick(); #endif +#ifdef USE_TINT_RAMPING +void update_tint(); +#endif + // auto-detect the data type for PWM tables #ifndef PWM_BITS #define PWM_BITS 8 @@ -49,10 +53,14 @@ void gradual_tick(); #endif #if PWM_BITS <= 8 #define PWM_DATATYPE uint8_t +#define PWM_DATATYPE2 uint16_t #define PWM_TOP 255 #define PWM_GET(x,y) pgm_read_byte(x+y) #else #define PWM_DATATYPE uint16_t +#ifndef PWM_DATATYPE2 +#define PWM_DATATYPE2 uint32_t +#endif #ifndef PWM_TOP #define PWM_TOP 1023 // 10 bits by default #endif -- cgit v1.2.3 From 75cecc4525522b3a4c6339b5aa303bb568769974 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 10 Sep 2021 01:22:35 -0600 Subject: fixed K9.3 builds (oops, new update_tint() needed to be compiled out for K9.3) --- spaghetti-monster/fsm-ramping.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spaghetti-monster/fsm-ramping.h') diff --git a/spaghetti-monster/fsm-ramping.h b/spaghetti-monster/fsm-ramping.h index d8aad18..c1f6064 100644 --- a/spaghetti-monster/fsm-ramping.h +++ b/spaghetti-monster/fsm-ramping.h @@ -42,7 +42,7 @@ inline void set_level_gradually(uint8_t lvl); void gradual_tick(); #endif -#ifdef USE_TINT_RAMPING +#if defined(USE_TINT_RAMPING) && (!defined(TINT_RAMP_TOGGLE_ONLY)) void update_tint(); #endif -- cgit v1.2.3