mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-17 10:00:46 -04:00
realized that wont work lol cause roomba
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -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="Roomba Rover" />
|
<meta name="apple-mobile-web-app-title" content="Roomba Rover" />
|
||||||
<title>Roomba Rover</title>
|
<title>Roomba Rover</title>
|
||||||
<script type="module" crossorigin src="/assets/index-vnQEm7kz.js"></script>
|
<script type="module" crossorigin src="/assets/index-BBvqjYI_.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-CkqCBh_q.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-CkqCBh_q.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Drive Dock Action
|
// Drive Dock Action
|
||||||
// Purpose: Defines the Drive Dock Action module and the local helpers/components used in this file.
|
// Purpose: Defines the Drive Dock Action module and the local helpers/components used in this file.
|
||||||
// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit.
|
// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit.
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useControlSystem } from '../../controls/index.js';
|
import { useControlSystem } from '../../controls/index.js';
|
||||||
import { useTelemetryFrame } from '../../context/TelemetryContext.jsx';
|
import { useTelemetryFrame } from '../../context/TelemetryContext.jsx';
|
||||||
import { formatKeyLabel } from '../../controls/keymapUtils.js';
|
import { formatKeyLabel } from '../../controls/keymapUtils.js';
|
||||||
@@ -113,6 +113,7 @@ export default function DriveDockAction({
|
|||||||
const [confirmOpen, setConfirmOpen] = useState(false);
|
const [confirmOpen, setConfirmOpen] = useState(false);
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(false);
|
||||||
const manualAssistActive = Boolean(manualDockAssist?.active);
|
const manualAssistActive = Boolean(manualDockAssist?.active);
|
||||||
|
const wasDockedRef = useRef(false);
|
||||||
|
|
||||||
const driveDisabled = !roverId || pending !== null;
|
const driveDisabled = !roverId || pending !== null;
|
||||||
const dockDisabled = !roverId || pending !== null;
|
const dockDisabled = !roverId || pending !== null;
|
||||||
@@ -138,17 +139,17 @@ export default function DriveDockAction({
|
|||||||
const chargeValue = charging ? 'Charging' : docked ? 'Charging soon...' : '—';
|
const chargeValue = charging ? 'Charging' : docked ? 'Charging soon...' : '—';
|
||||||
const chargeTone = charging ? 'good' : docked ? 'warn' : 'bad';
|
const chargeTone = charging ? 'good' : docked ? 'warn' : 'bad';
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const justDocked = docked && !wasDockedRef.current;
|
||||||
|
if (manualAssistActive && justDocked) {
|
||||||
|
actions.sendSong([{ note: 84, duration: 6 }], { slot: 1 });
|
||||||
|
}
|
||||||
|
wasDockedRef.current = docked;
|
||||||
|
}, [actions, docked, manualAssistActive]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!manualAssistActive) return;
|
if (!manualAssistActive) return;
|
||||||
if (!charging) return;
|
if (!charging) return;
|
||||||
actions.sendSong(
|
|
||||||
[
|
|
||||||
{ note: 79, duration: 10 },
|
|
||||||
{ note: 84, duration: 10 },
|
|
||||||
{ note: 88, duration: 14 },
|
|
||||||
],
|
|
||||||
{ slot: 1 },
|
|
||||||
);
|
|
||||||
actions.setManualDockAssistActive(false);
|
actions.setManualDockAssistActive(false);
|
||||||
}, [actions, charging, manualAssistActive]);
|
}, [actions, charging, manualAssistActive]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user