From 0ccc08e3470c03adeceedbc05f3de944b9925512 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 12:16:07 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- examples/hopejr/visualizer/index.html | 48 +++++++++++++-------------- examples/hopejr/visualizer/script.js | 20 +++++------ 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/examples/hopejr/visualizer/index.html b/examples/hopejr/visualizer/index.html index 672cd9302..b39d93317 100644 --- a/examples/hopejr/visualizer/index.html +++ b/examples/hopejr/visualizer/index.html @@ -14,29 +14,29 @@ flex-direction: column; height: 100vh; } - + .controls { padding: 15px; background-color: #f5f5f5; z-index: 100; } - + .status { padding: 10px; border-radius: 5px; margin: 10px 0; } - + .connected { background-color: #d4edda; color: #155724; } - + .disconnected { background-color: #f8d7da; color: #721c24; } - + button { padding: 8px 16px; background-color: #4CAF50; @@ -46,27 +46,27 @@ cursor: pointer; margin-right: 10px; } - + button:hover { background-color: #45a049; } - + button:disabled { background-color: #cccccc; cursor: not-allowed; } - + .container { display: flex; flex: 1; overflow: hidden; } - + #canvas-container { flex: 3; position: relative; } - + #sidebar { flex: 1; padding: 15px; @@ -75,22 +75,22 @@ max-width: 300px; border-left: 1px solid #ddd; } - + .joint-info { margin-bottom: 10px; padding: 8px; border: 1px solid #ddd; border-radius: 4px; } - + .joint-name { font-weight: bold; } - + .joint-value { font-family: monospace; } - + .bar-container { width: 100%; background-color: #e0e0e0; @@ -99,14 +99,14 @@ overflow: hidden; margin-top: 5px; } - + .bar { height: 100%; background-color: #4CAF50; width: 0%; transition: width 0.2s ease-in-out; } - + .log-container { margin-top: 20px; border: 1px solid #ddd; @@ -117,14 +117,14 @@ font-family: monospace; background-color: #f8f9fa; } - + .view-controls { position: absolute; bottom: 10px; left: 10px; z-index: 10; } - + .view-button { background-color: rgba(0, 0, 0, 0.5); color: white; @@ -149,7 +149,7 @@ Status: Disconnected - +
@@ -160,23 +160,23 @@
- + - + - + - \ No newline at end of file + diff --git a/examples/hopejr/visualizer/script.js b/examples/hopejr/visualizer/script.js index 052899bbd..83c330a31 100644 --- a/examples/hopejr/visualizer/script.js +++ b/examples/hopejr/visualizer/script.js @@ -199,7 +199,7 @@ function initializeJointElements() { // Calibration controls const calibRow = document.createElement('div'); calibRow.className = 'calib-row'; - + const resetCalibBtn = document.createElement('button'); resetCalibBtn.textContent = 'Reset Calib'; resetCalibBtn.className = 'calib-btn'; @@ -208,11 +208,11 @@ function initializeJointElements() { observedMax[i] = -Infinity; addLogMessage(`Reset calibration for ${fingerName} ${jointType}`); }); - + const calibStatus = document.createElement('span'); calibStatus.className = 'calib-status'; calibStatus.textContent = `Range: --`; - + calibRow.appendChild(resetCalibBtn); calibRow.appendChild(calibStatus); @@ -244,7 +244,7 @@ function initializeJointElements() { ui.slider.disabled = connected; ui.slider.style.display = connected ? 'none' : ''; } - + // Reset calibration when connecting if (connected) { observedMin.fill(Infinity); @@ -299,20 +299,20 @@ async function readSerialData() { while ((idx = inputBuffer.indexOf('\n')) !== -1) { const line = inputBuffer.slice(0, idx).trim(); inputBuffer = inputBuffer.slice(idx + 1); - + const vals = line.split(/\s+/).map(v => parseInt(v, 10)); if (vals.length === MAX_JOINTS && vals.every(v => Number.isFinite(v))) { for (let i = 0; i < MAX_JOINTS; i++) { const info = fingerJointMap[i]; if (!info) continue; - + let rawValue = vals[i]; - + // Update calibration tracking if (calibrationEnabled) { observedMin[i] = Math.min(observedMin[i], rawValue); observedMax[i] = Math.max(observedMax[i], rawValue); - + // Update calibration display const ui = uiRefs[i]; if (ui && ui.calibStatus) { @@ -320,7 +320,7 @@ async function readSerialData() { ui.calibStatus.textContent = `Range: ${observedMin[i]}-${observedMax[i]}`; } } - + // Remap observed range to target range if (observedMin[i] !== Infinity && observedMax[i] !== -Infinity && observedMax[i] > observedMin[i]) { const observedRange = observedMax[i] - observedMin[i]; @@ -329,7 +329,7 @@ async function readSerialData() { rawValue = info.min + (normalizedValue * targetRange); } } - + let v = clamp(rawValue, info.min, info.max); if (info.inverted) v = (info.min + info.max) - v; jointValues[i] = v;