diff --git a/web/js/sections/board-control.js b/web/js/sections/board-control.js index af554eb..58113aa 100644 --- a/web/js/sections/board-control.js +++ b/web/js/sections/board-control.js @@ -300,7 +300,9 @@ async function executeMove(spot) { UI.log(`BLE error: ${e.message}`, 'error'); } } else { - UI.log(`[sim] ${cmd1} ${cmd2}`, 'info'); + const simMsg = `[sim] ${cmd1} ${cmd2}`; + console.log(simMsg); + UI.log(simMsg, 'info'); } } diff --git a/web/js/sections/stepper-test.js b/web/js/sections/stepper-test.js index a58242a..55288ed 100644 --- a/web/js/sections/stepper-test.js +++ b/web/js/sections/stepper-test.js @@ -209,7 +209,9 @@ async function moveToXY(targetX, targetY) { UI.log(`BLE error: ${e.message}`, 'error'); } } 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; } @@ -223,9 +225,12 @@ async function jogMotor(motor, delta) { else steps2 += delta; renderArmFromSteps(); const cmd = `S${motor}${delta >= 0 ? '+' : ''}${delta}`; - BLE.isConnected() - ? await BLE.write(cmd).catch(e => UI.log(e.message, 'error')) - : UI.log(`[sim] ${cmd}`, 'info'); + if (BLE.isConnected()) { + await BLE.write(cmd).catch(e => UI.log(e.message, 'error')); + } else { + console.log(`[sim] ${cmd}`); + UI.log(`[sim] ${cmd}`, 'info'); + } } async function zeroMotor(motor) { @@ -240,9 +245,12 @@ async function zeroMotor(motor) { } renderArmFromSteps(); const cmd = motor === 'ALL' ? 'HOMEALL' : `HOME${motor}`; - BLE.isConnected() - ? await BLE.write(cmd).catch(e => UI.log(e.message, 'error')) - : UI.log(`[sim] ${cmd}`, 'info'); + if (BLE.isConnected()) { + await BLE.write(cmd).catch(e => UI.log(e.message, 'error')); + } else { + console.log(`[sim] ${cmd}`); + UI.log(`[sim] ${cmd}`, 'info'); + } } // ─────────────────────────────────────────────────────────────────