diff --git a/src/event_logger.rs b/src/event_logger.rs index 4b2ab86..abb2286 100644 --- a/src/event_logger.rs +++ b/src/event_logger.rs @@ -21,7 +21,7 @@ pub enum LoggerEventKind { Rp2040WokenByAlarm, RtcCommError, AttinyCommError, - Rp2040Woken, + Rp2040MissedAudioAlarm, } impl Into for LoggerEventKind { @@ -47,7 +47,7 @@ impl Into for LoggerEventKind { Rp2040WokenByAlarm => 17, RtcCommError => 18, AttinyCommError => 19, - Rp2040Woken => 20, + Rp2040MissedAudioAlarm => 20, } } } @@ -77,7 +77,7 @@ impl TryFrom for LoggerEventKind { 17 => Ok(Rp2040WokenByAlarm), 18 => Ok(RtcCommError), 19 => Ok(AttinyCommError), - 20 => Ok(Rp2040Woken), + 20 => Ok(Rp2040MissedAudioAlarm), _ => Err(()), } } diff --git a/src/main.rs b/src/main.rs index a7b9140..4ebc2b8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -466,7 +466,7 @@ fn main() { let (tx, rx) = channel(); let (restart_tx, restart_rx) = channel(); let cross_thread_signal: Arc = Arc::new(AtomicBool::new(false)); - if frame_acquire{ + if frame_acquire { let cross_thread_signal_2 = cross_thread_signal.clone(); let _ = thread::Builder::new().name("frame-socket".to_string()).spawn_with_priority(ThreadPriority::Max, move |result| { @@ -597,7 +597,7 @@ fn main() { } }); } - info!("Waiting to acquire frames from rp2040"); + info!("Waiting to for messages from rp2040"); // Poke register 0x07 of the attiny letting the rp2040 know that we're ready: let mut attiny_i2c_interface = None; if let Ok(mut attiny_i2c) = I2c::new() { @@ -935,7 +935,12 @@ fn main() { part_count = 0; let mut file = Vec::new(); file.extend_from_slice(&chunk); - save_cptv_file_to_disk(file, device_config.output_dir()); + let shebang = u8_slice_as_u16_slice(&file[0..2]); + if shebang[0] == AUDIO_SHEBANG{ + save_audio_file_to_disk(file, device_config.output_dir()); + }else{ + save_cptv_file_to_disk(file, device_config.output_dir()) + } let _ = tx.send((None, Some(false))); } CAMERA_GET_MOTION_DETECTION_MASK => {