From 429f8258bc38cde56ebe976017ebc71b14d27e94 Mon Sep 17 00:00:00 2001 From: Jared Burce Date: Thu, 29 Oct 2020 06:41:40 -0700 Subject: [PATCH] reorder functions --- src/main.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8b8ef4a..450b06b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,18 +17,6 @@ const OUTDOOR_CHIME_FILE: &str = "static/outdoor.mp3"; const BUTTON_PIN: u8 = 26; const CHANNEL_VEC_SIZE: usize = 32; -fn button_pressed(_level: Level, - clients: &Arc; CHANNEL_VEC_SIZE]>>>) { - info!("DOORBELL PRESS"); - clients.lock().unwrap().retain(|tx: &mut mpsc::Sender<()>| { - match tx.try_send(()) { - Ok(_) => true, - Err(mpsc::error::TrySendError::Full(_)) => true, // we just get some free debouncing - Err(mpsc::error::TrySendError::Closed(_)) => { info!("Event client disconnected"); false } - } - }); -} - thread_local! { static AUDIO_CHILD: RefCell> = RefCell::new(None) } @@ -60,6 +48,18 @@ async fn main() { } } +fn button_pressed(_level: Level, + clients: &Arc; CHANNEL_VEC_SIZE]>>>) { + info!("DOORBELL PRESS"); + clients.lock().unwrap().retain(|tx: &mut mpsc::Sender<()>| { + match tx.try_send(()) { + Ok(_) => true, + Err(mpsc::error::TrySendError::Full(_)) => true, // we just get some free debouncing + Err(mpsc::error::TrySendError::Closed(_)) => { info!("Event client disconnected"); false } + } + }); +} + async fn warp(clients: Arc; CHANNEL_VEC_SIZE]>>>) { // GET / let root = warp::path::end()