Skip to content

[Request] Allow API for setting Temp for "Current Tool" for Multi-Toolhead Printers #5018

@ccatlett1984

Description

@ccatlett1984

Is your feature request related to a problem? Please describe.

If you have multiple printers, there is no way to send a temp command for the current tool:
M104 T{current_extruder} S140

Describe the solution you'd like

I've taken a crack at editing standard.py, but must have a syntax error. Not a python person ;)

Adding this additional endpoint, would allow for setting hotend temp of the loaded tool, without having to specify the tool (and in the case of OctoDash being hard coded to tool0 currently.)

    def set_temperature(self, heater, value, *args, **kwargs):
        if not PrinterInterface.valid_heater_regex.match(heater):
            raise ValueError(
                'heater must match "tool([0-9]+|Current)", "bed" or "chamber": {heater}'.format(
                    heater=heater
                )
            )

        if not isinstance(value, (int, float)) or value < 0:
            raise ValueError(f"value must be a valid number >= 0: {value}")

        tags = kwargs.get("tags", set()) | {"trigger:printer.set_temperature"}

        if heater.startswith("tool"):
            printer_profile = self._printerProfileManager.get_current_or_default()
            extruder_count = printer_profile["extruder"]["count"]
            shared_nozzle = printer_profile["extruder"]["sharedNozzle"]
            if extruder_count > 1 and not shared_nozzle:
                if heater[len("tool") :] == "Current":
                    self.commands(f"M104 T{"current_extruder"} S{value}", tags=tags)
                else:
                    toolNum = int(heater[len("tool") :])
                self.commands(f"M104 T{toolNum} S{value}", tags=tags)
            else:
                self.commands(f"M104 S{value}", tags=tags)

Describe alternatives you've considered

Since there does not be a method to query a Marlin (or other OS) printer for which toolhead is active, I don't see another way for controlling the "current" toolhead temp.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    doneDone but not yet releasedrequestFeature request

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions