diff --git a/services/bao-video/Cargo.toml b/services/bao-video/Cargo.toml index e746da8a5..9ecfffcc6 100644 --- a/services/bao-video/Cargo.toml +++ b/services/bao-video/Cargo.toml @@ -63,6 +63,7 @@ hosted-baosec = ["bao1x-emu", "ux-api/hosted-baosec", "no-gam"] autotest = [] # factory feature - makes it keep on scanning forever - used for calibrating factory test jigs eternal-scan = [] +cam-watchdog = [] with-logo = [] bao1x = ["utralib/bao1x", "blitstr2/bao1x"] diff --git a/services/bao-video/src/main.rs b/services/bao-video/src/main.rs index 60f822ff4..1fbec9af6 100644 --- a/services/bao-video/src/main.rs +++ b/services/bao-video/src/main.rs @@ -432,6 +432,7 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! { let mut bw_thresh: u8 = 128; let mut qr_request: Option = None; let mut kbd_listeners: Vec<(CID, usize)> = Vec::new(); + #[cfg(feature = "cam-watchdog")] let cam_started = Arc::new(AtomicBool::new(false)); let mut dry_run = false; #[allow(unused_mut)] @@ -514,9 +515,13 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! { cam.set_slicing((border, 0), (cols - border, IMAGE_HEIGHT)); log::info!("320x240 resolution setup with 256x240 slicing"); + #[cfg(feature = "cam-watchdog")] cam_started.store(false, Ordering::SeqCst); + #[cfg(not(feature = "cam-watchdog"))] + hal.set_preemption(false); // start watchdog to make sure camera is running + #[cfg(feature = "cam-watchdog")] let _ = std::thread::spawn({ let cid = cid.clone(); let cam_started = cam_started.clone(); @@ -600,6 +605,7 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! { } } GfxOpcode::CamIrq => { + #[cfg(feature = "cam-watchdog")] cam_started.store(true, Ordering::SeqCst); // copy the camera data to our FB let fb: &[u32] = cam.rx_buf();