Class PhoenixUtil

java.lang.Object
org.team1126.lib.util.vendors.PhoenixUtil

public final class PhoenixUtil extends Object
Utilities for the CTRE Phoenix 6 API.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Disables background processes managed by Phoenix, intended for competition use.
    static boolean
    run(Supplier<com.ctre.phoenix6.StatusCode> target)
    Runs a Phoenix API call and checks for errors.
    static boolean
    run(Supplier<com.ctre.phoenix6.StatusCode> target, int maxTries)
    Runs a Phoenix API call and checks for errors.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • disableDaemons

      public static void disableDaemons()
      Disables background processes managed by Phoenix, intended for competition use. Note that Phoenix Tuner X will not be able to connect to the robot when this method is in use.
    • run

      public static boolean run(Supplier<com.ctre.phoenix6.StatusCode> target)
      Runs a Phoenix API call and checks for errors. Will try up to 3 times if the target API call fails.
      Parameters:
      target - The target call to run.
      Returns:
      true if success (StatusCode.isOK()), false otherwise.
    • run

      public static boolean run(Supplier<com.ctre.phoenix6.StatusCode> target, int maxTries)
      Runs a Phoenix API call and checks for errors.
      Parameters:
      target - The target call to run.
      maxTries - The number of times to try the call before failing. 1 only runs the call once.
      Returns:
      true if success (StatusCode.isOK()), false otherwise.