fix(ev): preview EV via software matrix, flush AE bias only at capture
This commit is contained in:
@@ -9,7 +9,7 @@ import * as Haptics from 'expo-haptics';
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
|
||||
import TopBar from './src/components/TopBar';
|
||||
import Viewfinder from './src/components/Viewfinder';
|
||||
import Viewfinder, { type ViewfinderHandle } from './src/components/Viewfinder';
|
||||
import AdjustmentPanel from './src/components/AdjustmentPanel';
|
||||
import CameraControls from './src/components/CameraControls';
|
||||
import ToolRail, { TabId } from './src/components/ToolRail';
|
||||
@@ -32,6 +32,10 @@ console.error('[camdebug-ver] debug build console.error path');
|
||||
|
||||
export default function App() {
|
||||
const [mode, setMode] = useState<'camera' | 'library'>('camera');
|
||||
// Imperative handle into the Viewfinder camera controller: flushes the EV to
|
||||
// the hardware AE bias right before each capture (live slider drags never
|
||||
// touch the hardware — that flashed the Xiaomi preview).
|
||||
const viewfinderRef = useRef<ViewfinderHandle>(null);
|
||||
const [recipes, setRecipes] = useState<Recipe[]>([]);
|
||||
const [selectedRecipe, setSelectedRecipe] = useState<Recipe | null>(null);
|
||||
|
||||
@@ -393,6 +397,14 @@ export default function App() {
|
||||
}
|
||||
|
||||
const tShot = Date.now();
|
||||
// Hardware AE bias for this shot (best-effort, bounded retries inside).
|
||||
// Applied here — right before the capture — instead of live during EV
|
||||
// slider drags, which re-locked AE on the Xiaomi and flashed preview.
|
||||
try {
|
||||
await viewfinderRef.current?.flushExposureBias();
|
||||
} catch (e) {
|
||||
console.error('[ev] flush at capture failed: ' + String(e));
|
||||
}
|
||||
const { filePath } = await photoOutput.capturePhotoToFile({}, {});
|
||||
console.error(`[capture] shot-took ${Date.now() - tShot}ms`);
|
||||
const sourceUri = toUri(filePath);
|
||||
@@ -504,6 +516,7 @@ export default function App() {
|
||||
{/* Fullscreen hero: photo or live preview fills the whole screen */}
|
||||
<View className="absolute inset-0 bg-black">
|
||||
<Viewfinder
|
||||
ref={viewfinderRef}
|
||||
mode={mode}
|
||||
recipe={
|
||||
selectedRecipe || {
|
||||
|
||||
Reference in New Issue
Block a user