aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hwdef-Sofirn_LT1S-Pro.h8
-rw-r--r--spaghetti-monster/anduril/ramp-mode.c27
-rw-r--r--spaghetti-monster/anduril/ramp-mode.h10
-rw-r--r--spaghetti-monster/fsm-ramping.h8
4 files changed, 34 insertions, 19 deletions
diff --git a/hwdef-Sofirn_LT1S-Pro.h b/hwdef-Sofirn_LT1S-Pro.h
index 4ee466b..d59e7bc 100644
--- a/hwdef-Sofirn_LT1S-Pro.h
+++ b/hwdef-Sofirn_LT1S-Pro.h
@@ -25,19 +25,21 @@
// * 3. red + white blend
#define NUM_CHANNEL_MODES 4
//#define CHANNEL_MODES_ENABLED 1,1,1,1
-#define CHANNEL_MODES_ENABLED 0b00001111
#define CM_WHITE 0
#define CM_AUTO 1
#define CM_RED 2
#define CM_WHITE_RED 3
+#define CHANNEL_MODES_ENABLED 0b00001111
+#define CHANNEL_HAS_ARGS 0b00001001
+// 128=middle CCT, N/A, N/A, 255=100% red
+#define CHANNEL_MODE_ARGS 128,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?
-// 128=middle CCT, N/A, N/A, 255=100% red
-#define CHANNEL_MODE_ARGS 128,0,0,255
#define SET_LEVEL_MODES set_level_white_blend, \
set_level_auto_3ch_blend, \
set_level_red, \
diff --git a/spaghetti-monster/anduril/ramp-mode.c b/spaghetti-monster/anduril/ramp-mode.c
index 88b141e..5a960c9 100644
--- a/spaghetti-monster/anduril/ramp-mode.c
+++ b/spaghetti-monster/anduril/ramp-mode.c
@@ -408,9 +408,18 @@ uint8_t steady_state(Event event, uint16_t arg) {
#endif
// 3H: momentary turbo (on lights with no tint ramping)
- // (or 4H on lights with tint ramping)
- // FIXME: handle 3H if channel mode has no args
- else if (event == EV_MOMENTARY_TURBO) {
+ // (or 4H when tint ramping is available)
+ else if ((event == EV_click3_hold)
+ #ifdef USE_CHANNEL_MODE_ARGS
+ || (event == EV_click4_hold)
+ #endif
+ ) {
+ #ifdef USE_CHANNEL_MODE_ARGS
+ // ramp tint if tint exists in this mode
+ if ((event == EV_click3_hold)
+ && (channel_has_args(cfg.channel_mode)))
+ return EVENT_NOT_HANDLED;
+ #endif
if (! arg) { // first frame only, to allow thermal regulation to work
#ifdef USE_2C_STYLE_CONFIG
uint8_t tl = style_2c ? MAX_LEVEL : turbo_level;
@@ -421,7 +430,17 @@ uint8_t steady_state(Event event, uint16_t arg) {
}
return MISCHIEF_MANAGED;
}
- else if (event == EV_MOMENTARY_TURBO_RELEASE) {
+ else if ((event == EV_click3_hold_release)
+ #ifdef USE_CHANNEL_MODE_ARGS
+ || (event == EV_click4_hold_release)
+ #endif
+ ) {
+ #ifdef USE_CHANNEL_MODE_ARGS
+ // ramp tint if tint exists in this mode
+ if ((event == EV_click3_hold_release)
+ && (channel_has_args(cfg.channel_mode)))
+ return EVENT_NOT_HANDLED;
+ #endif
set_level_and_therm_target(memorized_level);
return MISCHIEF_MANAGED;
}
diff --git a/spaghetti-monster/anduril/ramp-mode.h b/spaghetti-monster/anduril/ramp-mode.h
index c50e36a..e4ded1e 100644
--- a/spaghetti-monster/anduril/ramp-mode.h
+++ b/spaghetti-monster/anduril/ramp-mode.h
@@ -57,16 +57,6 @@
#endif
-// move a couple actions depending on whether there are channel modes
-#ifdef USE_CHANNEL_MODE_ARGS
- #define EV_MOMENTARY_TURBO EV_click4_hold
- #define EV_MOMENTARY_TURBO_RELEASE EV_click4_hold_release
-#else
- #define EV_MOMENTARY_TURBO EV_click3_hold
- #define EV_MOMENTARY_TURBO_RELEASE EV_click3_hold_release
-#endif
-
-
// default ramp options if not overridden earlier per-driver
#ifndef RAMP_STYLE
#define RAMP_STYLE 0 // smooth default
diff --git a/spaghetti-monster/fsm-ramping.h b/spaghetti-monster/fsm-ramping.h
index 4511508..a9e333e 100644
--- a/spaghetti-monster/fsm-ramping.h
+++ b/spaghetti-monster/fsm-ramping.h
@@ -41,6 +41,7 @@ GradualTickFuncPtr gradual_tick_modes[NUM_CHANNEL_MODES];
#ifdef USE_CUSTOM_CHANNEL_3H_MODES
// different 3H behavior per channel?
// TODO: move to progmem
+// TODO: move to Anduril, not FSM
StatePtr channel_3H_modes[NUM_CHANNEL_MODES];
#endif
@@ -60,11 +61,14 @@ StatePtr channel_3H_modes[NUM_CHANNEL_MODES];
#endif
#endif
-#ifndef USE_CFG
- #ifdef USE_CHANNEL_MODE_ARGS
+#ifdef USE_CHANNEL_MODE_ARGS
+ #ifndef USE_CFG
// one byte of extra data per channel mode, like for tint value
uint8_t channel_mode_args[NUM_CHANNEL_MODES] = { CHANNEL_MODE_ARGS };
#endif
+ // bitmask: which modes respond to their "arg", and which don't?
+ //const uint8_t channel_has_args = CHANNEL_HAS_ARGS;
+ #define channel_has_args(n) ((CHANNEL_HAS_ARGS >> n) & 1)
#endif
void set_channel_mode(uint8_t mode);
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.