kin
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user