chore: some debugging

This commit is contained in:
janishutz committed 2026-08-25 10:38:25 +02:00
1 parent 51c9b2068d
commit 760895bb5c
1 file changed
+4
+4
View File
@@ -12,6 +12,7 @@ pub struct InputPin {
pub struct OutputPin { pub struct OutputPin {
gpio: gpio::OutputPin, gpio: gpio::OutputPin,
off_timeout: u64, off_timeout: u64,
pub id: u8,
pub topic: String, pub topic: String,
} }
@@ -60,6 +61,7 @@ pub fn split_topics_and_configure_pins(topics: Vec<Topic>) -> (Vec<InputPin>, Ve
.get(topic.pin) .get(topic.pin)
.expect(&format!("Unable to find GPIO pin {}", topic.pin)) .expect(&format!("Unable to find GPIO pin {}", topic.pin))
.into_output_low(), .into_output_low(),
id: topic.pin,
off_timeout: topic.off_timeout, off_timeout: topic.off_timeout,
}); });
out_used.push(topic.pin) out_used.push(topic.pin)
@@ -132,8 +134,10 @@ impl GPIOController {
instr.push(*c as char) instr.push(*c as char)
} }
if instr == "ON" { if instr == "ON" {
println!("Turned ON pin {}", pin.id);
pin.gpio.set_high(); pin.gpio.set_high();
} else if instr == "OFF" { } else if instr == "OFF" {
println!("Turned OFF pin {}", pin.id);
pin.gpio.set_low(); pin.gpio.set_low();
} else { } else {
println!("Received unknown instruction {}", instr); println!("Received unknown instruction {}", instr);