aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-07-17 14:24:17 -0600
committerSelene ToyKeeper2023-07-17 14:24:17 -0600
commita16cf30beee2e5d06ba392c792aece17697b5a5f (patch)
tree4c1cb91bc64fb913acbce4aa979419d9482508a0
parent@wurkkos-*: raised default temperature limit from 45 C to 50 C, (diff)
downloadanduril-a16cf30beee2e5d06ba392c792aece17697b5a5f.tar.gz
anduril-a16cf30beee2e5d06ba392c792aece17697b5a5f.tar.bz2
anduril-a16cf30beee2e5d06ba392c792aece17697b5a5f.zip
fixed LT1S Pro (using new refactor)
-rw-r--r--hwdef-Sofirn_LT1S-Pro.c42
-rw-r--r--hwdef-Sofirn_LT1S-Pro.h48
2 files changed, 53 insertions, 37 deletions
diff --git a/hwdef-Sofirn_LT1S-Pro.c b/hwdef-Sofirn_LT1S-Pro.c
index f5af65a..6fe0fef 100644
--- a/hwdef-Sofirn_LT1S-Pro.c
+++ b/hwdef-Sofirn_LT1S-Pro.c
@@ -4,6 +4,48 @@
#pragma once
+void set_level_red(uint8_t level);
+void set_level_white_blend(uint8_t level);
+void set_level_auto_2ch_blend(uint8_t level);
+void set_level_auto_3ch_blend(uint8_t level);
+void set_level_red_white_blend(uint8_t level);
+
+bool gradual_tick_red(uint8_t gt);
+bool gradual_tick_white_blend(uint8_t gt);
+bool gradual_tick_auto_2ch_blend(uint8_t gt);
+bool gradual_tick_auto_3ch_blend(uint8_t gt);
+bool gradual_tick_red_white_blend(uint8_t gt);
+
+
+Channel channels[] = {
+ { // manual blend of warm and cool white
+ .set_level = set_level_white_blend,
+ .gradual_tick = gradual_tick_white_blend,
+ .has_args = 1
+ },
+ { // auto blend from warm white to cool white
+ .set_level = set_level_auto_2ch_blend,
+ .gradual_tick = gradual_tick_auto_2ch_blend,
+ .has_args = 0
+ },
+ { // auto blend from red to warm white to cool white
+ .set_level = set_level_auto_3ch_blend,
+ .gradual_tick = gradual_tick_auto_3ch_blend,
+ .has_args = 0
+ },
+ { // red only
+ .set_level = set_level_red,
+ .gradual_tick = gradual_tick_red,
+ .has_args = 0
+ },
+ { // manual white blend + adjustable red
+ .set_level = set_level_red_white_blend,
+ .gradual_tick = gradual_tick_red_white_blend,
+ .has_args = 1
+ }
+};
+
+
// calculate a 3-channel "auto tint" blend
// (like red -> warm white -> cool white)
// results are placed in *a, *b, and *c vars
diff --git a/hwdef-Sofirn_LT1S-Pro.h b/hwdef-Sofirn_LT1S-Pro.h
index a63f906..fa30a09 100644
--- a/hwdef-Sofirn_LT1S-Pro.h
+++ b/hwdef-Sofirn_LT1S-Pro.h
@@ -13,11 +13,11 @@
* Voltage: VCC
*/
-#define HWDEF_C_FILE hwdef-Sofirn_LT1S-Pro.c
-
#define ATTINY 1616
#include <avr/io.h>
+#define HWDEF_C_FILE hwdef-Sofirn_LT1S-Pro.c
+
// channel modes:
// * 0. warm/cool white blend
// * 1. auto 2ch white blend (warm -> cool by ramp level)
@@ -25,37 +25,24 @@
// * 3. red only
// * 4. red + white blend
#define NUM_CHANNEL_MODES 5
-#define CM_WHITE 0
-#define CM_AUTO2 1
-#define CM_AUTO3 2
-#define CM_RED 3
-#define CM_WHITE_RED 4
+enum channel_modes_e {
+ CM_WHITE = 0,
+ CM_AUTO2,
+ CM_AUTO3,
+ CM_RED,
+ CM_WHITE_RED,
+};
#define CHANNEL_MODES_ENABLED 0b00011111
-#define CHANNEL_HAS_ARGS 0b00010001
+#define USE_CHANNEL_MODE_ARGS
// 128=middle CCT, _, _, _, 255=100% red
#define CHANNEL_MODE_ARGS 128,0,0,0,255
-// TODO: blend mode should enable this automatically?
-#define USE_CHANNEL_MODES
-// TODO: blend mode should enable this automatically?
-#define USE_CHANNEL_MODE_ARGS
-// TODO: or maybe if args are defined, the USE_ should be auto-set?
-#define SET_LEVEL_MODES set_level_white_blend, \
- set_level_auto_2ch_blend, \
- set_level_auto_3ch_blend, \
- set_level_red, \
- set_level_red_white_blend
-// gradual ticking for thermal regulation
-#define GRADUAL_TICK_MODES gradual_tick_white_blend, \
- gradual_tick_auto_2ch_blend, \
- gradual_tick_auto_3ch_blend, \
- gradual_tick_red, \
- gradual_tick_red_white_blend
// can use some of the common handlers
#define USE_CALC_2CH_BLEND
//#define USE_CALC_AUTO_3CH_BLEND
+
// TODO: remove this as soon as it's not needed
#define PWM_CHANNELS 1
@@ -108,19 +95,6 @@
#define USE_INDICATOR_LED_WHILE_RAMPING
-// custom channel modes
-void set_level_red(uint8_t level);
-void set_level_white_blend(uint8_t level);
-void set_level_auto_2ch_blend(uint8_t level);
-void set_level_auto_3ch_blend(uint8_t level);
-void set_level_red_white_blend(uint8_t level);
-
-bool gradual_tick_red(uint8_t gt);
-bool gradual_tick_white_blend(uint8_t gt);
-bool gradual_tick_auto_2ch_blend(uint8_t gt);
-bool gradual_tick_auto_3ch_blend(uint8_t gt);
-bool gradual_tick_red_white_blend(uint8_t gt);
-
inline void hwdef_setup() {
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.