mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
servo fix
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@
|
|||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>webui</title>
|
<title>webui</title>
|
||||||
<script type="module" crossorigin src="/assets/index-DBNvZqXA.js"></script>
|
<script type="module" crossorigin src="/assets/index-tDRd6DNO.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-DP0zs3Oi.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-DP0zs3Oi.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -53,11 +53,14 @@ export function ControlSystemProvider({ children }) {
|
|||||||
const min = typeof config.minAngle === 'number' ? config.minAngle : -45;
|
const min = typeof config.minAngle === 'number' ? config.minAngle : -45;
|
||||||
const max = typeof config.maxAngle === 'number' ? config.maxAngle : 45;
|
const max = typeof config.maxAngle === 'number' ? config.maxAngle : 45;
|
||||||
const base = typeof config.homeAngle === 'number' ? config.homeAngle : (min + max) / 2;
|
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({
|
dispatch({
|
||||||
type: 'control/set-camera-config',
|
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]);
|
}, [pipeline.servoConfig]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user