mainsail-crew / mainsail

Mainsail is the popular web interface for managing and controlling 3D printers with Klipper.
https://docs.mainsail.xyz
GNU General Public License v3.0
1.71k stars 363 forks source link

feat(spoolman): add multi tool support #1946

Open meteyou opened 3 months ago

meteyou commented 3 months ago

Description

This PR adds support for multi tool support for the spoolman integration.

Related Tickets & Documents

fixes #1927

Mobile & Desktop Screenshots/Recordings

image

[optional] Are there any post-deployment tasks we need to perform?

none

github-actions[bot] commented 3 months ago
Language file analysis report: File Missing Keys Unused Keys
en.json 0 0
github-actions[bot] commented 3 months ago
Language file analysis report: File Missing Keys Unused Keys
en.json 0 0
moggieuk commented 3 months ago

May I ask for one little enhancement:

For reference, Happy Hare will (in upcoming release) creates these "extra" fields in the spools table: MMU_NAME_FIELD = 'printer_name' MMU_GATE_FIELD = 'mmu_gate_map'

E.g. A GET on http://192.168.0.108:7912/api/v1/spool/1, would return the extra fields on the spool_info object like this:

{
  "id": 1,
  "registered": "2023-09-17T08:55:26Z",
  "first_used": "2023-09-17T08:55:01.044000Z",
  "last_used": "2024-06-27T15:28:41Z",
  "filament": {
    "id": 1,
    "registered": "2023-09-17T08:54:03Z",
    "name": "Matte Green",
    "vendor": {
      "id": 1,
      "registered": "2023-09-17T08:51:36Z",
      "name": "eSun",
      "extra": {}
    },
    "material": "PLA - Silk",
    "price": 20,
    "density": 1.25,
    "diameter": 1.75,
    "weight": 1000,
    "spool_weight": 1100,
    "settings_extruder_temp": 210,
    "settings_bed_temp": 70,
    "color_hex": "8CDFAC",
    "extra": {}
  },
  "remaining_weight": 943.4987993892125,
  "initial_weight": 1000,
  "spool_weight": 1100,
  "used_weight": 56.501200610787414,
  "remaining_length": 313808.97483559017,
  "used_length": 18792.375625840086,
  "location": "BigRed @ MMU Gate:0",
  "archived": false,
  "extra": {
    "printer_name": "\"BigRed\"",
    "mmu_gate_map": "0"
  }
}

Would it be possible to check if the mmu_gate_map field exists and if so, add that to the meta information for the tool?

This is very useful because it is possible to map any "logical" tool to any physical "gate" (or slot or lane) on MMU. This extra field will contain that gate if Happy Hare is being used but it would set a place for others to use. Of course if the filed is not found or is -1 (the default) there is no gate assignment and it would be ignored.

github-actions[bot] commented 1 month ago
Language file analysis report: File Missing Keys Unused Keys
en.json 0 0