Skip to content

Commit 5bb4204

Browse files
committed
Update MKS tuner UI
1 parent 2c60377 commit 5bb4204

1 file changed

Lines changed: 6 additions & 25 deletions

File tree

esp32mks/index.html

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2393,38 +2393,19 @@
23932393
function updateStateUI() {
23942394
const s = Math.min(robotState, STATE_NAMES.length - 1);
23952395

2396-
// Compute fallen direction sub-state (uses latest pitch/roll data)
2397-
let stateName = STATE_NAMES[s] || String(robotState);
2398-
if (robotState === 0) {
2399-
const p = lastPitch || 0;
2400-
const r = lastRollAngle;
2401-
if (Math.abs(r) > 60) {
2402-
fallenDir = r > 0 ? 3 : 4;
2403-
stateName = r > 0 ? 'FALLEN LEFT' : 'FALLEN RIGHT';
2404-
} else if (Math.abs(p) > 30) {
2405-
fallenDir = p > 0 ? 2 : 1;
2406-
stateName = p > 0 ? 'FALLEN BWD' : 'FALLEN FWD';
2407-
} else {
2408-
fallenDir = 0;
2409-
}
2410-
} else {
2411-
fallenDir = 0;
2412-
}
2396+
const stateName = STATE_NAMES[s] || String(robotState);
2397+
fallenDir = 0;
24132398

24142399
swingBtn.classList.toggle('active', robotState === 1);
24152400
standUpBtn.classList.toggle('active', robotState === 3);
24162401
playProgBtn.classList.toggle('active', robotState === 6);
24172402
ctrlStateVal.textContent = stateName;
24182403
ctrlStateCard.className = 'ctrl-card ' + (STATE_CSS[s] || '');
24192404

2420-
// D-pad hints: highlight button(s) relevant to current fall direction
2421-
const pitchFallen = robotState === 0 && (fallenDir === 1 || fallenDir === 2);
2422-
const leftFallen = robotState === 0 && fallenDir === 3;
2423-
const rightFallen = robotState === 0 && fallenDir === 4;
2424-
btnFwd.classList.toggle('dpad-hint', pitchFallen);
2425-
btnBack.classList.toggle('dpad-hint', pitchFallen);
2426-
btnLeft.classList.toggle('dpad-hint', leftFallen);
2427-
btnRight.classList.toggle('dpad-hint', rightFallen);
2405+
btnFwd.classList.remove('dpad-hint');
2406+
btnBack.classList.remove('dpad-hint');
2407+
btnLeft.classList.remove('dpad-hint');
2408+
btnRight.classList.remove('dpad-hint');
24282409
}
24292410

24302411
// ==================== TABS ====================

0 commit comments

Comments
 (0)