Initialize number of lights from environment
This commit is contained in:
parent
11fe309b34
commit
9f565cdafb
@ -18,6 +18,7 @@ rppal = "0.14"
|
||||
ws2818-rgb-led-spi-driver = { path = "./lib-ws2818-rgb-led-spi-driver" }
|
||||
common = { path = "./common" }
|
||||
webui = { path = "./webui" }
|
||||
dotenv = "0.15.0"
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
|
10
src/main.rs
10
src/main.rs
@ -44,6 +44,9 @@ use strip::LedStrip;
|
||||
use ui::console_ui_loop;
|
||||
|
||||
fn main() -> ProgramResult<()> {
|
||||
// Initialize any config
|
||||
dotenv::dotenv().ok();
|
||||
|
||||
// Strip control transmitter and receiver
|
||||
let (strip_tx, strip_rx) = channel::<common::strip::Message>();
|
||||
let (console_strip_tx, webui_strip_tx) = (strip_tx.clone(), strip_tx);
|
||||
@ -53,7 +56,12 @@ fn main() -> ProgramResult<()> {
|
||||
make_child(message_tx.clone(), move |message_tx| -> ProgramResult<()> {
|
||||
let mut strip = LedStrip::new(strip::Config {
|
||||
// I have 89 right now, but start off with 20
|
||||
num_lights: 89,
|
||||
num_lights: std::env::var("NUM_LIGHTS")
|
||||
.as_ref()
|
||||
.map(String::as_str)
|
||||
.unwrap_or("89")
|
||||
.parse()
|
||||
.unwrap(),
|
||||
// Skip 14 lights
|
||||
shift_lights: 14,
|
||||
// Scaling factor (scale 0..255)
|
||||
|
Loading…
x
Reference in New Issue
Block a user