Output_pin in place of GPIO pin?

Basic Information:

Printer Model: N/A
MCU / Printerboard: Custom, RP2040
Host / SBC: PI 3A
klippy.log: Not relevant

Describe your issue:

I am using the “enable_pin” parameter of one of my stepper motors to enable and disable a cooling fan (they are controlled over UART/step/dir, so EN is not needed). This works as intended, but I would like to see the fan enable status reflected in the UI.

A simple output_pin allows me to see the status in the UI, but isn’t updated by the stepper enable. Is there a way to put the output_pin in place of the direct GPIO pin name in the enable parameter?
E.g. “enable_pin: fan_en” instead of gpio20

Since the method described above didn’t seem feasible I came up with an alternative approach:

  1. When homing enable the stepper cooling fan (via output_pin)
  2. Replace the M84 (disable motors) command with a gcode macro that calls the original M84 and turns the fan off

Since the steppers are only active while homing/homed this seems to address the problem cleanly.