From 5f99db01147a6abb9eb36a65d97cba0f025ccf65 Mon Sep 17 00:00:00 2001 From: SiteRelEnby <125829806+SiteRelEnby@users.noreply.github.com> Date: Tue, 30 Apr 2024 18:31:35 -0500 Subject: [PATCH] Issue #69: tint_ramp_direction does not get reset when channel mode arg is changed by manual memory https://github.com/ToyKeeper/anduril/issues/69 --- ui/anduril/channel-modes.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ui/anduril/channel-modes.c b/ui/anduril/channel-modes.c index 74e7ea41..4e094edb 100644 --- a/ui/anduril/channel-modes.c +++ b/ui/anduril/channel-modes.c @@ -71,6 +71,17 @@ uint8_t channel_mode_state(Event event, uint16_t arg) { if (! arg) { active = 1; // first frame means this is for us past_edge_counter = 0; // doesn't start until user hits the edge + + // Issue 69: if manual memory was set to an arg of 0 or 255, this could result in an incorrect + // ramp direction with the arg resetting, so make sure tint_ramp_direction is set correctly + if (channel_has_args(channel_mode)) { + if (cfg.channel_mode_args[channel_mode] == 0){ + tint_ramp_direction = 1; + } + else if (cfg.channel_mode_args[channel_mode] == 255){ + tint_ramp_direction = -1; + } + } } // ignore event if we weren't the ones who handled the first frame if (! active) return EVENT_NOT_HANDLED;