tmp: creating specific modules for 8 channels & 16 channels

This commit is contained in:
2025-08-17 08:57:05 +00:00
parent 57ace1383b
commit c9ca399e20
23 changed files with 253 additions and 88 deletions
-13
View File
@@ -16,16 +16,3 @@ rppal = "0.22.1"
spectrum-analyzer = "1.7.0"
textplots = "0.8.7"
led_driver = { path = "../led_driver" }
[build-dependencies]
bindgen = "0.71.0"
[features]
default = ["rpizero2", "16channel"]
rpizero2 = ["rpi3"]
rpizero = ["rpi"]
rpi4 = []
rpi3 = []
rpi2 = []
rpi = []
16channel = []
-1
View File
@@ -1 +0,0 @@
@@ -110,8 +110,10 @@ impl AppModeHandler for ArtNetMode {
is_first_data_frame = false;
}
let led_strip = (u16::from(output.port_address) & 0b0111_u16) as usize;
//output.port_address
let led_strip = (u16::from(output.port_address)
& led_driver::CHAN_NUM_MASK as u16)
as usize;
for i in 0..led_driver.get_led_per_strip_count() {
let data_index = i * 3;
let g = *output.data.as_ref().get(data_index).unwrap_or(&0);
@@ -120,9 +122,9 @@ impl AppModeHandler for ArtNetMode {
// let color = (r as u32) << 16 + (g as u32) << 8 + b;
let color: u32 =
((r as u32) << 16) | ((g as u32) << 8) | (b as u32);
led_driver.direct_set_color(color, i);
led_driver.set_led_color(color, i, led_strip);
}
led_driver.refresh();
led_driver.direct_refresh();
}
ArtCommand::PollReply(_) => {
log::trace!("[ArtNet] Received PollReply command, ignoring");
@@ -76,7 +76,7 @@ impl AppModeHandler for DiagnosticsMode {
}
};
log::trace!("Setting LED {} to color {:06x}", led, color);
led_driver.refresh();
led_driver.direct_refresh();
}
self.cycle_count += 1;
Ok(())
@@ -146,7 +146,7 @@ impl AppModeHandler for StandaloneMode {
// Set the remaining LEDs to black
led_driver.direct_set_color(0x000000, i);
}
led_driver.refresh();
led_driver.direct_refresh();
}
None => {
log::trace!("[Standalone] No audio data received");
+4 -2
View File
@@ -1,5 +1,4 @@
mod channels;
mod config;
mod cputasks;
mod devices;
mod iotasks;
@@ -107,7 +106,10 @@ impl From<LightSabre> for LightSabreIntitialized {
impl From<LightSabreIntitialized> for LightSabreRunning {
fn from(mut value: LightSabreIntitialized) -> Self {
LightSabreRunning {
join_handle: std::thread::spawn(move || run(&mut value.ctx)),
join_handle: std::thread::Builder::new()
.name("main_app".to_string())
.spawn(move || run(&mut value.ctx))
.expect("Failed to start main app thread"),
}
}
}