See the Switch module for wiring and config examples.
| V1 Setting | V2 Setting | Description |
|---|---|---|
|
Creates and enables a new Switch module instance — when set to true, the switch is active and responds to configured inputs and controls outputs. Set to false to disable the switch instance without removing its configuration. Each switch instance requires a unique name. |
||
|
Specifies a GPIO pin that controls the switch state through hardware input. When the pin becomes high the switch changes to ON, and when it becomes low it changes to OFF (exact behavior depends on input_pin_behavior). The firmware checks the input 100 times a second on V1 and 50 times a second on V2. The pin can be configured with pullup (^) or inverted (!) modifiers. |
||
|
Defines how the input pin controls the switch state.
|
||
|
Specifies a G-code or M-code command that sets the switch to the ON state — when this command is received, the switch turns ON. Supports optional subcode matching via switch.{name}.subcode. The S parameter can control the PWM value for PWM-type outputs. Commands are queued and executed synchronously with motion. |
||
|
Specifies a G-code or M-code command that sets the switch to the OFF state — when this command is received, the switch turns OFF. Supports optional subcode matching via switch.{name}.subcode. Commands are queued and executed synchronously with motion. |
||
|
Specifies a subcode for input command matching, allowing multiple switch instances to respond to different subcodes of the same base command (e.g., M106.1 vs M106.2). Subcode 0 is the default and matches commands without explicit subcodes. Only evaluated when input_on_command and/or input_off_command are set. |
||
|
Specifies the GPIO pin controlled by the switch — set low when the switch is OFF, and high when it is ON. The pin's exact behavior depends on output_type (digital on/off, PWM, hardware PWM, or software PWM). For hardware PWM (hwpwm), the pin must be PWM-capable. |
||
|
Sets the type of output for the switch output pin.
|
||
|
Specifies a G-code command to execute when the switch transitions to the ON state. The command is sent to the G-code parser and executed. Underscores in the command are replaced with spaces to allow multi-word commands (e.g., M117_Hello_World becomes M117 Hello World). Commands execute in the main loop when the switch state changes to ON. |
||
|
Specifies a G-code command to execute when the switch transitions to the OFF state. The command is sent to the G-code parser and executed, with underscores replaced by spaces before execution. Commands execute in the main loop when the switch state changes to OFF. Special handling: $J STOP triggers an emergency stop request for continuous jog (only works with input pins). |
||
|
Sets the initial state of the switch when the system boots.
For PWM outputs with startup_state true, default_on_value is used instead of startup_value. For input-pin switches (momentary mode), the initial state is read from the pin and overrides this setting. |
||
|
Sets the PWM value when the switch is OFF, or at startup if startup_state is false.
Also used as the PWM value on HALT for HWPWM and SWPWM. startup_state must be false for this to take effect. |
||
|
Sets the PWM duty cycle percentage when the switch is turned ON without an explicit S parameter. Only applies to hardware PWM (hwpwm) and software PWM (swpwm) output types. Value range is 0-100 (percentage). Used when the switch is turned on via command, or when startup_state is true. Can be overridden by an S parameter in commands (e.g., M106 S75 sets to 75%). |
||
|
Sets the maximum PWM value for sigma-delta PWM output, allowing the maximum output power/speed to be limited when using PWM mode. The S parameter in commands is scaled from 0-255 to 0-max_pwm. Only applies to the SIGMADELTA (pwm) output type, not hwpwm or swpwm. Default is 255, meaning no limiting (full range). |
||
|
On V1, set the period in milliseconds for hardware or software PWM. On V2, set the hardware PWM frequency in hertz in the PWM timer section. Match the period to the device you are driving.
|
||
|
On V1, this sets the pin level used by the debug output handling. The V2 firmware reads the setting, but the code that applies it is disabled. The older wiki described it as the pin state (0 or 1) to set during a crash, watchdog reset or debug halt condition, as a safety feature (not checked against the current firmware). Different from halt_set_to, which handles To set what happens when the firmware halts, use |
||
|
Defines the switch state (true or false) to set during a HALT condition (typically triggered by Digital and sigma-delta outputs use this state. Hardware PWM (and V1 software PWM) uses the configured duty cycle from Different from failsafe_set_to, which handles crash/debug conditions. |
||
|
Set this to true to leave an output as it is when the firmware halts. That may be useful for an indicator light, or any non-safety-critical output (lights, status indicators) that should keep its state during an emergency stop. The firmware does not apply the failsafe or startup_value when a halt is triggered on such a switch. The older wiki also said this is automatically set to true for input-pin switches and cannot be overridden (not checked against the current firmware). |