This commit is contained in:
PROFERIS - Mi³osz Stocki
2026-07-08 13:30:30 +02:00
parent cf71803fc4
commit eeb2cb191b
3 changed files with 16 additions and 22 deletions
+3 -5
View File
@@ -198,13 +198,11 @@ async function moveToXY(targetX, targetY) {
const newSteps1 = IK.radToSteps(theta1);
const newSteps2 = IK.radToSteps(theta2);
const cmd1 = `X1:${newSteps1}`;
const cmd2 = `X2:${newSteps2}`;
const cmd = `X:${newSteps1},${newSteps2}`;
if (BLE.isConnected()) {
try {
await BLE.write(cmd1);
await BLE.write(cmd2);
await BLE.write(cmd);
// Do not update steps1/steps2 here; let the P: notify handler update the UI smoothly
} catch (e) {
UI.log(`BLE error: ${e.message}`, 'error');
@@ -213,7 +211,7 @@ async function moveToXY(targetX, targetY) {
steps1 = newSteps1;
steps2 = newSteps2;
renderArm(theta1, theta2);
const simMsg = `[sim] IK→ θ1=${IK.radToDeg(theta1).toFixed(1)}° θ2=${IK.radToDeg(theta2).toFixed(1)}° | ${cmd1} ${cmd2}`;
const simMsg = `[sim] IK→ θ1=${IK.radToDeg(theta1).toFixed(1)}° θ2=${IK.radToDeg(theta2).toFixed(1)}° | ${cmd}`;
console.log(simMsg);
UI.log(simMsg, 'info');
}