improved logging
This commit is contained in:
@@ -300,7 +300,9 @@ async function executeMove(spot) {
|
|||||||
UI.log(`BLE error: ${e.message}`, 'error');
|
UI.log(`BLE error: ${e.message}`, 'error');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
UI.log(`[sim] ${cmd1} ${cmd2}`, 'info');
|
const simMsg = `[sim] ${cmd1} ${cmd2}`;
|
||||||
|
console.log(simMsg);
|
||||||
|
UI.log(simMsg, 'info');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,9 @@ async function moveToXY(targetX, targetY) {
|
|||||||
UI.log(`BLE error: ${e.message}`, 'error');
|
UI.log(`BLE error: ${e.message}`, 'error');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
UI.log(`[sim] IK→ θ1=${IK.radToDeg(theta1).toFixed(1)}° θ2=${IK.radToDeg(theta2).toFixed(1)}° | ${cmd1} ${cmd2}`, 'info');
|
const simMsg = `[sim] IK→ θ1=${IK.radToDeg(theta1).toFixed(1)}° θ2=${IK.radToDeg(theta2).toFixed(1)}° | ${cmd1} ${cmd2}`;
|
||||||
|
console.log(simMsg);
|
||||||
|
UI.log(simMsg, 'info');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -223,9 +225,12 @@ async function jogMotor(motor, delta) {
|
|||||||
else steps2 += delta;
|
else steps2 += delta;
|
||||||
renderArmFromSteps();
|
renderArmFromSteps();
|
||||||
const cmd = `S${motor}${delta >= 0 ? '+' : ''}${delta}`;
|
const cmd = `S${motor}${delta >= 0 ? '+' : ''}${delta}`;
|
||||||
BLE.isConnected()
|
if (BLE.isConnected()) {
|
||||||
? await BLE.write(cmd).catch(e => UI.log(e.message, 'error'))
|
await BLE.write(cmd).catch(e => UI.log(e.message, 'error'));
|
||||||
: UI.log(`[sim] ${cmd}`, 'info');
|
} else {
|
||||||
|
console.log(`[sim] ${cmd}`);
|
||||||
|
UI.log(`[sim] ${cmd}`, 'info');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function zeroMotor(motor) {
|
async function zeroMotor(motor) {
|
||||||
@@ -240,9 +245,12 @@ async function zeroMotor(motor) {
|
|||||||
}
|
}
|
||||||
renderArmFromSteps();
|
renderArmFromSteps();
|
||||||
const cmd = motor === 'ALL' ? 'HOMEALL' : `HOME${motor}`;
|
const cmd = motor === 'ALL' ? 'HOMEALL' : `HOME${motor}`;
|
||||||
BLE.isConnected()
|
if (BLE.isConnected()) {
|
||||||
? await BLE.write(cmd).catch(e => UI.log(e.message, 'error'))
|
await BLE.write(cmd).catch(e => UI.log(e.message, 'error'));
|
||||||
: UI.log(`[sim] ${cmd}`, 'info');
|
} else {
|
||||||
|
console.log(`[sim] ${cmd}`);
|
||||||
|
UI.log(`[sim] ${cmd}`, 'info');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user