Skip to content

Instantly share code, notes, and snippets.

@jaredharley
Last active September 2, 2023 14:28
Show Gist options
  • Save jaredharley/31e6a05da2a2edf44c5150d839439c9b to your computer and use it in GitHub Desktop.
Save jaredharley/31e6a05da2a2edf44c5150d839439c9b to your computer and use it in GitHub Desktop.
My working notes on figuring out the Monoprice Mini Delta V2 (MPMDv2) web API

Monoprice Mini Delta V2 printer API

My in-progress documentation of the Monoprice Mini Delta V2 printer api. This is traffic captured between the included Wiibuilder application and the printer when you connect to the printer through Wiibuilder and send a gcode file to print.

api/printer

api/printer during print job

{
    "sd": {
        "ready": false
    },
    "state": {
        "flags": {
            "cancelling": false,
            "closedOrError": false,
            "error": false,
            "finishing": false,
            "operational": false,
            "paused": false,
            "pausing": false,
            "printing": true,
            "ready": false,
            "resuming": false,
            "sdReady": false
        },
        "text": "Printing"
    },
    "temperature": {
        "tool0": {
            "actual": 200,
            "offset": 0,
            "target": 0
        }
    }
}
Path Value Notes
sd/ready true/false When the printer is ready to receive a file over wifi (ready for a new print job), false if the sd card is missing
state/flags/cancelling true/false Unknown; True when the printer is in the process of cancelling a job?
state/flags/closedOrError true/false Unknown
state/flags/error true/false Unknown; True when the printer is in an error state?
state/flags/finishing true/false Unknown; True when the printer is finishing a job?
state/flags/operational true/false True when the printer is on the main menu of the LCD, ready to receive/start a print job
state/flags/paused true/false True when the printer is paused
state/flags/pausing true/false Unknown; True when the printer is pausing a job?
state/flags/printing true/false True when printer is running a job, false otherwise
state/flags/ready true/false True when the printer is ready (no job), false otherwise
state/flags/resuming true/false Unknown; True when the printer is resuming a job after printing?
state/flags/sdReady true/false Same as sd/ready
state/text text State text, not what is displayed on the LCD. See "Text messages" below
temperature/tool0/actual integer Current temperature of the hot end, in C
temperature/tool0/offset integer Unknown; haven't seen anything other than 0
temperature/tool0/target integer Target temperature in C - this is set when a target temp is set on the printer screen, and doesn't clear when you start a print job (even though the target temps are different in the job)

Text messages:

  • Printing - while a print job is running
  • Finish - while the "Print Completed" screen is displayed on the printer
  • Operational - when the printer is on the main LCD menu

api/job

api/job during print:

{
    "job": {
        "file": {
            "date": 0,
            "name": "wiibuilder_pos.gcode",
            "path": "wiibuilder_pos.gcode",
            "origin": "local",
            "size": 10
        },
        "filament": {
            "length": 1939.1099853515625,
            "volume": 4.6538639068603516
        },
        "estimatedPrintTime": 2784
    },
    "progress": {
        "completion": 15,
        "filepos": 10,
        "printTime": 873,
        "printTimeLeft": 2341
    },
    "state": "Printing"
}
Path Value Notes
job/file/date Unknown Unknown, always 0
job/file/name Text Filename of file currently being printed. If transferred over wifi from Wiibuilder, it will display "wiibuilder_pos.gcode"
job/file/path Text Path of file currently being printed. If transferred over wifi from Wiibuilder, it will display "wiibuilder_pos.gcode"
job/file/origin Text Unknown; Origin of file, perhaps? Have always seen it set to local
job/file/size integer Unknown; Alway set to 10
job/filament/length float Length of filament to use, in mm. Seems to match the "FilamentUsed:749.94" comment in gcode files
job/filament/volume float Unknown
job/estimatedPrintTime integer Estimated time to complete print job, in seconds
job/progress/completion integer Print job complete percentage
job/progress/filepos integer Unknown; Always set to 10
job/progress/printTime integer Number of seconds elpased since print job start
job/progress/printTimeLeft integer Estimated number of seconds left in print job (this is not estimatedPrintTime minus printTime)
job/state text Job status text, appears to match state/text from api/printer

POSTS

/api/printer/printhead

{"command":"jog","x":0.0,"y":0.0,"z":-10.0}

Buttons to test:

  • y, z, Home, Cancel print

Transmitting a file

POST /api/files/local HTTP/1.1
X-Api-Key: 097EBEDA13A1402BB2D07505874E6414
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryBHFJVxswwyoqKvCt
Host: 192.168.1.174
Content-Length: 4937590
Expect: 100-continue

------WebKitFormBoundaryBHFJVxswwyoqKvCt
Content-Disposition: form-data; name="file"; filename="wiibuilder_pos.gcode"
Content-Type:application/octet-stream

;FLAVOR:Marlin
;TIME:8156
;InfillDensity:20
;FilamentType:PLA
;FilamentUsed:4127.60
;Layer height: 0.14
;MINX:-30.626
;MINY:-24.102
;MINZ:0.32
;MAXX:26.761
;MAXY:20.135
;MAXZ:48.06
;POSTPROCESSED
;Generated with Cura_SteamEngine 4.12.1
; thumbnail begin
W221
W220 5f534a50475f5f0056312e3030008c008c00090010001d0314032b031d0321033c032c031903d702

...the rest of the gcode file...

;SETTING_3 rts = True\\nwall_thickness = 1.2\\nxy_offset_layer_0 = =xy_offset\\n
;SETTING_3 \\n"]}

------WebKitFormBoundaryBHFJVxswwyoqKvCt
Content-Disposition: form-data; name="select"

true
------WebKitFormBoundaryBHFJVxswwyoqKvCt
Content-Disposition: form-data; name="print"

true
------WebKitFormBoundaryBHFJVxswwyoqKvCt--

The printer sent back:

HTTP/1.1 201 CREATED
Content-Type: application/json;charset=utf-8
Content-Length: 112

And then a json packet:

{
    "done": "true",
    "files": {
        "local": {
            "name": "wiibuilder_pos.gcode",
            "origin": "local",
            "path": "wiibuilder_pos.gcode"
        }
    }
}
@FerreiraPablo
Copy link

FerreiraPablo commented Aug 9, 2023

Extremely weird: Confirmed.
The files are the following:
flash.wfm, lcd.efm respectively:
I updated through this menu:
20230809_123629

Is the last version even if the homescreen still says there is a new version available. Nothing happens when you click the notification it just installs the files from the SD Again. (I'm using the same 8GB one that came with the printer if that matters)
20230809_123601

Can you enter the /api/version endpoint from of your printers ip to confirm? Like this.
image

@piberry
Copy link

piberry commented Aug 9, 2023

Here´s the output:
{"api":"1.0","server":"1.4.2","text":"MiniDeltaLCD","mem":85196}

I ran the printer on the weedo community firmware and also on Marlin 2.1.x by TheThomasD for some days but i flashed it back to the official firmware via the flash.wfm file you provided. The firmware flash went fine - shows v.1.2.0 on the screen again. The Marlin 2.1.x branch is a bit different in some ways, the delta calibration is buggy and the z-heigt calibration acts different too. Now, with the original firmware, everything is back to normal, so i´m 100% sure everything is stock again. I don´t know if this is related to the problem in some way.
The weedo community firmware 1.2.0 also gets stuck at the monoprice logo which i found really weird but version 1.1.5 works normal.
With every firmware i tried to connect with cura but the printer always resets and cura throws the error.

Edit:
I sent M502 via pronterface to reset the eeprom and also tried with a 8GB card and a 128MB one - same result.

@piberry
Copy link

piberry commented Aug 23, 2023

i almost got somewhere...
i was able to dump the flash of the esp32 with a ftdi exactly as described here:
https://github.com/Mclute0/-MPMDv2-modifications-and-fixes/blob/main/esp32-wroom32e%20output

my dump is the size of the flash memory but the dump from that git is double the size. in a text editor i can see that it is indeed firmware 1.5 but how can it be 8mb large? stuck again...

@piberry
Copy link

piberry commented Sep 2, 2023

solved:
https://github.com/piberry/-MPMDv2-modifications-and-fixes

i also managed to enable the parts cooling fan in marlin firmware so it responds to M106.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment