aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-04-17 01:30:41 -0600
committerSelene ToyKeeper2023-04-17 01:30:41 -0600
commit561a85c175920074fafea33738d24f54317e2f3a (patch)
tree6b250dd5f9fd1c4f687792964b43d212fedb5769 /spaghetti-monster
parentLT1S Pro: raised the ramp a bit; it seemed too low in the middle (diff)
downloadanduril-561a85c175920074fafea33738d24f54317e2f3a.tar.gz
anduril-561a85c175920074fafea33738d24f54317e2f3a.tar.bz2
anduril-561a85c175920074fafea33738d24f54317e2f3a.zip
made "Ramp 3H" do momentary turbo if current channel mode has no args
Diffstat (limited to '')
-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
3 files changed, 29 insertions, 16 deletions
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);