Cookbook: Custom Controls

Gina Häußge edited this page Jun 26, 2017 · 22 revisions

Cookbook: Custom Controls

This node's purpose is to collect useful custom controls you can add to OctoPrint's configuration in the controls section to fulfill certain tasks. Feel free to contribute!

Fan control

Adds two controls, one parametric control for enabling the fan which also allows you to specify the speed as a value between 0 (off) and 255 (full speed), and one simple button for turning the fan off.

- name: Enable Fan
  type: parametric_command
  command: M106 S%(speed)s
  input:
    - name: Speed (0-255)
      parameter: speed
      default: 255
- name: Disable Fan
  type: command
  command: M107

ATX Power Supply Control

Turn on and off your ATX power supply.

  - name: PSU
    type: section
    children:
      - name: Power On
        type: command
        command: M80
      - name: Power Off
        type: command
        command: M81

Print speed and flow control

Use these two adjust speed and flow control during printing.

  - name: Printing Controls
    type: section
    children: 
    - command: M220 S%(speed)s
      name: Printer Speed
      type: parametric_command
      input: 
      - name: (0-200%)
        parameter: speed
        default: 100
    - command: M221 S%(flow)s
      name: Flow rate
      type: parametric_command
      input: 
      - name: (0-200%)
        parameter: flow
        default: 100

Get current position

Adds a command that queries the current position of the print head and extruder from the printer, parses the corresponding response and displays it in the UI.

- name: Get Position
  type: feedback_command
  command: M114
  regex: "X:([0-9.-]+)\s*Y:([0-9.-]+)\s*Z:([0-9.-]+)\s*E:([0-9.-]+)"
  template: "Position: X={0}, Y={1}, Z={2}, E={3}"

A few more details: "[...] feedback_command: Like command, but you can defined a regular expression that will be checked against messages sent by the printer and allow displaying the extracted groups in the UI, e.g. "M114" -> "ok C: X:10.00 Y:3.20 Z:5.20 E:1.24" -> "Current position is (10.00, 3.20, 5.20), E = 1.24". Uses Python's "str.format" method to merge the matched sub groups from the given regex ("(...)") into the template format string. [...]"

Calibration controls for delta printers.

These controls allow you to quickly move between the three points used during delta calibration. Simply move to the desired point, jog the nozzle down (either with an LCD controller or octoprint), adjust your end stops, rinse and repeat.

- name: Calibrate
  type: section
  children:
  - name: Move Z
    type: parametric_commands
    commands:
    - G28
    - G0 Z%(height)s F1500
    input:
    - default: 5
      name: Height
      parameter: height
  - name: Zero Z axis
    type: parametric_commands
    commands:
    - G28
    - G0 X0 Y90 Z%(height)s F1500
    input:
    - default: 5
      name: G0 X0 Y90 Z
      parameter: height
  - name: Zero Y Axis
    type: parametric_commands
    commands:
    - G28
    - G0 X77.94 Y-45 Z%(height)s F1500
    input:
    - default: 5
      name: G0 X77.94 Y-45 Z
      parameter: height
  - name: Zero X Axis
    type: parametric_commands
    commands:
    - G28
    - G0 X-77.94 Y-45 Z%(height)s F1500
    input:
    - default: 5
      name: G0 X-77.94 Y-45 Z
      parameter: height

If you want to use these to also jog up and down to a specific location you can remove the G28 command.

Updating Repetier EEPROM values.

There are three parametric commands here. The first is for updating the XYZ max length. The second will change any value as long as you know the type, location and desired value. Finally, the last set can be used to update PID values.

- children:
  - commands:
    - M206 T3 P145 X%(maxLength)s
    - M206 T3 P149 X%(maxLength)s
    - M206 T3 P153 X%(maxLength)s
    - M500
    - G28
    input:
    - default: null
      name: Max Z height
      parameter: maxLength
    name: Set XYZ max length
    type: parametric_commands
  - commands:
    - M206 T%(type)s P%(location)s X%(value)s
    - M500
    - G28
    input:
    - default: null
      name: Type
      parameter: type
    - default: null
      name: Location
      parameter: location
    - default: null
      name: Value
      parameter: value
    name: EEPROM
    type: parametric_commands
  - commands:
    - M206 T3 P218 X%(pgain)s
    - M206 T3 P222 X%(igain)s
    - M206 T3 P226 X%(dgain)s
    - M500
    input:
    - default: null
      name: P-gain
      parameter: pgain
    - default: null
      name: I-gain
      parameter: igain
    - default: null
      name: D-gain
      parameter: dgain
    name: Update PID
    type: parametric_commands

These controls were written for a delta printer using Repetier firmware on a rambo board. Please keep that in mind if you use them.

Filament Change

Establishes a section to swap out filament easily.

- name: Filament Change
  children:
  - name: Filament Out
    type: command
    commands:
    - G91
    - G1 E-600 F600
    - G90
  - name: Filament In
    type: command
    commands:
    - G91
    - G1 E550 F600
    - G90
  - name: Finish Load
    type: command
    commands:
    - G91
    - G1 E50 F300
    - G90
    - G92 E0

Details: G1 Ennn is dependent on how long your path from extruder to hotend is in mm. Fnnn is feedrate for the extruder, which is in mm/min. It's handy to have this value be a higher number than you normally use for the Extrude/Retract buttons in OctoPrint to expedite filament swap. The Finish Load button is intended to allow for manipulation of a long bowden tube at the very end where the filament may jam up if not positioned accurately, and I'm not sure the G92 E0 is strictly necessary but I've found it helpful for doing other tweaks with the extrude/retract function in the terminal. You can easily do away with the whole Finish Load section if you're confident that your filament is not prone to jamming at the juncture of whatever feed tube you may have installed. Add "layout: horizontal" without the quotes below Filament Change to modify the menu appearance. Happy tweaking and printing!

Source: Configuration-Page of this Wiki

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.