Class SpectrumLEDs.Config

java.lang.Object
frc.spectrumLib.leds.SpectrumLEDs.Config
Enclosing class:
SpectrumLEDs

public static class SpectrumLEDs.Config extends Object
Configuration for a SpectrumLEDs subsystem instance.

Use Config(String, int, int, CANBus) to create a standalone instance that owns and configures its CANdle, or Config(String, CANdle, int, int) to share an already-configured device across multiple subsystems targeting different LED segments.

  • Constructor Details

    • Config

      public Config(String name, int deviceId, int numLeds, CANBus canBus)
      Creates a configuration for a standalone LED instance that creates and owns its own CANdle. Hardware configuration (strip type, brightness, loss-of-signal) is applied automatically in the constructor.
      Parameters:
      name - human-readable name for telemetry
      deviceId - CAN device ID of the CANdle
      numLeds - number of LEDs on the external strip (not counting the 8 onboard LEDs)
      canBus - CAN bus the CANdle is on
    • Config

      public Config(String name, CANdle sharedCandle, int startIdx, int numLeds)
      Creates a configuration for a LED zone that shares an existing, already-configured CANdle device. No hardware configuration is applied.
      Parameters:
      name - human-readable name for telemetry
      sharedCandle - the CANdle to reuse
      startIdx - first LED index (inclusive) in the shared strip for this zone
      numLeds - number of LEDs in this zone
  • Method Details

    • getName

      public String getName()
      Human-readable name used in telemetry.
    • isAttached

      public boolean isAttached()
      Whether this LED strip is physically connected to the robot.
    • setAttached

      public void setAttached(boolean attached)
      Whether this LED strip is physically connected to the robot.
    • getSharedCandle

      public CANdle getSharedCandle()
      Pre-built CANdle to reuse. When non-null, deviceId and canBus are ignored and no hardware configuration is applied by this instance.
    • setSharedCandle

      public void setSharedCandle(CANdle sharedCandle)
      Pre-built CANdle to reuse. When non-null, deviceId and canBus are ignored and no hardware configuration is applied by this instance.
    • getDeviceId

      public int getDeviceId()
      CAN device ID used when no sharedCandle is provided.
    • setDeviceId

      public void setDeviceId(int deviceId)
      CAN device ID used when no sharedCandle is provided.
    • getCanBus

      public CANBus getCanBus()
      CAN bus used when no sharedCandle is provided.
    • setCanBus

      public void setCanBus(CANBus canBus)
      CAN bus used when no sharedCandle is provided.
    • getStartIdx

      public int getStartIdx()
      First LED index (inclusive) in the strip. Use 0 to include the 8 onboard status LEDs on the CANdle board itself; use 8 to skip them.
    • setStartIdx

      public void setStartIdx(int startIdx)
      First LED index (inclusive) in the strip. Use 0 to include the 8 onboard status LEDs on the CANdle board itself; use 8 to skip them.
    • getNumLeds

      public int getNumLeds()
      Number of LEDs in the segment owned by this instance.
    • setNumLeds

      public void setNumLeds(int numLeds)
      Number of LEDs in the segment owned by this instance.
    • getAnimationSlot

      public int getAnimationSlot()
      CANdle hardware animation slot (0–7) used by this instance's animation patterns. Each SpectrumLEDs instance sharing a single CANdle must use a distinct slot, otherwise their animations overwrite each other.
    • setAnimationSlot

      public void setAnimationSlot(int animationSlot)
      CANdle hardware animation slot (0–7) used by this instance's animation patterns. Each SpectrumLEDs instance sharing a single CANdle must use a distinct slot, otherwise their animations overwrite each other.
    • getStripType

      public StripTypeValue getStripType()
      LED strip type (RGB, RGBW, GRB, etc.). Ignored when sharedCandle is set.
    • setStripType

      public void setStripType(StripTypeValue stripType)
      LED strip type (RGB, RGBW, GRB, etc.). Ignored when sharedCandle is set.
    • getBrightness

      public double getBrightness()
      Overall brightness scalar applied in hardware (0.0–1.0). Ignored when sharedCandle is set.
    • setBrightness

      public void setBrightness(double brightness)
      Overall brightness scalar applied in hardware (0.0–1.0). Ignored when sharedCandle is set.
    • getLossOfSignalBehavior

      public LossOfSignalBehaviorValue getLossOfSignalBehavior()
      Behavior of the strip when CAN signal is lost. Ignored when sharedCandle is set.
    • setLossOfSignalBehavior

      public void setLossOfSignalBehavior(LossOfSignalBehaviorValue lossOfSignalBehavior)
      Behavior of the strip when CAN signal is lost. Ignored when sharedCandle is set.