servo fix

This commit is contained in:
legop3
2025-11-20 14:12:06 -05:00
parent 400054ae58
commit ff0bf30eac
4 changed files with 17 additions and 14 deletions
+5 -2
View File
@@ -53,11 +53,14 @@ export function ControlSystemProvider({ children }) {
const min = typeof config.minAngle === 'number' ? config.minAngle : -45;
const max = typeof config.maxAngle === 'number' ? config.maxAngle : 45;
const base = typeof config.homeAngle === 'number' ? config.homeAngle : (min + max) / 2;
const preserved =
typeof servoAngleRef.current === 'number' ? clamp(servoAngleRef.current, min, max) : null;
const angle = preserved != null ? preserved : clamp(base, min, max);
dispatch({
type: 'control/set-camera-config',
payload: { config, angle: clamp(base, min, max) },
payload: { config, angle },
});
servoAngleRef.current = clamp(base, min, max);
servoAngleRef.current = angle;
}, [pipeline.servoConfig]);
useEffect(() => {