diff --git a/src/main.rs b/src/main.rs index dfd3b96..ebe6595 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,6 +8,8 @@ use tracing::{error, info}; #[tokio::main] async fn main() -> Result<()> { + info!("Starting noisebell..."); + tracing_subscriber::fmt::init(); const DEFAULT_GPIO_PIN: u8 = 17; @@ -21,16 +23,16 @@ async fn main() -> Result<()> { let callback = move |event: gpio::CircuitEvent| { info!("Circuit state changed: {:?}", event); - - // Clone the webhook notifier for the async block + let notifier = webhook_notifier.clone(); - - // Spawn a new task to send webhooks + tokio::spawn(async move { notifier.notify_all("circuit_state_change", event).await; }); }; + info!("starting gpio_monitor"); + if let Err(e) = gpio_monitor.monitor(callback).await { error!("GPIO monitoring error: {}", e); }