aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-ramping.h
diff options
context:
space:
mode:
authorSelene ToyKeeper2021-09-08 17:14:53 -0600
committerSelene ToyKeeper2021-09-08 17:14:53 -0600
commit49f4475b2e45b2110b46cd6d44cc967f637c07fc (patch)
tree1a17018a7c17f4038d1943084f968af91b89127b /spaghetti-monster/fsm-ramping.h
parentcopied k9.3 config for new d4sv2-tintramp (diff)
downloadanduril-49f4475b2e45b2110b46cd6d44cc967f637c07fc.tar.gz
anduril-49f4475b2e45b2110b46cd6d44cc967f637c07fc.tar.bz2
anduril-49f4475b2e45b2110b46cd6d44cc967f637c07fc.zip
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.
Diffstat (limited to '')
-rw-r--r--spaghetti-monster/fsm-ramping.h8
1 files changed, 8 insertions, 0 deletions
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