let wp; function setup() { const canvas = createCanvas(windowWidth, windowHeight); canvas.parent('sketch-host'); wp = new WallPlotter({ penUpGcode: 'M280 P0 S120', penDownGcode: 'M280 P0 S30', penUpDelayMs: 250, penDownDelayMs: 150, }); wp.setSpeed(3000, 1500); wp.setTimingMultiplier(1); wp.enableKeyInputs(); wp.enablePlotButtons(); } function draw() { background(28, 28, 32); wp.showInfos(); } function windowResized() { resizeCanvas(windowWidth, windowHeight); } async function plot() { await drawPlot(false); } async function test() { await drawPlot(true); } async function drawPlot(testOnly) { const s = 200; // 400 × 400 mm around home wp.startPath(); wp.move(-s, -s); // pen up to bottom-left wp.draw(s, -s); // bottom edge wp.draw(s, s); // right edge wp.draw(-s, s); // top edge wp.draw(-s, -s); // left edge, close the rectangle wp.move(0, 0); // pen up back to home await wp.runPath(testOnly); }