make tower LEDs more arcade accurate

This commit is contained in:
beerpsi 2024-01-10 02:51:23 +07:00
parent 821037f600
commit ade1b8644d
2 changed files with 11 additions and 8 deletions

View File

@ -135,13 +135,14 @@ pub fn set_led_colors<T: UsbContext>(
let air_rgb = if board == 0 { 0x96 } else { 0xB4 };
let output_start = if board == 0 { 96 } else { 168 };
for buf_chunk in output[output_start..output_start + 72]
for (buf_chunk, state_chunk) in output[output_start..output_start + 72]
.chunks_mut(3)
.take(24)
.zip(rgb[air_rgb..air_rgb + 9].chunks(3).cycle().take(24))
{
buf_chunk[0] = rgb[air_rgb + 1];
buf_chunk[1] = rgb[air_rgb];
buf_chunk[2] = rgb[air_rgb + 2];
buf_chunk[0] = state_chunk[1];
buf_chunk[1] = state_chunk[0];
buf_chunk[2] = state_chunk[2];
}
device.write_bulk(0x03, output, TIMEOUT)?;

View File

@ -107,13 +107,15 @@ pub fn set_led_colors<T: UsbContext>(
let air_rgb = if board == 0 { 0x96 } else { 0xB4 };
let output_start = if board == 0 { 96 } else { 168 };
for buf_chunk in output[output_start..output_start + 72]
for (buf_chunk, state_chunk) in output[output_start..output_start + 72]
.chunks_mut(3)
.take(24)
.zip(rgb[air_rgb..air_rgb + 9].chunks(3).cycle().take(24))
{
buf_chunk[0] = rgb[air_rgb + 1];
buf_chunk[1] = rgb[air_rgb];
buf_chunk[2] = rgb[air_rgb + 2];
buf_chunk[0] = state_chunk[1];
buf_chunk[1] = state_chunk[0];
buf_chunk[2] = state_chunk[2];
}
device.write_bulk(0x03, output, TIMEOUT)?;