Skip to content

AD5X IFS Material Station

GhostTypes edited this page Feb 22, 2026 · 4 revisions

Intelligent Filament Station (IFS)

The AD5X features an Intelligent Filament Station (IFS) that enables multi-color and multi-material printing through a 4-slot material management system. This document is the comprehensive reference for all IFS operations.

For a general AD5X overview, see AD5X README.

Overview

Property Value
Model AD5X only
Slots 4
Control Endpoint /control
Status Endpoint /detail
Serial Protocol Dedicated IFS UART path

The IFS manages automatic filament loading, unloading, and switching during multi-material prints. It communicates with the main printer controller via a dedicated serial subsystem.

Querying Material Station Status

matlStationInfo from /detail

The /detail endpoint returns comprehensive material station status when hasMatlStation is true.

Request:

POST http://10.0.0.42:8898/detail
Content-Type: application/json

{
  "serialNumber": "SNADVA5XXXXX",
  "checkCode": "12345"
}

Response:

{
  "code": 0,
  "message": "Success",
  "detail": {
    "hasMatlStation": true,
    "matlStationInfo": {
      "currentLoadSlot": 0,
      "currentSlot": 1,
      "slotCnt": 4,
      "stateAction": 0,
      "stateStep": 0,
      "slotInfos": [
        {
          "slotId": 0,
          "hasFilament": true,
          "materialName": "PLA",
          "materialColor": "#FFFFFF"
        },
        {
          "slotId": 1,
          "hasFilament": true,
          "materialName": "PLA",
          "materialColor": "#FF0000"
        },
        {
          "slotId": 2,
          "hasFilament": false,
          "materialName": "",
          "materialColor": ""
        },
        {
          "slotId": 3,
          "hasFilament": false,
          "materialName": "",
          "materialColor": ""
        }
      ]
    }
  }
}

MatlStationInfo Fields

Field Type Description
currentLoadSlot int Slot currently being loaded (0 if none active)
currentSlot int Slot currently active/printing (1-4, or 0 if none)
slotCnt int Total number of slots (typically 4)
stateAction int Current action state code (see State Action Codes)
stateStep int Current step within the action sequence
slotInfos array Array of SlotInfo objects for each slot

SlotInfo Fields

Field Type Description
slotId int Physical slot ID (0-3 in backend, displayed as 1-4 in UI)
hasFilament bool Whether filament is detected in the slot
materialName string Material type (e.g., "PLA", "PETG", "TPU")
materialColor string Hex color code (e.g., "#FFFFFF", "#FF0000")

State Action Codes

Code Description
0 Idle - no operation in progress
1 Loading - filament being loaded from slot
2 Unloading - filament being retracted to slot
3 Switching - changing between slots
4 Canceling - operation being canceled
5 Homing - IFS selector mechanism homing

Slot Configuration Commands {#slot-configuration-commands}

msConfig_cmd - Configure Slot Material

Sets the material metadata for a specific slot. This information is displayed on the printer UI and used for print validation.

Request:

POST http://10.0.0.42:8898/control
Content-Type: application/json

{
  "serialNumber": "SNADVA5XXXXX",
  "checkCode": "12345",
  "payload": {
    "cmd": "msConfig_cmd",
    "args": {
      "slot": 1,
      "mt": "PLA",
      "rgb": "FF0000"
    }
  }
}

Response:

{
  "code": 0,
  "message": "Success"
}

Arguments:

Argument Type Description
slot int Slot number (1-4)
mt string Material type (see Supported Materials)
rgb string Hex color code without # prefix (e.g., "FF0000" for red)

Behavior Notes:

  • The firmware accepts arbitrary strings for material type and color without validation
  • The printer UI only displays recognized values properly
  • Configuration persists across power cycles

Load/Unload Commands {#loadunload-commands}

ms_cmd - Slot Load/Unload Operations

Performs filament loading, unloading, or cancellation operations on IFS slots.

Load Filament:

POST http://10.0.0.42:8898/control
Content-Type: application/json

{
  "serialNumber": "SNADVA5XXXXX",
  "checkCode": "12345",
  "payload": {
    "cmd": "ms_cmd",
    "args": {
      "slot": 1,
      "action": 0
    }
  }
}

Unload Filament:

POST http://10.0.0.42:8898/control
Content-Type: application/json

{
  "serialNumber": "SNADVA5XXXXX",
  "checkCode": "12345",
  "payload": {
    "cmd": "ms_cmd",
    "args": {
      "slot": 1,
      "action": 1
    }
  }
}

Cancel Operation:

POST http://10.0.0.42:8898/control
Content-Type: application/json

{
  "serialNumber": "SNADVA5XXXXX",
  "checkCode": "12345",
  "payload": {
    "cmd": "ms_cmd",
    "args": {
      "slot": 0,
      "action": 2
    }
  }
}

Response:

{
  "code": 0,
  "message": "Success"
}

Arguments:

Argument Type Values Description
slot int 1-4 Target slot number
action int 0, 1, 2 0=load, 1=unload, 2=cancel

Action Descriptions:

Action Description
0 (load) Loads filament from the specified slot into the extruder
1 (unload) Retracts filament from the extruder back to the specified slot
2 (cancel) Cancels the current IFS operation

Operational Notes:

  • Load operations require the target slot to have filament detected (hasFilament: true)
  • Unload operations require the extruder to be heated for clean retraction
  • Operations are asynchronous; monitor stateAction in matlStationInfo for completion
  • The cancel action can be used to abort any in-progress operation

Material Type Support

Standard Materials

The firmware accepts these standard material types:

Material Description
PLA Polylactic Acid (standard)
PLA-CF PLA with Carbon Fiber
ABS Acrylonitrile Butadiene Styrene
PETG Polyethylene Terephthalate Glycol
PETG-CF PETG with Carbon Fiber
TPU Thermoplastic Polyurethane
SILK Silk-effect PLA

Extended Materials

Additional materials supported by the firmware:

Material Description
PA-CF Nylon with Carbon Fiber
PC Polycarbonate
PC-ABS Polycarbonate-ABS blend
PET-CF PET with Carbon Fiber
PPS-CF Polyphenylene Sulfide with Carbon Fiber
PA Nylon/Polyamide
PAHT-CF High-Temperature Nylon with Carbon Fiber

Note: The firmware accepts arbitrary material strings. Materials outside the standard list may not display correctly in the printer UI but will not cause errors.

Color Support

UI-Recognized Color Palette

The printer UI recognizes and displays these hex color codes:

#FFFFFF  #FEF043  #DCF478  #0ACC38  #067749  #0C6283  #0DE2A0  #75D9F3
#45A8F9  #2750E0  #46328E  #A03CF7  #F330F9  #D4B0DC  #F95D73  #F72224
#7C4B00  #F98D33  #FDEBD5  #D3C4A3  #AF7836  #898989  #BCBCBC  #161616
Color Name Hex Code
White #FFFFFF
Yellow #FEF043
Light Green #DCF478
Green #0ACC38
Dark Green #067749
Teal #0C6283
Cyan #0DE2A0
Light Blue #75D9F3
Blue #45A8F9
Dark Blue #2750E0
Purple #46328E
Violet #A03CF7
Magenta #F330F9
Pink #D4B0DC
Coral #F95D73
Red #F72224
Brown #7C4B00
Orange #F98D33
Cream #FDEBD5
Tan #D3C4A3
Dark Brown #AF7836
Gray #898989
Light Gray #BCBCBC
Black #161616

Note: Arbitrary hex color values are accepted but may result in missing or incorrect color icons in the printer UI.

Slot State Monitoring

Monitoring Load/Unload Progress

During IFS operations, poll /detail to monitor progress:

POST http://10.0.0.42:8898/detail
Content-Type: application/json

{
  "serialNumber": "SNADVA5XXXXX",
  "checkCode": "12345"
}

Monitor these fields:

Field Purpose
matlStationInfo.stateAction Current operation type
matlStationInfo.stateStep Progress within operation
matlStationInfo.currentLoadSlot Target slot for operation

State Machine Flow

IDLE (stateAction=0)
  |
  |-- Load Request --> LOADING (stateAction=1)
  |                       |
  |                       |-- Complete --> IDLE
  |                       |-- Error --> ERROR
  |                       |-- Cancel --> CANCELING --> IDLE
  |
  |-- Unload Request --> UNLOADING (stateAction=2)
                          |
                          |-- Complete --> IDLE
                          |-- Error --> ERROR
                          |-- Cancel --> CANCELING --> IDLE

Error Handling

IFS-Specific Error Codes

IFS operations can produce these error codes, reported in the /detail response:

Code Description Trigger
E0100 Channel 1 feeding timeout Load failure (Slot 1)
E0101 Channel 2 feeding timeout Load failure (Slot 2)
E0102 Channel 3 feeding timeout Load failure (Slot 3)
E0103 Channel 4 feeding timeout Load failure (Slot 4)
E0104 Channel 1 retracting timeout Unload failure (Slot 1)
E0105 Channel 2 retracting timeout Unload failure (Slot 2)
E0106 Channel 3 retracting timeout Unload failure (Slot 3)
E0107 Channel 4 retracting timeout Unload failure (Slot 4)
E0108 Feed failure to extruder Filament sensor timeout
E0109 Odometer stall Filament tangle/jam (stall count > 200)
E0114 IFS homing error Selector mechanism failure

Error Response Example

{
  "detail": {
    "hasMatlStation": true,
    "errorCode": "E0100",
    "status": "error",
    "matlStationInfo": {
      "stateAction": 0,
      "currentLoadSlot": 0
    }
  }
}

Multi-Material Printing Workflow

1. Query Available Materials

Before starting a multi-material print, query the material station:

POST http://10.0.0.42:8898/detail
Content-Type: application/json

{
  "serialNumber": "SNADVA5XXXXX",
  "checkCode": "12345"
}

Verify:

  • hasMatlStation is true
  • Required slots have hasFilament: true
  • Material types and colors match print requirements

2. Get File Requirements

For files on printer storage, use /gcodeList to get tool requirements:

POST http://10.0.0.42:8898/gcodeList

Response (AD5X Extended):

{
  "gcodeListDetail": [
    {
      "gcodeFileName": "Multicolor.gcode",
      "printingTime": 3600,
      "totalFilamentWeight": 150.5,
      "useMatlStation": true,
      "gcodeToolCnt": 2,
      "gcodeToolDatas": [
        {
          "toolId": 0,
          "materialName": "PLA",
          "materialColor": "#FFFFFF",
          "filamentWeight": 75.0,
          "slotId": 0
        },
        {
          "toolId": 1,
          "materialName": "PLA",
          "materialColor": "#000000",
          "filamentWeight": 75.0,
          "slotId": 0
        }
      ]
    }
  ]
}

3. Configure Slot Metadata

Set material metadata for each slot:

POST http://10.0.0.42:8898/control
Content-Type: application/json

{
  "serialNumber": "SNADVA5XXXXX",
  "checkCode": "12345",
  "payload": {
    "cmd": "msConfig_cmd",
    "args": {
      "slot": 1,
      "mt": "PLA",
      "rgb": "FFFFFF"
    }
  }
}

4. Build Material Mappings

Create tool-to-slot mappings based on the G-code file requirements:

[
  {
    "toolId": 0,
    "slotId": 1,
    "materialName": "PLA",
    "toolMaterialColor": "#FFFFFF",
    "slotMaterialColor": "#FFFFFF"
  },
  {
    "toolId": 1,
    "slotId": 2,
    "materialName": "PLA",
    "toolMaterialColor": "#FF0000",
    "slotMaterialColor": "#FF0000"
  }
]

5. Start Print with Mappings

For local files:

POST http://10.0.0.42:8898/printGcode
Content-Type: application/json

{
  "serialNumber": "SNADVA5XXXXX",
  "checkCode": "12345",
  "fileName": "Multicolor.gcode",
  "levelingBeforePrint": true,
  "flowCalibration": false,
  "useMatlStation": true,
  "gcodeToolCnt": 2,
  "materialMappings": [
    {
      "toolId": 0,
      "slotId": 1,
      "materialName": "PLA",
      "toolMaterialColor": "#FFFFFF",
      "slotMaterialColor": "#FFFFFF"
    },
    {
      "toolId": 1,
      "slotId": 2,
      "materialName": "PLA",
      "toolMaterialColor": "#FF0000",
      "slotMaterialColor": "#FF0000"
    }
  ]
}

For file uploads:

POST http://10.0.0.42:8898/uploadGcode
Content-Type: multipart/form-data
serialNumber: SNADVA5XXXXX
checkCode: 12345
fileSize: 1234567
printNow: true
levelingBeforePrint: true
flowCalibration: false
useMatlStation: true
gcodeToolCnt: 2
materialMappings: W3sidG9vbElkIjowLCJzbG90SWQiOjEsIm1hdGVyaWFsTmFtZSI6IlBMQSIsInRvb2xNYXRlcmlhbENvbG9yIjoiI0ZGRkZGRiIsInNsb3RNYXRlcmlhbENvbG9yIjoiI0ZGRkZGRiJ9LHsidG9vbElkIjoxLCJzbG90SWQiOjIsIm1hdGVyaWFsTmFtZSI6IlBMQSIsInRvb2xNYXRlcmlhbENvbG9yIjoiI0ZGMDAwMCIsInNsb3RNYXRlcmlhbENvbG9yIjoiI0ZGMDAwMCJ9XQ==

[gcodeFile form data]

Note: For uploads, materialMappings must be Base64-encoded JSON.

Print Parameters

Parameter Type Description
useMatlStation bool Enable IFS for this print job
gcodeToolCnt int Number of distinct tools/colors in the G-code
materialMappings array Tool-to-slot mapping objects
flowCalibration bool Enable flow calibration before print
levelingBeforePrint bool Perform auto-leveling before print
firstLayerInspection bool Enable first layer monitoring
timeLapseVideo bool Enable timelapse recording

Material Mapping Object

Field Type Description
toolId int Logical tool index (0-3), represents color index in G-code
slotId int Physical slot index (1-4) on the IFS
materialName string Material type for this tool
toolMaterialColor string Expected color from G-code (hex with #)
slotMaterialColor string Actual slot color (hex with #)

Manual Control Commands

The AD5X provides manual control commands for maintenance and direct operations. These commands are also documented in the AD5X README.

moveCtrl_cmd - Manual Axis Movement

Jog axes manually during idle state:

POST http://10.0.0.42:8898/control
Content-Type: application/json

{
  "serialNumber": "SNADVA5XXXXX",
  "checkCode": "12345",
  "payload": {
    "cmd": "moveCtrl_cmd",
    "args": {
      "axis": "x",
      "delta": 10.0
    }
  }
}

Arguments:

Argument Values Description
axis "x", "y", "z" Axis to move
delta float Distance in mm (positive or negative)

extrudeCtrl_cmd - Manual Extrusion

Control the extruder manually for filament changes:

POST http://10.0.0.42:8898/control
Content-Type: application/json

{
  "serialNumber": "SNADVA5XXXXX",
  "checkCode": "12345",
  "payload": {
    "cmd": "extrudeCtrl_cmd",
    "args": {
      "axis": "e",
      "delta": 10.0
    }
  }
}

Arguments:

Argument Values Description
axis string Axis identifier (value is ignored by firmware)
delta float Filament length in mm (positive = extrude, negative = retract)

homingCtrl_cmd - Manual Homing

Home all axes manually:

POST http://10.0.0.42:8898/control
Content-Type: application/json

{
  "serialNumber": "SNADVA5XXXXX",
  "checkCode": "12345",
  "payload": {
    "cmd": "homingCtrl_cmd"
  }
}

Note: The args object is optional and ignored by firmware. This command homes all axes.

errorCodeCtrl_cmd - Error Management

Clear or manage error states:

POST http://10.0.0.42:8898/control
Content-Type: application/json

{
  "serialNumber": "SNADVA5XXXXX",
  "checkCode": "12345",
  "payload": {
    "cmd": "errorCodeCtrl_cmd",
    "args": {
      "action": "clear"
    }
  }
}

Clone this wiki locally