get_motor_if_active

get_motor_if_active(key: str, index_key: str, values_key: str, pwm) Motor | NullMotor[source]

Builds a Motor from its settings if the key presence flag is ON.

Parameters:
  • key (str) – The Active setting that gates whether this motor exists.

  • index_key (str) – The setting holding the motor’s PWM channel index.

  • values_key (str) – The setting holding the motor’s [open, close, time_open, time_close] values.

  • pwm – The PWM chip (or NullChip) the motor is wired to.

Returns:

A real Motor if enabled, otherwise a NullMotor.

Return type:

Motor | NullMotor