This commit is contained in:
legop3
2025-12-26 23:19:55 -05:00
parent 1a6ca5ce73
commit bd862bf3f2
4 changed files with 21 additions and 15 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -11,7 +11,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" /> <meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" />
<title>Multi Roomba Rover</title> <title>Multi Roomba Rover</title>
<script type="module" crossorigin src="/assets/index-CbjSjbCA.js"></script> <script type="module" crossorigin src="/assets/index-p6gcdfwT.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Dv-S8jVC.css"> <link rel="stylesheet" crossorigin href="/assets/index-Dv-S8jVC.css">
</head> </head>
<body> <body>
+8 -2
View File
@@ -1,6 +1,7 @@
import { useEffect, useMemo, useState } from 'react'; import { useEffect, useMemo, useState } from 'react';
const HOLD_MS = 700; const HOLD_MS = 650;
const RECENT_MS = 400; // how fresh a hit must be to count toward activation
const DOCK_CODES = { const DOCK_CODES = {
161: { red: true }, // Red buoy 161: { red: true }, // Red buoy
@@ -84,8 +85,13 @@ export function useDockIr(sensors, options = {}) {
const left = withWindow(state.left); const left = withWindow(state.left);
const right = withWindow(state.right); const right = withWindow(state.right);
const omni = withWindow(state.omni); const omni = withWindow(state.omni);
const visible = left.active || right.active || omni.active;
const forceDetected = left.force || right.force || omni.force; const forceDetected = left.force || right.force || omni.force;
const leftColor = left.red || left.green;
const rightColor = right.red || right.green;
const leftFresh = leftColor && left.age != null && left.age <= RECENT_MS;
const rightFresh = rightColor && right.age != null && right.age <= RECENT_MS;
// Require either force field (close range) or both sides freshly seeing buoys.
const visible = forceDetected || (leftFresh && rightFresh);
const bias = const bias =
left.active && !right.active left.active && !right.active
? 'right' ? 'right'