From 139882b3257f3dba36d9a6d3193de0bcdd12a170 Mon Sep 17 00:00:00 2001 From: Petr Horacek Date: Sun, 12 Nov 2023 17:37:48 +0100 Subject: [PATCH] Change position display rotation Signed-off-by: Petr Horacek --- control/src/cache/display.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/control/src/cache/display.rs b/control/src/cache/display.rs index 78aebd7..71c9ae1 100644 --- a/control/src/cache/display.rs +++ b/control/src/cache/display.rs @@ -454,7 +454,7 @@ fn leds_for_attribute(attribute: AttributeScreen) -> [bool; 8] { AttributeScreen::HeadsOverview((top, bottom)) => [ top[0], top[1], top[2], top[3], bottom[0], bottom[1], bottom[2], bottom[3], ], - AttributeScreen::Position(position) => index_to_leds(position), + AttributeScreen::Position(position) => position_to_leds(position), AttributeScreen::OctaveOffset(offset) => { let mut leds = [false; 8]; if offset >= leds.len() { @@ -517,6 +517,16 @@ fn index_to_leds(index: usize) -> [bool; 8] { leds } +fn position_to_leds(position: usize) -> [bool; 8] { + let mut leds = [false; 8]; + if position < 4 { + leds[position] = true; + } else { + leds[7 - (position - 4)] = true; + } + leds +} + fn dry_wet_to_leds(phase: f32) -> [bool; 8] { let mut leds = [false; 8];