CRYSTAL FOCUS X
Beginner Guide Series
LED PADS
Accent outputs · leds.txt · Polarity · PLI

Accent LED Pads & Sequences

A practical guide to the CFX accent LED pads, including which outputs are PWM or digital-only, how leds.txt works, how polarity behaves, and how to build accent patterns and battery indicators.

What you will learn
  • Which accent outputs are PWM and which are digital-only
  • How leds.txt is structured
  • How sections, states, delays, and repeat blocks work
  • How polarity and PLI work on the LED pads
Main folder
Accent styles
/extra/ACCENTS/
Config key
style_accents
Main file
leds.txt
Best used for
  • Crystal chambers and illuminated switches
  • Battery level indicators
  • Sequenced blinkies and pulsing LEDs
  • Themed hilt lighting setups

What Are Accent LEDs?

Accent LEDs are smaller lights in the hilt that work independently from the main blade. They can light a crystal chamber, illuminate a switch, show battery level, pulse, mirror blade channels, react to sound, or run blinking patterns.

The Crystal Focus X supports up to 9 accent LED outputs for hilt lighting features such as crystal chambers, AV switches, chassis LEDs, and battery indicators. Not all of those outputs are true PWM outputs, so some can fade smoothly while others are digital-only.

Where Are the LED Pads on the CFX?

CFX board accent LED pad locations

Two Types of Accent LEDs

PWM Accents (Single-Color LEDs)

These are the 9 discrete LED outputs on the CFX board, labeled ACCENT1 through ACCENT8, plus GPIO4. They work with individual LEDs such as crystal chamber LEDs, illuminated AV switches, and chassis lighting.

Not all 9 outputs have the same capabilities:

OutputTypeCapabilities
Accent #1Digital onlyON / OFF switching
Accent #2PWMVariable brightness (10-bit)
Accent #3Digital onlyON / OFF switching
Accent #4Digital onlyON / OFF switching
Accent #5PWMVariable brightness (10-bit)
Accent #6PWMVariable brightness (10-bit)
Accent #7PWMVariable brightness (10-bit)
Accent #8PWMVariable brightness (10-bit)
Accent #9 (GPIO4)PWMVariable brightness (10-bit)

PWM outputs, which are accents 2, 5, 6, 7, 8, and 9, can produce smooth brightness control. That makes them ideal for pulsing, fading, audio-reactive flicker, blade color mirroring, and crystal color pulsing.

Digital-only outputs, which are accents 1, 3, and 4, can only switch fully ON or fully OFF. You can still assign PWM-style behaviors such as self-pulsing or audio flicker to them, but they will blink between ON and OFF instead of fading smoothly.

SD Card Layout

/extra/ACCENTS/
├── 0-Default/
│   └── leds.txt
├── 1-Breathing/
│   └── leds.txt
├── 2-RainbowChase/
│   └── leds.txt
└── ...

Each subfolder uses a numbered naming style similar to font folders. The number is the style index you reference from config.txt.

Selecting a Style in config.txt

[profile=0]
style_accents=0
Config KeyPurpose
style_accents=NSelects the PWM accent sequence subfolder index from /extra/ACCENTS/

Different blade profiles can use different accent styles, so switching blade profiles can also change the hilt lighting behavior.

The leds.txt File

The leds.txt file defines how the 9 accent outputs behave. It has two main parts: global settings at the top, and one or more state sections below.

Accent Attributes

The accents= line is the most important setting. Each character controls one accent output from left to right, meaning accent 1 through accent 9.

accents=aappp12Oa
CharNameBehavior
aRegularFollows the ON / OFF sequence pattern in the active section
mMorphingFades between ON and OFF states instead of snapping
rRandomRandomly ON or OFF each step
pPLIPart of the power level indicator bargraph
oBoard PowerAlways ON while the board is awake
OBlade IndicatorON when the blade is ignited
1Mirror Channel 1Mirrors blade color channel 1
2Mirror Channel 2Mirrors blade color channel 2
3Mirror Channel 3Mirrors blade color channel 3
4Mirror Channel 4Mirrors blade color channel 4
C, R, Y, SCrystal PulsePulses using crystal chamber color channels
~Self-PulsingBreathes using accpulsel and accpulsed
@Audio FlickerBrightness follows audio volume
#Reverse AudioInverse of audio volume
uUSB MirrorBlinks on USB serial Rx / Tx activity
tTemp Cool-DownBrightness reflects blade temperature behavior
TSelf Cool-DownStarts bright and decays over time
bBlade BrightnessMirrors overall blade brightness
BBlade DimnessInverse of blade brightness
lLow BatteryTurns ON when battery is low
LLow Battery OffTurns OFF when battery is low

Polarity

Polarity tells the firmware how each accent LED is physically wired, so the LED behaves correctly without you having to change your sequences or rewire the hardware.

polarity=NNNNNNNNN
CharMeaningWhat it means in practice
NNormal polarityUse this for common cathode wiring. A HIGH signal turns the LED on and a LOW signal turns it off.
RReversed polarityUse this for common anode wiring. The logic is inverted, so a LOW signal turns the LED on and a HIGH signal turns it off.

Common cathode, which is the normal N setting, means the LED shares ground and the accent output drives it in the usual way.

Common anode, which uses R, means the LED shares its positive supply instead. That flips the logic.

When you set an accent to R, the firmware flips the behavior for you. Digital ON and OFF states are inverted, and PWM brightness is mirrored as well, so the effect still looks correct on the LED.

Why this is useful: Different LED modules, illuminated switches, and custom hilt installs do not all use the same wiring convention. Polarity lets you adapt in software, so sequences, pulsing, audio flicker, and PLI still behave normally even when the physical wiring is inverted.

Pulse Parameters

KeyDescriptionDefault
accpulsed=NPulse depth from 0 to 100%0
accpulsel=NPulse period in milliseconds1000

These can appear at the top of the file or inside a section. They control self-pulsing and crystal-pulsing accent behaviors.

Sections

Section HeaderWhen Active
[IDLE]Saber is powered on but blade is off
[LEDS]Blade is ignited
[LOCKUP]During lockup
[POWERON]During ignition
[POWEROFF]During retraction
[PREON]During pre-ignition effect
[POSTOFF]During post-retraction effect
[FOREVER]Overrides all other sections if defined

Sequence Blocks

A <forever> block loops indefinitely:

[LEDS]
<forever>
delay=200
state=100000000
state=010000000
state=001000000
state=000100000
</forever>

A <repeat=N> block plays a set number of times, then moves on:

[POWERON]
<repeat=3>
delay=50
state=111111111
state=000000000
</repeat>
stop

State Lines

Each state= line defines the ON and OFF values for all 9 accent outputs, from left to right.

state=101000010
Important: Only accents using regular, morphing, or random behavior actually follow the state= sequence. Accents assigned to PLI, mirroring, pulsing, or other special behaviors ignore the state pattern and run their own logic.

Delay Lines

delay= sets how long the following states are held in milliseconds. If no delay is set, the default is 100 ms.

delay=200
state=110000000
state=001100000
delay=500
state=000011000

Complete leds.txt Example

// Crystal chamber mirrors blade color, PLI bargraph, pulsing switch, chase blinkies
accents=123ppp~aa
polarity=NNNNNNNNN

accpulsed=60
accpulsel=2000

[IDLE]
<forever>
delay=800
state=000000010
state=000000001
</forever>

[LEDS]
<forever>
delay=150
state=000000010
state=000000001
</forever>

[POWERON]
<repeat=4>
delay=40
state=000000011
state=000000000
</repeat>
stop

[POWEROFF]
<repeat=3>
delay=100
state=000000010
state=000000001
state=000000000
</repeat>
stop

[LOCKUP]
<forever>
delay=60
state=000000011
state=000000000
</forever>

PLI

The PLI system turns one or more accent LEDs into a battery level bargraph. Assign the p attribute to consecutive accents.

accents=aapppppaa
Config KeyDescriptionDefault
plilh=LOW,HIGHBattery voltage range in millivolts3400,4200
plirev=1Reverse the PLI direction0

When the battery drops below 10%, the last lit LED blinks as a warning.

How Sections Switch

Saber EventAccent Section
Board powers on, blade off[IDLE]
Pre-ignition effect starts[PREON]
Blade ignites[POWERON] then [LEDS]
Blade fully on, normal use[LEDS]
Lockup begins[LOCKUP]
Lockup endsBack to [LEDS]
Blade retracts[POWEROFF] then [IDLE]
Post-retraction effect[POSTOFF]

If [FOREVER] is defined, it overrides all other sections and plays constantly regardless of saber state.

Themed Accent Files

When a theme is active, the firmware looks for accent files inside the theme folder first. If it does not find them there, it falls back to the global accent path.

//extra/ACCENTS/0-Default/leds.txt

Configuration Summary

KeyPurpose
style_accents=NPWM accent style subfolder index
accpulsed=NGlobal pulse depth
accpulsel=NGlobal pulse period
plilh=LOW,HIGHPLI voltage range in millivolts
plirev=1Reverse PLI direction

Quick Reference

PWM Accent Attributes

CharBehavior
aRegular sequenced ON / OFF
mMorphing fade
rRandom ON / OFF
pPLI battery bargraph
oBoard powered
OBlade-on indicator
14Mirror blade channel
C, R, Y, SCrystal color pulse
~Self-pulsing
@Audio reactive
#Reverse audio reactive
uUSB activity
tTemperature cool-down
TSelf cool-down
bBlade brightness mirror
BBlade dimness
lLow battery indicator
LLow battery off

leds.txt Syntax

ElementSyntaxDescription
Section[LEDS], [IDLE], etc.State-specific sequence section
Attributesaccents=aappp12OaPer-accent behavior, left = accent 1
Polaritypolarity=NNNNNNNNNPer-accent polarity
Delaydelay=200Hold time in ms
Statestate=101010101ON / OFF per accent, left = accent 1
Pulse depthaccpulsed=500–100%
Pulse periodaccpulsel=1000Milliseconds
Forever block<forever> ... </forever>Infinite loop
Repeat block<repeat=N> ... </repeat>Play N times
StopstopDo not loop after repeat finishes

Limits

ParameterMaximum
Accent outputs9
Steps per sequence block32
Blocks per section16
Sections per leds.txt file8