This commit is contained in:
PROFERIS - Mi³osz Stocki
2026-07-15 14:13:46 +02:00
9 changed files with 61 additions and 58 deletions
+8 -8
View File
@@ -38,9 +38,9 @@ const ARM = {
d2: 12.9, // half separation; M1 at (-d2, 0), M2 at (+d2, 0)
l1: 85.0, // proximal link length (mm)
l2: 110.0, // distal link length (mm)
STEPS_PER_REV: 2048,
STEP_ANGLE_DEG: 360 / 2048, // ≈ 0.17578125 °/step
HOME_STEPS: { m1: 1024, m2: 0 }, // M1 (Left) at +180°, M2 (Right) at 0° (arms folded outward)
STEPS_PER_REV: 4096,
STEP_ANGLE_DEG: 360 / 4096, // ≈ 0.087890625 °/step
HOME_STEPS: { m1: 2048, m2: 0 }, // M1 (Left) at +180°, M2 (Right) at 0° (arms folded outward)
};
// ── WORKSPACE CONSTRAINTS ─────────────────────────────────────────
@@ -279,13 +279,13 @@ function radToSteps(rad) {
function radToStepsAbsolute(rad, motor) {
let steps = radToSteps(rad);
// Motor 1 (Left) is constrained near 1536 steps (90 deg, UP)
// Motor 2 (Right) is constrained near -512 steps (90 deg, UP)
const center = motor === 1 ? 1536 : -512;
// Motor 1 (Left) is constrained near 3072 steps (90 deg, UP)
// Motor 2 (Right) is constrained near -1024 steps (90 deg, UP)
const center = motor === 1 ? 3072 : -1024;
// Snap the step position to the closest equivalent angle around the center.
// This guarantees we always take the "top" physical path and never wrap through the bottom.
while (steps - center > 1024) steps -= 2048;
while (steps - center < -1024) steps += 2048;
while (steps - center > 2048) steps -= 4096;
while (steps - center < -2048) steps += 4096;
return steps;
}
function stepsToDeg(steps) {
+2 -2
View File
@@ -146,13 +146,13 @@ function buildHTML() {
<label class="form-label" style="margin:0;">Speed</label>
<span id="speed-val" style="font-size: 0.8rem; color: var(--text-muted);">${Settings.speed}</span>
</div>
<input type="range" id="bc-slider-speed" min="100" max="2000" step="100" value="${Settings.speed}" style="width:100%; margin-bottom: 8px;">
<input type="range" id="bc-slider-speed" min="100" max="1200" step="100" value="${Settings.speed}" style="width:100%; margin-bottom: 8px;">
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
<label class="form-label" style="margin:0;">Accel</label>
<span id="accel-val" style="font-size: 0.8rem; color: var(--text-muted);">${Settings.accel}</span>
</div>
<input type="range" id="bc-slider-accel" min="50" max="2000" step="50" value="${Settings.accel}" style="width:100%;">
<input type="range" id="bc-slider-accel" min="50" max="500" step="50" value="${Settings.accel}" style="width:100%;">
</div>
<div class="form-group" style="margin-bottom: 12px;">
+7 -6
View File
@@ -166,13 +166,14 @@ function buildHTML() {
<label class="form-label" style="margin:0;">Speed</label>
<span id="speed-val" style="font-size: 0.8rem; color: var(--text-muted);">${Settings.speed}</span>
</div>
<input type="range" id="slider-speed" min="100" max="2000" step="100" value="${Settings.speed}" style="width:100%; margin-bottom: 8px;">
<div class="setting-row">
<label class="form-label" style="margin:0;">Accel</label>
<span id="accel-val" style="font-size: 0.8rem; color: var(--text-muted);">${Settings.accel}</span>
<input type="range" id="slider-speed" min="100" max="1200" step="100" value="${Settings.speed}" style="width:100%; margin-bottom: 8px;">
</div>
<div class="form-group" style="margin-bottom:0;">
<div style="display:flex; justify-content:space-between; margin-bottom:4px;">
<label class="form-label" style="margin:0;">Acceleration</label>
<span id="val-accel" style="font-size:0.8rem; color:var(--accent-blue);">${Settings.accel}</span>
</div>
<input type="range" id="slider-accel" min="50" max="2000" step="50" value="${Settings.accel}" style="width:100%; margin-bottom: 8px;">
<input type="range" id="slider-accel" min="50" max="500" step="50" value="${Settings.accel}" style="width:100%; margin-bottom: 8px;">
<div class="setting-row">
<label class="form-label" style="margin:0;">Global Delay (ms)</label>
+2 -2
View File
@@ -298,13 +298,13 @@ function buildHTML() {
<label class="form-label" style="margin:0;">Speed</label>
<span id="speed-val" style="font-size: 0.8rem; color: var(--text-muted);">${Settings.speed}</span>
</div>
<input type="range" id="slider-speed" min="100" max="2000" step="100" value="${Settings.speed}" style="width:100%; margin-bottom: 8px;">
<input type="range" id="slider-speed" min="100" max="1200" step="100" value="${Settings.speed}" style="width:100%; margin-bottom: 8px;">
<div class="setting-row">
<label class="form-label" style="margin:0;">Accel</label>
<span id="accel-val" style="font-size: 0.8rem; color: var(--text-muted);">${Settings.accel}</span>
</div>
<input type="range" id="slider-accel" min="50" max="2000" step="50" value="${Settings.accel}" style="width:100%; margin-bottom: 8px;">
<input type="range" id="slider-accel" min="50" max="500" step="50" value="${Settings.accel}" style="width:100%; margin-bottom: 8px;">
<div class="setting-row">
<label class="form-label" style="margin:0;">Global Delay (ms)</label>
+7 -7
View File
@@ -56,9 +56,9 @@ function syncStateFromStorage() {
steps2 = isHomed ? parseInt(localStorage.getItem('wiji_steps2') || IK.ARM.HOME_STEPS.m2) : IK.ARM.HOME_STEPS.m2;
// Auto-migrate the old buggy negative home position to the new positive one
if (steps1 === -1024) {
steps1 = 1024;
localStorage.setItem('wiji_steps1', 1024);
if (steps1 === -2048 || steps1 === -1024 || steps1 === 1024) {
steps1 = 2048;
localStorage.setItem('wiji_steps1', 2048);
}
Motion.setSteps(steps1, steps2);
}
@@ -570,16 +570,16 @@ function buildHTML() {
<label class="form-label">Speed (steps/s)</label>
<div class="range-row">
<input class="form-range" type="range" id="speed-slider"
min="100" max="2000" step="50" value="600"/>
<span class="range-value" id="speed-val">600</span>
min="100" max="1200" step="50" value="800"/>
<span class="range-value" id="speed-val">800</span>
</div>
</div>
<div class="form-group">
<label class="form-label">Accel (steps/s²)</label>
<div class="range-row">
<input class="form-range" type="range" id="accel-slider"
min="50" max="2000" step="25" value="100"/>
<span class="range-value" id="accel-val">100</span>
min="50" max="500" step="25" value="400"/>
<span class="range-value" id="accel-val">400</span>
</div>
</div>
</div>
+2 -2
View File
@@ -6,8 +6,8 @@
*/
const DEFAULTS = {
speed: 600,
accel: 100,
speed: 800,
accel: 400,
delay: 2500
};