1
0
mirror of https://github.com/4yn/slidershim.git synced 2025-02-08 07:08:15 +01:00

flip slider input and rgb order

This commit is contained in:
4yn 2022-02-22 23:08:51 +08:00
parent 08b1b92f52
commit 0029dad2f2
2 changed files with 16 additions and 1 deletions

View File

@ -300,6 +300,7 @@ impl ThreadJob for DivaSliderJob {
input_handle
.ground
.copy_from_slice(&data_packet.data[0..32]);
input_handle.flip_all();
work = true;
}
}
@ -312,7 +313,15 @@ impl ThreadJob for DivaSliderJob {
if lights_handle.dirty || self.last_lights.elapsed() > Duration::from_millis(1000) {
send_lights = true;
lights_buf[0] = self.brightness;
lights_buf[1..94].copy_from_slice(&lights_handle.ground[0..93]);
for (buf_chunk, state_chunk) in lights_buf[1..94]
.chunks_mut(3)
.take(31)
.zip(lights_handle.ground.chunks(3).rev())
{
buf_chunk[0] = state_chunk[1];
buf_chunk[1] = state_chunk[0];
buf_chunk[2] = state_chunk[2];
}
lights_handle.dirty = false;
}
}

View File

@ -47,6 +47,12 @@ impl SliderInput {
self.ground.swap(i * 2, i * 2 + 1);
}
}
pub fn flip_all(&mut self) {
for i in 0..16 {
self.ground.swap(i, 31 - i);
}
}
}
// Stores the lighting state of a slider controller.