Send out the full set of lights
This commit is contained in:
parent
54c4b99ab6
commit
d7a70119c8
|
@ -98,17 +98,23 @@ impl<
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_lights(&self, dashboard_lights: DashboardPattern, body_lights: BodyPattern) {
|
fn update_lights(&self, dashboard_lights: DashboardPattern, body_lights: BodyPattern) {
|
||||||
let mut lights: [u8; 20] = [0; 20];
|
let mut lights: [u8; 260] = [0; 260];
|
||||||
lights[16] = 0xff;
|
lights[256] = 0xff;
|
||||||
lights[17] = 0xff;
|
lights[257] = 0xff;
|
||||||
lights[18] = 0xff;
|
lights[258] = 0xff;
|
||||||
lights[19] = 0xff;
|
lights[259] = 0xff;
|
||||||
for (idx, rgb) in dashboard_lights.iter().enumerate() {
|
for (idx, rgb) in dashboard_lights.iter().enumerate() {
|
||||||
lights[(idx + 1) * 4 + 0] = 0xe0 + DASHBOARD_BRIGHTESS;
|
lights[(idx + 1) * 4 + 0] = 0xe0 + DASHBOARD_BRIGHTESS;
|
||||||
lights[(idx + 1) * 4 + 1] = (I16F16::from(rgb.r) * LIGHT_SCALE).saturating_as();
|
lights[(idx + 1) * 4 + 1] = (I16F16::from(rgb.r) * LIGHT_SCALE).saturating_as();
|
||||||
lights[(idx + 1) * 4 + 2] = (I16F16::from(rgb.b) * LIGHT_SCALE).saturating_as();
|
lights[(idx + 1) * 4 + 2] = (I16F16::from(rgb.b) * LIGHT_SCALE).saturating_as();
|
||||||
lights[(idx + 1) * 4 + 3] = (I16F16::from(rgb.g) * LIGHT_SCALE).saturating_as();
|
lights[(idx + 1) * 4 + 3] = (I16F16::from(rgb.g) * LIGHT_SCALE).saturating_as();
|
||||||
}
|
}
|
||||||
|
for (idx, rgb) in body_lights.iter().enumerate() {
|
||||||
|
lights[(idx + 4) * 4 + 0] = 0xe0 + BODY_BRIGHTNESS;
|
||||||
|
lights[(idx + 4) * 4 + 1] = (I16F16::from(rgb.r) * LIGHT_SCALE).saturating_as();
|
||||||
|
lights[(idx + 4) * 4 + 2] = (I16F16::from(rgb.b) * LIGHT_SCALE).saturating_as();
|
||||||
|
lights[(idx + 4) * 4 + 3] = (I16F16::from(rgb.g) * LIGHT_SCALE).saturating_as();
|
||||||
|
}
|
||||||
let mut spi = self.spi.borrow_mut();
|
let mut spi = self.spi.borrow_mut();
|
||||||
spi.write(lights.as_slice());
|
spi.write(lights.as_slice());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue