Package frc.spectrumLib.leds
Class SpectrumLEDs.Config
java.lang.Object
frc.spectrumLib.leds.SpectrumLEDs.Config
- Enclosing class:
- SpectrumLEDs
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCANdle hardware animation slot (0–7) used by this instance's animation patterns.doubleOverall brightness scalar applied in hardware (0.0–1.0).CAN bus used when nosharedCandleis provided.intCAN device ID used when nosharedCandleis provided.Behavior of the strip when CAN signal is lost.getName()Human-readable name used in telemetry.intNumber of LEDs in the segment owned by this instance.Pre-builtCANdleto reuse.intFirst LED index (inclusive) in the strip.LED strip type (RGB, RGBW, GRB, etc.).booleanWhether this LED strip is physically connected to the robot.voidsetAnimationSlot(int animationSlot) CANdle hardware animation slot (0–7) used by this instance's animation patterns.voidsetAttached(boolean attached) Whether this LED strip is physically connected to the robot.voidsetBrightness(double brightness) Overall brightness scalar applied in hardware (0.0–1.0).voidCAN bus used when nosharedCandleis provided.voidsetDeviceId(int deviceId) CAN device ID used when nosharedCandleis provided.voidsetLossOfSignalBehavior(LossOfSignalBehaviorValue lossOfSignalBehavior) Behavior of the strip when CAN signal is lost.voidsetNumLeds(int numLeds) Number of LEDs in the segment owned by this instance.voidsetSharedCandle(CANdle sharedCandle) Pre-builtCANdleto reuse.voidsetStartIdx(int startIdx) First LED index (inclusive) in the strip.voidsetStripType(StripTypeValue stripType) LED strip type (RGB, RGBW, GRB, etc.).
-
Constructor Details
-
Config
Creates a configuration for a standalone LED instance that creates and owns its ownCANdle. Hardware configuration (strip type, brightness, loss-of-signal) is applied automatically in the constructor.- Parameters:
name- human-readable name for telemetrydeviceId- CAN device ID of the CANdlenumLeds- number of LEDs on the external strip (not counting the 8 onboard LEDs)canBus- CAN bus the CANdle is on
-
Config
Creates a configuration for a LED zone that shares an existing, already-configuredCANdledevice. No hardware configuration is applied.- Parameters:
name- human-readable name for telemetrysharedCandle- theCANdleto reusestartIdx- first LED index (inclusive) in the shared strip for this zonenumLeds- number of LEDs in this zone
-
-
Method Details
-
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. -
getDeviceId
public int getDeviceId()CAN device ID used when nosharedCandleis provided. -
setDeviceId
public void setDeviceId(int deviceId) CAN device ID used when nosharedCandleis provided. -
getCanBus
CAN bus used when nosharedCandleis provided. -
setCanBus
CAN bus used when nosharedCandleis provided. -
getStartIdx
public int getStartIdx()First LED index (inclusive) in the strip. Use0to include the 8 onboard status LEDs on the CANdle board itself; use8to skip them. -
setStartIdx
public void setStartIdx(int startIdx) First LED index (inclusive) in the strip. Use0to include the 8 onboard status LEDs on the CANdle board itself; use8to 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. EachSpectrumLEDsinstance sharing a singleCANdlemust 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. EachSpectrumLEDsinstance sharing a singleCANdlemust use a distinct slot, otherwise their animations overwrite each other. -
getStripType
LED strip type (RGB, RGBW, GRB, etc.). Ignored whensharedCandleis set. -
setStripType
LED strip type (RGB, RGBW, GRB, etc.). Ignored whensharedCandleis set. -
getBrightness
public double getBrightness()Overall brightness scalar applied in hardware (0.0–1.0). Ignored whensharedCandleis set. -
setBrightness
public void setBrightness(double brightness) Overall brightness scalar applied in hardware (0.0–1.0). Ignored whensharedCandleis set. -
getLossOfSignalBehavior
Behavior of the strip when CAN signal is lost. Ignored whensharedCandleis set. -
setLossOfSignalBehavior
Behavior of the strip when CAN signal is lost. Ignored whensharedCandleis set.
-