chore: fix outof bounds problem
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone Build is failing

This commit is contained in:
Andre Henriques 2023-07-10 21:23:22 +01:00
parent d8716ce8bc
commit 41210d756c

View File

@ -175,7 +175,7 @@ impl Render {
);
self.local_led_config = local_led_config;
self.ws = Some(Ws2812Rpi::new(current_pos as i32, PIN).unwrap());
self.ws = Some(Ws2812Rpi::new(self.num_leds as i32, PIN).unwrap());
Ok(())
}
@ -248,7 +248,11 @@ impl Render {
local_led_config.push(LocalLedConfiguration { tag, start, end });
}
self.num_leds = current_pos;
if (self.num_leds != current_pos + 1) {
return self.load_config();
}
self.num_leds = current_pos + 1;
println!(
"Loaded: {} leds, with config: {:?}",
self.num_leds, local_led_config