chore: fix outof bounds problem
This commit is contained in:
parent
d8716ce8bc
commit
41210d756c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user