diff --git a/src/gpio_utils.rs b/src/gpio_utils.rs index 4214727..c53acbe 100644 --- a/src/gpio_utils.rs +++ b/src/gpio_utils.rs @@ -12,7 +12,6 @@ pub struct InputPin { pub struct OutputPin { gpio: gpio::OutputPin, off_timeout: u64, - pub id: u8, pub topic: String, } @@ -61,7 +60,6 @@ pub fn split_topics_and_configure_pins(topics: Vec) -> (Vec, Ve .get(topic.pin) .expect(&format!("Unable to find GPIO pin {}", topic.pin)) .into_output_low(), - id: topic.pin, off_timeout: topic.off_timeout, }); out_used.push(topic.pin) @@ -127,7 +125,7 @@ impl GPIOController { if self.topics.contains(&instruction.topic) { let pin = self .out_pins - .get(&instruction.topic) + .get_mut(&instruction.topic) .expect("Failed to load pins data"); let mut instr = "".to_string(); for c in &instruction.payload { @@ -138,7 +136,7 @@ impl GPIOController { } else if instr == "OFF" { pin.gpio.set_low(); } else { - println!("Received unknown instruction", instr); + println!("Received unknown instruction {}", instr); } if pin.off_timeout > 0 { self.timeout_topics diff --git a/src/main.rs b/src/main.rs index fd79686..a2a4530 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,3 @@ -use std::{thread, time::Duration}; mod conf; mod gpio_utils; mod mqtt; @@ -13,7 +12,6 @@ fn main() { // TODO: Remove this when done println!("{:#?}", config); - thread::sleep(Duration::from_secs(2)); mqtt::handler(config); }