From 19b83a86505bdccdfe00f49e4521bd83d4baa473 Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 3 Apr 2026 01:52:57 +0800 Subject: [PATCH] fix offset in camera driver --- libs/bao1x-hal/src/gc2145/gc2145.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/bao1x-hal/src/gc2145/gc2145.rs b/libs/bao1x-hal/src/gc2145/gc2145.rs index 8440e4143..2a4c921c3 100644 --- a/libs/bao1x-hal/src/gc2145/gc2145.rs +++ b/libs/bao1x-hal/src/gc2145/gc2145.rs @@ -239,7 +239,10 @@ impl Gc2145 { } /// TODO: figure out how to length-bound this to...the frame slice size? line size? idk... - pub fn rx_buf(&self) -> &[T] { &self.ifram.as_ref().unwrap().as_slice() } + /// The offset on the slice is a "cheater" parameter which is empirically calibrated based on + /// observed data. I don't know the underlying cause of it, but I suspect it probably has to + /// do with data in the pipeline that's not flushed, so the first three elements are "stale" + pub fn rx_buf(&self) -> &[T] { &self.ifram.as_ref().unwrap().as_slice()[3..] } /// TODO: figure out how to length-bound this to...the frame slice size? line size? idk... pub unsafe fn rx_buf_phys(&self) -> &[T] { &self.ifram.as_ref().unwrap().as_phys_slice() }