phoenix6.configs.candi_configs

Module Contents

class phoenix6.configs.candi_configs.CANdiConfiguration

Class for CANdi, a CAN digital input device that detects when a digital signal is asserted or deasserted.

This handles the configurations for CANdi

future_proof_configs: bool = True

True if we should factory default newer unsupported configs, false to leave newer unsupported configs alone.

This flag addresses a corner case where the device may have firmware with newer configs that didn’t exist when this version of the API was built. If this occurs and this flag is true, unsupported new configs will be factory defaulted to avoid unexpected behavior.

This is also the behavior in Phoenix 5, so this flag is defaulted to true to match.

custom_params: CustomParamsConfigs

Custom Params.

Custom paramaters that have no real impact on controller.

digital_inputs: DigitalInputsConfigs

Configs related to CANdi digital I/O settings

Contains float-state settings and when to assert the S1/S2 inputs.

quadrature: QuadratureConfigs

Configs related to CANdi’s quadrature interface using both the S1IN and S2IN inputs

All the configs related to the quadrature interface for CANdi, including encoder edges per revolution and sensor direction.

pwm1: PWM1Configs

Configs related to CANdi’s PWM interface on the Signal 1 input (S1IN)

All the configs related to the PWM interface for CANdi on S1, including absolute sensor offset, absolute sensor discontinuity point and sensor direction.

pwm2: PWM2Configs

Configs related to CANdi’s PWM interface on the Signal 2 input (S2IN)

All the configs related to the PWM interface for CANdi on S1, including absolute sensor offset, absolute sensor discontinuity point and sensor direction.

with_custom_params(new_custom_params: CustomParamsConfigs) CANdiConfiguration

Modifies this configuration’s custom_params parameter and returns itself for method-chaining and easier to use config API.

Custom Params.

Custom paramaters that have no real impact on controller.

Parameters:

new_custom_params (CustomParamsConfigs) – Parameter to modify

Returns:

Itself

Return type:

CANdiConfiguration

with_digital_inputs(new_digital_inputs: DigitalInputsConfigs) CANdiConfiguration

Modifies this configuration’s digital_inputs parameter and returns itself for method-chaining and easier to use config API.

Configs related to CANdi digital I/O settings

Contains float-state settings and when to assert the S1/S2 inputs.

Parameters:

new_digital_inputs (DigitalInputsConfigs) – Parameter to modify

Returns:

Itself

Return type:

CANdiConfiguration

with_quadrature(new_quadrature: QuadratureConfigs) CANdiConfiguration

Modifies this configuration’s quadrature parameter and returns itself for method-chaining and easier to use config API.

Configs related to CANdi’s quadrature interface using both the S1IN and S2IN inputs

All the configs related to the quadrature interface for CANdi, including encoder edges per revolution and sensor direction.

Parameters:

new_quadrature (QuadratureConfigs) – Parameter to modify

Returns:

Itself

Return type:

CANdiConfiguration

with_pwm1(new_pwm1: PWM1Configs) CANdiConfiguration

Modifies this configuration’s pwm1 parameter and returns itself for method-chaining and easier to use config API.

Configs related to CANdi’s PWM interface on the Signal 1 input (S1IN)

All the configs related to the PWM interface for CANdi on S1, including absolute sensor offset, absolute sensor discontinuity point and sensor direction.

Parameters:

new_pwm1 (PWM1Configs) – Parameter to modify

Returns:

Itself

Return type:

CANdiConfiguration

with_pwm2(new_pwm2: PWM2Configs) CANdiConfiguration

Modifies this configuration’s pwm2 parameter and returns itself for method-chaining and easier to use config API.

Configs related to CANdi’s PWM interface on the Signal 2 input (S2IN)

All the configs related to the PWM interface for CANdi on S1, including absolute sensor offset, absolute sensor discontinuity point and sensor direction.

Parameters:

new_pwm2 (PWM2Configs) – Parameter to modify

Returns:

Itself

Return type:

CANdiConfiguration

serialize() str

Get the serialized form of this configuration

Returns:

Serialized form of this config group

Return type:

str

deserialize(to_deserialize: str) phoenix6.status_code.StatusCode

Take a string and deserialize it to this configuration

Returns:

Return code of the deserialize method

Return type:

str

class phoenix6.configs.candi_configs.CANdiConfigurator(id: phoenix6.hardware.device_identifier.DeviceIdentifier)

Bases: phoenix6.configs.parent_configurator.ParentConfigurator

  • Class for CANdi, a CAN digital input device that detects when a digital

  • signal is asserted or deasserted.

    This handles the configurations for CANdi

refresh(configs: SupportsSerialization, timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Refreshes the values of the specified config group.

Call to refresh the selected configs from the device.

Parameters:
  • configs (name) – The configs to refresh

  • timeout_seconds (second) – Maximum amount of time to wait when performing configuration

Returns:

StatusCode of refreshing the configs

Return type:

StatusCode

apply(configs: SupportsSerialization, timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Applies the contents of the specified config to the device.

Call to apply the selected configs.

Parameters:
  • configs (SupportsSerialization) – Configs to apply

  • timeout_seconds (second) – Maximum amount of time to wait when performing configuration

Returns:

StatusCode of the apply method

Return type:

StatusCode

set_quadrature_position(new_value: phoenix6.units.rotation, timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Sets the position of the quadrature input.

This is available in the configurator in case the user wants to initialize their device entirely without passing a device reference down to the code that performs the initialization. In this case, the user passes down the configurator object and performs all the initialization code on the object.

Parameters:
  • new_value (rotation) – Value to set to. Units are in rotations.

  • timeout_seconds (second) – Maximum time to wait up to in seconds.

Returns:

StatusCode of the set command

Return type:

StatusCode

clear_sticky_faults(timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Clear the sticky faults in the device.

This typically has no impact on the device functionality. Instead, it just clears telemetry faults that are accessible via API and Tuner Self-Test.

This is available in the configurator in case the user wants to initialize their device entirely without passing a device reference down to the code that performs the initialization. In this case, the user passes down the configurator object and performs all the initialization code on the object.

Parameters:

timeout_seconds (second) – Maximum time to wait up to in seconds.

Returns:

StatusCode of the set command

Return type:

StatusCode

clear_sticky_fault_hardware(timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Clear sticky fault: Hardware fault occurred

This is available in the configurator in case the user wants to initialize their device entirely without passing a device reference down to the code that performs the initialization. In this case, the user passes down the configurator object and performs all the initialization code on the object.

Parameters:

timeout_seconds (second) – Maximum time to wait up to in seconds.

Returns:

StatusCode of the set command

Return type:

StatusCode

clear_sticky_fault_undervoltage(timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Clear sticky fault: Device supply voltage dropped to near brownout levels

This is available in the configurator in case the user wants to initialize their device entirely without passing a device reference down to the code that performs the initialization. In this case, the user passes down the configurator object and performs all the initialization code on the object.

Parameters:

timeout_seconds (second) – Maximum time to wait up to in seconds.

Returns:

StatusCode of the set command

Return type:

StatusCode

clear_sticky_fault_boot_during_enable(timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Clear sticky fault: Device boot while detecting the enable signal

This is available in the configurator in case the user wants to initialize their device entirely without passing a device reference down to the code that performs the initialization. In this case, the user passes down the configurator object and performs all the initialization code on the object.

Parameters:

timeout_seconds (second) – Maximum time to wait up to in seconds.

Returns:

StatusCode of the set command

Return type:

StatusCode

clear_sticky_fault_unlicensed_feature_in_use(timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.

This is available in the configurator in case the user wants to initialize their device entirely without passing a device reference down to the code that performs the initialization. In this case, the user passes down the configurator object and performs all the initialization code on the object.

Parameters:

timeout_seconds (second) – Maximum time to wait up to in seconds.

Returns:

StatusCode of the set command

Return type:

StatusCode

clear_sticky_fault_5_v(timeout_seconds: phoenix6.units.second = 0.1) phoenix6.status_code.StatusCode

Clear sticky fault: CANdi has detected a 5V fault. This may be due to overcurrent or a short-circuit.

This is available in the configurator in case the user wants to initialize their device entirely without passing a device reference down to the code that performs the initialization. In this case, the user passes down the configurator object and performs all the initialization code on the object.

Parameters:

timeout_seconds (second) – Maximum time to wait up to in seconds.

Returns:

StatusCode of the set command

Return type:

StatusCode