Skip to content

Contributors

Avatar

Vishnu C Rajeev

Embedded Systems Engineer

Page cover

Overview

Comprehensive reference for the PolyPlot controller features: Automatic Tool Changer (ATC), work area & origin calibration, limits handling, laser offset, persistence layer, job control endpoints, and safety / troubleshooting notes.

Quick Navigation

Tool Change (M6 Tn)

AspectDetail
CommandM6 Tn
PurposeChange to tool (pen) number n
Motion TypeControlled system motion (soft-limit safe path)
Failure HandlingAutomatic rollback to previous tool
PersistenceCurrent tool stored in /spiffs/penstate.json

How it Works:

  • Validates / loads tool configuration.
  • Distinct approach vs precise feedrates; feed overrides disabled for repeatability.
  • Planner synchronized before executing; rollback performed on error; modal flag cleared.

ATC JSON Storage (Tool Bank Persistence)

FilePurpose
/spiffs/toolconfig.jsonArray of tool objects (autogenerated + calibrated)
/spiffs/penstate.jsonLast known active tool (for resume/state continuity)

API: /toolconfig (GET/POST), /toolconfig/status.

JSON Examples

json
{
  "tools": [
    { "number": 1, "x": -30.2, "y": -100.0, "z": -10.0, "occupied": true },
    { "number": 2, "x": -30.2, "y": -110.0, "z": -10.0, "occupied": false }
  ]
}
json
{ "currentPen": 1, "timestamp": 1712345678900 }

Work Area and Work Origin

Config BlockKeys
work_area (in FluidNC/data/config.yaml)min_x, min_y, max_x, max_y, origin_x, origin_y, enabled, move_to_origin

Notes:

  • Rounding to 0.1 mm prevents float residue near boundaries.
  • Enable/disable soft-limit enforcement via M160 / M161.

Work Area Toggles

CommandAction
M160Enable work area limits
M161Disable work area limits

Laser Pointer Offset (M150/M151)

CommandFunction
M150Apply (and optionally set) laser offsets X/Y
M151Remove laser offsets

Details:

  • Config keys: laser_offset_x, laser_offset_y (in config.yaml).
  • Applied as internal parser coordinate offset (not a G92), preserving limit integrity.
  • Removing clears offset & disables auto-apply until reissued.
  • UI notified via internal state broadcast.

New Limits System (Tool + Work Area)

FeatureDescription
CentralizationUnified soft-limit enforcement layer
System MotionCalibration + tool changes route via special path
SafetyHard limits always authoritative

Mechanics:

  • State router: Homing → ToolCalibration → WorkAreaCalibration → Normal.
  • During calibration: limit events treated as measurement callbacks (no alarm).
  • Outside calibration: soft limits enforced; hard limits alarm.
  • Real-time reset: Immediately aborts active calibration (steppers stop, state → Idle).

The minimal job-control UI (/jobcontrol) is intentionally lightweight to avoid SD dependency and reduce resource contention during active jobs.

G-code Dry Run (Check Mode)

CommandEffect
$CToggle check (no-motion) parsing mode

Behavior: Planner simulates path & limit checks without energizing motion—ideal for preflight validation.

Troubleshooting (Quick)

SymptomAction
Float residue near edgesRe-run M156 (rounding normalization)
Tool change failsInspect /spiffs/toolconfig.json & occupancy; re-run M155
Soft-limit alarm mid-calibrationVerify you executed M155 / M156, not manual jog
Values not persistedCheck local FS free space & atomic rewrite (temp rename)

Command Reference

CommandDescription
M6 T1Change to tool 1
M150 X-2.5 Y-1.0Set & apply laser offset
M151Clear laser offset
M160Enable work area limits
M161Disable work area limits
$CToggle dry run (check) mode

For calibration commands and procedures, see CALIBRATION.md.

API Endpoints

Job Control

MethodEndpointDescription
GET/jobcontrolMinimal job control page
POST/job/pausePause active job
POST/job/resumeResume paused job
POST/job/stopStop current job
GET/jobstatusReal-time job status JSON
GET/jobblockedBlocking page shown during active job

Tool Configuration (ATC)

MethodEndpointDescription
GET/toolconfigRetrieve tool bank
POST/toolconfigReplace entire tool bank
POST/toolconfig/positionUpdate single tool position
GET/toolconfig/statusReal-time tool status

Pen Configuration

MethodEndpointDescription
GET/penconfigGet pen configuration
POST/penconfigUpdate pen configuration
DELETE/penconfigDelete specific pen configuration

Work Area & Calibration

MethodEndpointDescription
GET/workoriginWork origin (COFF command bridge)

Pen Change Mode

MethodEndpointDescription
GET/penchangemodeGet pen change mode status
POST/penchangemodeEnable / disable pen change mode

System Control

MethodEndpointDescription
POST/restartRestart MCU (admin)
POST/commandExecute G-code / system command
POST/command_silentExecute silently (no echo)

File Management

MethodEndpointDescription
GET/filesList LocalFS (SPIFFS) files
POST/filesUpload to LocalFS
DELETE/filesDelete from LocalFS
GET/uploadList SD card files
POST/uploadUpload to SD card
DELETE/uploadDelete from SD card

Enhanced Job Control System

Job Blocking During Motion

  • Active jobs redirect new UI sessions to /jobcontrol to minimize interference & FS contention.
  • Lightweight UI = reduced resource usage under motion load.

Real-time Job Status

  • /jobstatus exposes: state, file, percent complete, pause state.
  • Polled by job control UI for live incremental updates.

Safety Features

  • Pen change mode gates non-ATC endpoints while active.
  • Job blocking prevents mid-cycle interference.
  • CORS support allows controlled cross-origin integrations.

Contributors

Avatar

Vishnu C Rajeev

Embedded Systems Engineer