mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
regressing rn
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// Control Context Provider
|
||||
// Purpose: Exposes control-system state/actions to control-capable components. Scope: Owns reducer wiring, pipeline integration, and top-level provider hooks.
|
||||
import { createContext, useCallback, useContext, useEffect, useMemo, useReducer, useRef } from 'react';
|
||||
import { controlReducer, initialControlState } from './controlReducer.js';
|
||||
import { computeDifferentialSpeeds, clamp } from './controlMath.js';
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Control Command Pipeline
|
||||
// Purpose: Converts normalized inputs into command packets sent to the server. Scope: Applies throttling/coalescing/safety filters before socket command emission.
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { useSocket } from '../context/SocketContext.jsx';
|
||||
import { useSessionSelector } from '../context/SessionContext.jsx';
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Control System Constants
|
||||
// Purpose: Defines immutable control tuning and command constants for input pipelines. Scope: Central source of truth for movement scaling, deadzones, and timing values.
|
||||
export const AUX_LIMITS = {
|
||||
main: [-127, 127],
|
||||
side: [-127, 127],
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Control Math Utilities
|
||||
// Purpose: Contains numeric transforms for joystick/keyboard input normalization and shaping. Scope: Implements deadzone, clamp, and mixing math used by control dispatch logic.
|
||||
/* global Buffer */
|
||||
|
||||
import { DRIVE_LIMITS } from './constants.js';
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Control State Reducer
|
||||
// Purpose: Implements reducer transitions for control-system runtime state. Scope: Centralizes deterministic state updates for input, mode, and dispatch events.
|
||||
import { DEFAULT_KEYMAP, DEFAULT_MACROS, SONG_DEFAULT_NOTE } from './constants.js';
|
||||
|
||||
function createDriveState() {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Control Module Exports
|
||||
// Purpose: Re-exports control context/providers and input managers from one entrypoint. Scope: Keeps control imports stable and concise for app/module consumers.
|
||||
export { ControlSystemProvider, useControlSystem } from './ControlContext.jsx';
|
||||
export { default as KeyboardInputManager } from './inputs/KeyboardInputManager.jsx';
|
||||
export { default as GamepadInputManager } from './inputs/GamepadInputManager.jsx';
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Gamepad Input Manager
|
||||
// Purpose: Converts polled gamepad state into normalized control actions/commands. Scope: Integrates bindings, deadzone math, and dispatch callbacks for driving.
|
||||
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||
import { useControlSystem } from '../ControlContext.jsx';
|
||||
import { useSettingsNamespace } from '../../settings/index.js';
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Keyboard Input Manager
|
||||
// Purpose: Captures and translates keyboard events into normalized control intents. Scope: Owns keydown/keyup listeners and dispatch coordination for drive controls.
|
||||
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||
import { useControlSystem } from '../ControlContext.jsx';
|
||||
import { useChat } from '../../context/ChatContext.jsx';
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Gamepad Bindings
|
||||
// Purpose: Defines default gamepad axis/button-to-action mappings and lookup helpers. Scope: Supplies binding metadata for gamepad input manager and settings UI.
|
||||
const CURVE_EXPO = 1.6;
|
||||
|
||||
export function getPadSignature(pad) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Gamepad Hub Runtime
|
||||
// Purpose: Tracks connected gamepads and polls input state for downstream handlers. Scope: Encapsulates browser Gamepad API access and per-frame update orchestration.
|
||||
import { useEffect, useState } from 'react';
|
||||
import { getPadSignature } from './gamepadBindings.js';
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Input Focus Utilities
|
||||
// Purpose: Handles focus/blur guards so controls only capture input when appropriate. Scope: Prevents accidental command capture while typing or using form elements.
|
||||
const TEXT_INPUT_TYPES = new Set([
|
||||
'',
|
||||
'text',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Keyboard Capture Lock Helper
|
||||
// Purpose: Coordinates global keyboard-capture lock state across UI regions. Scope: Ensures only intended surfaces receive keyboard control events at runtime.
|
||||
let keyboardCaptureLocked = false;
|
||||
|
||||
export function setKeyboardCaptureLocked(value) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Keymap Utilities
|
||||
// Purpose: Normalizes key binding definitions and lookup behavior for control settings. Scope: Provides conversion/validation helpers for keyboard mapping workflows.
|
||||
const KEY_ALIASES = {
|
||||
'{': '[',
|
||||
'}': ']',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Overcurrent Limiter Hook/Utility
|
||||
// Purpose: Applies client-side overcurrent guard logic to reduce harmful command spikes. Scope: Tracks limiter state and exposes gated dispatch behavior to controls.
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useTelemetryFrame } from '../context/TelemetryContext.jsx';
|
||||
import { useSessionSelector } from '../context/SessionContext.jsx';
|
||||
|
||||
Reference in New Issue
Block a user