trippwill / OctoPrint-MarlinBft

Upload files using Marlin Binary File Transfer Mark II
11 stars 6 forks source link

OctoPrint-MarlinBft

Upload files using Marlin Binary File Transfer Mark II

Setup

Install via the bundled Plugin Manager or manually using this URL:

https://github.com/charleswillis3/OctoPrint-MarlinBft/archive/master.zip

Configuration

This will transfer a file to a printer using Marlin firmware's experimental binary file transfer protocol.

General use:

  1. Connect to the printer
  2. Click the Marlin BFT icon in the Nav bar to open the transfer dialog
  3. Click the gear icon to adjust the timeouts in the settings dialog
  4. Back in the transfer dialog, adjust the transfer settings "Reconnect" and "Send GCode after Transfer"
  5. Click the upload button to select the file. Transfer will start immediately
  6. The dialog will close automatically when the transfer and post-transfer phases are complete

Updating firmware on BigTreeTech boards:

  1. In settings:
    1. Ensure bin is in the "Accept file extensions" list
    2. Set "Wait before reconnect" to a reasonable value like 12000 (12 seconds)
  2. In the transfer dialog:
    1. Enable "Send GCode after transfer" and set the Gcode to M997 (marlin reset)
    2. Click the upload button and select the firmware.bin file. Click OK.
    3. After the M997 reset, reconnect the printer (or enable "Reconnect after transfer")

It's also possible to transfer a file using the http api.

  1. Upload the file to OctoPrint using the files api
  2. Disconnect the printer using the connection api
  3. POST a json object to the marlinbft api:
    
    POST /api/plugin/marlinbft
    Content-Type: application/json
    X-Api-Key: abcdef...

Body: { "command": "start_transfer", "handler_type": "api" "port": "/dev/ttyACM0", "baudrate": 250000, "local_path": "marlinbft/firmware.bin", "comm_timeout_ms": 1000, "wait_after_connect_ms": 3000, "post_transfer_gcode_enable": true, "post_transfer_gcode": ["M997"] }



The properties:

`command`
: required. must be the value "start_transfer"

`api`
: required. must be the value "api"

`port`
: required. the serial port the printer is connected on

`baudrate`
: required.

`local_path`
: required. the local path on the server to the uploaded file

`comm_timeout_ms`
: optional, settings override, int. the communication timeout

`wait_after_connect_ms`
: optional, settings override, int. if provided, how long to wait after establishing connection

`post_transfer_gcode_enable`
: optional, settings override, bool. whether to send gcode after the transfer completes

`post_transfer_gcode`
: optional, settings override, string array. the gcode to send

For settings override properties, if no value is provided the current configuration will be used.