Search page


Project maintained by profezzorn Hosted on GitHub Pages — Theme by mattgraham
<p>So you got a second saber, and it has more LEDs than your first one? Maybe it has a crystal chamber, or an illuminated pogo pin PCB. So now you want to take your existing configuration file and add another blade for the extra LEDs. You've come to the right place.</p> <p>We'll need to do four things:</p> <ol> <li>remove KEEP_SAVEFILES_WHEN_PROGRAMMING if present</li> <li>increase NUM_BLADES by one</li> <li>add another blade in each entry in the blades[] array</li> <li>add another style to each preset in your config file</li> </ol> <h2 id="step-1-remove-keepsavefileswhenprogramming-if-present">Step 1, remove KEEP_SAVEFILES_WHEN_PROGRAMMING if present</h2> <p>If you have <a href="/config/the-config_top-section.html#keepsavefileswhenprogramming">KEEP_SAVEFILES_WHEN_PROGRAMMING</a> in your config file, you need to remove it, because it's not going to work when you add another blade.</p> <h2 id="step-2-increase-numblades-by-one">Step 2, increase NUM_BLADES by one.</h2> <p>Simple, just change:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define NUM_BLADES 1 </span></code></pre></div></div> <p>to:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define NUM_BLADES 2 </span></code></pre></div></div> <h2 id="step-3-add-another-blade-in-each-entry-in-the-blades-array">Step 3, add another blade in each entry in the blades[] array</h2> <p>This is a little trickier. Your blades array may look like this:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">BladeConfig</span> <span class="n">blades</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="mi">0</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">132</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">presets</span><span class="p">)</span> <span class="p">},</span> <span class="p">};</span> </code></pre></div></div> <p>Now, let's say we have a crystal chamber with two LEDs, once we add the second blade, it might look like this:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">BladeConfig</span> <span class="n">blades</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="mi">0</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">144</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">2</span><span class="p">,</span> <span class="n">blade4Pin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin6</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">presets</span><span class="p">)</span> <span class="p">},</span> <span class="p">};</span> </code></pre></div></div> <p>This assumes that the data for your crystal chamber comes from LED4, and the (-) pad is hooked up to LED6. If that's not the case, you'll need to modify this example accordingly. You can also use the configuration generator to generate blades arrays which might look more like your specific setup to make it easier.</p> <h2 id="step-4-add-another-style-to-each-preset">Step 4, add another style to each preset</h2> <p>The style will determine the color for your new LEDs, and obviously, you can use anything you want, but for simplicity, I'm going to show three easy options to get you started:</p> <h3 id="option-1-copy-the-existing-style">Option 1, copy the existing style.</h3> <p>So if your preset looks like this:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">{</span> <span class="s">"TeensySF"</span><span class="p">,</span> <span class="s">"tracks/venus.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"cyan"</span><span class="p">},</span> </code></pre></div></div> <p>Then you just copy the style, and the comma after it, like so:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">{</span> <span class="s">"TeensySF"</span><span class="p">,</span> <span class="s">"tracks/venus.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"cyan"</span><span class="p">},</span> </code></pre></div></div> <p>Now the new LEDs will behave exactly like the main blade. That might not be what you actually want, but it's always a good idea to keep it simple first and make one more change at a time.</p> <h2 id="option-2-get-a-style-from-somewhere">Option 2, get a style from somewhere</h2> <p>You can use the style generator, take a style posted somewhere, or one that came with a sound font. You just insert the new style after the old one, exactly like we did above, the result might look like:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">{</span> <span class="s">"TeensySF"</span><span class="p">,</span> <span class="s">"tracks/venus.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">SimpleClash</span><span class="o">&lt;</span><span class="n">Lockup</span><span class="o">&lt;</span><span class="n">Blast</span><span class="o">&lt;</span><span class="n">Cylon</span><span class="o">&lt;</span><span class="n">Rgb</span><span class="o">&lt;</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">64</span><span class="o">&gt;</span><span class="p">,</span><span class="mi">15</span><span class="p">,</span><span class="mi">10</span><span class="p">,</span> <span class="n">DeepSkyBlue</span><span class="p">,</span><span class="mi">15</span><span class="p">,</span><span class="mi">100</span><span class="p">,</span><span class="mi">2000</span><span class="p">,</span><span class="n">Cylon</span><span class="o">&lt;</span><span class="n">Rgb</span><span class="o">&lt;</span><span class="mi">64</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="o">&gt;</span><span class="p">,</span><span class="mi">15</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span> <span class="n">Red</span><span class="p">,</span><span class="mi">15</span><span class="p">,</span><span class="mi">57</span><span class="p">,</span><span class="mi">2000</span><span class="p">,</span><span class="n">Cylon</span><span class="o">&lt;</span><span class="n">Rgb</span><span class="o">&lt;</span><span class="mi">0</span><span class="p">,</span><span class="mi">40</span><span class="p">,</span><span class="mi">0</span><span class="o">&gt;</span><span class="p">,</span><span class="mi">15</span><span class="p">,</span><span class="mi">7</span><span class="p">,</span> <span class="n">Green</span><span class="p">,</span><span class="mi">15</span><span class="p">,</span><span class="mi">37</span><span class="p">,</span><span class="mi">2000</span><span class="o">&gt;&gt;&gt;</span><span class="p">,</span><span class="n">White</span><span class="o">&gt;</span><span class="p">,</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">Blue</span><span class="p">,</span><span class="n">White</span><span class="o">&gt;&gt;</span><span class="p">,</span><span class="n">White</span><span class="o">&gt;&gt;</span><span class="p">(),</span> <span class="s">"cyan"</span><span class="p">},</span> </code></pre></div></div> <p>This is just an example of course, the style you use might be much shorter. (Or, in some cases, much longer.)</p> <h2 id="option-3-make-the-new-leds-black">Option 3, make the new LEDs black</h2> <p>This can be nice for some presets that don't need the extra bling. In this case we simply set the new style to black, like so:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">{</span> <span class="s">"TeensySF"</span><span class="p">,</span> <span class="s">"tracks/venus.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">Black</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"cyan"</span><span class="p">},</span> </code></pre></div></div> <p>Now, please note that you may have a charging style that looks something like this:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">{</span> <span class="s">"TeensySF"</span><span class="p">,</span> <span class="s">"tracks/mars.wav"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">style_charging</span><span class="p">,</span> <span class="s">"Battery</span><span class="se">\n</span><span class="s">Level"</span><span class="p">}</span> </code></pre></div></div> <p>Note that &quot;&amp;style_charging&quot; <em>is</em> a style, even if it looks different from most other styles. All the options above apply the same. Here is what it would look like if make the crystal chamber off/black while charging.</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">{</span> <span class="s">"TeensySF"</span><span class="p">,</span> <span class="s">"tracks/mars.wav"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">style_charging</span><span class="p">,</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">Black</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"Battery</span><span class="se">\n</span><span class="s">Level"</span><span class="p">}</span> </code></pre></div></div> <p>Ok, so there you go. Save the config file and upload your new configuration.</p> <p><code> WS2811BladePtr&lt;97, WS2811_800kHz | WS2811_RGB, blade2Pin, PowerPINS&lt;bladePowerPin1&gt;&gt;()</code></p> <ol> <li>First argument specifies the number of LEDs in the strip</li> <li>Second argument specifies configuration options that are specific to the LED strip</li> </ol> <p>Color order onfiguration options:</p> <ul> <li>WS2811_RGB</li> <li>WS2811_RBG</li> <li>WS2811_GRB</li> <li>WS2811_GBR</li> </ul> <p>Data clock rate configuration options:</p> <ul> <li>WS2811_800kHz</li> <li>WS2811_400kHz</li> <li>WS2813_800kHz</li> <li>WS2811_580kHz</li> <li>WS2811_ACTUALLY_800kHz</li> </ul> <ol start="3"> <li>Data pin that is used to drive the specific LED strip:</li> </ol> <ul> <li>bladePin</li> <li>blade1Pin (ProffieBoard)</li> <li>blade2Pin (ProffieBoard)</li> <li>blade3Pin (ProffieBoard)</li> <li>blade4Pin (ProffieBoard)</li> <li>blade5Pin (ProffieBoard)</li> </ul> <p>On a teensysaber, pin 8 and 9 can be used if not used as a serial port.</p> <ol start="4"> <li>FET transistor output that enables power to the LED strip:</li> </ol> <ul> <li>bladePowerPin1</li> <li>bladePowerPin2</li> <li>bladePowerPin3</li> <li>bladePowerPin4</li> <li>bladePowerPin5</li> <li>bladePowerPin6</li> </ul> <p><strong>If no option is set Pin Array object is created for bladePowerPin1, bladePowerPin2 and bladePowerPin3</strong></p> <p>Addresable LEDs have 4 signals (WS2813 have additional bypass line)</p> <ul> <li>VCC</li> <li>GND</li> <li>DATA IN</li> <li>DATA OUT</li> </ul> <p>The ProffieOS supports the following types:</p> <ul> <li>WS2812</li> <li>WS2812B</li> <li>WS2813</li> <li>PL9823</li> <li>SK6812</li> </ul> <hr /> <h2 id="protection">Protection</h2> <ol> <li>As the led strips get immense amount of current, it is good suggestion to use thick wires for VCC and GND to avoid heat/power loss.</li> <li>It is good practice to put large electrolytic capacitor ( 470uF to 2200uF) as close as possible to the strip to avoid spontaneous current draws, that might occur.</li> <li>In order to protect the first addressable led in the chain from voltage spikes and additionally to make sure those spikes don't disrupt the integrity of the communication signal, a series resistor must be put as close as possible to the LED strip (100ohm to 470ohm)</li> </ol> <hr /> <h2 id="neopixel">Neopixel</h2> <p>NeoPixel is Adafruit's brand of individually-addressable red-green-blue (RGB) LED. They are based on the WS2812 LED and WS2811 driver, where the WS2811 is integrated into the LED, for reduced footprint. The control protocol for NeoPixels is based on only one communication wire.</p> <p>From ProffieOS 7.x, sound fonts can can have alternatives for some or all sound effects.</p> <h2 id="file-structure">File structure</h2> <p>Let's say we want to create a light and a dark version of the same font, and the only sounds we actually want to change to do that is the hum and the force sounds.</p> <p>Before, our font directory looks like this: (some effects omitted for brevity.)</p> <pre><code class="language-txt">clsh/ font.wav force/ hum.wav in/ out/ swingl/ swingh/ </code></pre> <p>The force directory then contains a number of files, like:</p> <pre><code class="language-txt">force/01.wav force/02.wav force/03.wav </code></pre> <p>Now, to set up this font with two alternatives, we create alt directories called alt000 and alt001. Alt directories must always have three digits and always start at 000. We then move the hum.wav and force directory into one of the alt directories, and we create a new hum and force for the other alt directory. Our top level directory thus looks like:</p> <pre><code class="language-txt">alt000/ alt001/ clsh/ font.wav in/ out/ swingl/ swingh/ </code></pre> <p>And the alt directories have the following content:</p> <pre><code class="language-txt">alt000/force/01.wav alt000/force/02.wav alt000/force/03.wav alt000/hum.wav alt001/force/01.wav alt001/force/02.wav alt001/force/03.wav alt001/hum.wav </code></pre> <p>Note that alt001/force and alt002/force has the same number of files in it. This is important; every alt directory MUST have exactly the same set of files in them. Only the length and content of the files can be different. If you don't have the same set of files, you will get an &quot;error in font directory&quot; error.</p> <h2 id="controlling-which-alternative-is-used">Controlling which alternative is used.</h2> <p>Ok, so now our sound font has two sets of hum and force sounds, but how do we select which set of sounds is actually used? ProffieOS does not actually do anything to select which alternative is used by default, it just provides ways for you to do it, either from a blade style, or from a prop. I will now describe a few ways that this could work, but it's by no means the only ways.</p> <h3 id="syncalttovariance">SyncAltToVariance</h3> <p>By putting SyncAltToVarianceL or SyncAltToVarianceF in your style, which alt is used will be linked to the variance. This makes it super-easy to create blade styles which switch colors AND sounds at the same time. Any controls used to change the variance (color change) will also affect the alt sounds.</p> <p>Example, here is a simple layered style:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">Layers</span><span class="o">&lt;</span> <span class="n">ColorChange</span><span class="o">&lt;</span><span class="n">TrFade</span><span class="o">&lt;</span><span class="mi">300</span><span class="o">&gt;</span><span class="p">,</span><span class="n">Red</span><span class="p">,</span><span class="n">Blue</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">LockupL</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">Rainbow</span><span class="p">,</span><span class="n">White</span><span class="o">&gt;&gt;</span><span class="p">,</span> <span class="n">SimpleClashL</span><span class="o">&lt;</span><span class="n">White</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">InOutHelperL</span><span class="o">&lt;</span><span class="n">InOutFuncX</span><span class="o">&lt;</span><span class="n">Int</span><span class="o">&lt;</span><span class="mi">300</span><span class="o">&gt;</span><span class="p">,</span><span class="n">Int</span><span class="o">&lt;</span><span class="mi">800</span><span class="o">&gt;&gt;&gt;&gt;&gt;</span><span class="p">()</span> </code></pre></div></div> <p>SyncALtToVarianceL is an always-transparent layer, so we can basically insert it anywhwere in the layer stack, except at the beginning:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">Layers</span><span class="o">&lt;</span> <span class="n">ColorChange</span><span class="o">&lt;</span><span class="n">TrFade</span><span class="o">&lt;</span><span class="mi">300</span><span class="o">&gt;</span><span class="p">,</span><span class="n">Red</span><span class="p">,</span><span class="n">Blue</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">SyncAltToVarianceL</span><span class="p">,</span> <span class="n">LockupL</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">Rainbow</span><span class="p">,</span><span class="n">White</span><span class="o">&gt;&gt;</span><span class="p">,</span> <span class="n">SimpleClashL</span><span class="o">&lt;</span><span class="n">White</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">InOutHelperL</span><span class="o">&lt;</span><span class="n">InOutFuncX</span><span class="o">&lt;</span><span class="n">Int</span><span class="o">&lt;</span><span class="mi">300</span><span class="o">&gt;</span><span class="p">,</span><span class="n">Int</span><span class="o">&lt;</span><span class="mi">800</span><span class="o">&gt;&gt;&gt;&gt;&gt;</span><span class="p">()</span> </code></pre></div></div> <p>There, now alt and variance will be synchronized, so the Red color will play alt000 sounds and the Blue color will play alt001 sounds.</p> <h3 id="trdoeffectlteffectaltsound-ngt">TrDoEffect&lt;EFFECT_ALT_SOUND, N&gt;</h3> <p>By using TrDoEffect, with the EFFECT_ALT_SOUND effect, we can have the style explicitly select which alt sounds are used. This means that you can trigger alt sounds based on effects and pulses. This creates the ability to move between states in the style, and you can check which state you are in by using the AltF function. The possibilities here are endless, but also more complicated, so I will leave it up to the reader to figure out good examples of how to use this.</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">Layers</span><span class="o">&lt;</span> <span class="n">ColorSelect</span><span class="o">&lt;</span><span class="n">AltF</span><span class="p">,</span><span class="n">TrWipe</span><span class="o">&lt;</span><span class="mi">300</span><span class="o">&gt;</span><span class="p">,</span><span class="n">Green</span><span class="p">,</span><span class="n">Blue</span><span class="p">,</span><span class="n">Red</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">TransitionEffectL</span><span class="o">&lt;</span><span class="n">TrDoEffectX</span><span class="o">&lt;</span><span class="n">TrInstant</span><span class="p">,</span><span class="n">EFFECT_ALT_SOUND</span><span class="p">,</span><span class="n">EffectIncrementF</span><span class="o">&lt;</span><span class="n">EFFECT_FORCE</span><span class="p">,</span><span class="n">Int</span><span class="o">&lt;</span><span class="mi">3</span><span class="o">&gt;&gt;&gt;</span><span class="p">,</span><span class="n">EFFECT_FORCE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">InOutTrL</span><span class="o">&lt;</span><span class="n">TrWipe</span><span class="o">&lt;</span><span class="mi">300</span><span class="o">&gt;</span><span class="p">,</span><span class="n">TrWipeIn</span><span class="o">&lt;</span><span class="mi">500</span><span class="o">&gt;</span><span class="p">,</span><span class="n">Black</span><span class="o">&gt;&gt;&gt;</span><span class="p">()</span> </code></pre></div></div> <p>This style will increment the alt and color by 1 each time EFFECT_FORCE is triggered, so Green color will play alt000 sounds, Blue color will play alt001 sounds and Red color will play alt002 sounds. The TransitionEffectL&lt;&gt; layer controls the change for EFFECT_ALT_SOUND which in turn changes the ColorSelect via the AltF function.</p> <h3 id="have-the-prop-control-the-alt">Have the prop control the alt.</h3> <p>If your prop has builtin modes, it might make sense to switch alt sounds when you switch mode as well. For fonts that don't have alt sounds, this will have no effect. A prop that wants to do this should call SaberBase::DoEffect(EFFECT_ALT_SOUND, 0.0, N), which is basically the same as the TrDoEffect&lt;&gt; shown above. The prop could also control the variance, and let the style decide if the font should be synchronized with the variance or not. Doing it this way would essentially disable the &quot;color change&quot; functionality though.</p> <h3 id="altchng">altchng</h3> <p>When the alt is changed, the altchng effect is played. If the altchng effect is itself located in the alt folders, then it is played from the <em>new</em> alternative. (So if you switch from alt000 to alt004, it may play alt004/altchng/001.wav) Note that there is generally no way to select which altchng sound to play, since the number which is normally used to select which sound to play, is now used to select which alternative to use instead.</p> <p>While a bit lengthy, and hard to put into typed words, hopefully this helps you understand how to read error messages and what they are caused by.<br> First, understand that a long list of errors does not necessarily mean there’s a ton of errors. They are just a cascade effect from the first problem. If the compiler comes across something it doesn’t like, let’s say a brace that should be part of an open-close pair but there’s only an opening one without a closing brace, it will continue through the rest of the code trying to pair the remaining odd number of braces, finding each one mis-matched, and will spit out an error for ALL of those problems. If the first one gets repaired, all the others will not occur.</p> <p>Fortunately, Arduino error messages indicate a line number AND character number in the message, AND give you a little caret symbol underneath one of the characters. (little upward pointing arrow, pointing at a character). Understand that it is not necessarily pointing at the problem, but is actually pointing at the part of the code it &quot;choked&quot; on. So for example, if it was pointing at a closing brace at the end of a preset, the problem is likely a PREVIOUS character, like a missing or extra comma in the line before. It could also be pointing at a Closing brace that it came to without having read an Opening brace first. In that case, back at the beginning of a section, a preset, or higher up in the config, there's a missing opening brace somewhere. In other words, it's missing it's paired brace and it's saying....close? Close what? Nothing told me to open (missing open brace)</p> <h1 id="incorrect-number-of-blade-styles-in-preset">Incorrect number of blade styles in preset</h1> <p>You have to have a blade style for every &quot;blade&quot; defined in the Bladeconfig section at the bottom of your config file. If you have 3 blades (a main blade, a crystal chamber LED, and another LED pixel accent for example), then there needs to be 3 blade styles in each preset. This is a typical error, indicating there's at least one preset with too little or too many styles.</p> <pre><code>error: too many initializers for 'Preset' 421 | }; </code></pre> <h1 id="transparent-color-as-base-layer">Transparent color as base layer</h1> <p>The error generated if this is the case will say:</p> <pre><code>error: conversion from 'RGBA_um_nod' to non-scalar type 'OverDriveColor' requested </code></pre> <p>The base layer of a blade style can not be an AlphaL with transparency. Such as:</p> <pre><code>StylePtr&lt;Layers&lt; AlphaL&lt;Red,Int&lt;16000&gt;&gt;,........... </code></pre> <p>The quick fix is to simply add a Black layer underneath everything else, since that won't be a visible difference, and it qualifies as a solid color as the first layer. So like:</p> <pre><code>StylePtr&lt;Layers&lt;Black, AlphaL&lt;Red,Int&lt;16000&gt;&gt;,........... </code></pre> <h2 id="example-for-the-next-few-sections">Example for the next few sections:</h2> <p>A config file named my_config.h that contains 2 blades, therefore 2 blade styles per preset. Here’s the preset:</p> <pre><code>17 { &quot;JediFont&quot;, &quot;tracks/GoodGuys.wav&quot;, 18 StylePtr&lt;Cylon&lt;SpringGreen,5,5,DeepSkyBlue,5,50,200&gt;&gt;(), 19 StylePtr&lt;InOutHelper&lt;DeepSkyBlue,100,100&gt;&gt;(), 20 &quot;jedi&quot; }, </code></pre> <h1 id="strongmissing-comma-after-a-blade-stylestrong"><strong>Missing comma after a blade style:</strong></h1> <p>A missing comma at the end of a blade style error can look like this:</p> <pre><code>In file included from /User/Desktop/ProffieOS/ProffieOS.ino:556:0: sketch/config/my_config.h:19:2: error: expected '}' before 'StylePtr' StylePtr&lt;InOutHelper&lt;DeepSkyBlue,100,100&gt;&gt;(), ^ </code></pre> <p>The pointer is indicating the first character of the second blade style. Here, you should look for what’s wrong just before this character. In this case, even though the compiler says it was looking for a brace, it was actually a missing comma after the first blade style as seen here:</p> <pre><code>17 { &quot;JediFont&quot;, &quot;tracks/GoodGuys.wav&quot;, 18 StylePtr&lt;Cylon&lt;SpringGreen,5,5,DeepSkyBlue,5,50,200&gt;&gt;() 19 StylePtr&lt;InOutHelper&lt;DeepSkyBlue,100,100&gt;&gt;(), 20 &quot;jedi&quot; }, </code></pre> <p>This is a case where the compiler got to the end of the first style and found no comma, so it assumed it was the end of the preset, and expected a closing brace }<br></p> <h1 id="strongmissing-or-an-extra-lt-or-gt-in-a-blade-stylestrong"><strong>Missing or an extra &lt; or &gt; in a blade style:</strong></h1> <p>An extra &gt; error usually looks like this:<br></p> <pre><code>In file included from /User/Desktop/ProffieOS/ProffieOS.ino:556:0: sketch/config/my_config.h:18:57: error: expected primary-expression before ')' token StylePtr&lt;Cylon&lt;SpringGreen,5,5,DeepSkyBlue,5,50,200&gt; &gt; &gt;(), ^ </code></pre> <p>The pointer is indicating a StylePtr’s close, but that’s because the compiler got to that and said…whut?? The problem here is that there’s an extra &gt; before it at the end of the style (I spaced it out for visibility) and it’s messing up the order of things. If you read the file line and character number, you’ll see it’s line 18, character 57, which is indeed the extra &gt;.</p> <p>Conversely, a MISSING &gt; at the end of the same style, so StylePtr&lt;Cylon&lt;SpringGreen,5,5,DeepSkyBlue,5,50,200&gt;(),<br /> makes this error:</p> <pre><code>In file included from /User/Desktop/ProffieOS/ProffieOS.ino:556:0: sketch/config/my_config.h:19:45: error: call to non-constexpr function 'StyleFactory* StylePtr() [with STYLE = Layers&lt;Rgb&lt;0, 135, 255&gt;, AlphaL&lt;Rgb&lt;0, 0, 0&gt;, InOutHelperF&lt;InOutFuncX&lt;Int&lt;100&gt;, Int&lt;100&gt; &gt;, true&gt; &gt; &gt;]' StylePtr&lt;InOutHelper&lt;DeepSkyBlue,100,100&gt;&gt;(), ^ </code></pre> <p>Notice how now the pointer is indicating a StylePtr’s close again, but THIS time, it’s at the NEXT style’s ending on line 19. The missing closing &gt; for the first style’s Cylon effect has thrown off the correct formatting, and the compiler thought the whole next line was still part of the first style.</p> <h1 id="strongmisspellingstrong"><strong>Misspelling:</strong></h1> <p>The error should be pretty clear about this, just look at the thing it’s telling you “was not declared in this scope”, for example, an extra e in Green seen here:</p> <pre><code>In file included from /User/Desktop/ProffieOS/ProffieOS.ino:556:0: sketch/config/my_config.h:18:17: error: 'SpringGreeen' was not declared in this scope StylePtr&lt;Cylon&lt;SpringGreeen,5,5,DeepSkyBlue,5,50,200&gt;&gt;(), ^ </code></pre> <h1 id="strongwrong-board-version-selectedstrong"><strong>Wrong Board version Selected:</strong></h1> <pre><code>#error Please select Proffieboard V2 in Tools-&gt;Board </code></pre> <p>Self explanatory.</p> <h1 id="strongweird-unicode-character-errors-strong"><strong>Weird Unicode character errors :</strong></h1> <p>The error message will say something like: &quot; error: stray '\342' &quot;, or “stray '\200' &quot;, or “stray '\234' &quot;</p> <p>It seems that lately this is mostly a specific problem encountered by using a newer MacOS version of Textedit, but it could happen to anyone, including even straight copy/pasting from the Proffieboard Configurator page or using Windows Notepad.</p> <p>Everything will appear fine in your config file on the surface, but this error means it contains one or more stylized characters, like fancy quotation marks, italicized looking braces etc... that are not valid characters to the Arduino compiler.</p> <p>The fix is to delete the offending character(s) and retype them. Sometimes it can even be a return character (invisible) so deleting back to the last character in the previous line and typing a new return sometimes is needed. That being said, you need to make sure your text editing software is set to PLAIN TEXT. In MacOS's Textedit, this option has changed defaults lately, so go to the menubar&gt;Format&gt;Make Plain Text before re-typing the characters. This is another reason I highly suggest using SublimeText instead, as it uses proper unicode for coding, numbered lines, is color coded, and can even &quot;spell-check&quot; your code using linting if you want.</p> <p>Here's an example:<br></p> <p><code>{ &quot;KyberTROS&quot;, &quot;tracks/TwoThemes.wav”,</code></p> <p>Notice the last quotation mark is fancy/italicized.</p> <p>Hard to catch, but nonetheless it is the problem. Here's what the error would look like:<br></p> <pre><code>In file included from /User/Desktop/ProffieOS/ProffieOS.ino:556:0: sketch/config/my_config.h:17:1: error: missing terminating &quot; character { &quot;KyberTROS&quot;, &quot;tracks/TwoThemes.wav”, ^ </code></pre> <p>If you look, you can see that it didn’t like something about the file my_config.h, line 17, character 1, and in this case that’s the opening brace. Now this is not a great example because the problem lies AFTER the reported character, but this happens, and sometimes you need to look before AND after the little pointer to see what’s wrong, but it’s always close by. However, in this case, it DOES tell you in plain English that there’s a missing terminating &quot; character. That’s because the ” is not the same as &quot; . So there’s your problem. Delete the fancy/italicized weird Unicode ” with a nice plain text &quot; , save the file, and then try Verify again. Alternately, selecting the whole body of the file and Make Plain Text should work as well (shift+cmd+F in MacOS Textedit)</p> <h1 id="strongbase-layer-cant-have-transparencystrong"><strong>Base layer can't have transparency</strong></h1> <p>If you have an AlphaL as the base layer in a blade style, you'll see this error:</p> <pre><code> error: conversion from 'RGBA_nod' to non-scalar type 'OverDriveColor' requested </code></pre> <p>The base color needs to be a non-Alpha color. Depending on the desired look, even just adding a base layer of Black will suffice.</p> <h1 id="strongproffieboard-plug-in-not-selected-correctlystrong"><strong>Proffieboard plug-in not selected correctly</strong></h1> <p>This is a typical error message you'll see if you don't have the board selected in Arduino menu Tools&gt;Board&gt;Proffieboard&gt;Proffieboard (Version)</p> <pre><code>FS.h No such file or directory </code></pre> <h1 id="text-will-not-fit-in-region-flash">'.text' will not fit in region 'FLASH'</h1> <p>This means that you've configured too many things, and ProffieOS won't fit in the available memory anymore. See the <a href="/howto/saving-memory.html">saving memory page</a> for things you can do to fix it.</p> <ol> <li> <p>charge the battery and see if that helps</p> </li> <li> <p>try &quot;get_volume&quot; in the serial monitor and make sure it's at least 1000, you can also try the &quot;beep&quot; command</p> </li> <li> <p>With the board off, measure resistance across the speaker pads if you see....</p> <p>... less than 1 ohm, you may have a short somewhere, or a broken speaker</p> <p>... more than 10 ohm, you have a broken speaker</p> <p>... 3-9 ohms, should be ok</p> </li> <li> <p>With the board on, and while it's ignited, check the voltage between GND and the 5v pad, is it about 5 volts? (If not, there is something wrong with the voltage booster.)</p> </li> <li> <p>Switch your multimeter to AC measurements and measure between the speaker pads, do you see voltage when it's supposed to be playing? (And no voltage when it's not.) (If not, you may have a broken amplifier.)</p> </li> </ol> <p>If you're using the DISABLE_TALKIE define to save memory, the spoken error messages from the <a href="/troubleshooting/what-is-it-saying.md">&quot;What is it saying?&quot; page</a> will be replaced with beeps. This page will let you figure out what those beeps mean. Once you figure out which one is is, go to the <a href="/troubleshooting/what-is-it-saying.html">What is it saying? page</a> to find out what to do about it.</p> <p>Try clicking on each line to hear what it sounds like.</p> <center style="font-size:0;"> <image src="/troubleshooting/images/font_directory_not_found.png" alt="Font directory not found" onclick='(new Audio("/troubleshooting/sound/font_directory_not_found.wav")).play()' /></br><image src="/troubleshooting/images/sd_card_not_found.png" alt="SD card not found" onclick='(new Audio("/troubleshooting/sound/sd_card_not_found.wav")).play()' /></br><image src="/troubleshooting/images/error_in_font_directory.png" alt="Error in font directory" onclick='(new Audio("/troubleshooting/sound/error_in_font_directory.wav")).play()' /></br><image src="/troubleshooting/images/error_in_blade_array.png" alt="Error in blade array" onclick='(new Audio("/troubleshooting/sound/error_in_blade_array.wav")).play()' /></br><image src="/troubleshooting/images/battery_low.png" alt="Battery low" onclick='(new Audio("/troubleshooting/sound/battery_low.wav")).play()' /></br><image src="/troubleshooting/images/aliens_are_here.png" alt="Aliens are here" onclick='(new Audio("/troubleshooting/sound/aliens_are_here.wav")).play()' /></br> </center> <p>That last one is not actually an error message, it's the sounds you hear if you use the &quot;beep&quot; command, and is also the notes from &quot;Close Encounters of the 3rd Kind&quot;.</p> <h3 id="try-singing-it">Try singing it</h3> <p>All of the beep codes above were composed with the same number of notes as the syllables in the error message. If you can sing the error code to the beep codes, then maybe you can figure out what the problem is without consulting this page. This video might help visualize things as well: <a href="https://www.youtube.com/watch?v=bVPDhBp1l9c">https://www.youtube.com/watch?v=bVPDhBp1l9c</a></p> <p>Proffie OS allows the use of multiple blades configurations.</p> <p>All blades are defined in object array of type <em>BladeConfig</em>. Blade selection works with resistance measurement on the ID pin of the board. If no more then one blade configurations are defined in the array, it will be selected regardless of the resistance on the pin.</p> <p>Example: The following code defines two blade configurations. If you connect 2.6k Resistor between ID and GND pin, the saber board will be configured to use neopixel setup with style configuration in the <em>presets</em> array. Similarly the second configuration switches to Tri-Cree setup. To learn how to configure presets array check out the <a href="/config/preset-configuration.html">Preset Configuration</a> page.</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">BladeConfig</span> <span class="n">blades</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span><span class="mi">2600</span><span class="p">,</span> <span class="n">WS2811BladePtr</span><span class="o">&lt;</span><span class="mi">144</span><span class="p">,</span> <span class="n">WS2811_ACTUALLY_800kHz</span> <span class="o">|</span> <span class="n">WS2811_GRB</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">presets</span><span class="p">)</span> <span class="p">},</span> <span class="p">{</span><span class="mi">13000</span><span class="p">,</span> <span class="n">SimpleBladePtr</span><span class="o">&lt;</span><span class="n">CreeXPL</span><span class="p">,</span> <span class="n">CreeXPL</span><span class="p">,</span> <span class="n">CreeXPL</span><span class="p">,</span> <span class="n">NoLED</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">white_presets</span><span class="p">)</span> <span class="p">},</span> <span class="p">};</span> </code></pre></div></div> <p>For more information about the blades array, see <a href="/config/the-config_presets-section.html">The CONFIG_PRESETS section</a> page.</p> <h2 id="led-support">LED Support</h2> <p>Most major LEDs that are used in the saber practice are already defined as templates (CreeXPE2White, CreeXPE2Blue and etc.), and their current and voltage values are defined so that the PWM engine can drive them accordingly.</p> <p><strong>Note</strong>: For direct drive it is still good practice to use a resistor to prolong the LED dye lifespan.</p> <p>For more info on direct drive LEDs, see <a href="/config/blades/led-configuration.html">this page</a>.</p> <h2 id="subblade">SubBlade</h2> <p>When using addressable LED strip, a single strip can be separated into a couple of sub blades with their own style configuration and behaviour. This is really useful when you want to use only one data pin for all the addressable LEDs in your setup.</p> <p>Example for SubBlade usage:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">BladeConfig</span> <span class="n">blades</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="mi">0</span><span class="p">,</span> <span class="n">SubBlade</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">WS2811BladePtr</span><span class="o">&lt;</span><span class="mi">146</span><span class="p">,</span> <span class="n">WS2811_580kHz</span><span class="o">&gt;</span><span class="p">()),</span> <span class="n">SubBlade</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">14</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">),</span> <span class="c1">// Quillon A</span> <span class="n">SubBlade</span><span class="p">(</span><span class="mi">15</span><span class="p">,</span><span class="mi">26</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">),</span> <span class="c1">// Quillon B</span> <span class="n">SubBlade</span><span class="p">(</span><span class="mi">27</span><span class="p">,</span> <span class="mi">145</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">)</span> <span class="c1">// Main Blade</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">presets</span><span class="p">)</span> <span class="p">}</span> <span class="p">};</span> </code></pre></div></div> <p>Sample Preset that works with sub-blades:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define FIRE1_SPEED 2 #define FIRE1_DELAY 800 #define FIRE1_NORMAL 0, 1000, 2 #define FIRE1_CLASH 3000, 0, 0 #define FIRE1_LOCKUP 0, 5000, 10 #define FIRE1PTR(NUM, DELAY) \ StyleFirePtr&lt;RED, YELLOW, NUM, DELAY, FIRE1_SPEED, \ FIRE1_NORMAL, FIRE1_CLASH, FIRE1_LOCKUP&gt;() </span> <span class="n">Preset</span> <span class="n">presets</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="s">"font01"</span><span class="p">,</span> <span class="s">"tracks/title.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">YELLOW</span><span class="p">,</span> <span class="n">WHITE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">RED</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">,</span> <span class="c1">//Accent Pixel Style</span> <span class="n">FIRE1PTR</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">FIRE1_DELAY</span><span class="p">),</span> <span class="c1">//Quilon A Style</span> <span class="n">FIRE1PTR</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">FIRE1_DELAY</span><span class="p">),</span> <span class="c1">//Quilon A Style</span> <span class="n">FIRE1PTR</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="c1">//Main Blade Style</span> <span class="p">}</span> <span class="p">};</span> </code></pre></div></div> <p>For more details check out the <a href="/config/blades/subblade.html">SubBlade</a> page.</p> <p>Blade Detect typically uses a floating pin on the hilt side PCB that only gets connected when the ring of the blade side PCB contacts it and another pin in the same ring footprint. A latching button or switch could also be used.<br /> This latching action is detected by the board and triggers a sound and a swap of which blade configuration is used; NO_BLADE or a blade present one. The active blades[] array specifies which CONFIGARRAY (bank of presets) to use, so you get to have a different group of presets used depending on the presence of a blade or not.<br /> Example BladesConfig using Blade Detect:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="n">BladesConfig</span> <span class="n">blades</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="mi">0</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">144</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">blade_in</span><span class="p">)</span> <span class="p">},</span> <span class="p">{</span> <span class="n">NO_BLADE</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">144</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">no_blade</span><span class="p">),</span> <span class="s">"nbsave"</span> <span class="p">}</span> <span class="p">};</span> </code></pre></div></div> <p>Please note the &quot;nbsave&quot; part, which will make ProffieOS save presets.ini and other related save files into the &quot;nbsave/&quot; directory on the SD card. If that directory doesn't exist, saving will fail, but that might be ok for the no-blade case.</p> <p>Blade detection is activated by using the BLADE_DETECT_PIN define in the <a href="/config/the-config_top-section">CONFIG_TOP</a> section of the config file.<br /> The pin number can either be just a number, or a symbolic name like &quot;blade2Pin&quot;. See these 2 examples:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define BLADE_DETECT_PIN 0 </span></code></pre></div></div> <p>or</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define BLADE_DETECT_PIN blade4Pin </span></code></pre></div></div> <p>All pins that are hooked up directly to the CPU can be used for blade detect, so data pins, free pins, button pins and RX/TX, with the exception of Data1 because it’s already bridged to a resistor.<br /> The blade detect pin will be monitored continuously, when it changes, the Blade ID routines will be re-triggered. In addition, when not connected to anything, Blade ID will be offset by the value of NO_BLADE, which equals a billion.</p> <p>The detection works by repeatedly switching between pull-up and pull-down mode and see if the input follows, or if it stays put at high or low. That means that it doesn't matter if the blade ID pin is connected to GND or BATT+, which is a good thing, because when connected to the '-' pad on an LED pixel strip, that can flip between high and low when the FETs are turned on/off.</p> <p>Here's an example template of a config file formatted to use Blade Detect:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// This is a simplified config file template set up for Blade Detect.</span> <span class="cp">#ifdef CONFIG_TOP #define BLADE_DETECT_PIN blade4Pin </span><span class="c1">// other defines go here</span> <span class="cp">#endif </span> <span class="cp">#ifdef CONFIG_PROP #include</span> <span class="cpf">"../props/PROP_FILE_OF_CHOICE_GOES_HERE.h"</span><span class="cp"> #endif </span> <span class="cp">#ifdef CONFIG_PRESETS </span> <span class="n">Preset</span> <span class="n">no_blade</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="s">"font"</span><span class="p">,</span> <span class="s">"tracks/track"</span><span class="p">,</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">Blue</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"preset name"</span><span class="p">},</span> <span class="p">};</span> <span class="c1">//---------------------------------------------------------------</span> <span class="n">Preset</span> <span class="n">blade_in</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="s">"font"</span><span class="p">,</span> <span class="s">"tracks/track"</span><span class="p">,</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">Red</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"preset name"</span><span class="p">},</span> <span class="p">};</span> <span class="n">BladesConfig</span> <span class="n">blades</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="n">NO_BLADE</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">144</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">no_blade</span><span class="p">),</span> <span class="s">"no_blade_Save"</span> <span class="p">},</span> <span class="p">{</span> <span class="mi">0</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">144</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">blade_in</span><span class="p">),</span> <span class="s">"blade_in_Save"</span> <span class="p">}</span> <span class="p">};</span> <span class="cp">#endif </span> <span class="cp">#ifdef CONFIG_BUTTONS </span><span class="n">Button</span> <span class="n">PowerButton</span><span class="p">(</span><span class="n">BUTTON_POWER</span><span class="p">,</span> <span class="n">powerButtonPin</span><span class="p">,</span> <span class="s">"pow"</span><span class="p">);</span> <span class="n">Button</span> <span class="n">AuxButton</span><span class="p">(</span><span class="n">BUTTON_AUX</span><span class="p">,</span> <span class="n">auxPin</span><span class="p">,</span> <span class="s">"aux"</span><span class="p">);</span> <span class="cp">#endif </span> </code></pre></div></div> <p>Please note that Blade Detect is separate from Blade ID and cannot use the same pin.<br /> See more about <a href="blade-id.html">Blade ID here</a>.</p> <p>Events of animations on the blade are triggered by various things.<br /> Some examples are ignition, clash, blast, etc...<br /> When these are triggered by a button event, a gesture, or other means, the way the blade knows which animation, or EFFECT to show, is by designating it in the blade style.<br /> A basic example:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">TransitionEffectL</span><span class="o">&lt;</span><span class="n">TrConcat</span><span class="o">&lt;</span><span class="n">TrWipe</span><span class="o">&lt;</span><span class="mi">50</span><span class="o">&gt;</span><span class="p">,</span><span class="n">White</span><span class="p">,</span><span class="n">TrWipe</span><span class="o">&lt;</span><span class="mi">50</span><span class="o">&gt;&gt;</span><span class="p">,</span><span class="n">EFFECT_BLAST</span><span class="o">&gt;</span> </code></pre></div></div> <p>In plain English, this says &quot;When I press the blaster deflect button, run a string of concatenated events that wipe White for 50ms, then wipe it away.&quot;<br /> Any EFFECT can be substituted in place of the EFFECT_BLAST argument above.<br /> Note that some of these EFFECTS may be included in features used by some prop files (button controls files) but not in others.</p> <p>The majority of these are self explanitory. Just read EFFECT as &quot;do something during_XXXX&quot;</p> <ul> <li><a href="#general-effects">General effects</a></li> <li><a href="#blaster-effects">Blaster effects</a></li> <li><a href="#mini-game-effects">Mini game effects</a></li> <li><a href="#user-definable-effects">User-definable effects</a></li> <li><a href="#errors">Errors</a></li> </ul> <h2 id="general-effects">General effects</h2> <h3 id="effectnone">EFFECT_NONE</h3> <p>Never generated, used as defaults in some places to mean &quot;no effect&quot;, but is otherwise not useful for anything.</p> <h3 id="clashupdate">CLASH_UPDATE</h3> <p><em>(OS 6.0+)</em> No effect in blade styles, but may be used in props and other places to detect when the strength of a clash increases after the EFFECT_CLASH has occurred..</p> <h3 id="effectclash">EFFECT_CLASH</h3> <h3 id="effectblast">EFFECT_BLAST</h3> <h3 id="effectforce">EFFECT_FORCE</h3> <h3 id="effectstab">EFFECT_STAB</h3> <h3 id="effectboot">EFFECT_BOOT</h3> <h3 id="effectlockupbegin">EFFECT_LOCKUP_BEGIN</h3> <h3 id="effectlockupend">EFFECT_LOCKUP_END</h3> <h3 id="effectdragbegin">EFFECT_DRAG_BEGIN</h3> <h3 id="effectdragend">EFFECT_DRAG_END</h3> <h3 id="effectpreon">EFFECT_PREON</h3> <h3 id="effectpostoff">EFFECT_POSTOFF</h3> <p><em>(OS 6.0+)</em></p> <h3 id="effectignition">EFFECT_IGNITION</h3> <h3 id="effectretraction">EFFECT_RETRACTION</h3> <h3 id="effectchange">EFFECT_CHANGE</h3> <p>When using color change.</p> <h3 id="effectnewfont">EFFECT_NEWFONT</h3> <p>Used when changing presets.</p> <h3 id="effectlowbattery">EFFECT_LOW_BATTERY</h3> <h3 id="effectpowersave">EFFECT_POWERSAVE</h3> <p>Typically used to apply a dimming effect on blade to conserve battery.</p> <h3 id="effectbatterylevel">EFFECT_BATTERY_LEVEL</h3> <p>Show battery level visually on blade.</p> <h3 id="effecton">EFFECT_ON</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectoff">EFFECT_OFF</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectfaston">EFFECT_FAST_ON</h3> <p>When using a feature that skips preon.</p> <h3 id="effectfastoff">EFFECT_FAST_OFF</h3> <p><em>(OS 7.0+)</em> When using a feature that bypasses postoff.</p> <h3 id="effectvolumelevel">EFFECT_VOLUME_LEVEL</h3> <p><em>(OS 7.0+)</em> Show volume level visually on blade, great for using with volume menu feature.</p> <h3 id="effectquote">EFFECT_QUOTE</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectsecondaryignition">EFFECT_SECONDARY_IGNITION</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectsecondaryretraction">EFFECT_SECONDARY_RETRACTION</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectoffclash">EFFECT_OFF_CLASH</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectnextquote">EFFECT_NEXT_QUOTE</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectinteractivepreon">EFFECT_INTERACTIVE_PREON</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectinteractiveblast">EFFECT_INTERACTIVE_BLAST</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effecttrack">EFFECT_TRACK</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectbeginbattlemode">EFFECT_BEGIN_BATTLE_MODE</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectendbattlemode">EFFECT_END_BATTLE_MODE</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectbeginautoblast">EFFECT_BEGIN_AUTO_BLAST</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectendautoblast">EFFECT_END_AUTO_BLAST</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectaltsound">EFFECT_ALT_SOUND</h3> <p><em>(OS 7.0+)</em> Triggers the change for sets of sounds within the font from one alternative to another.<br /> See: <a href="/sound/alt_sounds.html">Alt Sounds</a></p> <h3 id="effecttransitionsound">EFFECT_TRANSITION_SOUND</h3> <p><em>(OS 7.0+)</em> Triggers an optional sound effect during transitions from within a style via TrDoEffect.<br /> Basic usage example:<br /> <code>TrDoEffect&lt;CURRENT_TRANSITION,EFFECT_TRANSITION_SOUND&gt;</code><br /> Uses sounds named trNN.wav, where N is a number if more than one tr.wav exist.</p> <h3 id="effectsoundloop">EFFECT_SOUND_LOOP</h3> <p><em>(OS 7.0+)</em> Toggles an optonal sound effect loop ON/OFF from within a style via TrDoEffect.<br /> Used like a user-defined Lockup state in coordination with a control and visual effect.<br /> Uses sounds named trloopNN.wav, where N is a number if more than one trloop.wav exist.</p> <h2 id="blaster-effects">Blaster effects</h2> <h3 id="effectstun">EFFECT_STUN</h3> <h3 id="effectfire">EFFECT_FIRE</h3> <h3 id="effectclipin">EFFECT_CLIP_IN</h3> <h3 id="effectclipout">EFFECT_CLIP_OUT</h3> <h3 id="effectreload">EFFECT_RELOAD</h3> <h3 id="effectmode">EFFECT_MODE</h3> <h3 id="effectrange">EFFECT_RANGE</h3> <h3 id="effectempty">EFFECT_EMPTY</h3> <h3 id="effectfull">EFFECT_FULL</h3> <h3 id="effectjam">EFFECT_JAM</h3> <h3 id="effectunjam">EFFECT_UNJAM</h3> <h3 id="effectplion">EFFECT_PLI_ON</h3> <h3 id="effectplioff">EFFECT_PLI_OFF</h3> <h2 id="mini-game-effects">Mini game effects</h2> <h3 id="effectgamestart">EFFECT_GAME_START</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectgameaction1">EFFECT_GAME_ACTION1</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectgameaction2">EFFECT_GAME_ACTION2</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectgamechoice">EFFECT_GAME_CHOICE</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectgameresponse1">EFFECT_GAME_RESPONSE1</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectgameresponse2">EFFECT_GAME_RESPONSE2</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectgameresult1">EFFECT_GAME_RESULT1</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectgameresult2">EFFECT_GAME_RESULT2</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectgamewin">EFFECT_GAME_WIN</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectgamelose">EFFECT_GAME_LOSE</h3> <p><em>(OS 7.0+)</em></p> <h2 id="user-definable-effects">User-definable effects</h2> <h3 id="effectuser1">EFFECT_USER1</h3> <h3 id="effectuser2">EFFECT_USER2</h3> <h3 id="effectuser3">EFFECT_USER3</h3> <h3 id="effectuser4">EFFECT_USER4</h3> <h3 id="effectuser5">EFFECT_USER5</h3> <h3 id="effectuser6">EFFECT_USER6</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectuser7">EFFECT_USER7</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectuser8">EFFECT_USER8</h3> <p><em>(OS 7.0+)</em></p> <h2 id="errors">Errors</h2> <h3 id="effectsdcardnotfound">EFFECT_SD_CARD_NOT_FOUND</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effecterrorinfontdirectory">EFFECT_ERROR_IN_FONT_DIRECTORY</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effecterrorinbladearray">EFFECT_ERROR_IN_BLADE_ARRAY</h3> <p><em>(OS 7.0+)</em></p> <h3 id="effectfontdirectorynotfound">EFFECT_FONT_DIRECTORY_NOT_FOUND</h3> <p><em>(OS 7.0+)</em></p> <p>As of ProffieOS7, a new method of detecting different &quot;blades&quot; by using Blade ID is available.<br /> This can also include detecting other changes besides just blades, such as a removable chassis being inserted into a hilt.</p> <p>Where previously Blade ID scanning only would occur at power on, this new way provides continuous scanning in the background, and will detect a change in blade state in real time, at any time.</p> <p>The following defines can be added to the config file:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define BLADE_ID_SCAN_MILLIS 1000 #define BLADE_ID_TIMES 10 </span></code></pre></div></div> <p>In the example above, 1000 is the milliseconds between scans, and 10 is the number of scans that get averaged together to come up with a useable scanned value. These specific values have been tested to work well, but of course can be modified as desired.</p> <p>Additionally, a BLADE_ID_CLASS will need to be defined, as well as SHARED_POWER_PINS for this method to work.<br /> See <a href="blade-id.html">Blade ID</a> for more information.</p> <p>So you know that first number in the blade configuration?<br /> Do you know what it's for?<br /> It's the Blade ID.</p> <p>When ProffieOS starts, it measures the resistance between the Blade ID pin (which is usually the same as the neopixel data pin for the first blade) and GND. It then finds the entry in the blades table with the closest first number, and then it uses that entry until the next time it scans for a blade. This may be at power on, or triggered by <a href="blade-detect.html">Blade Detect</a>. An example of a BladeConfig with multiple, different resistor value blades is shown here:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="n">BladeConfig</span> <span class="n">blades</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="mi">5000</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">132</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">blade1_in</span><span class="p">)</span> <span class="p">},</span> <span class="p">{</span> <span class="mi">10000</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">128</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">blade2_in</span><span class="p">)</span> <span class="p">},</span> <span class="p">{</span> <span class="n">NO_BLADE</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">144</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">no_blade</span><span class="p">)</span> <span class="p">},</span> <span class="p">};</span> </code></pre></div></div> <p>So how do you use this?<br /> Well, the idea is that if you have multiple blades, you can place a resistor between the data pin and GND, and ProffieOS can use that resistor to identify which blade is connected. In the simplest possible case, this could be used to support WS281X blades of different lengths, but it's also possible to support entirely different types of blades, assuming your blade connector has enough pins.</p> <p>Note that the Blade ID resistor is different from the in-line resistor normally used for WS281X blades. The resistors are also different sizes. The in-line resistor should be 150-470 ohms, but the Blade ID resistor should be somewhere in the 2k to 100k range. Any lower may interfere with the blade data.</p> <p>The V1 electronics is still one of the best pictures for showing how this can work: <a href="https://fredrik.hubbe.net/lightsaber/electronics.html">https://fredrik.hubbe.net/lightsaber/electronics.html</a></p> <p>Unfortunately, it turns out that Proffieboard V1.5 and V2.2s are unable to do Blade ID in the same way as TeensySabers do, because there is no way to enable a pullup/pulldown resistor while doing an analog read from the pin. Several options can be defined to help with this as of ProffieOS 3.x.<br /> <em>NOTE</em> - These are not needed for a Proffieboard V3. V3 already has a Bridged Pullup internally.</p> <p>The first BLADE_ID_CLASS option is the default on Proffieboards V1.5 and V2.2s. Therefore it does not need to be specified in the config file, but here is what it is and what it does:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define BLADE_ID_CLASS SnapshotBladeID&lt;bladeIdentifyPin&gt; </span></code></pre></div></div> <p>The default blade ID class SnapshotBladeID charges up the internal sampling capacitor, then connects the sampling capacitor to the Blade ID pin for a <em>very</em> short time, and then does the analog-to-digital conversion. This should give consistent values for the same blade, but unfortunately, the values will not reflect the actual value of the Blade ID resistor in the blade. The blades array has to be configured with these measured values instead. Measured values can be found by using Serial Monitor in Arduino, and entering <code>scanid</code> while the blade is off. This will report &quot;BLADE ID: N&quot; where N is the measured value.</p> <p>Alternatively, an external pull-up resistor can be used. This resistor should be in the 20k to 50k range and placed between the blade pin and 3.3v. Then you add this to the config file:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define BLADE_ID_CLASS ExternalPullupBladeID&lt;bladeIdentifyPin, 22000&gt; </span></code></pre></div></div> <p>(Replace 22000 with the value of your pullup resistor.) With this workaround, Blade ID should return values that are close to the Blade ID resistor values, which will make configuration easier.</p> <p>Another option is to bridge the blade pin with another pin and use that pull-up resistor. This is the default method on a V3 board as it is built-in already, so it does not to be specified.<br /> On a Proffieboard V2.2, the ID pin is right next to the TX pin. If you bridge those two together, and put this is your config file:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define BLADE_ID_CLASS BridgedPullupBladeID&lt;bladeIdentifyPin, 9&gt; </span></code></pre></div></div> <p>(9 is the pin number for the TX pin) With this, Blade ID should return the actual value of the Blade ID Resistor. Use this value in the blade definition.</p> <ul> <li>Note - this means that you can't use the TX pin for anything else of course, such as a Bluetooth radio.</li> </ul> <p>Another quirk of Blade ID is that unpowered neopixels throws it off. When the neopixels are powered, the inputs are high impedance, which doesn't affect the Blade ID, but when unpowered, they leech power from the data line, which throws off the Blade ID value. The solution is to turn the power on while we're doing Blade ID by using the ENABLE_POWER_FOR_ID define. If your blade is hooked up to the LED2 and LED3 pads, it would look like this:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define ENABLE_POWER_FOR_ID PowerPINS&lt;bladePowerPin2,bladePowerPin3&gt; </span></code></pre></div></div> <p><em>IMPORTANT NOTE</em> - BladeID requires a direct, uninterrupted connection from the board's data pin to the main blade (usually the center pin on the hilt-side of the main blade PCB). Therefore using SubBlades with neopixel accents, crystal chamber, or NPXL LED PCBs in series with the main blade won't work. They can be their own SubBlade chain on a data pin other than data1, but only data1 can use BladeID.</p> <p>Here's an example template of a config file formatted to use Blade ID:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="c1">// This is a simplified config file template set up for Blade ID.</span> <span class="cp">#ifdef CONFIG_TOP #define SHARED_POWER_PINS </span><span class="c1">// #define BLADE_DETECT_PIN blade4Pin</span> <span class="cp">#define ENABLE_POWER_FOR_ID PowerPINS&lt;bladePowerPin2, bladePowerPin3&gt; </span><span class="c1">// #define BLADE_ID_CLASS ExternalPullupBladeID&lt;bladeIdentifyPin, 33000&gt; // value of resistor used</span> <span class="c1">// #define BLADE_ID_CLASS BridgedPullupBladeID&lt;bladeIdentifyPin, 9&gt; // TX pad for example</span> <span class="cm">/* This will make it use the speed-of-charging-a-capacitor method of blade ID which sometimes works without resistors. Blade ID can detect if a blade is connected or not, but it won't actually reach the NO_BLADE value, so I would recommend using something like 200000 instead of NO_BLADE. */</span> <span class="cp">#define BLADE_ID_CLASS SnapshotBladeID&lt;bladeIdentifyPin&gt; </span> <span class="cm">/* Millis is Blade ID scan interval. If the blade ID comes out the same as before, it will do nothing. If it comes out different, it will do FindBladeAgain(), which will basically initialize the saber from scratch and load the right settings for the new id(). It will only work with neopixel blades, and requires SHARED_POWER_PINS to work. */</span> <span class="cp">#define BLADE_ID_SCAN_MILLIS 1000 </span><span class="c1">// How many Blade ID scans to average</span> <span class="cp">#define BLADE_ID_TIMES 15 </span><span class="c1">// other defines go here</span> <span class="cp">#endif </span> <span class="cp">#ifdef CONFIG_PROP #include</span> <span class="cpf">"../props/PROP_FILE_OF_CHOICE_GOES_HERE.h"</span><span class="cp"> #endif </span> <span class="cp">#ifdef CONFIG_PRESETS </span> <span class="n">Preset</span> <span class="n">blade_1</span> <span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="s">"font"</span><span class="p">,</span> <span class="s">"tracks/track"</span><span class="p">,</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">Red</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"preset name"</span><span class="p">},</span> <span class="p">};</span> <span class="c1">//---------------------------------------------------------------</span> <span class="n">Preset</span> <span class="n">blade_2</span> <span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="s">"font"</span><span class="p">,</span> <span class="s">"tracks/track"</span><span class="p">,</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">Green</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"preset name"</span><span class="p">},</span> <span class="p">};</span> <span class="c1">//---------------------------------------------------------------</span> <span class="n">Preset</span> <span class="n">no_blade</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="s">"font"</span><span class="p">,</span> <span class="s">"tracks/track"</span><span class="p">,</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">Blue</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"preset name"</span><span class="p">},</span> <span class="p">};</span> <span class="n">BladesConfig</span> <span class="n">blades</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="mi">10000</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">123</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">blade_1</span><span class="p">),</span> <span class="s">"blade_1_Save"</span> <span class="p">},</span> <span class="p">{</span> <span class="mi">33000</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">144</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">blade_2</span><span class="p">),</span> <span class="s">"blade_2_Save"</span> <span class="p">},</span> <span class="p">{</span> <span class="mi">200000</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">1</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">no_blade</span><span class="p">),</span> <span class="s">"no_blade_Save"</span> <span class="p">}</span> <span class="p">};</span> <span class="cp">#endif </span> <span class="cp">#ifdef CONFIG_BUTTONS </span><span class="n">Button</span> <span class="n">PowerButton</span><span class="p">(</span><span class="n">BUTTON_POWER</span><span class="p">,</span> <span class="n">powerButtonPin</span><span class="p">,</span> <span class="s">"pow"</span><span class="p">);</span> <span class="n">Button</span> <span class="n">AuxButton</span><span class="p">(</span><span class="n">BUTTON_AUX</span><span class="p">,</span> <span class="n">auxPin</span><span class="p">,</span> <span class="s">"aux"</span><span class="p">);</span> <span class="cp">#endif </span> </code></pre></div></div> <p>As of ProffieOS7, a new method of detecting different &quot;blades&quot; by using Blade ID is available.<br /> See <a href="blade-id-constant-monitoring.html">Blade ID constant monitoring</a>.</p> <p>Blade styles specifies the look and behavior of the &quot;blade&quot;. I put &quot;blade&quot; in double quotes, because every accent led, motor or other thing you can control is generally also a &quot;blade&quot;.</p> <p>Blade styles are made by combining style templates. Style templates are sort of mix between layers in gimp and &quot;functions&quot; from high school math. When you use one, it looks like this:</p> <pre><code>StyleTemplateName&lt;FirstArgument, SecondArgument, ThirdArgument&gt; </code></pre> <p>As you can see, it looks just like using a function, but with &lt; &gt; instead of ( ). The interesting part is that these can be nested, so the arguments can also be used as functions, like this:</p> <pre><code>StyleTemplateName&lt;OtherTemplate&lt;Arg1, Arg2&gt;, AnotherTemplate&lt;Arg&gt;, ThirdArgument&gt; </code></pre> <p>Important - always check that you have not forgotten to close every opening &lt; with a &gt; and that there's a comma used in between each argument.</p> <p>A style template that takes no arguments, can be written in two ways:</p> <pre><code>Rainbow&lt;&gt; Rainbow </code></pre> <p>Now, there is one more thing we need to know, which is that not all arguments are the same. For instance, if you have a template that expects that the first argument is a number, you can't just put a color there and have it work. For our purposes, these are the categories we care about:</p> <ul> <li>COLOR: Most common type of argument, these sort of work like layers in gimp</li> <li>INTEGER: A simple number</li> <li>FUNCTION: A style template that returns a number.</li> <li>TRANSITION: Defines how to go from one color to another</li> </ul> <p>So if a template expects an argument of a particular type, you must give it an argument of that type, and not some other type, or it won't work. Here are some basic examples:</p> <pre><code>Rgb&lt;255,0,0&gt; // COLOR (red in this case), takes three INTEGERs as arguments 10 // INTEGER Int&lt;10&gt; // FUNCTION (this function always returns 10) TrFade&lt;100&gt; // TRANSITION (fade from one color to next in 100ms) Rainbow // COLOR (always changing) </code></pre> <p>Finally, in order to actually <em>use</em> a blade style, we have to wrap it in something that will create the style and return a pointer to it. This might not make any sense unless you know C++, but all you need to really know is that once you have made a blade style, you have to wrap it in SylePtr<YOUR STYLE HERE>() to actually use it. There are other ways to do this, like StyleNormalPtr(), but ultimately, they are just shorthands for a longer style that uses StylePtr&lt;&gt;.</p> <p>Now, let's dissect a very simple blade style to understand what it does:</p> <pre><code>StylePtr&lt;InOutHelper&lt;SimpleClash&lt;Lockup&lt;Blast&lt;Blue,White&gt;,AudioFlicker&lt;Blue,White&gt;&gt;,White&gt;, 300, 800&gt;&gt;() </code></pre> <p>To better see how the arguments work, we can re-format it like this:</p> <pre><code>StylePtr&lt; InOutHelper&lt; SimpleClash&lt; Lockup&lt; Blast&lt; Blue, // base blade color White // blast color &gt;, // end of blast AudioFlicker&lt;Blue,White&gt; // lockup color &gt;, // end of lockup White&gt;, // second argument to SimpleClash 300, // second argument to InOutHelper 800 // third argument to InOutHelper &gt; // end of InOutHelper &gt;() // end of StylePtr </code></pre> <p>This is a still a valid blade style, which can be placed in your config file as is. The config file will not care if there are some extra spaces or newlines or comments inside your style. Let's walk through it from inside to out.</p> <ul> <li>Blast&lt;Blue, White&gt;: Blue is the base color of this blade. Blast&lt;&gt; adds a white effect to it when the blast effect is triggered.</li> <li>Lockup&lt;..., AudioFlicker&lt;Blue, White&gt;&gt;: This adds the lockup (and drag) effects to the blade. The color used for the lockup uses AudioFlicker&lt;Blue, White&gt; to produce an unstable flickering effect between white and blue.</li> <li>SimpleClash&lt;..., White&gt;: This adds a white clash effect</li> <li>InOutHelper&lt;...., 300, 800&gt;: This adds extension (300ms) and retraction (800ms)</li> </ul> <p>Here is where you can find all the possible style templates:</p> <ul> <li>COLOR <a href="https://github.com/profezzorn/ProffieOS/tree/master/styles">https://github.com/profezzorn/ProffieOS/tree/master/styles</a></li> <li>FUNCTIONS <a href="https://github.com/profezzorn/ProffieOS/tree/master/functions">https://github.com/profezzorn/ProffieOS/tree/master/functions</a></li> <li>TRANSITIONS <a href="https://github.com/profezzorn/ProffieOS/tree/master/transitions">https://github.com/profezzorn/ProffieOS/tree/master/transitions</a></li> </ul> <p>Note - There are default values for style templates. These can be found in the files located in the styles folder. Arguments with default values can be left out, which makes it easier and shorter to write out the style, however, it can be difficult to know that those arguments are available if you are trying to change something in an existing blade style. The <a href="https://fredrik.hubbe.net/lightsaber/style_editor.html">Style Editor</a> will show all arguments for a style, so you can use it find arguments that you otherwise cannot see.</p> <p>For example, SimpleClash has a default duration of 40. In the example above, that argument is not shown, but it is nevertheless there. If you use the style editor you will see it, or if you look up the <a href="https://github.com/profezzorn/ProffieOS/blob/094b3f482d1981d47235bb40773c6424214f2b69/styles/clash.h#L6">documentation for SimpleClash</a> you can see that the full template is:</p> <pre><code>SimpleClash&lt;BASE, CLASH_COLOR, CLASH_MILLIS&gt; </code></pre> <p>So for a Red blade that clashes White for 80 milliseconds, you would need to add the 80 (non default) value in the appropriate argument's position in the template, like so:</p> <pre><code>SimpleClash&lt;Red, White, 80&gt; </code></pre> <p>For a working list of many templates, some with default values included, along with Functions and Transition syntax, see here: <a href="http://therebelarmory.com/thread/11489/templates-syntax-summary">TEMPLATES SYNTAX SUMMARY</a></p> <p>To experiment with them and figure out how to use them, I recommend using the <a href="https://fredrik.hubbe.net/lightsaber/style_editor.html">Style Editor</a>.</p> <p>Also, you can find lots of pre-made blade styles in the <a href="http://therebelarmory.com/thread/9273/teensysaber-blade-style-sharing-thread">Style sharing thread on TheRebelArmory.com</a>.</p> <p>As of ProffiesOS 6.x, it's possible to show bullet counts on an OLED display. Here's what you would need:</p> <p>This includes the display code, but doesn't activate it. May become the default in the future.</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define INCLUDE_SSD1306 </span></code></pre></div></div> <p>Here's how we activate the display:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#ifdef CONFIG_BOTTOM </span> <span class="n">DisplayHelper</span><span class="o">&lt;</span><span class="mi">128</span><span class="p">,</span> <span class="kt">uint32_t</span><span class="p">,</span> <span class="n">BaseLayerOp</span><span class="o">&lt;</span><span class="n">StandardDisplayController</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">ClearRectangleOp</span><span class="o">&lt;</span><span class="mi">10</span><span class="p">,</span> <span class="mi">80</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">24</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">WriteBulletCountOp</span><span class="o">&lt;</span><span class="mi">10</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="mi">5</span><span class="o">&gt;</span> <span class="o">&gt;</span> <span class="n">display_controller</span><span class="p">;</span> <span class="n">SSD1306Template</span><span class="o">&lt;</span><span class="mi">128</span><span class="p">,</span> <span class="kt">uint32_t</span><span class="o">&gt;</span> <span class="n">display</span><span class="p">(</span><span class="o">&amp;</span><span class="n">display_controller</span><span class="p">);</span> <span class="cp">#endif </span></code></pre></div></div> <p>The <code>DisplayHelper</code> class takes a list of display operations, which works a lot like the <code>Layers&lt;&gt;</code> style. Currently, these operations are available:</p> <p>Two different base layers:</p> <ol> <li><code>BaseLayerOp&lt;StandardDisplayController&gt;</code></li> <li><code>ClearScreenOp</code></li> </ol> <p>The first one makes it work like a standard display controller (shows, font.bmp, messages, etc., the second one just makes it black.</p> <h3 id="codeclearrectangleopltx1-x2-y1-y2gtcode"><code>ClearRectangleOp&lt;x1, x2, y1, y2&gt;</code></h3> <p>This op clears a rectangle on the screen.</p> <h3 id="codewritebulletcountopltx-y-digitsgtcode"><code>WriteBulletCountOp&lt;x, y, digits&gt;</code></h3> <p>Writes the current bullet count at the specified location.</p> <h3 id="codeifimageopltopgtcode"><code>IfImageOp&lt;OP&gt;</code></h3> <p>This executes OP if the base layer is showing an image, but not otherwise. The idea is that you could have a bullet count that draws over images, but not messages and battery monitors.</p> <p>We will probably need more display OPs real soon for other purposes... In 7.x I plan to make it possible to specify a different display controller for each preset, essentially making it a &quot;style&quot; for the display.</p> <p>The following instructions require <code>#define DISABLE_DIAGNOSTIC_COMMANDS</code> to NOT be enabled in the CONFIG_TOP section of the config file.</p> <p>A config file typically uses &quot;pow&quot;, &quot;aux&quot; and &quot;aux2&quot; as names for the available buttons, which means that those names can be used as commands from the Serial Monitor.</p> <p>If you just type &quot;pow&quot;, it will send an event which will match one of these cases in your prop file:</p> <pre><code>case EVENTID(BUTTON_POWER, EVENT_CLICK_SHORT, MODE_OFF): case EVENTID(BUTTON_POWER, EVENT_CLICK_SHORT, MODE_ON): </code></pre> <p>(depending on whether the saber is on or off)</p> <p>You can also specify which kind of click/hold/press/release event with the following shorthand:</p> <ul> <li>p = PRESSED</li> <li>r = RELEASED</li> <li>h = HELD</li> <li>m = HELD_MEDIUM</li> <li>l = HELD_LONG</li> <li>S = CLICK_SHORT</li> <li>s = SAVED_CLICK_SHORT</li> <li>L = CLICK_LONG</li> </ul> <p>So if you type &quot;pow L&quot;, it will match the following cases:</p> <pre><code>case EVENTID(BUTTON_POWER, EVENT_CLICK_LONG, MODE_OFF): case EVENTID(BUTTON_POWER, EVENT_CLICK_LONG, MODE_ON): </code></pre> <p>You can also add a number to work with double/triple/quad-clicks. So for instance &quot;pow s2&quot; will match:</p> <pre><code>case EVENTID(BUTTON_POWER, EVENT_SECOND_SAVED_CLICK_SHORT, MODE_OFF): case EVENTID(BUTTON_POWER, EVENT_SECOND_SAVED_CLICK_SHORT, MODE_ON): </code></pre> <p>Finally, these commands can also be used as modifiers for other commands. For instance, to execute a clash with the power button held, you'd type &quot;pow clash&quot;, which would match a case like this:</p> <pre><code>case EVENTID(BUTTON_NONE, EVENT_CLASH, MODE_ON | BUTTON_POWER): case EVENTID(BUTTON_NONE, EVENT_CLASH, MODE_OFF | BUTTON_POWER): </code></pre> <p>And a command like &quot;pow aux&quot; would match one of:</p> <pre><code> case EVENTID(BUTTON_AUX, EVENT_CLICK_SHORT, MODE_ON | BUTTON_POWER): case EVENTID(BUTTON_AUX, EVENT_CLICK_SHORT, MODE_OFF | BUTTON_POWER): </code></pre> <p>The template is <code>ColorChange&lt;TRANSITION, COLOR1, COLOR2, ...&gt;</code><br /> ProffieOS will detect if the style uses ColorChange&lt;&gt; or not.<br /> If it does NOT use ColorChange&lt;&gt;, the &quot;color wheel&quot; will be activated, which has 32768 steps per rotation.<br /> If it does contain ColorChange&lt;&gt;, the OS will let the ColorChange&lt;&gt; template handle the change. When you activate color change mode, there will be up to 12 steps per rotation with a little sound at each step (ccchange.wav)<br /> The prop file used will determine the button combinations to Enter and Exit Color Change mode, as well as save a chosen color, or Exit without changing anything.</p> <p>IF the style uses ColorChange&lt;&gt;, AND you have <code>#define COLOR_CHANGE_DIRECT</code> in your config file, then when you activate color change mode, it will immediately go to the next color with the button press and exit color change mode. If the style does not use ColorChange&lt;&gt;, having <code>#define COLOR_CHANGE_DIRECT</code> active has no effect.</p> <h2 id="rotatecolorsxltvariationcolorgt">RotateColorsX&lt;Variation,COLOR&gt;</h2> <p>If you use this in a blade style, the &quot;color wheel&quot; colorchange will only affect the colors in a RotateColorsX, and the other colors will not change. This is useful if you want your base blade color to change, but leave all of the effects like clash, blast, lockup etc... unchanged. It is also a good way to prevent other blade's styles in the preset (like an accent LED) from changing with the main blade. If you want to prevent ANY color change on a style, you could just insert a single ColorChange&lt;&gt; value, like <code>ColorChange&lt;TrInstant,Blue&gt;</code>, or make a non-changing Black or White to be <code>RotateColorsX&lt;Variation,Black&gt;</code></p> <h2 id="disable-color-change">Disable Color Change</h2> <p>If you want to completely disable any color change option,<br /> you can use the following define in <a href="/config/the-config_top-section.html">The CONFIG_TOP section</a> of the config file.</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define DISABLE_COLOR_CHANGE </span></code></pre></div></div> <p>DimBlade is used to reduce the brightness of a blade, usually to save battery.</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">DimBlade</span><span class="p">(</span><span class="n">percentage</span><span class="p">,</span> <span class="n">blade_definition</span><span class="p">)</span> </code></pre></div></div> <p>Note the use of () instead of &lt;&gt;, as DimBlade is a regular function, not a template. DimBlade will wrap a blade definition and reduce the brightness of the output. If percentage is 10.0, the blade will be 10% as bright, produce less heat and the battery will last longer. <br/> Note that some effects, like clash will NOT be dimmed, which can make it stand out more than normal.<br/> So for example, if you your blades array looks like this:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">BladeConfig</span> <span class="n">blades</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="mi">0</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">144</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">presets</span><span class="p">)</span> <span class="p">},</span> <span class="p">};</span> </code></pre></div></div> <p>Then here is how it would look with DimBlade():</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">BladeConfig</span> <span class="n">blades</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="mi">0</span><span class="p">,</span> <span class="n">DimBlade</span><span class="p">(</span><span class="mf">50.0</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">144</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">()),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">presets</span><span class="p">)</span> <span class="p">},</span> <span class="p">};</span> </code></pre></div></div> <p>This would make your blade 50% as bright.</p> <p>In ProffieOS6 using Fett263's prop file you can set your font up to select ignition, preon, retraction and postoff sounds based on blade position. With the odd numbered files being used when the blade is pointing up and even numbered files being used when the blade is pointing down.</p> <p>You will need to use /props/saber_fett263_buttons.h</p> <p>And add this define to your config:</p> <blockquote> <p><code>#define FETT263_DUAL_MODE_SOUND</code></p> </blockquote> <p>This will allow you to have different length sounds, dual ignition sounds for Crossguards or Staff sabers, or varied ignition, preon, retraction and postoff sounds within a font.</p> <p>You will set your font up with the even sounds for when your saber is pointing down and odd sounds for when your saber is pointing up as long as there is more than one of each sound. The sounds will be randomly selected from odd or even files based on the blade orientation when effect is triggered.</p> <p>Example:</p> <ul> <li>out01.wav //randomly selected when blade is up</li> <li>out02.wav //randomly selected when blade is down</li> <li>out03.wav //randomly selected when blade is up</li> <li>out04.wav //randomly selected when blade is down</li> </ul> <p>In addition, you can set effects for Ignition, Preon and Retraction using BladeAngle&lt;&gt; to have unique effects for both positions (up or down) including setting up an effect for only one position if you desire.</p> <p>You can also use WavLen&lt;&gt; function to set the timing of the effect based on the sound file used and have longer or shorter files used in the odd/even set up to have the effect match the sound based on blade orientation.</p> <p>Ok folks, so here is how you can use the .ini files stored on the SD card to update your installed fonts and blade presets manually.</p> <p>IMPORTANT: to use presets.ini, you have to flash the saber with the #define SAVE_PRESET in your config file, so the saber writes the preset information to the SD card.<br /> This define is blanketed under SAVE_STATE. ( See <a href="/config/the-config_top-section.html">The CONFIG_TOP Section</a> )</p> <p><em>Note</em>* As of ProffieOS 7, files are saved differently and need to be &quot;unlocked&quot; before editing.<br /> There's an easy app that do this for you here: <a href="https://github.com/NoSloppy/Unlock_Savefiles">https://github.com/NoSloppy/Unlock_Savefiles</a></p> <p>See here for more info on the new save format. <a href="/explainers/save-file-format.html">Save File Format</a></p> <p>Once the .ini is unlocked and editable, find the presets.ini on the SD card and edit it using a text editor like Sublime Text, or Notepad ++ on PC or Textedit on Mac. It has a very basic structure:</p> <p>First line is the 'installed date,' which is when the saber was last programmed Then we have blocks of statements that look like this:</p> <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>new_preset font=TFAFlex track=tracks/rey_training.wav style=builtin 0 1 style=builtin 0 2 name=Graflex8 variation=23299 </code></pre></div></div> <p>That block of statements describes a preset. It shows the font, the track, blade style(s) (in this case, the saber in question has two 'blades:' the main blade an a pixel chamber), the name of the preset (used for OLED displays) and the 'variation' which is used for color-change. You'll see that the style entries show 'builtin and then two numbers. The first number corresponds to the first entry in your presets list and the second is which blade style in that entry should be used.</p> <p>So for this saber, the config file entry for this preset looks like this:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span> <span class="s">"TFAFlex"</span><span class="p">,</span> <span class="s">"tracks/rey_training.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">Blue</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"Graflex8"</span><span class="p">},</span> </code></pre></div></div> <p>So you can see how the config file entry matches what we see in the presets.ini style statements: builtin style, entry 0 (the first entry) and blade style 1 / 2</p> <p>You will see several of these blocks, corresponding to the number of presets in your config file. At the end of the file, there is a single line with the word <code>end</code> which tells the saber that there are no more presets to use.</p> <p>Now, if you want to alter your presets, you can change any of the lines in the block that describe a preset AND you can add new blocks. Here's how we would change this preset to use a new font:</p> <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>new_preset font=GraflexIV track=tracks/rey_training.wav style=builtin 0 1 style=builtin 0 2 name=Graflex8 variation=23299 </code></pre></div></div> <p>You could also change the track:</p> <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>new_preset font=GraflexIV track=tracks/rots.wav style=builtin 0 1 style=builtin 0 2 name=Graflex8 variation=23299 </code></pre></div></div> <p>Or even alter the styles to use entries from an entirely different preset:</p> <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>new_preset font=GraflexIV track=tracks/rots.wav style=builtin 3 1 style=builtin 3 2 name=Graflex8 variation=23299 </code></pre></div></div> <p>You could even use a blade style from one preset and a crystal chamber style from an entirely different preset:</p> <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>new_preset font=GraflexIV track=tracks/rots.wav style=builtin 3 1 style=builtin 5 2 name=Graflex8 variation=23299 </code></pre></div></div> <p>So as you can see, the presets.ini can be modified by editing a couple lines and totally change how that preset functions when the saber is used. You can also insert as many preset blocks as you like, so long as they reference the blade styles in your config file and there is a single line at the end of presets.ini with the word <code>end</code> to tell the saber that the list of presets is finished.</p> <p>For anyone struggling with 'running out of memory' or if you want to tinker with the saber without reflashing, take a look at the presets.ini file and try out some modifications. You can add fonts and tracks to the SD card and update your saber to use those fonts without reflashing, or re-order/increase/decrease your presets list without ever needing to open Arduino.</p> <p>If for some reason you mess up the file, the saber will read from the backup .tmp file and boot up normally.</p> <p>Of course, if you prefer to use a UI to do all of these changes, you can use the <a href="../webusb.html">WebUSB</a> interface.</p> <p>As blade styles become more complex, combined with some pixel strips having more LEDs in serial,<br /> you may find less animation lag and fewer Audio Underflows (pops, clicks, gaps) by optimizing your font folder structure.</p> <p>Sounds with multiple files should live in subfolders, such as a clsh folder containing clsh01.wav, clsh02.wav etc...<br /> while single files, such as hum.wav or lock.wav should live in the font root.<br /> See attached image for a visual of this.</p> <p>ProffieOS will perform best if you cater to the way that FAT32 formatting works.</p> <p>Each block can contain 16 file entries.<br /> If you have 128 files in one directory, ProffieOS has to read on average 4 blocks to find the the file.<br /> If you have 16 subdirectories with 16 files each, only 2 blocks have to be read.<br /> It may be possible to optimize this by adding most commonly used files (hum) first.<br /> Also, ProffieOS might be able to improve on this with some caching. (Future development)<br /> For effects that only have one sound, it should be more efficient to NOT put them into a sub-directory.&quot;</p> <p><img src="/sound/images/fast1.jpg" alt="" /></p> <p>FASTLEDBladePtr is EXPERIMENTAL, that means that it probably doesn't work. In theory, it can be used to drive dotstar blades though. If you need help using it just let me know. If it turns out to be useful, I will write better documentation for it. :)</p> <p><a href="/glossary.html#fet">FETs</a> can sometimes get damaged by shorts. However, it can be difficult to test if they are working or not, because when they are not supposed to be on, they behave just like if they were broken. So let's discuss some ways to check if they are working or not.</p> <p>First or all: It's not easy to test if a FET is working if nothing is connected to it. However, if something <em>is</em> connected to it, it's fairly easy.</p> <h2 id="method-1">Method 1</h2> <p>Connect the blade, turn your proffieboard on and make sure the blade you want to test is supposed to be on. Now measure the voltage between BATT+ and the LED pad on the board. If it's working, the voltage should be 3+ volts. When the blade is supposed to be off, the voltage shuld be less than 0.1 volts. Note that errors in your config file could potentially throw off these measurements, as the FET might never really be turned on.</p> <h2 id="method-2">Method 2</h2> <p>This method is particularly effective for <a href="/config/blades/simplebladeptr.html">simple LED blades</a>. Basically, you just take a small piece of wire and short the relevant LED pad to BATT-. If that makes the LED light up, then LED and it's wiring is obviously OK, meaning that if it doesn't light up when you turn your saber on, it must either be a programming problem or a broken FET. This method can work with neopixels too, but if the neopixels don't light up, it might be because the data isn't working properly, so there are more possible causes.</p> <p>Now, before you jump to conclusions, please make sure that your proffieboard programming is actually trying to turn the FET on. If you're not sure, I recommend measuring the gate voltage on the FET. Make sure your multimeter probe is pointy enough, and measure the voltage between the FET gate and GND.</p> <img src="/images/fet-gate.jpg" width=223 height=348 alt="fet gate illustration" /> <p>When the gate is supposed to be on, this voltage is supposed to be 3.3v. When the gate is off, this voltage is supposed to be 0v.</p> <p>If the gate voltage is right, but the FET doesn't turn on (as determined by Method 1/2 above) then the FET is definitely broken, and you should probably try <a href="/howto/switch-fets.html">using a different LED pad</a>, replace the FETs on the board, or replace the board.</p> <p>Short version first:</p> <p>The ProffieOS.ino file must be in a folder named ProffieOS. Your config file (my_saber_config.h or however you named yours) must be in the config folder that is inside the SAME ProffieOS folder as the ProffieOS.ino file you are using in Arduino. So the paths to these files would look like this in Windows:</p> <blockquote> <p>C:\Users\Fredrik\Desktop\ProffieOS\ProffieOS.ino C:\Users\Fredrik\Desktop\ProffieOS\config\my_saber_config.h</p> </blockquote> <p>Or graphically in MacOS: <img src="/troubleshooting/images/ff1.jpg" alt="" /></p> <p>Longer detailed version:</p> <p>Some common problems often heard in the forums and saber board pages:</p> <ul> <li>&quot;After making some changes to my config (such as a new preset, blade style, or a font etc...) everything compiles and uploads successfully to the board. However, when powering on the saber, it seems nothing has changed.&quot;<br/>NOTE - If you use #define SAVE_STATE in your config, you might not have changes take effect until you try deleting the generated files from the root level of your SD card named preset, curstate, and global. It's OK, they get replaced next time you run a preset.</li> <li>&quot;After downloading and unzipping the ProffieOS package, Arduino says something about a ProffieOS folder and offers to create one and move something, and after clicking OK, nothing compiles.&quot;</li> </ul> <p>Issues like these are a very simple fix, but some basic understanding of file and folder hierarchy is needed.</p> <p>Note that as of the latest version, simply unzipping the software package creates the correct folder structure, whereas previously, some versions have required renaming folders and moving files and folders into a ProffieOS folder, and not everyone maintained the hierarchy correctly in doing so.</p> <p>ProffieOS code is using files which it expects to be in a certain place. It uses paths to files, which you've probably seen and used before, See above for examples.</p> <p>The root folder for the software (top level folder) must be named ProffieOS. The ProffieOS.ino file that you open in Arduino must live in this folder. Subfolders of the ProffieOS folder contain the files the code needs (blades, common, config, props, and so on). When you have downloaded multiple versions and copies of the software, including forks and prop files, you need to keep everything organized to avoid mixing up which files you're currently using and working with.</p> <p>It is recommended that you create a folder somewhere, either on the Desktop or in &quot;Documents&quot; where you keep lightsaber stuff. Then inside that, have one directory per ProffieOS version, and inside that, it would be ProffieOS/ProffieOS.ino, so something like: <img src="/troubleshooting/images/ff2.jpg" alt="" /></p> <p>The written path in full could look like this: C:\Users\Hubbe\Documents\Lightsaber Stuff\ProffieOS-2.8\ProffieOS\ProffieOS.ino</p> <p>Another reasonable alternative is to organize things by saber, which could look like: C:\Users\Hubbe\Documents\Lightsabers\Graflex\ProffieOS\ProffieOS.ino</p> <p>Or, if you have multiple versions of ProffieOS for each saber (like I do):<br /> C:\Users\Hubbe\Documents\Lightsabers\Graflex\ProffieOS-2.8\ProffieOS\ProffieOS.ino</p> <p>Let's say you currently have everything contained in a folder named ProffieOS-2.8 and you try to open the ProffieOS.ino file in Arduino.</p> <p><img src="/troubleshooting/images/ff3.jpg" alt="" /></p> <p>You get a message saying &quot;The file &quot;ProffieOS.ino&quot; needs to be inside a sketch folder named &quot;ProffieOS&quot;. Create this folder, move the file, and continue?&quot;</p> <p><img src="/troubleshooting/images/ff4.jpg" alt="" /></p> <p>If you agree, the ProffieOS.ino file you tried to open gets moved into a newly created subfolder called ProffieOS, and the sketch opens. However, this only moved the .ino and left all of the files that the software needs outside the new folder. <img src="/troubleshooting/images/ff5.jpg" alt="" /></p> <p>You need to structure this folder correctly before you can compile the code. Take all the folders next to ProffieOS and place them inside WITH ProffieOS.ino.</p> <p><img src="/troubleshooting/images/ff6.jpg" alt="" /> <img src="/troubleshooting/images/ff7.jpg" alt="" /></p> <p>The usual problem is that the wrong version of ProffieOS/config/my_saber_config.h is being edited, one from an older version folder, while the newer ProffieOS.ino is being used in Arduino. The relative paths are the same from the ProffieOS folder and down, but the path prior is different. It's hard to put into words, but just make sure you edit the correct config file, and that you #define it in Arduino.</p> <p>To have the &quot;name&quot; argument at the end of a blade style display the correct characters, it should be understood that the StarJedi font maps ACSII to glyphs with all kinds of characters aside from alphabetical, as well as some that have stylized differences.<br /> The font shows as all capitals, but for most cases, <strong><em>you should use all lowercase letters</em></strong> to assure it will display as the characters you expect.<br /> For example, an R can either have the long tail as in the Star Wars logo, or it can be shorter to work with other letters.<br /> Lowercase 'o' is 'O', but a capital 'O' is a stylized 'N'.</p> <p>If you install the font on your computer (it's in ProffieOS/display), and choose it as the font in a text editor, you can run through the whole keyboard and see what each character generates.</p> <p>Additionally, to have the &quot;name&quot; argument at the end of a blade style be displayed in Aurebesh language,<br /> add <code>#define USE_AUREBESH_FONT</code> to the config file.</p> <p>Tip:<br /> If you want to split the message up across 2 lines use a newline \n, so like:<br /> &quot;darth\nvader&quot;<br /> or if you want to get fancy, use a couple of spaces to center it on the screen<br /> &quot; darth\n vader&quot;</p> <p>If you're installing your own Proffieboard, you will need to build a config file which matches your wiring, or ProffieOS won't know how to operate the things you connected to the Proffieboard. There is a tool that helps you do this. The tool is slightly different for each different kind of Proffieboard. Here are links to the different versions:</p> <ul> <li>Proffieboard V1: <a href="https://fredrik.hubbe.net/lightsaber/v4/">https://fredrik.hubbe.net/lightsaber/v4/</a></li> <li>Proffieboard V2: <a href="https://fredrik.hubbe.net/lightsaber/v5/">https://fredrik.hubbe.net/lightsaber/v5/</a></li> <li>Proffieboard V3: <a href="https://fredrik.hubbe.net/lightsaber/v6/configurator.html">https://fredrik.hubbe.net/lightsaber/v6/configurator.html</a></li> </ul> <p>For the rest of this tutorial, I will be using the Proffieboard V3 generator. The others work similarly, but have fewer options. When you load the configuration generator, you'll see something like this:</p> <image src="/config/images/configurator_default.png" width=640 height=603 alt="configurator defaults" /> <p>If you scroll down, you'll see a text window which contains the full text of a ProffieOS config file which matches the options and wiring diagram at the top:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#ifdef CONFIG_TOP #include</span> <span class="cpf">"proffieboard_v3_config.h"</span><span class="cp"> #define NUM_BLADES 3 #define NUM_BUTTONS 2 #define VOLUME 1000 </span><span class="k">const</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">maxLedsPerStrip</span> <span class="o">=</span> <span class="mi">144</span><span class="p">;</span> <span class="cp">#define CLASH_THRESHOLD_G 1.0 #define ENABLE_AUDIO #define ENABLE_MOTION #define ENABLE_WS2811 #define ENABLE_SD #define SHARED_POWER_PINS #endif </span> <span class="cp">#ifdef CONFIG_PRESETS </span><span class="n">Preset</span> <span class="n">presets</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="s">"TeensySF"</span><span class="p">,</span> <span class="s">"tracks/venus.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"cyan"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"SmthJedi"</span><span class="p">,</span> <span class="s">"tracks/mars.wav"</span><span class="p">,</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="s">"blue"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"SmthGrey"</span><span class="p">,</span> <span class="s">"tracks/mercury.wav"</span><span class="p">,</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">YELLOW</span><span class="p">,</span> <span class="mi">0</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">YELLOW</span><span class="p">,</span> <span class="mi">1</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">YELLOW</span><span class="p">,</span> <span class="mi">2</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"fire"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"SmthFuzz"</span><span class="p">,</span> <span class="s">"tracks/uranus.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"red"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"RgueCmdr"</span><span class="p">,</span> <span class="s">"tracks/venus.wav"</span><span class="p">,</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">CYAN</span><span class="p">,</span> <span class="mi">0</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">CYAN</span><span class="p">,</span> <span class="mi">1</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">CYAN</span><span class="p">,</span> <span class="mi">2</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"blue fire"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"TthCrstl"</span><span class="p">,</span> <span class="s">"tracks/mars.wav"</span><span class="p">,</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutHelper</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">OnSpark</span><span class="o">&lt;</span><span class="n">GREEN</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutHelper</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">OnSpark</span><span class="o">&lt;</span><span class="n">GREEN</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutHelper</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">OnSpark</span><span class="o">&lt;</span><span class="n">GREEN</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="s">"green"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"TeensySF"</span><span class="p">,</span> <span class="s">"tracks/mercury.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">RED</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="p">,</span> <span class="n">RED</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">RED</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="p">,</span> <span class="n">RED</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">RED</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="p">,</span> <span class="n">RED</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"white"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"SmthJedi"</span><span class="p">,</span> <span class="s">"tracks/uranus.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">YELLOW</span><span class="p">,</span> <span class="n">WHITE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">BLUE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">YELLOW</span><span class="p">,</span> <span class="n">WHITE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">BLUE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">YELLOW</span><span class="p">,</span> <span class="n">WHITE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">BLUE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"yellow"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"SmthGrey"</span><span class="p">,</span> <span class="s">"tracks/venus.wav"</span><span class="p">,</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">MAGENTA</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">MAGENTA</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">MAGENTA</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="s">"magenta"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"SmthFuzz"</span><span class="p">,</span> <span class="s">"tracks/mars.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">Gradient</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">BLUE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">Gradient</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">YELLOW</span><span class="o">&gt;</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">Gradient</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">BLUE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">Gradient</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">YELLOW</span><span class="o">&gt;</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">Gradient</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">BLUE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">Gradient</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">YELLOW</span><span class="o">&gt;</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"gradient"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"RgueCmdr"</span><span class="p">,</span> <span class="s">"tracks/mercury.wav"</span><span class="p">,</span> <span class="n">StyleRainbowPtr</span><span class="o">&lt;</span><span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleRainbowPtr</span><span class="o">&lt;</span><span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleRainbowPtr</span><span class="o">&lt;</span><span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"rainbow"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"TthCrstl"</span><span class="p">,</span> <span class="s">"tracks/uranus.wav"</span><span class="p">,</span> <span class="n">StyleStrobePtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">Rainbow</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleStrobePtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">Rainbow</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleStrobePtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">Rainbow</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"strobe"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"TeensySF"</span><span class="p">,</span> <span class="s">"tracks/venus.wav"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">style_pov</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"POV"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"SmthJedi"</span><span class="p">,</span> <span class="s">"tracks/mars.wav"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">style_charging</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"Battery</span><span class="se">\n</span><span class="s">Level"</span><span class="p">}</span> <span class="p">};</span> <span class="n">BladeConfig</span> <span class="n">blades</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="mi">0</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">144</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">SubBladeWithStride</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">16</span><span class="p">,</span> <span class="n">blade2Pin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">()),</span> <span class="n">SubBladeWithStride</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">)</span> <span class="p">,</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">presets</span><span class="p">)</span> <span class="p">},</span> <span class="p">};</span> <span class="cp">#endif </span> <span class="cp">#ifdef CONFIG_BUTTONS </span><span class="n">Button</span> <span class="n">PowerButton</span><span class="p">(</span><span class="n">BUTTON_POWER</span><span class="p">,</span> <span class="n">powerButtonPin</span><span class="p">,</span> <span class="s">"pow"</span><span class="p">);</span> <span class="n">Button</span> <span class="n">AuxButton</span><span class="p">(</span><span class="n">BUTTON_AUX</span><span class="p">,</span> <span class="n">auxPin</span><span class="p">,</span> <span class="s">"aux"</span><span class="p">);</span> <span class="cp">#endif </span></code></pre></div></div> <p>Let's say for the sake of argument that we wanted to make a saber with quillions, a crystal chamber, an OLED display and a bluetooth module. After selecting those options, the top of the page now looks like this:</p> <image src="/config/images/configurator_complicated.png" width=640 height=623 alt="configurator complicated" /> <p>And the text window has been updated for this configuration:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#ifdef CONFIG_TOP #include</span> <span class="cpf">"proffieboard_v3_config.h"</span><span class="cp"> #define NUM_BLADES 10 #define NUM_BUTTONS 2 #define VOLUME 1000 </span><span class="k">const</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">maxLedsPerStrip</span> <span class="o">=</span> <span class="mi">144</span><span class="p">;</span> <span class="cp">#define CLASH_THRESHOLD_G 1.0 #define ENABLE_AUDIO #define ENABLE_MOTION #define ENABLE_WS2811 #define ENABLE_SD #define SHARED_POWER_PINS #define ENABLE_SERIAL #define ENABLE_SSD1306 #endif </span> <span class="cp">#ifdef CONFIG_PRESETS </span><span class="n">Preset</span> <span class="n">presets</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="s">"TeensySF"</span><span class="p">,</span> <span class="s">"tracks/venus.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"cyan"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"SmthJedi"</span><span class="p">,</span> <span class="s">"tracks/mars.wav"</span><span class="p">,</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="s">"blue"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"SmthGrey"</span><span class="p">,</span> <span class="s">"tracks/mercury.wav"</span><span class="p">,</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">YELLOW</span><span class="p">,</span> <span class="mi">0</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">YELLOW</span><span class="p">,</span> <span class="mi">1</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">YELLOW</span><span class="p">,</span> <span class="mi">2</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">YELLOW</span><span class="p">,</span> <span class="mi">3</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">YELLOW</span><span class="p">,</span> <span class="mi">4</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">YELLOW</span><span class="p">,</span> <span class="mi">5</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">YELLOW</span><span class="p">,</span> <span class="mi">6</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">YELLOW</span><span class="p">,</span> <span class="mi">7</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">YELLOW</span><span class="p">,</span> <span class="mi">8</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">YELLOW</span><span class="p">,</span> <span class="mi">9</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"fire"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"SmthFuzz"</span><span class="p">,</span> <span class="s">"tracks/uranus.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"red"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"RgueCmdr"</span><span class="p">,</span> <span class="s">"tracks/venus.wav"</span><span class="p">,</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">CYAN</span><span class="p">,</span> <span class="mi">0</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">CYAN</span><span class="p">,</span> <span class="mi">1</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">CYAN</span><span class="p">,</span> <span class="mi">2</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">CYAN</span><span class="p">,</span> <span class="mi">3</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">CYAN</span><span class="p">,</span> <span class="mi">4</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">CYAN</span><span class="p">,</span> <span class="mi">5</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">CYAN</span><span class="p">,</span> <span class="mi">6</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">CYAN</span><span class="p">,</span> <span class="mi">7</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">CYAN</span><span class="p">,</span> <span class="mi">8</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleFirePtr</span><span class="o">&lt;</span><span class="n">BLUE</span><span class="p">,</span> <span class="n">CYAN</span><span class="p">,</span> <span class="mi">9</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"blue fire"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"TthCrstl"</span><span class="p">,</span> <span class="s">"tracks/mars.wav"</span><span class="p">,</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutHelper</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">OnSpark</span><span class="o">&lt;</span><span class="n">GREEN</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutHelper</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">OnSpark</span><span class="o">&lt;</span><span class="n">GREEN</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutHelper</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">OnSpark</span><span class="o">&lt;</span><span class="n">GREEN</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutHelper</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">OnSpark</span><span class="o">&lt;</span><span class="n">GREEN</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutHelper</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">OnSpark</span><span class="o">&lt;</span><span class="n">GREEN</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutHelper</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">OnSpark</span><span class="o">&lt;</span><span class="n">GREEN</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutHelper</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">OnSpark</span><span class="o">&lt;</span><span class="n">GREEN</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutHelper</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">OnSpark</span><span class="o">&lt;</span><span class="n">GREEN</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutHelper</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">OnSpark</span><span class="o">&lt;</span><span class="n">GREEN</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutHelper</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">OnSpark</span><span class="o">&lt;</span><span class="n">GREEN</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="s">"green"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"TeensySF"</span><span class="p">,</span> <span class="s">"tracks/mercury.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">RED</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="p">,</span> <span class="n">RED</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">RED</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="p">,</span> <span class="n">RED</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">RED</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="p">,</span> <span class="n">RED</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">RED</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="p">,</span> <span class="n">RED</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">RED</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="p">,</span> <span class="n">RED</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">RED</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="p">,</span> <span class="n">RED</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">RED</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="p">,</span> <span class="n">RED</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">RED</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="p">,</span> <span class="n">RED</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">RED</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="p">,</span> <span class="n">RED</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">RED</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="p">,</span> <span class="n">RED</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"white"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"SmthJedi"</span><span class="p">,</span> <span class="s">"tracks/uranus.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">YELLOW</span><span class="p">,</span> <span class="n">WHITE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">BLUE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">YELLOW</span><span class="p">,</span> <span class="n">WHITE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">BLUE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">YELLOW</span><span class="p">,</span> <span class="n">WHITE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">BLUE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">YELLOW</span><span class="p">,</span> <span class="n">WHITE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">BLUE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">YELLOW</span><span class="p">,</span> <span class="n">WHITE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">BLUE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">YELLOW</span><span class="p">,</span> <span class="n">WHITE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">BLUE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">YELLOW</span><span class="p">,</span> <span class="n">WHITE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">BLUE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">YELLOW</span><span class="p">,</span> <span class="n">WHITE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">BLUE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">YELLOW</span><span class="p">,</span> <span class="n">WHITE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">BLUE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">AudioFlicker</span><span class="o">&lt;</span><span class="n">YELLOW</span><span class="p">,</span> <span class="n">WHITE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">BLUE</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"yellow"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"SmthGrey"</span><span class="p">,</span> <span class="s">"tracks/venus.wav"</span><span class="p">,</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">MAGENTA</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">MAGENTA</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">MAGENTA</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">MAGENTA</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">MAGENTA</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">MAGENTA</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">MAGENTA</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">MAGENTA</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">MAGENTA</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">InOutSparkTip</span><span class="o">&lt;</span><span class="n">EASYBLADE</span><span class="p">(</span><span class="n">MAGENTA</span><span class="p">,</span> <span class="n">WHITE</span><span class="p">),</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="s">"magenta"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"SmthFuzz"</span><span class="p">,</span> <span class="s">"tracks/mars.wav"</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">Gradient</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">BLUE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">Gradient</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">YELLOW</span><span class="o">&gt;</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">Gradient</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">BLUE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">Gradient</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">YELLOW</span><span class="o">&gt;</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">Gradient</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">BLUE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">Gradient</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">YELLOW</span><span class="o">&gt;</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">Gradient</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">BLUE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">Gradient</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">YELLOW</span><span class="o">&gt;</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">Gradient</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">BLUE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">Gradient</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">YELLOW</span><span class="o">&gt;</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">Gradient</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">BLUE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">Gradient</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">YELLOW</span><span class="o">&gt;</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">Gradient</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">BLUE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">Gradient</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">YELLOW</span><span class="o">&gt;</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">Gradient</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">BLUE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">Gradient</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">YELLOW</span><span class="o">&gt;</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">Gradient</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">BLUE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">Gradient</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">YELLOW</span><span class="o">&gt;</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">Gradient</span><span class="o">&lt;</span><span class="n">RED</span><span class="p">,</span> <span class="n">BLUE</span><span class="o">&gt;</span><span class="p">,</span> <span class="n">Gradient</span><span class="o">&lt;</span><span class="n">CYAN</span><span class="p">,</span> <span class="n">YELLOW</span><span class="o">&gt;</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"gradient"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"RgueCmdr"</span><span class="p">,</span> <span class="s">"tracks/mercury.wav"</span><span class="p">,</span> <span class="n">StyleRainbowPtr</span><span class="o">&lt;</span><span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleRainbowPtr</span><span class="o">&lt;</span><span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleRainbowPtr</span><span class="o">&lt;</span><span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleRainbowPtr</span><span class="o">&lt;</span><span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleRainbowPtr</span><span class="o">&lt;</span><span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleRainbowPtr</span><span class="o">&lt;</span><span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleRainbowPtr</span><span class="o">&lt;</span><span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleRainbowPtr</span><span class="o">&lt;</span><span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleRainbowPtr</span><span class="o">&lt;</span><span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleRainbowPtr</span><span class="o">&lt;</span><span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"rainbow"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"TthCrstl"</span><span class="p">,</span> <span class="s">"tracks/uranus.wav"</span><span class="p">,</span> <span class="n">StyleStrobePtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">Rainbow</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleStrobePtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">Rainbow</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleStrobePtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">Rainbow</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleStrobePtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">Rainbow</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleStrobePtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">Rainbow</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleStrobePtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">Rainbow</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleStrobePtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">Rainbow</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleStrobePtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">Rainbow</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleStrobePtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">Rainbow</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleStrobePtr</span><span class="o">&lt;</span><span class="n">WHITE</span><span class="p">,</span> <span class="n">Rainbow</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"strobe"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"TeensySF"</span><span class="p">,</span> <span class="s">"tracks/venus.wav"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">style_pov</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"POV"</span><span class="p">},</span> <span class="p">{</span> <span class="s">"SmthJedi"</span><span class="p">,</span> <span class="s">"tracks/mars.wav"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">style_charging</span><span class="p">,</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">StyleNormalPtr</span><span class="o">&lt;</span><span class="n">BLACK</span><span class="p">,</span> <span class="n">BLACK</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="mi">800</span><span class="o">&gt;</span><span class="p">(),</span> <span class="s">"Battery</span><span class="se">\n</span><span class="s">Level"</span><span class="p">}</span> <span class="p">};</span> <span class="n">BladeConfig</span> <span class="n">blades</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="mi">0</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">144</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">SubBladeWithStride</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">16</span><span class="p">,</span> <span class="n">blade2Pin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">()),</span> <span class="n">SubBladeWithStride</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">),</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">36</span><span class="p">,</span> <span class="n">blade3Pin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin1</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">SubBladeWithStride</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">16</span><span class="p">,</span> <span class="n">blade5Pin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin1</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">()),</span> <span class="n">SubBladeWithStride</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">),</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">36</span><span class="p">,</span> <span class="n">blade4Pin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin4</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> <span class="n">SubBladeWithStride</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">16</span><span class="p">,</span> <span class="n">blade6Pin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin4</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">()),</span> <span class="n">SubBladeWithStride</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">),</span> <span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">2</span><span class="p">,</span> <span class="n">blade7Pin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin5</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">()</span> <span class="p">,</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">presets</span><span class="p">)</span> <span class="p">},</span> <span class="p">};</span> <span class="cp">#endif </span> <span class="cp">#ifdef CONFIG_BUTTONS </span><span class="n">Button</span> <span class="n">PowerButton</span><span class="p">(</span><span class="n">BUTTON_POWER</span><span class="p">,</span> <span class="n">powerButtonPin</span><span class="p">,</span> <span class="s">"pow"</span><span class="p">);</span> <span class="n">Button</span> <span class="n">AuxButton</span><span class="p">(</span><span class="n">BUTTON_AUX</span><span class="p">,</span> <span class="n">auxPin</span><span class="p">,</span> <span class="s">"aux"</span><span class="p">);</span> <span class="cp">#endif </span></code></pre></div></div> <p>Whatever configuration you select at the top, the wiring diagram will change to match it, and the contents of the text window will contain the config file you need. Note that the presets for this config file are fairly primitive, and you might want to use the Fett263 configuration tool to make more interesting presets. This configuration generator is mainly targeted at getting the blade array and buttons configured correctly.</p> <h2 id="saving-the-config-file">Saving the config file.</h2> <p>To get the config file contents saved into a proper config file, please follow these directions:</p> <ol> <li>If you haven't already, download and unzip ProffieOS.</li> <li>Open up the &quot;config&quot; folder in ProffieOS.</li> <li>Hold the right mouse button on any config file in that directory, for instance &quot;default_proffieboard_config.h&quot;, drag the mouse a little up or down (but stay in the same window) and release.</li> <li>A menu will pop up, where one of the options is &quot;copy here&quot;, select that option.</li> <li>This will create a copy of this file, but named &quot;default_proffieboard_config - Copy.h&quot;. Right-click on the copy and select rename. (It's an icon near the top, and it doesn't actually say rename until you hoover over it for a bit.)</li> <li>Rename the file to something that makes sense for your saber. Let's say &quot;ben.h&quot; (Note that the .h might not show, in which case you would just call it &quot;ben&quot;. The &quot;.h&quot; part would show as an H in the type column instead.)</li> <li>Right-click the file again (now called &quot;ben.h&quot;) and select &quot;Edit in Notepad&quot;.</li> <li>In the NotePad window, select Edit -&gt; Select All, then Edit -&gt; Cut. The file should now be empty.</li> <li>Go to the configurator window, scroll down to the &quot;copy to clipboard&quot; button and click it.</li> <li>Go back to Notepad, select Edit -&gt; Paste, then File -&gt; Save</li> <li>Close Notepad</li> </ol> <p>Congratulations, you now have a config file that you can use to program your Proffieboard.</p> <p>If your Proffieboard was configured for &quot;Mass Storage&quot; when configured, then you can connect a USB cable to your Proffieboard, and the contents of the SD card should show up on your computer, same as if you connected an USB drive. On windows, this would show up under &quot;This PC&quot; as a new drive.</p> <p>If your board is not configured for &quot;Mass Storage&quot;, then you will need to take the SD card out of the saber and use an SD card reader to access the files on the SD card. This may be preferable anyways since it is generally much faster than accessing the SD card through the Proffieboard.</p> <p>When you open up the SD card, you should see something like this:</p> <image src="/config/images/sd_card_with_config.png" width=625 height=437 alt="sd card with config file" /> <p>This SD card has a config file called &quot;k4.h&quot; in the root directory. Please note that depending on how windows is configured and what programs are installed, the &quot;.h&quot; part might not show, and it might just show an H in the <code>type</code> column instead. This can be very confusing, but unfortunately this is something windows does by default.</p> <p>Unfortunatly, not everybody make it this easy to find the config file. Sometimes the config file in a sub-directory, in a zip file, and sometimes it will be a &quot;.txt&quot; file instead of a &quot;.h&quot; file. We'll talk about how to deal with that later.</p> <p>Sometimes people put a zip file containing all of ProffieOS, with the config file on the SD card, like this:</p> <image src="/config/images/sd_card_with_proffieos.png" width=625 height=437 alt="sd card with proffieos" /> <p>We could copy, unzip and use this directly, but since there is often a newer version of ProffieOS available, let's assume that we're only interested in getting the config file.</p> <p>To do that, click on the zip file. Usually it contains a single folder called &quot;ProffieOS-vX.Y&quot;, so click on that. In there there is usually a single folder called ProffieOS, so click on that. Now you should see multiple folders called blades, buttons, etc. Scroll down until you find a file called &quot;ProffieOS&quot;, of type INO. (Or &quot;ProffieOS.ino&quot; if your windows installation shows extensions.) Now click on that. It should open up in Arduino (if you don't have Arduino installed, you can either install it, or use a text editor instead.)</p> <p>Once the files open, scroll down until you see something like this: <image src="/config/images/ino_with_config.png" width=611 height=464 alt="ProffieOS.ino with config file" /></p> <p>Note that yours may look different, but only the lines WITHOUT // in the beginning counts. So in this case it shows that the config file we're looking for is called &quot;k4.h&quot; and it's in the &quot;config&quot; directory.</p> <p>So we can close Arduino, then click on the &quot;config&quot; directory, and scroll until we find the file:</p> <image src="/config/images/config_in_config_directory.png" width=625 height=437 alt="config directory with config file" /> <p>Once you find the config file, copy it to somewhere reasonable, like &quot;Documents&quot;, or your desktop, and if need be, rename it to something that makes it easy to know which saber it's for.</p> <h2 id="a-hrefhttpswwwarduinoccensoftwarearduinoa"><a href="https://www.arduino.cc/en/software">Arduino</a></h2> <p>A cross-platform program that attempts to make software development for embedded platforms simple.</p> <h2 id="a-hrefconfigthe-config-filehtmlconfig-filea"><a href="/config/the-config-file.html">config file</a></h2> <p>A file that specifies everything ProffieOS needs to know to make your saber (or other prop) work.</p> <h2 id="define">#define</h2> <p>In ProffieOS, we use C++ defines to specify which features to turn on and off. See <a href="/config/the-config_top-section.html">the CONFIG_TOP section</a> for a list of available defines. Note that there may be more defines available depending on what prop file you use.</p> <h2 id="a-hrefblade-detecthtmlblade-detecta"><a href="/blade-detect.html">Blade Detect</a></h2> <p>Let's ProffieOS detect when a blade is attached/detached.</p> <h2 id="a-hrefblade-idhtmlblade-ida"><a href="/blade-id.html">Blade ID</a></h2> <p>Let's ProffieOS detect which blade is attached.</p> <h2 id="fet">FET</h2> <p>Field Effect Transistor. Basically a switch that can be controlled electically. A Proffieboard v2.2 has 6 of these that are used to enable/disable power to LEDs and other things.</p> <h2 id="kill-key">Kill key</h2> <p>A small plug that plugs into a charge port on a saber, but which does not do any charging. Instead, it just causes the battery to be disconnected. A kill key is an alternative to having an on/off switch to disconnect the battery when you're not using your saber.</p> <h2 id="neopixels">Neopixels</h2> <p>The Adafruit brand name for LEDs that can be controlled using the WS2811 protocol.</p> <h2 id="oled">OLED</h2> <p>Abbreviation meaning &quot;Organic Light Emitting Diode&quot;, but in this context, we use it to mean a small display connected to the Proffieboard which can show messages and images.</p> <h2 id="a-hrefconfigthe-configpresets-sectionhtmlpreseta"><a href="/config/the-config_presets-section.html">Preset</a></h2> <p>A combination of a font, a track and one or more styles. &quot;factory settings&quot; are configured in the config file, but changes can be made with edit mode or the ProffieOS workbench. Such changes are stored in prests.ini on the SD card.</p> <h2 id="port">Port</h2> <p>Short for &quot;serial port&quot;. Used in Arduino to communicate with your Proffieboard. Make sure to select the right one under Arduino -&gt; Tools -&gt; Port.</p> <h2 id="profezzorn">Profezzorn</h2> <p>Fredrik Hubinette's online alias. You know, the guy who designed the Proffieboards, wrote ProffieOS and various other stuff. If you want to get in touch with Profezzorn, see the <a href="/contacting-profezzorn.html">How to Contact Profezzorn Page</a>.</p> <h2 id="prop-file">Prop file</h2> <p>A file that controls most of the behaviors of ProffieOS. In particular, it controls which button does what. Several prop files come with ProffieOS, and you can also make your own. See <a href="/config/the-config_prop-section.html">the CONFIG_PROP section</a> to learn how to specify which prop file to use in your config file.</p> <h2 id="presetsini">presets.ini</h2> <p>A file that stores changes made to your presets.</p> <h2 id="a-hreftoolsserial-monitorhtmlserial-monitora"><a href="/tools/serial-monitor.html">Serial Monitor</a></h2> <p>A window in Arduino which lets you type commands and receive text-based output from a Proffieboard. (Or any other Arduino-compatible board.)</p> <h2 id="smoothswing">Smoothswing</h2> <p>An algorithm for how to make Star Wars-style lightsaber sounds from motion events.</p> <h2 id="teensysaber">TeensySaber</h2> <p>This is what ProffieOS used to be called. It is also the name of the teensy-based boards that were used with ProffieOS before Proffieboards.</p> <h2 id="a-hrefwebusbhtmlwebusba"><a href="/webusb.html">WebUsb</a></h2> <p>A way to connect a browser to a Proffieboard. Lets you use the ProffieOS workbench.</p> <h2 id="a-hreftoolszadightmlzadiga"><a href="/tools/zadig.html">Zadig</a></h2> <p>A windows program that allows you to specify which driver to use for a USB device.</p> <p>Many people ask me: Do I need to hook up all those negative pads?</p> <p>The answer is that you need to hook up at least two, and sometimes, you might want to hook up something like a switch or a connector between them. If you know how electricity flow, just look at the circuit diagram and you can see why. However, if you don't know how electricity flows, here are a few simple rules:</p> <p>There are two GND pads on the board, and you only need to hook up one of them. You can use the other one(s) to hook up buttons, bluetooth modules or other things that needs GND, or it can be spliced into the wires, either way is fine.</p> <p>Proffieboards also have two BATT- pads, and for the most part it's fine to hook up only one of them. The only reason there are two is to handle high current better. Hooking up both means less resistance, less heat and better cooling performance.</p> <p>BATT- and GND must be connected together while the board is on. Normally this is done by just hooking them up together. However, sometimes BATT- is hooked up directly to the battery, while GND goes through a switch, charge port or blade connector. Hooking it up this way means that the switch/port/connector doesn't have to transmit the high current that goes through BATT-. The board will automatically disable the FETs when GND is disconnected, which means that almost no current will leak through BATT- even though it is hooked up directly to the battery.</p> <p>UPDATE: The pull-down resistors for the FET on TeensySaber and Proffieboards up to version 1.5 are hooked up to GND not BATT-, this means that the FETs will be left floating if GND is disconnected. Floating FETs can be either on or off or something in between, which is generally speaking not a good thing. If you disconnect GND on these boards, you must also disconnect BATT-, or the power to the LEDs. (Which is what happens if you use an 8-pin blade connector as shown in the wiring charts.)</p> <p>In the beginning, there was <code>CLASH_THRESHOLD_G</code>.</p> <p>Originally, the clash algorithm would simply compare the new accelerometer value with the last accelerometer value, and if it was greater than <code>CLASH_THRESHOLD_G</code>, it would trigger a clash, like:</p> <p>$|Acceleration_{now} - Acceleration_{last} | &gt; \verb|CLASH_THRESHOLD_G| $</p> <p>Note that the acceleration values are vectors with X, Y and Z components, and the || takes the length of the vector. In other words, this is the same as doing:</p> <p>$X = XAcceleration_{now} - XAcceleration_{last}$</p> <p>$Y = YAcceleration_{now} - ZAcceleration_{last}$</p> <p>$Y = YAcceleration_{now} - ZAcceleration_{last}$</p> <p>$\sqrt{X^2 + Y^2 + Z^2} &gt; \verb|CLASH_THRESHOLD_G|$</p> <p>The problem with this algorithm is that the frequency of readings changes what it does. If you get more readings per second, then the difference between each one will be smaller, so the same CLASH_THRESHOLD_G wouldn't work. Back then, Proffieboards were new, and there were lots of Teensysabers still around, and because of differences in how they worked, they would often get different number of readings per second.</p> <p>So a long long time ago, I changed this algorithm, instead of using the &quot;last&quot; value, I used a slow average of values instead, so the algorithm became:</p> <p>$| Acceleration_{now} - Acceleration_{average} | &gt; \verb|CLASH_THRESHOLD_G| $</p> <p>In ProffieOS 3, this algorithm was improved by adding the Fusor class. The Fusor uses the accelerometer and the gyro to calculate a down vector. When nothing is happening, the down vector and the accelerometer should be the same thing. But this allowed me to change the algorithm to:</p> <p>$| Acceleration_{now} - Down | &gt; \verb|CLASH_THRESHOLD_G| $</p> <p>So far, the improvements have been just that: improvements, however, at this point the story takes a bit of a turn... I discovered two potentially problematic things.</p> <ol> <li>The range for acceleration values was set to -4 to 4. Values higher than this would be truncated by the motion chip. For some reason though, many people seemed to find that they needed values around four for clash detection to work well for them. Values around 3.9 were quite common for some reason. To me, that meant that the algorithm wasn't really working as designed. Also, it gets a little wonky, because the truncation is cube-shaped, so if you hold your saber at a 45 degree angle, then the maximum value would be $ \sqrt{3 * 4^2} = 6.9 $ and having an algorithm that works differently depending on the angle didn't seem like a good idea.</li> <li>The accelerometer was set to 1600 readings per second. However, because of implementation details, we were usually only getting 800 readings per second, but sometimes it was much less, if your saber had lots of blades, OLED displays and stuff. A related problem was that OLED displays were updating slowly when the saber was on.</li> </ol> <p>So I implemented an interrupt-driven i2c handler, which lets us reliably read 1600 accelerometer reading per second, and I also changed the range of values returned by the accelerometer from 4 to 16. Both of these seemed like a good idea, more and better data, right?</p> <p>This turns out to not always be the case.</p> <p>It turns out that when you sample the accelerometer very quickly, sound has a bigger impact on the readings. In the past, readings got <em>smaller</em> when I read the accelerometer more often, but this time, they got <em>bigger</em>, which causes more false clashes. Also, whatever fluke made the 3.9 values work well disappeared because I changed the range to 16.</p> <p>In order to figure out what was going on, I added some defines to control the speed and range of accelerometer readouts:</p> <pre><code>#define PROFFIEOS_ACCELEROMETER_RANGE 16 </code></pre> <p>This one can be set to 2, 4, 8 or 16, and specifies the range of values measured by the accelerometer. Higher values means less precision, but we don't really need high precision, so it doesn't really matter. However, if you want the 3.9-value-fluke, you should set this to 4.</p> <pre><code>#define PROFFIEOS_MOTION_FREQUENCY 1600 </code></pre> <p>This define controls how often we read the accelerometer. I don't remember exactly what all the valid values are, but the interesting ones are basically 800 and 1600. The default is 1600, 800 is basically what ProffieOS 5 and below would get.</p> <p>Once we started figuring out what was going on. We also added some potential solutions to the problem. In ProffieOS 6 there were two changes meant to solve this problem. The first one is a filter that averages the clash values over a short period of time to try to get rid of the high values that sometimes comes from sound. This filter is controlled by this define:</p> <pre><code>#define ACCEL_MEASUREMENTS_PER_SECOND 800 </code></pre> <p>The default is 800, and the code just creates a box filter of size (PROFFIEOS_MOTION_FREQUENCY / ACCCEL_MEASUREMENTS_PER_SECOND = 2) to do the averaging. Setting this define to the same value as PROFFIEOS_MOTION_FREQUENCY (1600) means that no filtering will occur. Setting it to a lower value is also valid, but will cause some (very minor) latency in clash detection.</p> <p>The other solution is:</p> <pre><code>#define AUDIO_CLASH_SUPPRESSION_LEVEL 10 </code></pre> <p>This define checks the volume of sound currently being emitted and increases the CLASH_THRESHOLD_G accordingly. Higher values means more suppression when the volumes goes up, but that also means it's more difficult to actually make a clash happen.</p> <p>Together these two things worked fairly well, but some people still had problems, and lots of people found that their old CLASH_THRESHOLD_G values were too low, and had to increase them to 5-7 for things to actually work. This wasn't really my intention, but that's what happened.</p> <p>At some point after releasing ProffieOS 6, Fett263 told me that he used the <em>gyro</em> to detect clashes in his blade code. I'm like you do <em>what</em>? Here I had been using the accelerometer for years, and it turns out there is different way...</p> <p>So I did a bunch of experimentation, and I found that the gyro values tends to spike when a clash occurs. This makes sense, because there is a change in rotation when the blade hits something. However, I found that the type of clash would affect the size of the gyro spike quite a bit, making it not always reliable. However, if I used <em>both</em> the gyro and the accelerometer, I got a clash detector that seemed to work much better than either one individually.</p> <p>The formula is basically:</p> <p>$| accel - down |/2+ | \Delta gyro|/2 &gt; \verb|CLASH_THRESHOLD_G| $</p> <p>For many people, this formula works really well, and it helps filter out most of the false clashes. However, for some people, this formula seems to be the opposite of helpful, forcing them to increase their clash threshold and make clashes harder to trigger. I'm not sure why that is though, but somehow the clash spike and the acceleration spike must not arrive at the same time.</p> <p>Anyways, I made a define for disabling this new formula and use the previous one:</p> <pre><code>#define PROFFIEOS_DONT_USE_GYRO_FOR_CLASH </code></pre> <p>For some people the old formula works better, and they need this define.</p> <p>That's it. Almost.</p> <p>There is one detail I left out, because I don't remember when I added it, and there is no define to control it. (It was a long time ago though.)</p> <p>There is a piece of code in there that checks the swing speed, and increases the clash threshold accordingly. Before I added this, false clashes during swings were very very common. That code lives here:</p> <p><a href="https://github.com/profezzorn/ProffieOS/blob/3bfcc59d7a831bc4fcc7ed1e1b5bbd70ec73ee34/props/prop_base.h#L823C34-L823C60">https://github.com/profezzorn/ProffieOS/blob/3bfcc59d7a831bc4fcc7ed1e1b5bbd70ec73ee34/props/prop_base.h#L823C34-L823C60</a></p> <p>If you buy a blade from someone else, you might not know how many LEDs are in it, and unfortunately there is no way for ProffieOS to &quot;just know&quot; how many LEDs there are. Also, when you configure your blades, if you specify too few LEDs, the tip of the blade will not light up, and if you specify too may LEDs, effects which only light up the tip of the blade will not show, as they will light up LEDs that you do not have.</p> <p>Fortunately, there is an easy way to find out how many LEDs your blade has. Add a new preset to your config file, and make the style for that blade this:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">StylePtr</span><span class="o">&lt;</span><span class="n">LengthFinder</span><span class="o">&lt;&gt;&gt;</span><span class="p">(),</span> </code></pre></div></div> <p>Change the blade config to 144 LEDs, something like this:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">WS281XBladePtr</span><span class="o">&lt;</span><span class="mi">144</span><span class="p">,</span> <span class="n">bladePin</span><span class="p">,</span> <span class="n">Color8</span><span class="o">::</span><span class="n">GRB</span><span class="p">,</span> <span class="n">PowerPINS</span><span class="o">&lt;</span><span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">(),</span> </code></pre></div></div> <p>If you have COLOR_CHANGE_DIRECT in your config file, I recommend removing that temporarily while determining the blade length. Now compile and upload.</p> <p>The LengthFinder&lt;&gt; style will light up a single LED, and speak the number of which one it is lighting up. So to start with it will say &quot;one&quot; and light up the first LED. Now, activate the color change mode. (Normally done with AUX+POWER, but may be different depending on your prop file). Rotate the hilt, the LED will move one at a time, and the saber will speak the LED number every 3 seconds. Keep rotating until you find the point where the light reaches the tip and disappears, then rotate it back one step, so that the last LED of your blade is lit. At that point it will tell you how exactly how many LEDs are in your blade.</p> <p>Now, go back to your config file, remove the LengthFinder&lt;&gt; preset, update your blade configuration with the length of your blade, compile, upload, and you're done.</p> <p>If you want to backup the program that is currently on your Proffieboard, you can do so by going here:</p> <p><a href="https://profezzorn.github.io/webdfu/dfu-util/">https://profezzorn.github.io/webdfu/dfu-util/</a></p> <p>Connect your Proffieboard to your computer with USB and make it go into bootloader mode.<br /> The easiest way to do this is by issuing a command in Arduino's Serial Monitor, <code>RebootDFU</code>.<br /> The physical way requires accessing the Proffieboard onboard buttons. (Hold BOOT, press and release RESET, then release BOOT.)<br /> If you're running a Windows computer and this is the first time you are connecting a Proffieboard via USB, then you will also need to run <a href="../zadig.html">Zadig</a>.</p> <p>Now click 'Connect' in the programmer. You should be prompted to connect to 'STM32 BOOTLOADER'.<br /> Click 'Read'. This will save a .bin file to your computer that is a backup of the programming on the board. A good idea might be to make a new folder to store your backups, something like:<br /> '/User.../lightsabers/backups/Graflex/' then name the download file 'Graflex_Nov11-2021.bin'.<br /> Note that this is not a config file and there isn't a way to tell how the board was configured from the downloaded file.</p> <p>If you later want to restore this backed up programming to your Proffieboard, you can go back to the page listed above, connect again, then click 'Write' and select the file you previously downloaded. This will restore the programming to the way it was.</p> <p>Note that some options may be stored on the SD card as .ini files, so you probably want to preserve those too.<br /> Simply copying them to your backup folder mentioned above would be ideal.</p> <h1 id="copying-the-font-to-the-sd-card">Copying the font to the SD card.</h1> <p>First thing we need to do is to make the SD card show up on the computer. There are two ways to do this: Either we can take the SD card out of the saber and put it in an SD card reader attached to the computer, or if your saber is configured with the &quot;mass storage&quot; option, then you can use the Proffieboard as an SD card reader and just connect the saber to the computer with an USB cable. SD card readers are faster, but can be impractical if it's hard to get the SD card out of your saber.</p> <p>Now, once the SD card shows up on the computer, we can put the font on it. Usually, what we want to do is to unzip the font into a new directory on your desktop, then copy or move that directory to the SD card. If the directory name is long, complicated or has weird characters in it, I suggest renaming it to something simple, preferably with only 8 characters. Sometimes font zip files contains a bunch of directories, and only one of those is intended to be used with ProffieOS, in which case you should only copy that directory to the SD card, not the whole thing.</p> <p>Once it's copied, you should have a new directory in the top level directory of the SD card. That directory should contain the sounds and config files that make up the font. Although each of the sounds may be in a sub-directory in the font directory.</p> <p>Now make sure to eject the sd card safely from the computer.</p> <h1 id="telling-proffieos-about-the-new-font">Telling ProffieOS about the new font.</h1> <p>There are several ways to do that:</p> <ol> <li>Use ProffieOS Workbench</li> <li>Use Edit Mode</li> <li>Add or change a preset and re-program the saber.</li> <li>Edit presets.ini on the sd card.</li> <li>Replace an existing font on SD card.</li> </ol> <h2 id="use-proffieos-workbench">Use ProffieOS Workbench.</h2> <p>I already wrote a guide for how to do this: <a href="https://fredrik.hubbe.net/lightsaber/webusb.html">https://fredrik.hubbe.net/lightsaber/webusb.html</a></p> <h2 id="use-edit-mode">Use Edit Mode</h2> <p>If you have ProffieOS 6.x or later, and are using the Fett263 prop with edit mode enabled, then you can create and modify presets using the edit mode menu. For more information, go here: <a href="https://www.fett263.com/proffieOS6-intro.html">https://www.fett263.com/proffieOS6-intro.html</a></p> <h2 id="add-or-change-a-preset-and-re-program-the-saber">Add or change a preset and re-program the saber.</h2> <p>See <a href="/config/the-config_presets-section.html">the CONFIG_PRESETS section</a> for how to edit configure presets, then just follow the instructions for how to install ProffieOS to re-program the saber. Note that this can be tricky if you don't have the config file that was used to program the saber last time.</p> <h2 id="edit-presetsini-directly">Edit presets.ini directly</h2> <p>Using the ProffieOS workbench, or edit mode both ends up modifying a file on the sd card called presets.ini. This file can also be edited directly. I wouldn't normally recommend doing this, but if you want to, there is more information about how to do it here: <a href="/howto/editing-presets.ini-by-hand.html">Editing presets.ini by hand</a></p> <h2 id="replacing-an-existing-font-on-the-sd-card">Replacing an existing font on the SD card.</h2> <p>Some people find it easier to just name their font directories something generic, like &quot;font1&quot;, &quot;font2&quot;, etc. Then you can just replace the contents of those directories to switch the font sounds, and then ProffieOS doesn't need to be told how to find the sounds since they the sounds are in the same place, just new sounds. Of course, you could do this even if the directories aren't generically named, but it might be confusing to have a &quot;darthvader&quot; directory with a Luke font in it.</p> <p>If your ProffieBoard is unresponsive, either because of creating a program that doesn't work, or because of interrupting a programming in a middle. Don't worry here's what you need to do:</p> <ol> <li>Plug in your Proffieboard to your computer</li> <li>hold the BOOT button.</li> <li>press and release the RESET button.</li> <li>Make sure that the board shows up as &quot;STM32 BOOTLOADER&quot; on your computer. <a href="../troubleshooting/usb-connection-issues.html">Click here to learn how to check.</a> If you don't see &quot;STM32 BOOTLOADER&quot; connected to your computer, try again. If you cannot get past this step, regardless of how many cables you try, then there is most likely something wrong with your board, or you're not actually pushing the buttons correctly.</li> <li>Click the upload button in Arduino. Note that the board will not show up under &quot;Arduino -&gt; Tools -&gt; Port&quot;. This is expected and not a problem, upload should work anyays.</li> <li>If the upload <a href="../troubleshooting/is-it-uploading.html">went well</a>, your board should now be working normally.</li> </ol> <p>If no other prop file has been set manually in the config file, then the default file gets used, which is the &quot;saber.h&quot; prop file, and this is how the buttons will work:</p> <pre><code>On/Off - Zero buttons saber = Twist (2 directional, like revving a motorcycle) ** Note that the motion has to be done long enough to count, so a very quick flick of the wrist will not work. 1 button saber = Click to turn the saber on or off. 2 button saber = Click POW ** Note, if #define DUAL_POWER_BUTTONS is added to config file, Clicking either POW or AUX will power on. Also note that POW and AUX become swapped while the saber is on if AUX used to power on. Turn On muted - Double-click POW button Next preset - Zero button saber = Point up and shake 1 or 2 button saber = Hold POW button and hit the blade while saber is off. Previous Preset - Hold AUX button and click the POW button while saber is off. Clash - Hit the blade while saber is on. Lockup - Hold either POW or AUX, then trigger a clash. Release button to end. Drag - Hold either POW or AUX, then trigger a clash while pointing down. Release button to end. Melt - Hold either POW or AUX and stab something. Force Lightning Block - Click AUX while holding POW. Force - Long-click POW button. Start Soundtrack - Long-click the POW button while blade is off. Blaster block - Short-click AUX button. Enter/Exit Color Change - 1 button saber = Hold button and Twist. 2 button saber = Hold Aux and click POW while on. ** Note Color Change only works with ProffieOS 3.x and above) </code></pre> <p>Note that other button configurations are available by using different prop files. Several prop files are already provided with ProffieOS and can be found in the <a href="https://github.com/profezzorn/ProffieOS/tree/master/props/">props directory</a>. To learn how to use a different prop file, see the <a href="/config/the-config_top-section.html">The CONFIG_TOP section</a>.</p> <p>ProffieOS can load images and animations from the SD card and display them on an OLED display screen.<br /> Currently, the following events can play them:</p> <ul> <li>boot (when power is applied to the board),</li> <li>font (when a new preset is selected)</li> <li>on (when blade is running)</li> <li>idle (when blade is not running)</li> <li>clsh</li> <li>blst</li> <li>force</li> <li>lock</li> </ul> <p>From ProffieOS 7.x, these additional events are available:</p> <ul> <li>preon</li> <li>out</li> <li>in</li> <li>pstoff</li> </ul> <p>In the future, there will probably be more things that will trigger loading OLED images or animations from the SD card.</p> <p>ProffieOS uses the same code to locate image files as it uses for sound files.<br /> This means that multiple numbered files can be used, and one of them will be selected randomly to show each time.<br /> During boot, ProffieOS will look in the first font directory of your font search path for &quot;boot.bmp&quot;, &quot;bootNNN.bmp&quot;, &quot;boot.pbm&quot; or &quot;bootNNN.pbm&quot; (where NNN is a number).<br /> During preset changes, ProffieOS will look in the font directory for &quot;font.bmp&quot;, &quot;fontNNN.bmp&quot; &quot;font.pbm&quot; or &quot;fontNNN.pbm&quot;, and so on for the other effects as well.</p> <ul> <li>Note - &quot;font&quot; is used as the example throughout this page. The same steps apply for on, boot, and the rest of the effects.</li> </ul> <p>Currently, two image formats are supported: bmp and pbm. In each case, files must be formatted to fit a 128x32 screen, or 32x128 and only use one bit per pixel.<br /> (a.k.a. 1bpp, monochrome, two colors). In addition, pbms must be saved in binary format, not ASCII.<br /> One thing to note is that bmp files will play inverted (black-&gt;white, white-&gt;black) so the resulting files should have the colors &quot;backwards&quot; of how we want them to appear on the OLED display.</p> <ul> <li>This can be easily fixed later if you forget the &quot;backwards&quot; part, and pbm files seem to avoid this inversion.</li> </ul> <p>Images can be single frame stills, or they can be animated.<br /> They can be created in an image editor like Paint or Photoshop, or online such as at <a href="https://www.pixilart.com">https://www.pixilart.com</a>.<br /> To get started, save each animation frame as its own image file, 128x32, and make sure the names of the exported files are sequential, like<br /> font001.jpg font002.jpg font003.jpg etc...<br /> The file type here doesn't really matter (jpg, bmp, png, etc...) as long as they are all the same.<br /> The file name extension will be used in the commands below to process the image down to a 1bpp monochrome image, formatted as either bmp or pbm.</p> <h2 id="install-imagemagick">Install Imagemagick</h2> <p>We can streamline the process of combining multiple images with command line tools. (exported slices/layers from Photoshop for example)<br /> For a step-by-step video, you can see : <a href="https://www.youtube.com/watch?v=-OCy1dyW7EQ">https://www.youtube.com/watch?v=-OCy1dyW7EQ</a></p> <p>Windows: Download the installer here : <a href="https://imagemagick.org/script/download.php">https://imagemagick.org/script/download.php</a><br /> Be sure to turn the checkmark ON for &quot;Install legacy utilities&quot; during the installation.<br /> Once installed, type <code>cmd</code> in the search box near the Start menu to open a command prompt,<br /> then navigate to the directory containing your numbered image files by using the <code>cd</code> command.</p> <p>MacOS: To install Imagemagick on MacOS, open Utilities/Terminal, copy and paste this:<br /> <code>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;</code><br /> When it’s done, this: <code>brew install imagemagick</code><br /> When that’s done, this: <code>brew install ghostscript</code><br /> <br/> <br/> Animations for the OLED display can play either looped, or non-looped.</p> <h2 id="looped-animations">Looped Animations</h2> <p>To make a looped animation, we simply make the image taller than it is wide, stacking frames vertically. For instance, if we make our image 128x64, that will be a 2-frame looped animation. 128x96 is a 3-frame looped animation, etc.<br /> Then, by using the &quot;convert&quot; command with &quot;-append&quot; and &quot;-monochrome&quot; flags, we can stack the images appropriately, and convert to 1bpp monochrome in one step. The source file type doesn't matter. For example, Photoshop slices out to .jpg files, so we process all the numbered files of the specified file type.<br /> ( * is a wildcard so all will be processed)<br /> <code>convert -append -monochrome *.jpg font.bmp</code><br /> This file is now ready to play on the OLED.</p> <h2 id="non-looped-animations">Non-looped Animations</h2> <p>To make non-looped animations, we need to concatenate the files together into a pbm file without the vertical stacking.<br /> We can use the same Imagemagick &quot;convert&quot; command as above, just without the &quot;-append&quot; option.<br /> <code>convert -monochrome *.jpg font.pbm</code></p> <p>On windows, this can also be done with the &quot;copy&quot; command, like so:<br /> <code>copy /b *.jpg font.pbm </code></p> <p>On Linux , this can be done with the &quot;cat&quot; command, however we need to either process files that are monochrome already, or convert the result of this:<br /> <code>cat font???.jpg &gt;font.pbm</code></p> <h2 id="converting-mp4-to-frames">Converting mp4 to frames</h2> <p>We can also use &quot;convert&quot; to easily break out an mp4 video file to individual frames for processing.<br /> Again, file type can be different, (jpg, bmp, etc..) Just use the correct one in the subsequent commands. This time, we'll make numbered bmp file frames for the font image.<br /> <code>convert file.mp4 font.bmp</code><br /> The result here will be one bmp file for each frame of the movie clip, numbered sequentially.<br /> Then, we process them the same way as above with one of the the previous commands, this time maybe using <code>font*.bmp</code> in case there are other named bmps we don't wish to include by using full wildcard as in <code>*.bmp</code>.</p> <p>We can directly convert an mp4 file into a non-looping pbm animation.<br /> For this, you should use a file pre-cropped to 128x32:<br /> <code>convert file.mp4 font.pbm</code></p> <h2 id="seeing-a-preview-of-the-results">Seeing a preview of the results</h2> <p>An easy way to preview the bmp image/animation is to just drag it into a Chrome browser window. The bmp file should look tall, stacked for as many frames as you processed (some lengthy animations are very tall skinny images).</p> <p>The non-looping pbm file won't view in the same way, so while it's pretty easy to just copy it to the SD card and actually view it on the OLED itself, there is another way to preview it, again using Imagemagick.<br /> Make a gif file from the frames, and then it CAN be dragged onto the browser window to watch the playback.</p> <ul> <li>Note - while gifs of pbm files will loop in the browser, the pbm will play once on the OLED using ProffieOS. The command to make the gif is very similar.</li> <li>Note - the delay speed here is pretty close to on-display speed when set to ~3 as seen below.<br /> <code>convert -delay 3 *.jpg preview.gif</code><br /> If we wanted to &quot;boomerang&quot; the animation by adding a reversed order of frames to the end,<br /> we make the gif as above, then use this command:<br /> <code>convert preview.gif -coalesce -duplicate 1,-2-1 -quiet -layers OptimizePlus -loop 0 boomerang.gif</code><br /> then just convert back to bmp or pbm.<br /> <code>convert boomerang.gif font.pbm</code></li> </ul> <h2 id="inverted-color-results">Inverted color results</h2> <p>If the final bmp image/animation is an inverted black and white color scheme from what you intended,<br /> simply redo the conversion as above, but this time add the <code>-negate</code> flag, like:<br /> <code>convert -monochrome -negate *.jpg font.bmp</code></p> <h2 id="orientation">Orientation</h2> <p>Lastly, if the image is displayed upside down on the installed screen, we can easily rotate it 180 degrees by adding<br /> a define to the CONFIG_TOP section of the uploaded config file:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define OLED_FLIP_180 </span></code></pre></div></div> <p>There's also an option to flip it mirror image:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define OLED_MIRRORED </span></code></pre></div></div> <ul> <li><a href="/props/fett263/battle-mode-os5.html">Fett263 Prop File with &quot;Battle Mode&quot; and Gesture Controls for ProffieOS5.x</a></li> <li><a href="/props/fett263/edit-mode-sounds-os6.html">Menu Prompts and Sounds for ProffieOS6</a></li> <li><a href="/props/fett263/dual_mode-os6.html">ProffieOS6 &quot;Dual Mode&quot; Ignition, Preon, Retraction, PostOff sounds in Fett263 Prop</a></li> <li><a href="/props/fett263/real-clash-sounds-os6.html">ProffieOS6 &quot;Real Clash&quot; sounds in Fett263 Prop</a></li> <li><a href="/props/fett263/track-player-os6.html">ProffieOS6 Fett263 Track Player</a></li> </ul> <ul> <li> <p><a href="/props/fett263/">fett263</a></p> </li> <li> <p><a href="/props/using-dual_prop.h.html">Using dual_prop.h</a></p> </li> </ul> <ul> <li><a href="/people/profezzorn.html">About Profezzorn</a></li> </ul> <ul> <li><a href="/sound/alt_sounds.html">Alt Sounds</a></li> <li><a href="/sound/faster-fonts.html">Faster performance of fonts and blade animations.</a></li> <li><a href="/sound/pairing-sequential-effect-sounds.html">Pairing sequential effect sounds</a></li> <li><a href="/sound/proffieos6-acceleration-based-accent-swings.html">ProffieOS v6.x acceleration-based accent swings</a></li> <li><a href="/sound/sound-font-configuration.html">Sound Font Configuration</a></li> <li><a href="/sound/sound-font-config.ini-configuration.html">Sound Font config.ini configuration</a></li> <li><a href="/sound/sub-sub-sounds.html">Sub-sub sounds</a></li> <li><a href="/sound/smoothsw.ini.html">smoothsw.ini</a></li> </ul> <ul> <li><a href="/config/functions/wavlen.html">WavLen</a></li> </ul> <ul> <li><a href="/config/styles/blade-effects.html">Blade Style EFFECTs</a></li> <li><a href="/config/styles/blade-styles.html">Blade Styles</a></li> <li><a href="/config/styles/responsive-styles-&amp;-effects.html">Responsive Styles &amp; Effects for ProffieOS 4.x or later.</a></li> <li><a href="/config/styles/style_arguments.html">Style Arguments</a></li> </ul> <ul> <li><a href="/config/blades/blade-configuration.html">Blade Configuration</a></li> <li><a href="/config/blades/dimblade.html">DimBlade</a></li> <li><a href="/config/blades/fastledbladeptr.html">FASTLEDBladePtr</a></li> <li><a href="/config/blades/led-channel-selection.html">LED Channel Selection</a></li> <li><a href="/config/blades/led-configuration.html">LED Configuration</a></li> <li><a href="/config/blades/simplebladeptr.html">SimpleBladePtr</a></li> <li><a href="/config/blades/spibladeptr.html">SpiBladePtr</a></li> <li><a href="/config/blades/stringbladeptr.html">StringBladePtr</a></li> <li><a href="/config/blades/subblade.html">SubBlade</a></li> <li><a href="/config/blades/subbladereverse.html">SubBladeReverse</a></li> <li><a href="/config/blades/ws2811bladeptr.html">WS2811BladePtr</a></li> <li><a href="/config/blades/ws281xbladeptr.html">WS281XBladePtr</a></li> </ul> <ul> <li><a href="/config/color-change.html">ColorChange&lt;&gt; in a blade style</a></li> <li><a href="/config/get-from-sd-card.html">Finding a config file on your SD card.</a></li> <li><a href="/config/preset-configuration.html">Preset Configuration</a></li> <li><a href="/config/keeping-edits-when-uploading.html">ProffieOS v6.x, Keeping edits when uploading</a></li> <li><a href="/config/the-config_buttons-section.html">The CONFIG_BUTTONS section</a></li> <li><a href="/config/the-config_presets-section.html">The CONFIG_PRESETS section</a></li> <li><a href="/config/the-config_prop-section.html">The CONFIG_PROP section</a></li> <li><a href="/config/the-config_styles-section.html">The CONFIG_STYLES section</a></li> <li><a href="/config/the-config_top-section.html">The CONFIG_TOP section</a></li> <li><a href="/config/the-config-file.html">The Config File</a></li> <li><a href="/config/generator.html">Using the configuration generator</a></li> <li><a href="/config/your-first-config-file.html">Your first config file</a></li> </ul> <ul> <li><a href="/howto/blade-detect.html">Blade Detect</a></li> <li><a href="/howto/blade-id.html">Blade ID</a></li> <li><a href="/howto/blade-id-constant-monitoring.html">Blade ID constant monitoring</a></li> <li><a href="/howto/how-many-leds-does-my-blade-have.html">How many leds does my blade have?</a></li> <li><a href="/howto/add-a-blade.html">How to add a blade</a></li> <li><a href="/howto/how-to-back-up-a-proffieboard.html">How to back up a Proffieboard</a></li> <li><a href="/howto/editing-presets.ini-by-hand.html">How to edit presets.ini by hand</a></li> <li><a href="/howto/how-to-install-a-new-font.html">How to install a new sound font</a></li> <li><a href="/howto/how-to-recover-from-a-bad-programming.html">How to recover from a bad programming</a></li> <li><a href="/howto/switch-fets.html">How to switch LED pads</a></li> <li><a href="/howto/how-to-use-it.html">How to use a ProffieOS saber</a></li> <li><a href="/howto/making-your-own-prop-file.html">Making your own prop file</a></li> <li><a href="/howto/saving-memory.html">Saving FLASH Memory</a></li> <li><a href="/howto/speeding-things-up.html">Speeding things up</a></li> </ul> <ul> <li><a href="/troubleshooting/audio-troubleshooting.html">Audio Troubleshooting</a></li> <li><a href="/troubleshooting/status-led.html">Deciphering the Status LED</a></li> <li><a href="/troubleshooting/voltage-drops.html">Finding Voltage Drops</a></li> <li><a href="/troubleshooting/arduino-error-messages.html">How to decipher Arduino error messages</a></li> <li><a href="/troubleshooting/fet-testing.html">How to test a FET</a></li> <li><a href="/troubleshooting/test-ws281X-data.html">How to test if data pins are working.</a></li> <li><a href="/troubleshooting/is-it-uploading.html">Is it uploading?</a></li> <li><a href="/troubleshooting/it-doesn&#x27;t-compile-and-i-don&#x27;t-know-why.html">It doesn't compile, and I don't know why</a></li> <li><a href="/troubleshooting/files-and-folder-structure.html">Troubleshooing Files and Folder Structure</a></li> <li><a href="/troubleshooting/usb-connection-issues.html">USB Connection Issues</a></li> <li><a href="/troubleshooting/webusb.html">WebUSB</a></li> <li><a href="/troubleshooting/beep_codes.html">What is it beeping?</a></li> <li><a href="/troubleshooting/what-is-it-saying.html">What is it saying?</a></li> <li><a href="/troubleshooting/wheres-my-port.html">Where's my port?</a></li> </ul> <ul> <li><a href="/tools/serial-monitor-additional-commands.html">Additional Serial Monitor Commands</a></li> <li><a href="/tools/button-commands.html">Button Commands</a></li> <li><a href="/tools/pov.html">POV (persistance of vision)</a></li> <li><a href="/tools/serial-monitor.html">Serial Monitor</a></li> <li><a href="/tools/serial-monitor-commands.html">Serial Monitor Commands</a></li> <li><a href="/tools/workbench.html">The ProffieOS Workbench</a></li> <li><a href="/tools/zadig.html">Zadig</a></li> </ul> <ul> <li><a href="/display/bullet-counts.html">OLED additional features: Bullet Counts</a></li> <li><a href="/display/fonts.html">OLED display fonts: StarJEDI or Aurabesh</a></li> <li><a href="/display/images-and-animations.html">OLED images and animations</a></li> </ul> <ul> <li><a href="/explainers/save-file-format.html">Save File Format</a></li> <li><a href="/explainers/history-of-clash.html">The history of clash detection in ProffieOS</a></li> <li><a href="/explainers/understanding-usb.html">Understanding usb and uploads</a></li> <li><a href="/explainers/version-numbers.html">Version Numbers</a></li> </ul> <ul> <li><a href="/hardware/addressable-led-strips.html">Adressable LED Strips</a></li> <li><a href="/hardware/gnd-vs-batt.html">GND vs BATT-</a></li> <li><a href="/hardware/proffieboard-v2.2-bom-alternative-parts.html">Proffieboard v2.2 BOM alternative parts</a></li> <li><a href="/hardware/proffieboard-v2.2-part-map---component-level.html">Proffieboard v2.2 part map</a></li> <li><a href="/hardware/resistors.html">Resistors</a></li> <li><a href="/hardware/sd-cards.html">SD Cards</a></li> <li><a href="/hardware/speakers.html">Speakers</a></li> <li><a href="/hardware/supported-hardware.html">Supported Hardware</a></li> <li><a href="/hardware/touch-buttons.html">Touch Buttons</a></li> </ul> <p>If you haven't already, make sure to do <a href="/proffieboard-setup.html">the required setup steps</a> first.</p> <h2 id="download-proffieos">Download ProffieOS</h2> <ol> <li>Go to <a href="https://fredrik.hubbe.net/lightsaber/proffieos.html">the ProffieOS homepage</a> and hit the download link.</li> <li>Put it somewhere handy and unzip it.</li> </ol> <p>You should now have a directory called ProffieOS with the following files in it:</p> <pre><code>Arduino.mk ir/ README.md blades/ LICENCE.txt scripts/ buttons/ Makefile sound/ common/ motion/ styles/ Common.mk mtp/ Teensy.mk config/ pov_tools/ transitions/ display/ Proffieboard.mk videotoblc/ fontconvert/ ProffieOS.ino functions/ props/ </code></pre> <p>Note that Windows may hide the part after the period, so it may look a little different, but it's still the same files.</p> <h2 id="the-config-file">The Config File</h2> <p>If you are upgrading an existing saber, then you may already have a config file, in which case, just use that. If you need to create a new config file, keep reading.</p> <ol> <li>Go to the configurator page that matches your board:</li> </ol> <ul> <li>Proffieboard V1.x: <a href="https://fredrik.hubbe.net/lightsaber/v4/">https://fredrik.hubbe.net/lightsaber/v4/</a></li> <li>Proffieboard V2.x: <a href="https://fredrik.hubbe.net/lightsaber/v5/">https://fredrik.hubbe.net/lightsaber/v5/</a></li> </ul> <ol start="2"> <li>Change the options to match how your saber is wired.</li> <li>Go back to your ProffieOS directory, then into config/.</li> <li>Make a copy of the file called <code>default_proffieboard_config.h</code>.</li> <li>Rename the copy to something reasonable for your saber, like maybe <code>my_saber_config.h</code>. (Please note, that on Windows, the <code>.h</code>. is normally not shown. If it wasn't before you selected rename, don't add it.)</li> <li>Open up the renamed file in a text editor. You can use Notepad, Notepad++, Sublime or any other editor that knows how to edit plain text. Do not use word, wordpad or other programs intended to edit documents. Documents and text are not the same thing.</li> <li>Select all the contents in the renamed file and delete it.</li> <li>Go back to the configurator page, scroll down and press the &quot;copy to clipboard&quot; button.</li> <li>Paste it into the editor and save.</li> </ol> <p>Congratulations, you now have a config file.</p> <h2 id="tell-profffieos-to-use-your-config-file">Tell ProfffieOS to use your config file</h2> <ol> <li>Go to the ProffieOS directory and click on ProffieOS.ino (.ino might be hidden on Windows)</li> <li>This should open up ProffieOS.ino in arduino. Arduino might show another file too, like README.md, if so, just click on the ProffieOS.ino tab.</li> <li>Find the CONFIG_FILE define, it will be a line that looks like this:</li> </ol> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// #define CONFIG_FILE "config/YOUR_CONFIG_FILE_NAME_HERE.h"</span> </code></pre></div></div> <ol start="4"> <li>Now change this line to:</li> </ol> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define CONFIG_FILE "config/my_saber_config.h" </span></code></pre></div></div> <p>Of course, if you used a different filename in the previous step, use that filename instead of <code>my_saber_config.h</code>.</p> <h2 id="upload">Upload</h2> <ol> <li>Connect your board to the computer using an micro-usb cable. (Make sure it's not a charge-only cable.)</li> <li>In Arduino -&gt; Tools -&gt; Port, make sure that the board shows up and is selected as the current port. If this doesn't work, see <a href="/troubleshooting/wheres-my-port.html">this page</a>.</li> <li>If the Proffieboard shows up as a drive on your computer, make sure to &quot;safely remove&quot; it before uploading the board.</li> <li>Press the upload button.</li> </ol> <p>Check out what happens in the window at the bottom of Arduino. You may need to scroll around to see what's going on. You can also make the window bigger, which helps. If you see a 0-100 progress bar and it goes all the way to 100, then the programming worked, regardless of what other errors and warnings you see.</p> <p>Now your saber is programmed. You can tweak your config file as many times as you like and re-upload as many times as you like.</p> <p>When you upload to a Proffieboard, the progress of the upload is shown in the same window as compile errors, and it should look something like this:</p> <image src="/troubleshooting/images/successful_upload.png" width=686 height=531 alt="successful upload" /> <p>Note that for some version of Arduino you will need to scroll down to see this. If you do not see this, or something similar, then the upload was probably not successful.</p> <h2 id="wrong-port">Wrong port</h2> <p>One of the most common reasons for a failed upload is not selecting the right port. Usually this looks like this:</p> <image src="/troubleshooting/images/wrong_port.png" width=707 height=361 alt="wrong port" /> <p>If this is what you see, select the right port in Arduino -&gt; Tools -&gt; Port, then try again. If the port is not shown, you can try these steps:</p> <ol> <li>Connect Proffieboard to computer.</li> <li>Hold the BOOT button.</li> <li>Press and release the RESET button.</li> <li>Check that the computer can see your board as STM32 BOOTLOADER. (See this page for how to find all USB devices connected to your computer: <a href="/troubleshooting/usb-connection-issues.html">USB Connection Issues</a>)</li> <li>If the board was not recognized by your computer, try a different cable, port, computer, etc. Ultimately, if the board cannot be found, it may be broken.</li> <li>Once the board is found, press the upload button in Arduino. Note that there will be no port listed under Arduino-&gt;Tools-&gt;Port, but if your board is already in bootloader mode, upload should work anyways.</li> </ol> <p>Once upload has finished, the Port should be available in arduino, so you shouldn't have to do this process again.</p> <h2 id="dfu-driver-not-installed">DFU driver not installed</h2> <image src="/troubleshooting/images/cannot_open_dfu.png" width=699 height=513 alt="cannot open DFU device" /> <p>If you get this message while uploading &quot;cannot open dfu device 0483:df11&quot;, it means that it found the bootloader, but it can't talk to it.</p> <p>On windows, that usually means that you need to run <a href="/tools/zadig.html">proffie-dfu-setup</a> to install the right driver for the STM32 BOOTLOADER. On Linux, it means that you need to install the right udev rules.</p> <p>If you see some other errors when uploading, it's probably a compile error. Check the <a href="/troubleshooting/arduino-error-messages.html">Arduino error messages</a> page for help with those.</p> <p>First up: The arduino program has a small region at the bottom where it shows error messages in red text. Unfortunately it usually scrolls past the first error message and only shows you the last part, which is not very helpful. Make the error region larger and scroll up to find the first error message. Read on to learn what usually causes the errors, and how to find and fix them.</p> <p>If you see this error: <code>#error Tools-&gt;DOSFS should be set to SDCARD (SPI)</code> Go to the Tools menu, find DOSFS and set it to &quot;SDCARD (SPI)&quot; and try again.</p> <p>If you see a lot of red text compile errors, don't be discouraged thinking there's a lot of things wrong. Usually, just the first error shown is the actual problem, and all of the following messages are just a result of a cascade effect. The most common errors are in the presets section of the config file (my_saber.h for example) where edits to presets have occured. It's quite easy to make a typo, specifically leaving out a code punctuation (comma, &lt; or &gt;, a parenthesis, a brace etc...). Many times styles can be copied from the [Style Editor] or elsewhere and pasted in the config file without having a comma added, or the whole line to be replaced was selected, including the comma, and then pasted over. Each blade style must be followed by a <strong>comma</strong>, unless the preset description at the end is being omitted, leaving the blade style as the last element, where it then just gets followed by a closing brace comma <strong>},</strong> Each style's arguments must open with &lt; and close with &gt;. Again, missing just one of these punctuations will cause the compile to fail. This is easy to miss once looking at long lines in a style or multiple nested templates, such as:</p> <blockquote> <p>AudioFlicker&lt;Blue,Rgb&lt;128,0,128&gt;&gt;</p> </blockquote> <p>is sometimes left as just</p> <blockquote> <p>AudioFlicker&lt;Blue,Rgb&lt;128,0,128&gt;</p> </blockquote> <p>It looks complete at a quick glance. However, the Rgb has its closing &gt; but AudioFlicker also needs one, and visually it's easy to miss until you get very used to seeing it.</p> <p>The second most common issue is a mismatch of number of blades defined in the CONFIG_TOP section and the number of blade styles contained in the preset(s). Each LED wired to an LED pin on the board counts as a &quot;blade&quot;, even if it's a single accent LED. If you have 1 main blade and 2 accent LEDs, 3 &quot;blades&quot; must be defined with #define NUM_BLADES 3, and all of the presets must contain 3 complete blade styles.</p> <p>The error message in Arduino gives the best clue as to where the problem exists in the form of a line number of the config file causing the problem. For this reason, it is highly suggested to use a text editor that uses line numbering for troubleshooting the problem with the config file. In the following example error message, Just before the first occurance of the word &quot;error&quot; is the line number, and there's a caret symbol pointing up to the issue.</p> <pre><code>In file included from /HardDrive/Lightsabers/ProffieOS/ProffieOS.ino:631:0: /var//T/arduino_build_915026/sketch/config/mysaber_config.h:47:5: error: expected '}' before 'StyleNormalPtr' StyleNormalPtr&lt;WHITE, RED, 300, 800, RED&gt;(), &quot;white&quot;}, ^ </code></pre> <p>This tells you that when the compiler got to line 47, it was expecting a closing bracket. So we can go look at why. Here's the section with line 47 from the config:</p> <pre><code>{ &quot;TeensySF&quot;, &quot;tracks/mercury.wav&quot;, StyleNormalPtr&lt;WHITE, RED, 300, 800, RED&gt;() StyleNormalPtr&lt;WHITE, RED, 300, 800, RED&gt;(), &quot;white&quot;}, </code></pre> <p>This config file uses 2 blade styles per preset, and line 47 looks fine, <em>and it is</em>. But the problem is that there is no comma after the style <strong>ABOVE</strong> it, so when the compiler got to the end of the first style and found no comma, it assumed it was the end of the preset, and expected a closing brace <strong>}</strong> That is how you find errors using error messages from Arduino. <br> For more info on deciphering Arduino error codes, read here: <br> <a href="/troubleshooting/arduino-error-messages.html">Error Messages in Arduino and how to decipher them.</a></p> <p>If it still doesn't compile, try Googling your error message combined with a search term &quot;Proffie&quot;. If it shows things that are not helpful, try adding site:therebelarmory.com to your query. Chances are that someone else has had the same problem and already asked about it on the forums.</p> <p>If you still could use some help, go to <a href="https://crucible.hubbe.net/c/proffieos/7">The Crucible</a> and post your config file and complete error message, and someone will help you figure out what the problem is.</p> <p>If you've made edits and it DOES compile, but you don't see your changes after uploading, see the <a href="/troubleshooting/files-and-folder-structure.html">Troubleshooting Files and Folder Structure</a> page.</p> <p>In ProffieOS6, all edits made to your presets or settings in either <a href="https://fett263.s3.us-east-2.amazonaws.com/proffieOS6-edit-mode.html">Edit Mode</a> or using <a href="/webusb.html">ProffieOS Workbench (WebUSB)</a> are saved to your SD card in various *.ini files.<br /> NOTE: It is strongly recommended you save a backup of all SD card contents (fonts and *.ini files) after making edits in case your SD card is erased or corrupted.</p> <p>Typically, whenever you reupload through Arduino the existing .ini files are ignored. In order to prevent this you will want to include this define in your config BEFORE you make your edits.</p> <p><code>#define KEEP_SAVEFILES_WHEN_PROGRAMMING</code></p> <p>This define will allow you to keep all previous Edits (so long as the .ini files were not erased or overwritten). As such this define is intended to be used when you no longer wish to upload changes via Arduino and only edit the saber via Edit Mode or ProffieOS Workbench.</p> <h3 id="however-before-using-this-define-its-important-to-note-the-following">However, BEFORE USING THIS DEFINE it's important to note the following.</h3> <p>#1 With #define KEEP_SAVEFILES_WHEN_PROGRAMMING changes to fonts, tracks, colors/settings, control defines (i.e. gestures) as well as volume, blade length and clash threshold in the config you upload will not be used, instead the saber will continue to use any previous values that exist in the .ini files. This means that if you're trying to make changes or adjustments via uploading changes to the config those changes may not actually appear on your saber after the upload if there are different values in the related .ini. So if you have a specific clash threshold or a font already in a .ini file the new value you put into your config and uploaded would not appear so you would then use Edit Mode or ProffieOS Workbench to make your adjustments. For this reason, it is not recommended that you add this define until you have the baseline for your saber set for the following:</p> <ul> <li>clash_threshold (CLASH_THRESHOLD_G)</li> <li>max volume (VOLUME)</li> <li>max blade length (set in BladeConfig for each blade)</li> <li>all desired styles (see below)</li> <li>other starting settings such as swing on speed, lockup delay, clash detect, max clash, brightness Once you have the saber set up in the form and with all styles that you want you would then add the above define to allow for all future adjustments and edits to made using Edit Mode or ProffieOS Workbench as intended.</li> </ul> <p>#2a The style number in presets.ini is based on the order of the styles in the recently uploaded config beginning with 0. So all styles in the first preset of your config are equal to &quot;style number 0&quot;. So if you change style code in a preset all presets that were edited to use &quot;style number 0&quot; will reflect the new style from the most recently uploaded config.<br /> If this is not desired it is recommended you add new style code to a new preset at the end of the config and use an editing method to change on the desired presets.</p> <p>#2b Related to above if you add a new preset to your config and upload it will not be visible on the saber until you use Edit Mode or ProffieOS Workbench to Copy Preset (add a preset) and then select the new style number and set up the font and track. This is because presets.ini will not have a reference to new presets uploaded. The style code from your new presets is stored on the board (if upload is successful) but there won't be any presets in the .ini that utilize. The easiest way to get the new style into a preset is to use Copy Preset for an existing preset, then Edit the style number to use the new style code and change Font and Track as desired.</p> <p>#3 <strong>You should not remove presets from your config</strong>.<br /> Because presets.ini is not updated on upload with this define if you upload a config missing a style number that is referenced it will cause the board to lock up. So if your original config had 15 presets and you upload a config that removes a preset presets.ini will reference style number 14 but it will not exist on the board.<br /> The simplest approach would be to replace the style for that preset in your config if you no longer wish to use that specific style code (see #2a above). If you only wish to not have the preset on your saber but don't need to remove the style code, just select the preset and use the Delete Preset functionality in Edit Mode or ProffieOS Workbench. If it's absolutely necessary to remove the style entirely then you will need to manually update your presets.ini file to change all instances of the style number(s) removed keeping in mind they are always sequential from the first preset starting at 0 to the final preset (being equal to preset # - 1). So if you have 15 presets the final style number is &quot;14&quot;. If you delete the last preset in your config and upload (without replacing) you would need to manually change any preset the uses:</p> <p><code>style=builtin 14 1</code></p> <p>and change the &quot;14&quot; to any number between 0 and 13 corresponding to the style you want. See <a href="/howto/editing-presets.ini-by-hand.html">Edit presets.ini by Hand</a> for more information.</p> <p>Once you have all of the initial settings and the styles you want uploaded to your saber you can then use this define to move all edits to Edit Mode or ProffieOS Workbench.</p> <p>If you have read the <a href="/config/blades/led-configuration.html">LED Configuration</a> page, you know how ProffieOS activates channels based on colors. However, what is perhaps less obvious is how to use that in practice.</p> <p>Let's start with the obvious case, an RGB three-cree star, using the recommended resistors:</p> <p><code>SimpleBladePtr&lt;CreeXPE2RedTemplate&lt;550&gt;, CreeXPE2GreenTemplate&lt;0&gt;, CreeXPE2BlueTemplate&lt;240&gt;, NoLED&gt;()</code></p> <p>In this case, the mapping between color and what channels are turned on is pretty obvious: Red colors turns on the red LED, green colors turn on the green LED and blue colors turn on the blue LED. But what if we replace the red led with an amber one?</p> <p>Now, we have two choices, the first one is fairly obvious: <code>SimpleBladePtr&lt;CreeXPE2AmberTemplate&lt;420&gt;, CreeXPE2GreenTemplate&lt;0&gt;, CreeXPE2BlueTemplate&lt;240&gt;, NoLED&gt;()</code></p> <p>However, the mapping between colors and channels now get more complicated. Green and blue works the way you would expect, but red won't turn on anything. The amber LED struct defines it's color as:</p> <p><code>static const int Red = 255; static const int Green = 128; static const int Blue = 0;</code> Going back to the <a href="/config/blades/led-configuration.html">LED configuration</a> page, we can figure out that we would need to use a color like Rgb&lt;255,128,0&gt; to activate the amber LED. However, that color will also activate the green LED with 50% power, which might not be what we want.</p> <p>However, there is another option: We can redefine what RGB means. To do that, we'll need to copy the amber LED struct into our config file and change it to:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">template</span><span class="o">&lt;</span><span class="kt">int</span> <span class="n">milliohms</span> <span class="o">=</span> <span class="mi">420</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">MyCreeXPE2PCAmberTemplate</span> <span class="p">{</span> <span class="k">static</span> <span class="k">constexpr</span> <span class="kt">float</span> <span class="n">MaxAmps</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">;</span> <span class="k">static</span> <span class="k">constexpr</span> <span class="kt">float</span> <span class="n">MaxVolts</span> <span class="o">=</span> <span class="mf">3.28</span><span class="p">;</span> <span class="k">static</span> <span class="k">constexpr</span> <span class="kt">float</span> <span class="n">P2Amps</span> <span class="o">=</span> <span class="mf">0.35</span><span class="p">;</span> <span class="k">static</span> <span class="k">constexpr</span> <span class="kt">float</span> <span class="n">P2Volts</span> <span class="o">=</span> <span class="mf">3.05</span><span class="p">;</span> <span class="k">static</span> <span class="k">constexpr</span> <span class="kt">float</span> <span class="n">R</span> <span class="o">=</span> <span class="n">milliohms</span> <span class="o">/</span> <span class="mf">1000.0</span><span class="p">;</span> <span class="k">static</span> <span class="k">const</span> <span class="kt">int</span> <span class="n">Red</span> <span class="o">=</span> <span class="mi">255</span><span class="p">;</span> <span class="k">static</span> <span class="k">const</span> <span class="kt">int</span> <span class="n">Green</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="c1">// This is the only thing that was changed</span> <span class="k">static</span> <span class="k">const</span> <span class="kt">int</span> <span class="n">Blue</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="p">};</span> </code></pre></div></div> <p>The we can use it: <code>SimpleBladePtr&lt;MyCreeXPE2AmberTemplate&lt;420&gt;, CreeXPE2GreenTemplate&lt;0&gt;, CreeXPE2BlueTemplate&lt;240&gt;, NoLED&gt;()</code></p> <p>Now we're back at a state where the red activates the first channel, even though it's not really red. So Rgb&lt;255,0,0&gt; now means amber, not red. Green and Blue still work as normal. Other colors will also become funky, because Purple will now activate amber and blue, and yellow will activate amber and green. Not sure exactly what these colors will look like, but they won't be purple and yellow.</p> <p>This trick can be applied to any of the channels. Note that this trick will not really work properly if you have four different LEDs on your star, and you want to control all of them. RGB only has three values in it after all.</p> <p>When using SimpleBladePtr&lt;&gt; or StringBladePtr&lt;&gt; in your blade array, you have to provide a led configuration class. That class specifies the color and electrical properties of the LED. If the color returned by the style matches the color specified in the led configuration, the LED will be activated. If the current battery voltage is higher than what is specified in the electrical properties, the LED brightness will be reduced to avoid overheating the LED.</p> <h2 id="example-led-configuration-class">Example LED configuration class</h2> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">struct</span> <span class="nc">MyBlueLED</span> <span class="p">{</span> <span class="k">static</span> <span class="k">constexpr</span> <span class="kt">float</span> <span class="n">MaxAmps</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">;</span> <span class="k">static</span> <span class="k">constexpr</span> <span class="kt">float</span> <span class="n">MaxVolts</span> <span class="o">=</span> <span class="mf">3.15</span><span class="p">;</span> <span class="k">static</span> <span class="k">constexpr</span> <span class="kt">float</span> <span class="n">P2Amps</span> <span class="o">=</span> <span class="mf">0.7</span><span class="p">;</span> <span class="k">static</span> <span class="k">constexpr</span> <span class="kt">float</span> <span class="n">P2Volts</span> <span class="o">=</span> <span class="mf">3.05</span><span class="p">;</span> <span class="k">static</span> <span class="k">constexpr</span> <span class="kt">float</span> <span class="n">R</span> <span class="o">=</span> <span class="mf">0.55</span><span class="p">;</span> <span class="c1">// LED color</span> <span class="k">static</span> <span class="k">const</span> <span class="kt">int</span> <span class="n">Red</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="k">static</span> <span class="k">const</span> <span class="kt">int</span> <span class="n">Green</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="k">static</span> <span class="k">const</span> <span class="kt">int</span> <span class="n">Blue</span> <span class="o">=</span> <span class="mi">255</span><span class="p">;</span> <span class="p">};</span> </code></pre></div></div> <p>MaxAmps should be the maximum current that the LED allows. In this case, 1.0A. MaxVolts is the forward voltage at which you get the maximum number of amps. In this case 3.15 volts. &quot;P2&quot; stands for &quot;second point&quot;, and P2Amps/P2Volts specifies another point on the amp/volt curve. In the case above, it says that at 3.05 volt, the LED will draw 0.7 Amps.</p> <p>Generally, MaxAmps can be found in the data sheet for the LED. And while you can also get the other values from the data sheet, it is preferable to measure them, as the forward voltages can vary from led to led and a small amount of difference in voltage can mean a fairly large difference in current.</p> <p>The &quot;R&quot; value, specifies what resistor is hooked up in series with the LED. In this case 0.55 ohms.</p> <p>Finally, the Red, Green and Blue values specifies the color of the LED.</p> <h2 id="color-activation">Color Activation</h2> <p>ProffieOS uses a simple formula to determine how much a LED should be turned on given a particular color from style associated with that LED. The formula is:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">activation</span> <span class="o">=</span> <span class="mi">255</span><span class="p">;</span> <span class="k">if</span> <span class="p">(</span><span class="n">LED</span><span class="p">.</span><span class="n">Red</span><span class="p">)</span> <span class="n">activation</span> <span class="o">=</span> <span class="n">min</span><span class="p">(</span><span class="n">activation</span><span class="p">,</span> <span class="n">color_from_style</span><span class="p">.</span><span class="n">red</span> <span class="o">*</span> <span class="mi">255</span> <span class="o">/</span> <span class="n">LED</span><span class="p">.</span><span class="n">Red</span><span class="p">);</span> <span class="k">if</span> <span class="p">(</span><span class="n">LED</span><span class="p">.</span><span class="n">Green</span><span class="p">)</span> <span class="n">activation</span> <span class="o">=</span> <span class="n">min</span><span class="p">(</span><span class="n">activation</span><span class="p">,</span> <span class="n">color_from_style</span><span class="p">.</span><span class="n">green</span> <span class="o">*</span> <span class="mi">255</span> <span class="o">/</span> <span class="n">LED</span><span class="p">.</span><span class="n">Green</span><span class="p">);</span> <span class="k">if</span> <span class="p">(</span><span class="n">LED</span><span class="p">.</span><span class="n">Blue</span><span class="p">)</span> <span class="n">activation</span> <span class="o">=</span> <span class="n">min</span><span class="p">(</span><span class="n">activation</span><span class="p">,</span> <span class="n">color_from_style</span><span class="p">.</span><span class="n">blue</span> <span class="o">*</span> <span class="mi">255</span> <span class="o">/</span> <span class="n">LED</span><span class="p">.</span><span class="n">Blue</span><span class="p">);</span> </code></pre></div></div> <p>This essentially means that for the blue led in our example, only the blue part of the RGB color is considered when deciding how much the LED should be activated. This also means that Cyan, Purple and White will also activate the Blue LED, which is usually what we want. A LED specified as being White, will only be activated when for White colors. For a color like {10, 20, 30}, the min() means that a white LED will have it's activation set to 10 (out of 255). For an RGB star, three LED definitions are used, and the activation for each channel is calculated separately according to the above formula.</p> <p>This formula is not well suited for color accuracy. A matrix multiplication could be used instead to get proper color accuracy and account for the fact &quot;blue&quot; can mean different things for different LEDs. While this formula does not provide that type of color accuracy, it is much simpler and generally chooses the brightest possible value, which I think is more suitable for a lightsaber.</p> <h2 id="using-subtract">Using SUBTRACT</h2> <p>One problem with the activation formula above is that if you have a Blue/Blue/White LED, there is no way to get a pure white color, because the Blue LEDs will also be activated. To remedy this, we can introduce subtraction into the activation formula. To do that we place the following in the blue LED struct:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">typedef</span> <span class="n">MyWhiteLED</span> <span class="n">SUBTRACT</span><span class="p">;</span> <span class="c1">// MyWhiteLED is the name of the led struct used for the white LED</span> </code></pre></div></div> <p>When you do this, ProffieOS will calculate the activation as shown above, then calculate the activation based on the white color and subtract that, sort of like:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">activation</span> <span class="o">=</span> <span class="n">CalculateActivation</span><span class="p">(</span><span class="n">MyBlueLED</span><span class="p">)</span> <span class="o">-</span> <span class="n">CalculateActivation</span><span class="p">(</span><span class="n">MyWhiteLED</span><span class="p">)</span> </code></pre></div></div> <p>With this setup, the blue led will turn on for blue colors, but turn off for white colors. This can also be used as a power-saving feature for RGBW stars to make it so that only the white die is used for white colors. Otherwise all of the dies will turn on for white colors. Here is how you would do that:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">struct</span> <span class="nc">MyWhiteLED</span> <span class="o">:</span> <span class="k">public</span> <span class="n">CreeXPE2WhiteTemplate</span><span class="o">&lt;</span><span class="mi">550</span><span class="o">&gt;</span> <span class="p">{};</span> <span class="k">struct</span> <span class="nc">MyRedLED</span> <span class="o">:</span> <span class="k">public</span> <span class="n">CreeXPE2RedTemplate</span><span class="o">&lt;</span><span class="mi">1000</span><span class="o">&gt;</span> <span class="p">{</span> <span class="k">typedef</span> <span class="n">MyWhiteLED</span> <span class="n">SUBTRACT</span><span class="p">;</span> <span class="p">};</span> <span class="k">struct</span> <span class="nc">MyGreenLED</span> <span class="o">:</span> <span class="k">public</span> <span class="n">CreeXPE2GreenTemplate</span><span class="o">&lt;</span><span class="mi">0</span><span class="o">&gt;</span> <span class="p">{</span> <span class="k">typedef</span> <span class="n">MyWhiteLED</span> <span class="n">SUBTRACT</span><span class="p">;</span> <span class="p">};</span> <span class="k">struct</span> <span class="nc">MyBlueLED</span> <span class="o">:</span> <span class="k">public</span> <span class="n">CreeXPE2BlueTemplate</span><span class="o">&lt;</span><span class="mi">240</span><span class="o">&gt;</span> <span class="p">{</span> <span class="k">typedef</span> <span class="n">MyWhiteLED</span> <span class="n">SUBTRACT</span><span class="p">;</span> <span class="p">};</span> <span class="n">BladeConfig</span> <span class="n">blades</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="p">{</span> <span class="mi">0</span><span class="p">,</span> <span class="n">SimpleBladePtr</span><span class="o">&lt;</span><span class="n">MyRedLED</span><span class="p">,</span> <span class="n">MyBlueLED</span><span class="p">,</span> <span class="n">MyGreenLED</span><span class="p">,</span> <span class="n">MyWhiteLED</span><span class="p">,</span> <span class="n">bladePowerPin1</span><span class="p">,</span> <span class="n">bladePowerPin2</span><span class="p">,</span> <span class="n">bladePowerPin3</span><span class="p">,</span> <span class="n">bladePowerPin4</span><span class="o">&gt;</span><span class="p">(),</span> <span class="n">CONFIGARRAY</span><span class="p">(</span><span class="n">presets</span><span class="p">)</span> <span class="p">}</span> <span class="p">};</span> </code></pre></div></div> <p>Note the use of &quot;struct SOMETHING : public SOMETHING_ELSE { .... }&quot; this creates a new struct, but copies the content of SOMETHING_ELSE into it. If you decide to use the snipped above in your config file, please make sure to adjust the resistors to the values you are actually using.</p> <h2 id="overheat-protection">Overheat protection</h2> <p>ProffieOS will use MaxAmps, MaxVolts, P2Amps, P2Volts and R to estimate the current flowing through the LED, based on the current battery voltage. This is done using a fairly simplistic affine model of the LED. Basically, imagine that you draw a current/voltage graph for the LED, locate the MaxAmps/MaxVolts and P2Amps/P2Volts points and draw a straight line through them. Based on this line, and R, the current can be estimated. If the estimated current comes out to be 20% higher than what is recommended for the LED, the activation value calculated above will be reduced by 20% to compensate. This works well enough that resistors are not always required to drive LEDs using ProffieOS, however, it may reduce the life span of the LED.</p> <p>Stated differently, if the above algorithm shows that the led would end up using more power than the LED struct specifies, the PWM ratio (the fraction of time that the FET is ON for each 800Hz cycle) is adjusted downwards to try to protect the LED.</p> <p>Note that if any of the values are not specified correctly, the LED may dim because ProffieOS thinks the LED is going to overheat. Or, overheat-protection might not work. If you don't want the overheat protection, because it is too difficult to configure, just specify a very high R and MaxVolts values and ProffieOS will always assume the LED will be fine.</p> <h2 id="templated-led-configuration">Templated LED configuration</h2> <p>Many popular LEDs already have LED configuration structs in blades/leds.h. Since people have their own preferences for what resistors to use, they are generally specified as templates, which lets you specify what resistor you actually used as a parameter in milliohms. (Unfortunately, specifying it in Ohms was not an option as templates cannot handle floating-point values.) For example, using <code>CreeXPE2PCAmberTemplate&lt;240&gt;</code> specifies that you have a CREE XP-E2 amber LED, and you have it hooked up in series with a 0.24 ohm resistor.</p> <h2 id="implications">Implications</h2> <ul> <li>If you specify the wrong led struct, or the wrong resistor, the above doesn't work the way it should.</li> <li>If you tell ProffieOS that you have less resistance than you really have, ProffieOS will dim the LED when it shouldn't.</li> <li>If you don't need or want overheat-protection (perhaps because your resistors take care of that part) then you can disable it by putting in a large resistor value, like for instance 100000.</li> </ul> <h2 id="calculating-resistor-values">Calculating resistor values</h2> <p>Calculating resistor values for LEDs is very simple. I could give you the formula, but why bother when there are <a href="https://ledcalculator.net/">simple calculators available online</a>.</p> <h2 id="addingmodifying-led-structs">Adding/Modifying LED structs</h2> <p>While you are welcome to add your own LED configuration structs to blades/leds.h, I recommend putting them in your config file instead, right before the blades[] array. That way, you won't have to remember to copy them over when you update to a new version of ProffieOS.</p> <p>By default, the Proffieboard has a wide array of button actions, based on your config (1, 2, or 3 buttons.) However, some of the default button actions can be less than ideal when spinning or dueling the saber. For example, a simple short click on the power button will shut off the saber, which is easy to trigger by accident when handling the saber.</p> <p>So, how do we fix this? Easy.</p> <p>Button actions are handled by a prop file. The default prop file is called saber.h and can be found in the &quot;ProffieOS/props/&quot; directory. While you can modify saber.h directly, the recommended way is to make a copy of saber.h, then add the following to your config file:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#ifdef CONFIG_PROP #include</span> <span class="cpf">"../props/yourfile.h"</span><span class="c1"> // this assumes your copy is called "yourfile.h"</span><span class="cp"> #endif </span></code></pre></div></div> <p>Inside the prop file, you'll find case statements that specify how buttons are handled. Case statements are a condition and an action, followed by &quot;return true&quot;. If the condition is met, then the action is triggered and the break stops other actions from firing in separate case statements. Here's an example of the power off case statement from line 72 in props/saber.h:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">case</span> <span class="nf">EVENTID</span><span class="p">(</span><span class="n">BUTTON_POWER</span><span class="p">,</span> <span class="n">EVENT_CLICK_SHORT</span><span class="p">,</span> <span class="n">MODE_ON</span><span class="p">)</span><span class="o">:</span> <span class="k">case</span> <span class="n">EVENTID</span><span class="p">(</span><span class="n">BUTTON_POWER</span><span class="p">,</span> <span class="n">EVENT_LATCH_OFF</span><span class="p">,</span> <span class="n">MODE_ON</span><span class="p">):</span> <span class="k">case</span> <span class="n">EVENTID</span><span class="p">(</span><span class="n">BUTTON_AUX</span><span class="p">,</span> <span class="n">EVENT_LATCH_OFF</span><span class="p">,</span> <span class="n">MODE_ON</span><span class="p">):</span> <span class="k">case</span> <span class="n">EVENTID</span><span class="p">(</span><span class="n">BUTTON_AUX2</span><span class="p">,</span> <span class="n">EVENT_LATCH_OFF</span><span class="p">,</span> <span class="n">MODE_ON</span><span class="p">):</span> <span class="cp">#if NUM_BUTTONS == 0 </span> <span class="k">case</span> <span class="n">EVENTID</span><span class="p">(</span><span class="n">BUTTON_NONE</span><span class="p">,</span> <span class="n">EVENT_TWIST</span><span class="p">,</span> <span class="n">MODE_ON</span><span class="p">):</span> <span class="cp">#endif #ifndef DISABLE_COLOR_CHANGE </span> <span class="k">if</span> <span class="p">(</span><span class="n">SaberBase</span><span class="o">::</span><span class="n">GetColorChangeMode</span><span class="p">()</span> <span class="o">!=</span> <span class="n">SaberBase</span><span class="o">::</span><span class="n">COLOR_CHANGE_MODE_NONE</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// Just exit color change mode.</span> <span class="c1">// Don't turn saber off.</span> <span class="n">ToggleColorChangeMode</span><span class="p">();</span> <span class="k">return</span> <span class="nb">true</span><span class="p">;</span> <span class="p">}</span> <span class="cp">#endif </span> <span class="n">Off</span><span class="p">();</span> <span class="k">return</span> <span class="nb">true</span><span class="p">;</span> <span class="k">case</span> <span class="n">EVENTID</span><span class="p">(</span><span class="n">BUTTON_POWER</span><span class="p">,</span> <span class="n">EVENT_CLICK_LONG</span><span class="p">,</span> <span class="n">MODE_ON</span><span class="p">):</span> <span class="n">SaberBase</span><span class="o">::</span><span class="n">DoForce</span><span class="p">();</span> <span class="k">return</span> <span class="nb">true</span><span class="p">;</span> </code></pre></div></div> <p>So we see that there are four separate case statements that have the same action: Turn off color change mode and then call Off(); That Off() call turns off the saber, and can be triggered by the power button or aux button, depending on config (both momentary and latching.) Most configs have two buttons: power and aux (both momentary), so we can ignore the three statements regarding latching switches.</p> <p>To alter the button behavior, we simply change</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">case</span> <span class="n">EVENTID</span><span class="p">(</span><span class="n">BUTTON_POWER</span><span class="p">,</span> <span class="n">EVENT_CLICK_SHORT</span><span class="p">,</span> <span class="n">MODE_ON</span><span class="p">):</span> </code></pre></div></div> <p>to</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">case</span> <span class="n">EVENTID</span><span class="p">(</span><span class="n">BUTTON_POWER</span><span class="p">,</span> <span class="n">EVENT_CLICK_LONG</span><span class="p">,</span> <span class="n">MODE_ON</span><span class="p">):</span> </code></pre></div></div> <p>Now a long press of the power button (any press longer than 500 ms) will shut off the saber when it's running. However, this isn't the only change that needs to be made. As you can see in the code, there is another action assigned to a long power button press while powered on: Force effects. We need to 'move' this action because there can only be one case statement for a given button, condition and power state in the code, which means that two identical case statements will prevent the code from compiling and uploading to your saber. In my case, I moved the Force effects from long press power to long press aux, like so:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">case</span> <span class="nf">EVENTID</span><span class="p">(</span><span class="n">BUTTON_AUX</span><span class="p">,</span> <span class="n">EVENT_CLICK_LONG</span><span class="p">,</span> <span class="n">MODE_ON</span><span class="p">)</span><span class="o">:</span> <span class="n">SaberBase</span><span class="o">::</span><span class="n">DoForce</span><span class="p">();</span> <span class="k">break</span><span class="p">;</span> </code></pre></div></div> <p>Now we've changed power off to a long press and moved force effects to long press aux. Hopefully this example shows how easy it is to change the case statements in the prop to customize your buttons to do exactly what you want them to do.</p> <p>To help further customize your preferences for button presses, the timings for different button events are as follows:</p> <p>You get a EVENT_PRESSED event when the button is first pressed.<br /> If it was less than 500ms since the button was released, you also get an EVENT_DOUBLE_CLICK event.<br /> After 300ms you get an EVENT_HELD (If it's still held)<br /> After 800ms you get an EVENT_HELD_MEDIUM (If it's still held)<br /> After 2000ms you get an EVENT_HELD_LONG (If it's still held)<br /> Then, once the button is released you get: An EVENT_RELEASED event.<br /> If held &lt;= 500 ms you get an EVENT_CLICK_SHORT<br /> If held &gt; 500 and &lt; 2500 you get an EVENT_CLICK_LONG<br /></p> <p>Happy sabering!</p> <p>Effect sounds in ProffieOS are played randomly when more than one file of a sound type exist (clsh01, clsh02, etc...)<br /> When using a polyphonic font, these can be triggered in succession and over lap each other, such as multiple blaster deflections.<br /> However, effect sounds that follow other sounds chronologically use a gapless transition as they are butted up to each other. An example of this is bgnlock-&gt;lock.</p> <p>These sounds can be paired so that the same number sound files play when the first sound is triggered.<br /> For example: preon01-&gt;out01, or bgndrag3-&gt;drag03.<br /> Let's say you have a Count Dooku sound font, and preon02 contain speech like<br /> &quot;It is obvious that this contest can not be decided by our knowledge of The Force...&quot;<br /> Wouldn't it be cool if the out.wav that followed had the ignition sound and included the rest of the sentence<br /> &quot;...but by our skills with a Lightsaber.&quot; ? Well, as of ProffieOS6 that's possible.<br /> Or, if you have a few different hums in the font, and out03.wav works really well with one particular hum, then name that perfect hum hum03.wav and pair them up!</p> <h2 id="how-to-pair-effect-sounds">How to pair effect sounds</h2> <p>First, the same number of files must exist for each sound to be paired. (so 3 preon.wavs need 3 out.wavs.)<br /> If there are different amounts, pairing will be bypassed.<br /> Then, in the font config.ini file, an entry is made setting the <em><strong>first</strong></em> effect of the sequence to paired=1.<br /> For example:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp"># pair preon -&gt; out.wavs </span><span class="n">ProffieOS</span><span class="p">.</span><span class="n">SFX</span><span class="p">.</span><span class="n">preon</span><span class="p">.</span><span class="n">paired</span><span class="o">=</span><span class="mi">1</span> <span class="cp"># pair in -&gt; pstoff.wavs </span><span class="n">ProffieOS</span><span class="p">.</span><span class="n">SFX</span><span class="p">.</span><span class="n">in</span><span class="p">.</span><span class="n">paired</span><span class="o">=</span><span class="mi">1</span> </code></pre></div></div> <p>As of ProffieOS7, we now have <strong>all</strong> of the sequential effects pairable, so possibilities include:<br /> preon-&gt;out<br /> out-&gt;hum<br /> hum-&gt;in<br /> in-&gt;pstoff<br /> bgnlock-&gt;lock<br /> lock-&gt;endlock<br /> *Note - this applies to all varities of lockup, so melt, drag, lb, arm</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ProffieOS</span><span class="p">.</span><span class="n">SFX</span><span class="p">.</span><span class="n">hum</span><span class="p">.</span><span class="n">paired</span><span class="o">=</span><span class="mi">1</span> </code></pre></div></div> <p>When using this hum -&gt; in pairing, the setting has another result.<br /> If multiple hum files exist, even if not the same number of files as in.wavs (so it won't pair to them,)<br /> this also will loop the same hum sound until next ignition instead of randomly choosing a different file once the current hum ends.</p> <p>This page needs more work, but here is some information from the pov_tools directory in ProffieOS...</p> <h1 id="createpovdatafiles-script">create_POV_data_files (script)</h1> <p>Use ProffieOS POV Tools to create Persistence-Of-Vision images that show when you swing the blade.<br /> This script utilizes the existing Makefile in the pov_tools folder.<br /> Images can be created without this script via command line by typing 'make'.<br /> Arguments may be provided as 'OPTIONS=--height=N --length=N --offset=N'</p> <p>Under the hood:<br /> pnmtorle - Converts a full-color image to hex data to be included in the code.<br /> pgmtorle - Converts a single-color image to hex data to be included in the code.<br /> pnmwindshieldwiper - Scales the image and bends it so that it will work on a swinging blade.<br /> pnmquantizedtorle - Quantizes images to 8bit 256 colors to balance using color images and not taking up too much memory.</p> <h3 id="operating-system-requirements">Operating System Requirements:</h3> <h3 id="windows-windows-10-at-time-of-writing">Windows (Windows 10 at time of writing):</h3> <p>Install Windows Subsystem for Linux<br /> Linux subsystem for Windows is required before usage. This can be done without manually downloading anything.</p> <ul> <li>Open Windows Powershell as administrator and then simply type in the following: wsl --install</li> <li>Let Powershell run through its thing and wait till it mentions that it's finished and that in order for the changes to take effect you have to reboot/restart your computer.</li> <li>Restart your computer as told and Ubuntu should install itself after you log back in.</li> <li>For more info: <a href="https://docs.microsoft.com/en-us/windows/wsl/install">https://docs.microsoft.com/en-us/windows/wsl/install</a></li> </ul> <p>Install g++ and netpbm</p> <ul> <li>It goes without saying that you hit the return key after each of the following entries.</li> <li>In the command line window that opened, type &quot;sudo apt-get update&quot;. Enter your password.</li> <li>When that finishes, type &quot;sudo apt-get install build-essential gdb&quot;.</li> <li>Answer the question with &quot;y&quot;.</li> <li>When that finishes, type &quot;sudo apt install netpbm&quot;.</li> <li>Answer the question with &quot;y&quot;.</li> </ul> <h3 id="macos">MacOS:</h3> <ul> <li>Install Homebrew <a href="https://treehouse.github.io/installation-guides/mac/homebrew">https://treehouse.github.io/installation-guides/mac/homebrew</a></li> <li>Install netpbm (In Terminal, type &quot;brew install netpbm&quot;).</li> </ul> <h3 id="linux">Linux</h3> <ul> <li>Install netpbm <a href="http://netpbm.sourceforge.net/">http://netpbm.sourceforge.net/</a></li> </ul> <hr /> <h3 id="make-pov-files">Make POV files</h3> <ul> <li>Put one or more .png images that you want to convert into the pov_tools folder.<br /> If you have no images, you can run the script anyway and it can download the sample Star Wars logo and process it for you :)<br /> File names that contain 'preview' will be ignored as valid source image files.</li> </ul> <p>To run the script:</p> <ul> <li> <p>Windows: Double click &quot;create_POV_data_files-Win.bat&quot;<br /> (If Microsoft Defender pops up a warning, click &quot;More Info&quot; then &quot;Run anyway&quot;)<br /> Mac or Linux: Double click &quot;create_POV_data_files&quot;</p> </li> <li> <p>Choose a sizing option from the list. There are some preset sizes plus 'Height entry only' and 'Custom size' options.<br /> (Height is the number of pixels in the blade)<br /> You may want to choose 'Custom' first to get an idea of what gets calculated, then the presets will make more sense.<br /> Once familiar, you can customize the presets by editing that section of the script.</p> </li> </ul> <p>All valid .png files in the pov_tools folder will be processed to the setting you chose.</p> <ul> <li> <p>Check the resulting *preview.png in the pov_tools folder. It should look warped like a windshield shape.</p> </li> <li> <p>The image data files are written directly to the ProffieOS/styles folder.<br /> They will be formatted &quot;sourceFileName_height_colorProfile_POV_data.h&quot;<br /> If you used a Single Color source file, use the resulting SC_POV_data.h file.<br /> If you used a Full Color source file, then use the resulting FC_POV_data.h file.<br /> If you used a Full Color source file, memory use might be less by choosing the 8b_POV_data.h file.</p> </li> <li> <p>A running log of your conversion history with the setting used is written to POV_conversions.log.</p> </li> <li> <p>To use the POV data file for a blade style, first tell the OS which one with the following line added to your config file<br /> in the CONFIG_TOP section: <code>#define POV_INCLUDE_FILE &quot;dataFileNameHere.h&quot;</code></p> </li> <li> <p>Then you just use the POV blade style in a preset:</p> </li> </ul> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span> <span class="s">"Font"</span><span class="p">,</span> <span class="s">"tracks/track.wav"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">style_pov</span><span class="p">,</span> <span class="s">"my_pov"</span><span class="p">},</span> </code></pre></div></div> <p>Swing the blade in a steady, quick movement to see the image in the air. A long-exposure camera capture showcases the result best.<br /> Enjoy!</p> <p>In Proffie OS the term Preset means the combination of:</p> <ul> <li>Sound Font</li> <li>Music Track</li> <li>Blade Style</li> <li>A name for the preset</li> </ul> <p>Presets are defined in object array of type <em>Preset</em>. A single Preset looks something like this:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span> <span class="s">"fontdir"</span><span class="p">,</span> <span class="s">"tracks/track.wav"</span><span class="p">,</span> <span class="n">style</span> <span class="n">definition</span><span class="p">,</span> <span class="c1">// NUM_BLADES specifies how many style definitions there are</span> <span class="s">"description"</span><span class="p">,</span> <span class="p">}</span> </code></pre></div></div> <h2 id="sound-font-quotfontdirquot">Sound Font (&quot;fontdir&quot;)</h2> <p>The first part of a preset is the directory of the sound font. ProffieOS supports most of the major sound font formats that are widely used. Sound-playing engine automatically detects through the files in the directory and switches to the appropriate mode.</p> <ul> <li>Plecter-style Fonts (Including CFX style fonts, as of ProffieOS 3.x)</li> <li>Nec-styled Fonts</li> <li>Smooth Swing V1</li> <li>Smooth Swing V2</li> </ul> <p>You can also specify multiple directories, in which case ProffieOS will search all of them when looking for sound files. When using multiple directories, they should be separated by semicolons, like this:</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="s">"fontdir;common"</span> </code></pre></div></div> <p>This will make ProffieOS first look in &quot;fontdir&quot; then in &quot;common&quot;. Note that all sounds with the same name (but different numbers) have to be in the same directory.</p> <h2 id="music-track-quottrackstrackwavquot">Music Track (&quot;tracks/track.wav&quot;)</h2> <p>In the second field is configured the audio track which can be used for soundtrack music or ambient sound in parallel to the rest of the sounds that are played by the saber. Music Track invoke is configured to be runned via button combination or with Command send via the Serial port/Bluetooth module.<br /> <em>NOTE -</em> If a music track is not desired for use with the preset, that's fine, however there needs to be a placeholder for the argument in the preset. This can be as simple as <code>&quot;&quot;,</code></p> <h2 id="style-definition">Style definition</h2> <p>The style definition specifies the look and behavior of the blade itself. If more then one blade is used (NUM_BLADES is greater than 1) then more then one styles have to be defined in the current preset.</p> <p>Style definitions, or &quot;blade styles&quot; are somewhat complicated, so they have their <a href="/config/styles/blade-styles.html">own page</a>.</p> <h2 id="preset-description">Preset Description</h2> <p>The last element in a preset is the Preset Name. It is in the form of a character string, and while it is optional to include in the preset in order for it to compile, it is highly suggested to use since the preset name is used by <a href="/webusb.html">the ProffieOS workbench</a> and OLED screens to identify the preset. Otherwise it will show nothing and you won't see what the preset is that you are working with. Additionally, if there's a mismatch of number of styles per preset and the number of blades set, no helpful error occurs without the &quot;name&quot; argument in place.<br /> The preset description generally uses the <a href="https://www.dafont.com/star-jedi.font">StarJedi</a> font when displayed. As of ProffieOS 6, the name can be displayed on an OLED screen using an Aurebesh font by adding <code>#define USE_AUREBESH_FONT</code> to your CONFIG_TOP section.</p> <p>Hi, I'm Profezzorn. My real name is Fredrik Hübinette, and I'm originally from Sweden, but nowadays I live in Washingon State, USA.</p> <p>I wrote ProffieOS, I designed the Proffieboards, and I also do a lot of <a href="https://fredrik.hubbe.net/">other stuff</a>.</p> <p>If you wish to contact me. Please go to <a href="https://crucible.hubbe.net">The Crucible</a></p> <p>If you need help with something, go to the right category and start a new thread about your problem. If you don't know which category to use, try the padawan area. You can also send me a personal message on the crucible if it's a business or personal question.</p> <p>Alternatively, you can go go to <a href="https://therebelarmory.com/board/97/profezzorns-lab">The Rebel Armory</a> Either create a thread in the section called &quot;Profezzorn's Lab&quot;, or send a personal message to &quot;Profezzorn&quot;.</p> <p>Using email is not advisable as emails from unknown people usually end up in my spam folder. Using Facebook messenger does not work, because I don't use that.</p> <p>This page will walk you through installing and configuring the software you need to program your Proffieboards. This includes installing Arduino, the arduino-proffieboard plugin, which provides Proffieboard support to Arduino, and any drivers you might need, which depends on what kind of computer you have.</p> <h2 id="arduino">Arduino</h2> <p>Go to <a href="https://www.arduino.cc/en/software">https://www.arduino.cc/en/software</a> and download the Arduino IDE version v1.6.19 or later. Once downloaded, run it to install the Arduino software on your computer.</p> <h2 id="the-arduino-proffieboard-plugin">The Arduino-Proffieboard plugin</h2> <ol> <li>Start the Arduino IDE</li> <li>Go into File -&gt; Preferences</li> <li>In &quot;Additional Board Manager URL&quot;, enter the following:</li> </ol> <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>https://profezzorn.github.io/arduino-proffieboard/package_proffieboard_index.json </code></pre></div></div> <p>It should look like this: <img src="/images/arduino_preferences.png" alt="arduino preferences" /></p> <ol start="6"> <li>Open Arduino menu Tools-&gt;Board-&gt;Boards Manager and type &quot;Proffie&quot; in the search box. Install the latest version &quot;Proffieboard Plugin&quot;. You may have to click on it for the &quot;install&quot; button to appear. Once done, it should look like this:</li> </ol> <p><img src="/images/arduino_board_manager.png" alt="arduino board manager" /></p> <ol start="8"> <li>Select your board version from Arduino menu Tools-&gt;Board-&gt;Proffieboard-&gt; menu</li> <li>Set Tools-&gt;DOSFS: to &quot;SDCARD (SPI)&quot;. For Proffieboard V3, choose &quot;SDCARD (SDIO High Speed)&quot;</li> </ol> <p>When you're done, the tools menu should look like this: <img src="/images/arduino_tools_menu.png" alt="arduino tools menu" /></p> <h2 id="os-specific-setup">OS Specific Setup</h2> <h3 id="windows">Windows</h3> <p>Download <a href="https://fredrik.hubbe.net/lightsaber/proffie-dfu-setup.exe">proffie-dfu-setup</a> and run it. (sha256:4773c8693cf62777cd8da4c95441690e7ae7c4171e8c1d533b1f6225f3bdc29e)</p> <p>If you're using Windows 7 or earlier, you also need to install a USB ACM serial driver:</p> <ol> <li>Go to ~/AppData/Local/Arduino15/packages/profezzorn/hardware/stm32l4/<code>&lt;VERSION&gt;</code>/drivers/windows</li> <li>Right-click on <code>dpinst_x86.exe</code> (32 bit Windows) or <code>dpinst_amd64.exe</code> (64 bit Windows) and select <code>Run as administrator</code></li> <li>Click on <code>Install this driver software anyway</code> at the <code>Windows Security</code> popup as the driver is unsigned</li> </ol> <h3 id="linux">Linux</h3> <ol> <li>Go to ~/.arduino15/packages/profezzorn/hardware/stm32l4/<code>&lt;VERSION&gt;</code>/drivers/linux/</li> <li>sudo cp *.rules /etc/udev/rules.d</li> <li>reboot</li> </ol> <p>If you have no 32-bit support, you will get this error:</p> <pre><code>dfu-suffix: no such file or directory </code></pre> <p>On debian-like systems, this can be fixed with the following commands:</p> <pre><code>sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 </code></pre> <h3 id="mac">Mac</h3> <p>If you're using an M1/M2 mac, you're going to need to install Rosetta. The Arduino-Proffieboard plugin does not have native arm-mac support yet.</p> <h2 id="done">Done</h2> <p>Now you're ready to configure, compile and upload ProffieOS to your Proffieboards.</p> <p>The list of components onboard a Proffieboard v2.2 can be found <a href="https://docs.google.com/spreadsheets/d/18MwtF8ENlrQoEh_lPH9iURkPmyv8qekj8NvmkMRsl70/edit?usp=sharing">here</a>.</p> <p>To see where the components go, refer to the <a href="/hardware/proffieboard-v2.2-part-map---component-level.html">ProffieBoard V2.2 part map</a>.</p> <p>As of late, a couple of the parts are coming up as either unavailable or only available in bulk.</p> <h4 id="this-can-serve-as-a-running-tab-of-alternative-parts">This can serve as a running tab of alternative parts:</h4> <table> <thead> <tr> <th>Designator</th> <th>Package</th> <th>Original Part</th> <th>Alternative parts</th> </tr> </thead> <tbody> <tr> <td>U40</td> <td>uQFN6</td> <td><a href="https://www.digikey.com/en/products/detail/stmicroelectronics/HSP061-2M6/3194677">HSP061-2M6</a></td> <td><a href="https://www.digikey.com/en/products/detail/stmicroelectronics/HSP061-2N4/3194638?fbclid=IwAR1K6J12FCT-Eu1BpGtWV-n2sl82efiHULLNhH3adsXwUN3E6_rNwJK4li8">HSP061-2N4</a></td> </tr> <tr> <td>RN4</td> <td>R_Array_Convex_2x0402</td> <td><a href="https://www.mouser.com/ProductDetail/71-CRA04S-J-22">CRA04S04322R0JTD</a></td> <td><a href="https://www.digikey.com/en/products/detail/rohm-semiconductor/MNR02MRAPJ220/2809533">MNR02MRAPJ220</a></td> </tr> <tr> <td>Q7</td> <td>U-DFN2020-6</td> <td><a href="https://www.mouser.com/ProductDetail/621-DMP2075UFDB-7">DMP2075UFDB</a></td> <td><a href="https://www.digikey.com/en/products/detail/diodes-incorporated/DMP2065UFDB-7/7352966">DMP2065UFDB-7</a></td> </tr> <tr> <td>Y1</td> <td>ST2012SB</td> <td><a href="https://www.digikey.com/en/products/detail/kyocera-international-inc-electronic-components/ST2012SB32768Z0HPWB4/4896431">ST2012SB32768Z0HPWB4</a></td> <td><a href="https://www.digikey.com/en/products/detail/abracon-llc/ABS05W-32-768KHZ-D-2-T/8346614">ABS05W-32.768KHZ-D-2-T</a></td> </tr> <tr> <td>U2</td> <td>LGA-14L</td> <td><a href="https://www.digikey.com/en/products/detail/stmicroelectronics/LSM6DS3HTR/5872331">LSM6DS3HTR</a></td> <td><a href="https://www.digikey.com/en/products/detail/stmicroelectronics/LSM6DS3TR/5180552">LSM6DS3TR</a></td> </tr> </tbody> </table> <p>These part numbers are referenced in the Bill Of Materials (BOM) for Proffieboard V2.2, which contains links to buy them (when available). It can be found here: <a href="https://docs.google.com/spreadsheets/d/18MwtF8ENlrQoEh_lPH9iURkPmyv8qekj8NvmkMRsl70/edit?usp=sharing">https://docs.google.com/spreadsheets/d/18MwtF8ENlrQoEh_lPH9iURkPmyv8qekj8NvmkMRsl70/edit?usp=sharing</a></p> <p>As of late, a couple of the parts are coming up as either unavailable or only available in bulk. There's a running tab of <a href="/hardware/proffieboard-v2.2-bom-alternative-parts.html">alternative parts here</a>.</p> <p><img src="/images/partmap.jpg" alt="partmap" /></p> <h4 id="list-of-parts-and-descriptions">List of Parts and Descriptions</h4> <table> <thead> <tr> <th>Part</th> <th>Description</th> <th>Notes</th> </tr> </thead> <tbody> <tr> <td>U0</td> <td>Main CPU</td> <td>Does everything</td> </tr> <tr> <td>U2</td> <td>Motion chip</td> <td>Senses when you move the saber around</td> </tr> <tr> <td>U1</td> <td>Audio Amplifier</td> <td></td> </tr> <tr> <td>U3</td> <td>Booster</td> <td></td> </tr> <tr> <td>U60</td> <td>3.3V Regulator</td> <td>Feeds the CPU, SD card</td> </tr> <tr> <td>L1</td> <td>Booster coil</td> <td></td> </tr> <tr> <td>Q7</td> <td>Dual pFET</td> <td>Used to control current to SD card and as reverse-current protection for most of the board. (Except for Q1-Q6)</td> </tr> <tr> <td>Y1</td> <td>Clock crystal</td> <td>(together with C7/C8)</td> </tr> <tr> <td>RN4</td> <td>USB protection resistors</td> <td></td> </tr> <tr> <td>U40</td> <td>USB ESD protection diodes</td> <td></td> </tr> <tr> <td>RN3</td> <td>i2C pullup resistors</td> <td></td> </tr> <tr> <td>R5</td> <td>Serves two functions: It protect the board from battery power, and also limits how much current the blade pixels can leech from the board when they are supposed to be off.</td> <td>Can be replaced with a bridge, but the board will be vulnerable unless there is an external resistor somewhere. Note that if you have a pogo pin connector, the resistor should be between the board and the pogo pins, having one in the blade is not sufficient to protect the board.</td> </tr> <tr> <td>L2</td> <td>Filters out noise on the power provided to the CPU.</td> <td>In most cases, this can be replaced with a bridge. The extra noise is still unlikely to cause problems for the CPU.</td> </tr> <tr> <td>Q1-Q6</td> <td>Controls the power to the LEDs or Pixels.</td> <td>There are six of these, and if some of them are not used, these become your spares if one of these breaks. So if you short your blade and Q2/Q3 fries, just hook up your blade to LED4/5 instead and update your configuration accordingly.</td> </tr> <tr> <td>D61</td> <td>Prevents current flow to the battery when on USB.</td> <td>Sometimes, this breaks down in an odd way, where the board will work just fine IF you plug it in to USB to boot it up. While the board can potentially operate if this is replaced with a bridge, it's not safe to do so, and the component must be replaced to make the board work again.</td> </tr> <tr> <td>RN4</td> <td>Protects the USB and CPU from each other.</td> <td>Can potentially be replaced with two bridges, but the board will be more vulnerable to electrical spikes over the USB connection. Also, if you bridge the pads, make sure to bridge them the right way, or USB communications will not work.</td> </tr> <tr> <td>SW1</td> <td>BOOT button</td> <td>The board will work just fine without it, until you end up with a bad programming and need to press it. If you remove the button completely, you can short the pads with a paperclip or tweezers when you need to push it.</td> </tr> <tr> <td>SW2</td> <td>RESET button</td> <td>The board will work fine without it. If it's not working, you can short the reset pad to GND instead. Also, if your goal is to put the board in bootloader mode, you can hold BOOT while providing power to the board instead of holding BOOT while pressing reset.</td> </tr> <tr> <td>C61</td> <td>Battery power noise filter</td> <td>This capacitor helps filter out incoming noise and helps the 3.3v regulator work properly. It's entirely possible that the board will work without it, especially if you don't have anything extra drawing power from the 3.3v pad.</td> </tr> </tbody> </table> <p>In ProffieOS6 you can set your font up to use Accent Swings (swng.wav or swing.wav) based on swing acceleration.</p> <p>Accent swings are played to give more life to faster swings on top of the normal swing pairs. Your font must include swng.wav or swing.wav files.</p> <p>To do so your swng.wav sound files should be ordered sequentially with lowest file numbers for slower acceleration swings and highest numbers for fastest acceleration.</p> <p>Acceleration Based Accent Swings will replace the need for Slashes, remove slsh.wav sounds from font or rename the slsh.wav files to swng.wav (or swing.wav) and use as the higher file numbers and combine with your Accent Swings to use this set up.</p> <p>Example (files must be numbered sequentially you cannot skip a number or you will get &quot;error in font directory&quot;):</p> <ul> <li>swng01.wav - slowest Accent swing sound</li> <li>swng02.wav</li> <li>swng03.wav</li> <li>...</li> <li>swng16.wav - fastest Accent swing sound</li> </ul> <p>Then in the font config.ini you will add these variables:</p> <blockquote> <p><code>#Minimum acceleration for Accent Swing file Selection</code></p> </blockquote> <blockquote> <p><code>#recommended value is 20.0 ~ 30.0</code></p> </blockquote> <blockquote> <p><code>ProffieOSMinSwingAcceleration=20.0</code></p> </blockquote> <blockquote> <p><code>#Maximum acceleration for Accent Swing file Selection</code></p> </blockquote> <blockquote> <p><code>#must be higher than Min value to enable selection</code></p> </blockquote> <blockquote> <p><code>#recommended value is 100.0 ~ 150.0</code></p> </blockquote> <blockquote> <p><code>ProffieOSMaxSwingAcceleration=100.0</code></p> </blockquote> <p>When these variables are present in the font config.ini -and- the MaxSwingAcceleration is greater than the MinSwingAcceleration the swng.wav files will be selected based on the actual acceleration of the swing event.</p> <p>In ProffieOS6, using Fett263's prop file you can enable clash, begin lockup and end lockup sounds to be selected based on the actual clash strength.</p> <p>To enable use /props/saber_fett263_buttons.h</p> <p>Your config should include the following define(s)</p> <blockquote> <p><code>#define FETT263_CLASH_STRENGTH_SOUND // enables Clash Strength selection for sounds</code></p> </blockquote> <blockquote> <p><code>#define FETT263_MAX_CLASH 16 // optional define to set the hardest clash on saber range 8 ~ 16, defaults to 16 if not defined</code></p> </blockquote> <p>Then in your fonts you will set up your clsh.wav, bgnlock.wav and endlock.wav (if more than one file) sequentially with the sounds for the lightest clashes as the lowest file numbers and the hardest clashes as the highest numbers.</p> <p>Example (files must be numbered sequentially you cannot skip a number or you will get &quot;error in font directory&quot;):</p> <ul> <li>clsh01.wav = lightest clash sound</li> <li>clsh02.wav</li> <li>clsh03.wav</li> <li>...</li> <li>clsh16.wav</li> </ul> <p>You can combine the sounds with Clash and Lockup Effects that utilize the ClashImpactF&lt;&gt; function to create &quot;Real Clash&quot; effects that match the sound and effect to the actual strength of the clash.</p> <p>Proffieboard and TeensySabers wiring charts features three types of resistors:</p> <h2 id="current-limiting-resistors">Current-limiting resistors</h2> <p>These are resistors used to limit how much current an LED receives. They can heat up and needs to be rated for enough watts to handle the. Values are usually in the 0.1-1ohm range, with watt ratings starting at 0.5 watts. More about how to calculate the right values for these will be added later.</p> <h2 id="data-line-resistors">Data-line resistors</h2> <p>These resistors are placed in-line on the data line for Neopixels. They are not always required, but help prevent the neopixels from sapping power from the data line. The power sap can be bad for the CPU and cause neopixels to glow even when they are supposed to be off. These resistors are generally in the 150-470 ohm range, and rated for 1/8th of a watt or more.</p> <h2 id="blade-id-resistors">Blade ID resistors</h2> <p>These resistors are used with replaceable blades to identify the blade. They are entirely optional. If you do use one, they are connected between the neopixel data line and GND. The board will test the Blade ID resistor and choose blade configuration and preset based on what it finds. Useful range is 2k to 100k ohm, watt ranting is pretty much irrelevant.</p> <p>Responsive Styles use BladeAngle&lt;&gt; or TwistAngle&lt;&gt; functions to control, modify or move effects in real-time, they are implemented using the below styles. The Responsive Styles all use Layers&lt;&gt; for implementation.</p> <p>Defaults are included to make implementation as easy as adding just the COLOR or you can customize using the other parameters in the styles.</p> <p>Example:</p> <blockquote> <p><code>StylePtr&lt;InOutHelper&lt;Layers&lt;</code> <code>BASE, </code> <code>ResponsiveClashL&lt; COLOR &gt;, </code> <code>ResponsiveBlastL&lt; COLOR &gt;, </code> <code>ResponsiveStabL&lt; COLOR &gt;, </code> <code>ResponsiveLockupL&lt; COLOR &gt;, </code> <code>ResponsiveDragL&lt; COLOR &gt;, </code> <code>ResponsiveLightningBlockL&lt; COLOR &gt;, </code> <code>ResponsiveMeltL&lt; &gt; &gt;, </code> <code>OUT_MILLIS, IN_MILLIS, OFF_COLOR&gt;&gt;()</code></p> </blockquote> <p>Responsive Styles can also be mixed with Standard styles, you do not need to use only Responsive styles, however, you probably only want one version of any effect otherwise Layer order will control which shows or both may show and conflict if one is partial blade and one is full blade.</p> <p>Templates (only COLOR is required to implement - all values are defaulted for simple implementation) *except for ResponsiveMeltL&lt;&gt; which defaults all parameters to allow responsive Melt effect:</p> <h3 id="responsivelockuplltlockup-color-transition1-transition2-top-bottom-sizegt">ResponsiveLockupL&lt;LOCKUP COLOR, TRANSITION1, TRANSITION2, TOP, BOTTOM, SIZE&gt;</h3> <p>Implements LocalizedLockup that will move based on the angle of the blade</p> <ul> <li>TRANSITION1 &amp; TRANSITION2 = transition Begin &amp; End</li> <li>TOP = uppermost lockup position limit, BOTTOM = lowermost lockup position limit, Int&lt;32768&gt; = tip, Int&lt;0&gt; = hilt</li> <li>SIZE controls LOCKUP area size Int&lt;0&gt; ~ Int&lt;32768&gt;</li> </ul> <h3 id="responsivedraglltdrag-color-transtion1-transition2-size1-size2gt">ResponsiveDragL&lt;DRAG COLOR, TRANSTION1, TRANSITION2, SIZE1, SIZE2&gt;</h3> <p>Implements Drag that will increase or decrease in size based on turning hilt</p> <ul> <li>TRANSITION1 &amp; TRANSITION2 = transition Begin &amp; End</li> <li>SIZE1 &amp; SIZE2 control limits for DRAG size with TwistAngle</li> </ul> <h3 id="responsivemeltlltmelt-color-transition1-transition2-size1-size2gt">ResponsiveMeltL&lt;MELT COLOR, TRANSITION1, TRANSITION2, SIZE1, SIZE2&gt;</h3> <p>Implements Melt effect for cutting through object, color will change to mimic metal heating* and intensity will increase or decrease based on turning hilt. *This requires the MELT COLOR enable TwistAngle&lt;&gt;, static COLORS or EFFECTS will not perform this effect. In the OS all of the parameters are defaulted so ResponsiveMeltL can be implemented as a Layer with no input as ResponsiveMeltL&lt;&gt;</p> <ul> <li>TRANSITION1 &amp; TRANSITION2 = transition Begin &amp; End</li> <li>SIZE1 &amp; SIZE2 control MELT area limits for TwistAngle&lt;&gt;</li> </ul> <h3 id="responsivelightningblocklltlightning-block-color-transition1-transition2gt">ResponsiveLightningBlockL&lt;LIGHTNING BLOCK COLOR, TRANSITION1, TRANSITION2&gt;</h3> <p>Implements hybrid Force Lightning Block with animation, intensity responds to turning the hilt and location/focus will respond to blade angle</p> <ul> <li>TRANSITION1 &amp; TRANSITION2 = transition Begin &amp; End</li> </ul> <h3 id="responsiveclashlltclash-color-transition1-transition2-top-bottom-sizegt">ResponsiveClashL&lt;CLASH COLOR, TRANSITION1, TRANSITION2, TOP, BOTTOM, SIZE&gt;</h3> <p>Implements LocalizedClash effect that mimics ResponsiveLockup location and size (unless changed by user)</p> <ul> <li>TRANSITION1 &amp; TRANSITION2 = transition Begin &amp; End</li> <li>TOP = uppermost Clash position limit, BOTTOM = lowermost Clash position limit, Int&lt;32768&gt; = tip, Int&lt;0&gt; = hilt</li> <li>SIZE controls Clash area size Int&lt;0&gt; ~ Int&lt;32768&gt;</li> </ul> <h3 id="responsiveblastlltblast-color-fadeoutms-wavesize-wavespeed-top-bottom-effectgt">ResponsiveBlastL&lt;BLAST COLOR, FADEOUT_MS, WAVE_SIZE, WAVE_SPEED, TOP, BOTTOM, EFFECT&gt;</h3> <p>Implements Blast effect that will move based on angle of the blade instead of random location Blast will impact and disperse along the blade from original position</p> <ul> <li>FADE = fade time ms</li> <li>WAVE_SIZE = size</li> <li>WAVE MS = speed ms</li> <li>TOP = uppermost Blast position limit, BOTTOM = lowermost Blast position limit, Int&lt;32768&gt; = tip, Int&lt;0&gt; = hilt</li> <li>EFFECT = effect type, defaults to EFFECT_BLAST</li> </ul> <h3 id="responsiveblastwavelltblast-color-fadeoutms-wavesize-wavespeed-top-bottom-effectgt">ResponsiveBlastWaveL&lt;BLAST COLOR, FADEOUT_MS, WAVE_SIZE, WAVE_SPEED, TOP, BOTTOM, EFFECT&gt;</h3> <p>Implements Blast effect that will move based on angle of the blade instead of random location Blast will impact and split up and down the length of the blade from original position</p> <ul> <li>FADE = fade time ms</li> <li>WAVE_SIZE = size</li> <li>WAVE MS = speed ms</li> <li>TOP = uppermost Blast position limit, BOTTOM = lowermost Blast position limit, Int&lt;32768&gt; = tip, Int&lt;0&gt; = hilt</li> <li>EFFECT = effect type, defaults to EFFECT_BLAST</li> </ul> <h3 id="responsiveblastfadelltblast-color-size-fade-top-bottom-effectgt">ResponsiveBlastFadeL&lt;BLAST COLOR, SIZE, FADE, TOP, BOTTOM, EFFECT&gt;</h3> <p>Implements Blast effect that will move based on angle of the blade instead of random location Blast will impact and Fade in position</p> <ul> <li>SIZE controls blast size bump 0 ~ 32768</li> <li>FADE = fade time ms</li> <li>TOP = uppermost Blast position limit, BOTTOM = lowermost Blast position limit, Int&lt;32768&gt; = tip, Int&lt;0&gt; = hilt</li> <li>EFFECT = effect type, defaults to EFFECT_BLAST</li> </ul> <h3 id="responsivestablltstab-color-transition1-transition2-size1-size2gt">ResponsiveStabL&lt;STAB COLOR, TRANSITION1, TRANSITION2, SIZE1, SIZE2&gt;</h3> <p>Stab effect Implements Stab effect that will change in size based on angle of the blade</p> <ul> <li>TRANSITION1 &amp; TRANSITION2 = transition Begin &amp; End</li> <li>SIZE1 &amp; SIZE2 control Stab area limits for BladeAngle, Int&lt;0&gt; ~ Int&lt;32768&gt;</li> </ul> <p>Up until ProffieOS 6.x all save files in ProffieOS were basically simple INI files. Just a bunch of lines like:</p> <div class="language-ini highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="py">variable</span><span class="p">=</span><span class="s">value</span> <span class="py">anotherVariable</span><span class="p">=</span><span class="s">value</span> <span class="err">end</span> </code></pre></div></div> <p>While super simple, it did cause some problems, because saving these files deleting or overwriting files, and every time you write to the SD card, there is there is a chance that the write could be interrupted in the middle, making one or more blocks turn into gobblygook. Now, if the data inside the file turns into gobblygook, that isn't really a problem. We have a .bak file for that. Also, the &quot;end&quot; written at the end of the file lets us check if the file was written all the way to the end or not.</p> <p>However, if the gobblygook occurs while creating or deleting a file, then the directory itself becomes corrupt, and that can mean files and directories just can't be found anymore. In some cases, this makes the SD card completely unreadable.</p> <p>In ProffieOS 7.x, this problem has been mostly solved. The solution is to create the files once, make them big enough to contain all the data we could ever want to write to them, and then re-write them. By never creating new files, and never resizing the files, only the contents of the files can become corrupt, not the directories. At least as long as the SD card itself doesn't go crazy.</p> <p>To make this work, we'll need two files for each save file, and we'll take turns writing to them. That way, we never overwrite the last savefile, we only write over the last-last savefile.</p> <p>Of course, we'll need some way to tell which file was is actually the newest one. We'll solve this by writing a number into the file which increases by one every time we save. That way, the file with the highest number will be the last one.</p> <p>We'll also need some way to know if the file gets corrupted for some reason. If that happens, we'll read the previous file. If we loose power in the middle of writing to a file, when we read the file, we should be able to discover that it was corrupted. For this, we'll use a checksum, if you don't know what a checksum is, google it.</p> <p>Finally, we'll need a way to know how long the data in the file is. Since the file is going to be much longer than we need, we can't rely on the length of the file itself to tell us how much data is in the file anymore.</p> <h2 id="the-actual-format">The actual format</h2> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="k">struct</span> <span class="nc">Header</span> <span class="p">{</span> <span class="kt">uint32_t</span> <span class="n">magic_number</span><span class="p">;</span> <span class="c1">// 0xFF1E5AFE</span> <span class="kt">uint32_t</span> <span class="n">checksum</span><span class="p">;</span> <span class="kt">uint32_t</span> <span class="n">iteration</span><span class="p">;</span> <span class="kt">uint32_t</span> <span class="n">length</span><span class="p">;</span> <span class="c1">// Length of the data, starting from the second block.</span> <span class="p">};</span> <span class="k">struct</span> <span class="nc">FirstBlock</span> <span class="p">{</span> <span class="n">Header</span> <span class="n">header1</span><span class="p">;</span> <span class="n">Header</span> <span class="n">header2</span><span class="p">;</span> <span class="kt">char</span> <span class="n">install_time</span><span class="p">[</span><span class="mi">480</span><span class="p">];</span> <span class="p">};</span> </code></pre></div></div> <p>The header is repeated twice, followed by the install time, and then enough zeroes to fill up the first block (512 bytes). Unless KEEP_SAVEFILES_WHEN_PROGRAMMING is defined, save files with a different install_time than the currentntly running program will be ignored. Files where header1 is different from header2 will also be ignored. Or where the checksum doesn't match the checksum of the data in the file. If neither of the two files pass all of these tests, ProffieOS will try to read the files as plain ini-files instead, which makes all of this backwards compatible. However, when it writes new files, those files will be in the new format.</p> <p>If you wish to edit a config file by hand, please be aware that you can't just skip the first 512 bytes and make a change in the file, because the checksum won't match anymore. However, you can <em>delete</em> the first 512 bytes from the file, then make the edits and save the file. The result will be a regular ini file, which ProffieOS can read in compatibility mode. Note that you'll need to delete the <em>other</em> file though, or ProffieOS will prefer that one.</p> <p>Basically, ProffieOS will do the following:</p> <ol> <li>check if the .ini file is in the new format, and is valid</li> <li>check if the .tmp file is in the new format, and is valid</li> <li>If both are true, it will read the one with the highest iteration number</li> <li>If only one is true, it will read that file</li> <li>If neither is true, it will try to read the .ini file as a plain ini file.</li> <li>If that fails, it will try to read the .tmp as a plain ini file.</li> </ol> <p>If you see this when trying to compile ProffieOS</p> <pre><code>`.text' will not fit in region `FLASH' </code></pre> <p>Then the combination of all the features and styles takes up too much space to fit on the board. Here is a list of things you can try to make it fit, or just to reduce memory use in general:</p> <h3 id="update-to-the-latest-available-arduino-proffieboard-plug-in">Update to the latest available Arduino Proffieboard plug-in.</h3> <p>Arduino menu Tools&gt;Board&gt;Boards Manager, type &quot;proffie&quot; in the search box. Install or update to the latest version available in the dropdown menu. Specifically, 3.6.0 introduced a lot of optimizations to save compiled code size.</p> <h3 id="use-quotsmallest-sizequot">Use &quot;smallest size&quot;.</h3> <p>In the Arduino menu Tools-&gt;Optimize, you can select &quot;smallest size&quot;. This will disable some optimizations that usually make the compiled code bigger. The program will run a little slower, but that is generally not a problem.</p> <h3 id="dont-use-quotserial--mass-storagequot-if-not-neccessary">Don't use &quot;Serial + Mass Storage&quot; if not neccessary.</h3> <p>Arduino menu Tools&gt;USB Type can be set to &quot;Serial&quot; only to save additional memory that is used if Mass Storage is turned on.<br /> If you can use a standalone USB SD card reader, you'll access your files faster, and with less chance of file corruption, plus get the memory savings as well.</p> <h3 id="dont-use-the-pov-style">Don't use the POV style.</h3> <p>The POV style uses a lot of memory, and most people never really use it. Look for &quot;&amp;pov_style&quot; in your config file and either replace those styles with something else, or remove the preset completely.</p> <h3 id="disable-diagnostic-commands">Disable diagnostic commands.</h3> <p>ProffieOS contains several serial monitor commands which are very useful for diagnosing problems, like &quot;top&quot;, &quot;monitor&quot; and &quot;dir&quot;. However, disabling these commands can save some memory. To do so you can add</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define DISABLE_DIAGNOSTIC_COMMANDS </span></code></pre></div></div> <p>to your config file. Note that this define is only available in ProffieOS 3.x and over.</p> <h3 id="reduce-number-of-presets-or-use-simpler-styles">Reduce number of presets, or use simpler styles.</h3> <p>If all else fails, you'll need to reduce the number of presets you use, or use less complicated blade styles.</p> <h3 id="use-the-same-or-similar-style-for-multiple-presets">Use the same, or similar style for multiple presets.</h3> <p>Using the same style multiple times in your config file uses no extra memory. This means that you can have multiple presets, with different fonts and tracks, but with identical blade styles, and it will use very little memory. Since ProffieOS 4.x, this sort of memory saving also applies when making minor changes, like changing the base color of a blade. Basically: Having similar blade styles, but with different colors uses less memory than having unique blade styles for each preset.</p> <h3 id="disable-basic-parser-styles--proffieos-6x-or-newer">Disable basic parser styles. (ProffieOS 6.x or newer)</h3> <p>ProffieOS contains a few simple blade styles can be selected, used and customized from the ProffieOS Workbench by using Bluetooth or WebUSB. If you never use the ProffieOS Workbench, you don't need these styles. Also, if you use styles updated for Edit Mode, then you will have lots of options for customization in the Workbench even if you don't have these basic styles. To disable them, you can add</p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define DISABLE_BASIC_PARSER_STYLES </span></code></pre></div></div> <p>to your config file.</p> <h3 id="disable-talkie-onboard-synthesized-voice-propmts--proffieos-7x-or-newer">Disable Talkie onboard synthesized voice propmts. (ProffieOS 7.x or newer)</h3> <p>This will bypass the onboard spoken propmts such as &quot;Font Directory Not Found&quot;, which can save a few KB.<br /> ProffieOS will use short melodies to indicate an error instead. The &quot;decoder&quot; for those musical passages can be found here:<br /> <a href="/troubleshooting/beep_codes.html">What is it beeping?</a></p> <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#define DISABLE_TALKIE </span></code></pre></div></div> <h3 id="use-proffieos-workbench-webpage-edit-mode-or-edit-presetsini-by-hand-to-add-more-presets">Use ProffieOS Workbench webpage, Edit Mode, or edit presets.ini by hand to add more presets.</h3> <p>Additional presets can be added to the saber by re-using existing code from the config file that was uploaded. This will use no additional FLASH memory.<br /> This is done by instructing the OS to use an existing preset's blade style in a new preset, assigning any font, and even changing the color of the blade for that new preset. More information can be found at these links:<br /> <a href="https://fredrik.hubbe.net/lightsaber/webusb.html">https://fredrik.hubbe.net/lightsaber/webusb.html</a><br /> <a href="https://www.fett263.com/proffieOS6-edit-mode.html">https://www.fett263.com/proffieOS6-edit-mode.html</a><br /> <a href="/howto/editing-presets.ini-by-hand.html">Editing presets.ini by hand</a></p> <p>Most SD cards will work fine with ProffieBoards / TeensySaber. Some very cheap cards, or cards below class 4 may cause issues with read speed. Unfortunately, the problem usually doesn't show up in regular benchmarks since the Proffieboard and TeensySaber uses SPI mode instead of sdio to access the cards. This limits the speed, and some cards have a problem with it.</p> <p>If you suspect that your SD card is causing problems, try the &quot;sdtest&quot; command. This will read the hum file from your current font over and over again and see how long it takes. Normal SD cards should give you 10-11 parallel streams. If you see less than 9, get a new SD card.</p> <p>Please note that the &quot;sdtest&quot; command will not be available in the <a href="/tools/serial-monitor.html">Serial Monitor</a> if you have DISABLE_DIAGNOSTIC_COMMANDS in your config file.</p> These commands are usually used for deeper diagnostics beyond typical use. For more typical use case commands, see [Serial Monitor Commands](/tools/serial-monitor-commands.html). # WARNING - While most of these are harmless, some of these are powerful and should only be used if you're familiar with how they work. ## scanid Have the board deactivate all current blades, check the BladeID and pick a BladeConfig [] array based on the new detected BladeID. ## id Show the blade ID. ## dacbuf Print the current contents of the dac buffer. ## list_named_style List all available named styles. ## describe_named_style <style> Show what arguments a style requires. ## amp on/off Turn amplifier on or off. ## booster on/off Turn 5V booster on or off. ## make_default_console Make this connection the default connection (if using something other than Arduino Serial monitor, like a TTL->USB interface) ## malloc Show how much dynamic memory is allocated. ## whatison Shows all the wav players, whether they are currently on or off, and what is loaded into each of them. # **BLADES:** ### **SimpleBlade:** ## blade on/off Turn simple blade on off. ## state Displays if SimpleBlade is on or off. <br/> The following requires ENABLE_FASTLED defined: ## blade on/off Turn apa102 blade on off. <br/> The following requires ENABLE_WS2811 defined: ## blade on/off Turn ws2811 blade on off. <br/> The following requires ENABLE_DEVELOPER_COMMANDS defined: ## state Displays if WS2811 is on or off <br/> <br/> *NOTE* - The following commands only work if `#define DISABLE_DIAGNOSTIC_COMMANDS` in _NOT_ active in the config.h file. ## monitor <topic> Toggle extra debug printouts. Topic is one of: swings, gyro, samples, touch, battery, pwm, clash, temp, strokes, serial, fusion, variation ## volumes Prints volumes of sounds currently occupying wav players. ## buffered Prints buffering of sounds currently occupying wav players. ## get_ble_config Show BLE PIN ## top Prints statistics about how often things are running and how much cpu they are using. If something is slow, start by running this command a few times and see if something sticks out at you. <br/> <br/> *NOTE* - The following commands only work if `#define ENABLE_DEVELOPER_COMMANDS` _IS_ active in the config.h file. ## say _ARG_ Test error messages. See following ARGs list: - bfd "Error in font directory" - bof "Font directory not found" - ftl "Font directory too long" - sd "SD card not found" - bb "Error in blade array" - bp "Error in preset array" - lb "Low battery" ## talkie <hexdata> Play talkie from hex string. rate = 25. ## talkie_slow rate = 25 ## talkie12 rate = 12 ## talkie15 rate = 15 This a list of some of the most typical commands you can use in the Serial Monitor. For more diagnostic/developer based commands, see [Serial Monitor Additional Commands](/tools/serial-monitor-additional-commands.html). The console can be opened in Arduino by choosing menu Tools>Serial Monitor. Type the command in the top box and hit return, or click the "Send" button on the right side. *Note* - Commands listed under the **Diagnostic Commands** section below only work if `#define DISABLE_DIAGNOSTIC_COMMANDS` in NOT active in the config.h file. ## version Prints which ProffieOS version is running. ## reset Reboots the Proffieboard. ## RebootDFU Reboots the Proffieboard as STM32BOOTLOADER device. ## get_volume Displays the current volume. ## set_volume xxxx Sets the current volume of the board. Overrides the value uploaded in your config.h file. ## n Go to next preset. ## p Go to the previous preset. ## on Turn the saber on. ## off Turn the saber off. ## clash Trigger a clash ## force Trigger a force push effect. ## blast Trigger a blast effect. ## stab Trigger a stab effect. ## lock Begin/end lockup mode. ## lblock/lb Begin/end lightning block. ## drag Begin/end drag. ## melt Begin/end melt. ## ccmode Enter/exit color change mode. ## cd <directory> Use the specified font directory. Full path needs to be provided. ## pwd Shows what font directory is currently active. ## dir <directory> Show the contents of a directory on the SD card. Full path needs to be provided. ## play <file> Plays a particular file. ## play_track <file> Like "play", but uses the track player to play it, which means that you can stop the track with "stop_track". ## stop_track Stops the currently playing track, if any. ## scanid Have the board deactivate all current blades, check the BladeID and pick a BladeConfig [] array based on the new detected BladeID. ## pow / aux / aux2 (or any button name) These commands can be used to send button events from the Serial Monitor. See [Button Commands](/button-commands.html) for more information. ## blink N Blink Status LED N times (Proffieboard V3 only) # Editing Presets in Place (writes to presets.ini) ## rotate Rotating is an alternative to saving the current preset. It puts the last preset first and saves presets.ini/tmp. ## list_presets Prints currently programmed presets. ## set_font FONTNAME Set current font. ## set_track (full path to)TRACK Sets current track. ## set_name NAME Set current preset name. ## set_style Set current style. <br/> <br/> # Diagnostic Commands *Note:* The uploaded config file can not have `#define DISABLE_DIAGNOSTIC_COMMANDS` active for these to work. ## beep Plays a few beeps, great for testing if your speaker is working. ## dir List contents of current font directory. ## effects List all found effect sounds in font search path. ## sdtest Tests the speed of the sd card. From ProffieOS 3.x and forward, this will read all the files in the current font, then present an average speed and a histogram of how long it took to read each block and open each file. ## sdtest all Like the "sdtest" command, but reads every file on the SD card, this can take a while. The Serial Monitor is a simple tool for talking to ProffieOS. ProffieOS will print out messages when something is happening, and you can enter commands to try things out. To start the Serial Monitor, go to connect your board to the computer and start up Arduino. Now go check Tools->Port and select the right port. For Proffieboard it might say "butterfly" next to it. If the port doesn't show up, see this page: [Where's my Port?](/troubleshooting/wheres-my-port.html) Once the right port is selected, start the serial monitor by selecting it from the Tools menu. If everything works, you should see some messages from ProffieOS, such as "Welcome to ProffieOS". The first time you use the Serial Monitor, you will need to select the correct line endings in the bottom right corner. The correct line ending is "newline". You should now be able to type commands. For a list of typically used entries, see [Serial Monitor Commands](/tools/serial-monitor-commands.html). For additional available commands, see [Serial Monitor Additional Commands](/tools/serial-monitor-additional-commands.html). SimpleBladePtr takes 8 arguments, 4 of which are required: SimpleBladePtr<LED1, LED2, LED3, LED4, pin1, pin2, pin3, pin4> The first four are class names which specifies how to drive the LEDs, the last four are the pins for those leds. The pins defaults to bladePowerPin1, bladePowerPin2, bladePowerPin3 and bladePin, respectively. You can read more about how to configure the led classes on the [Led Configuration](/config/blades/led-configuration.html) page. When one or more set of swingl/swingh (or lswing/hswing) files are present, ProffieOS will activate the SmoothSwing V1 or V2 algorithms. To decide which one to use, it will read a file called "smoothsw.ini", which can contain the following variables: (listed with their default values) ``` # SmoothSwing algorithm version, you probably want to set this to 2. Version=2 # Degrees of rotations per second required to reach full volume. # Default is 450.0 (any value) SwingSensitivity=450 # Smoothswing volume multiplier (defaults to 3x normal volume) # Default is 3.0 (value between 1 and 5) MaxSwingVolume=3.0 # What percent the hum sound will decrease as swing increases # Default is 75.0 (value between 1 and 100) MaximumHumDucking=75 # Non-linear swing response (higher values make it more non-linear) # Values greater than 1 will result in the Smoothswing sound staying quieter # at lower speeds and then ramping up quickly to full volume a higher speeds. # Values less than 1 will result in the Smoothswing volume ramping up quickly # at lower speeds and then staying there as you approach full speed. # the default is 1.75 (any value) SwingSharpness=1.75 # Degrees per second needed to register as a smoothswing. # Default is 20.0 (1 to 360) SwingStrengthThreshold=20 # Length of first transition in degrees. # Default is 45.0 (1 to 360) Transition1Degrees=45 # Length of second transition in degrees. # Default is 160.0 (1 to 360) Transition2Degrees=160.0 # If not zero, swngNNN.wav or swngNNN.wav will # be played when we reach this swing speed. # Unit is degrees per second, 450 is a reasonable value. # Default is 0.0 AccentSwingSpeedThreshold=450 # If not zero AND accent swings are on, this defines the threshold for when # a swing is considered a slash. Unit is degrees per second **per second**. # NOTE - While 260 is the default value, it is subjective. # Something like 100 might work better. # The higher the accent swing threshold, the higher the slash threshold will need to be. AccentSlashAccelerationThreshold=260.0 # NOTES # 1. The length of the smoothswing pair wavs has nothing to do with # the length of the swing movement or how it transitions. # Try setting the SwingSensitivity number so that you're not # detecting motion for smaller movements. # 2. If you find that the same swing pair sounds play for subsequent swings, # try adjusting SwingSensitivity. If the saber is moving faster than the threshold velocity, # it is going to be playing one of the smoothswing pairs on loop. # The algorithm only picks a new swing pair of swingl and swingh sounds when it thinks # it's safe to do so (when you're not in the middle of a swing). ``` This page explains the parameters that are available in a sound font's `config.ini` file, and provides an example file. For more information on how to create a ProffieOS compatible sound font, [click here](/sound/sound-font-configuration.html) ```ini # Default config.ini # This specifies how many milliseconds before the end of the "out" sound the hum # starts to fade in. Default 100 humStart=100 # From ProffieOS 7.x, you can use ProffieOSHumDelay to specify how many milliseconds # from the beginning of out.wav to start the hum. If both ProffieOSHumDelay and humStart # are specified, then ProffieOSHumDelay is the one that will count. # If not specified or set to -1, humStart will be used instead. # Defaults to -1. ProffieOSHumDelay=-1 # The volume of the hum sound. Can be 0-16, where 0 is muted. # Default 15 volHum=15 # The volume of all effect sounds. Can be 0-16, where 0 is muted. # Default 16 volEff=16 # How fast (degrees per second) we have to swing before a swing effect is # triggered. Default 250. ProffieOSSwingSpeedThreshold=250 # How much to bend the response curve between swing speed and swing volume. # Can be 0.01 - 2.0, where value of 1.0 will result in no bending. Default 0.5 ProffieOSSwingVolumeSharpness=0.5 # The volume multiplier when swings are at the swing speed threshold. # Can be 1.0 to 3.0. Default 2.0 ProffieOSMaxSwingVolume=2.0 # Specify what fraction of swing that must be played before a new swing can be # started. Can be 0.0-1.0. Defaults to 0.5 (50%). ProffieOSSwingOverlap=0.5 # This is used to control the volume of the combined hum and smoothswings # when an accent swing plays. # Defaults to 0.2 (volume is decreased by 20% of swing volume) ProffieOSSmoothSwingDucking=0.2 # How slow (degrees per second) the swing has to be before it's not considered a # swing anymore. Default 200. ProffieOSSwingLowerThreshold=200 # Only used for non-smoothswing fonts. Specifies how aggressive a swing has to be to be considered a slash. Once we # reach the ProffieOSSwingSpeedThreshold, rate of swing speed change is used to # determine if it's a swing or a slash. Default 260 ProffieOSSlashAccelerationThreshold=260 # For OLED displays. This specifies the frame rate of animations. # If not specified (or set to zero) the frame rate will be 24 frames # per second for non-looped animations. For looped animations, the # frame rate will be set so that the loop takes one second. ProffieOSAnimationFrameRate=0.0 # For OLED displays, the time a blade style's "message", # static BMP, or loop animation will play when changing presets. ProffieOSFontImageDuration=5000.0 # For OLED displays, the time an on.bmp will play ProffieOSOnImageDuration=5000.0 # For OLED displays, the time a blst.bmp will play ProffieOSBlastImageDuration=1000.0 # For OLED displays, the time a clsh.bmp will play ProffieOSClashImageDuration=500.0 # For OLED displays, the time a force.bmp will play ProffieOSForceImageDuration=1000.0 # If #define ENABLE_SPINS is defined. Number of degrees the blade must travel while staying above the # swing threshold in order to trigger a spin sound. Default is 360 or # one full rotation. ProffieOSSpinDegrees=360.0 ### ---- These below as of OS6 only ---- ### # Minimum acceleration for Accent Swing file Selection #recommended value is 20.0 ~ 30.0 ProffieOSMinSwingAcceleration=20.0 # Maximum acceleration for Accent Swing file Selection #must be higher than Min value to enable selection #recommended value is 100.0 ~ 150.0 ProffieOSMaxSwingAcceleration=100.0 # Match sequential effects such as preon->out.wav files # EFFECTNAME can be “preon”, “out”, “pstoff”, etc. # Set to 1 *AND* have the same number of files in the second effect to activate this feature. # ProffieOS.SFX.EFFECTNAME.paired=1 # For example: # ProffieOS.SFX.preon.paired=1 # ProffieOS.SFX.out.paired=1 # # Also, when multiple hum files exist, this will loop the # same hum sound until next ignition instead of randomly # choosing a different file once the current hum ends. # ProffieOS.SFX.hum.paired=1 # Set the volume for each effect individually, in percent. # 50 makes it half as loud. 200 makes it twice as loud. # Maximum allowed value is currently 255. The default is 100. # EFFECTNAME can be "clash", “preon”, “out”, “pstoff”, etc. # ProffieOS.SFX.EFFECTNAME.volume=100 ### ---- OS 7.x and above ---- # Note, that from ProffieOS 7.x, all of the ImageDuration # variables can be set to zero, in which case the length # of the played wav file will be used to determing how long # to show the image for. # For OLED displays, the time a out.bmp will play ProffieOSOutImageDuration=2000.0 # For OLED displays, the time a in.bmp will play ProffieOSInImageDuration=2000.0 # For OLED displays, the time a pstoff.bmp will play ProffieOSPstoffImageDuration=2000.0 # For OLED displays, the time a on.bmp will play ProffieOSOnImageDuration=5000.0 # If true (non-zero) then smoothswing pairs will be played # in sync with the hum. This means that you could have a # musical beat in the hum, and smoothswing sounds could have # melodies which would be played in sync with the beat. ProffieOSSmoothSwingHumstart=0 ``` From ProffieOS 7.x forward, if there are multiple config.ini files in the font search path, they will all be read. Values specified in the first one will take precedence over values specified in the second one, and so forth. In ProffieOS 6.x and earlier, only once a config.ini was found, no more files were read. A sound font is mostly made up of many sound files in a single directory. Let's take a look at the following example and break down the important aspects. <center><font size=+4 style=color:black><span style="background-color:yellow;-webkit-print-color-adjust: exact;">font1/</span><span style="background-color:magenta;-webkit-print-color-adjust: exact;">clash</span><span style="background-color:cyan;-webkit-print-color-adjust: exact;">001</span><span style="background-color:pink;-webkit-print-color-adjust: exact;">.wav</span></font></center> This file name is made up of four main parts: * The directory (Yellow) - This can be anything you want, and is typically the name of the font. All sound and config files must be in the same final directory, but fonts can be organized in to as many sub-directories as you want. The first entry in the [presets\[\] array](/config/the-config_presets-section.html) specifies the full path to the font directory. For example, you can have your fonts sorted as `sith\1\sith1`, or `fonts\jedi\named\obiwan`, etc. * The name (Magenta) - This is the name of the sound type, using the names specified below in the [Sound Effect Names](#sound-effect-names) section. In this example, it's a clash sound. * The number (Cyan) - If you want to have multiple sound effects of the same type, add a number to the end of the filename before the extension. The numbers can be in the following format: * 1,2,3, etc. * 01, 02, 03, etc. * 001, 002, 003, etc. The number sequence must be consistent and without any gaps. It's also possible to omit the number completely if there is only a single sound. When playing a sound, ProffieOS will generally pick one of them randomly. For looping sounds, ProffieOS will randomly pick one of the numbered files each time it starts over. This means it's possible to create a more interesting hum by having `hum.wav`, `hum1.wav`, `hum2.wav`, etc. * Note: While Proffie-based boards support long filenames, Teensy-based boards support a maximum of 8 characters for file names. It is recommended to stick to this maximum to ensure full compatibility with any sound board. * The extension (Pink) - The recommended format is .wav files that are 44khz, 16-bit mono PCM. ProffieOS also supports 11khz, 22khz, and 44khz .wav in both mono and stereo. You may also use .raw and .usl files, but they must be 44khz mono. ## Alternative font file naming Instead of font1/NameNNN.wav, you can also use font1/Name/NNN.wav, which lets you have more files and better organization. font1/Name/NameNNN.wav is also supported for compatibility with Igniter boards. ## Font Search Paths. You can have ProffieOS look in multiple directories for font and animation files, as well as config.ini and smoothsw.ini files. Primarily, this is meant to make it easier to share files like "ccbegin" and "ccend" between fonts, but it can also be used for more advanced things, like adding different quotes to a font. So how do you use this? Basically, you just specify a list of directories with a semicolon in between. So if your current preset says "font1", you could change it to "font1;common" to have it first search "font1", and any files found there will be used first. After that ProffieOS will search "common" and add any files not already found. A prime example of how this can be used is the "hero" font pack. You could have one "hero/font;hero/obiwan;common" preset, and another "hero/font;hero/luke;common" preset, without having to duplicate the files in the "hero/font" directory. <br/>Currently, the only limit on how many directories you can search is that the whole list of directories must be less than 127 characters.<br/> One caveat, you can't mix files with the same base name. Let's say hero/font contains preon01.wav. Even if hero/obiwan contains preon02.wav, it will not be used. The decision of which directory to use is done _once_ for all files with the same "name", individually for each numbered file. **Note** This feature is only available in ProffieOS 4.x. and later. ## Sound Effect Names The name part of the filename needs to be one that ProffieOS can recognize. Sounds can either be monophonic (Plecter) or polyphonic (Naigon Electronics) style. ProffieOS will automatically decide if a specific sound type is monophonic or polyphonic font based on the filename. Monophonic sounds will smoothly join with the hum when they are finished playing. Polyphonic sounds will automatically mix with the hum sound. Keep in mind that you cannot mix mono and polyphonic sounds for the same effect. For example, if you are using `clash`, you cannot use `clsh` as well. You can, however, mix for different effects. You could use `clash` alongside `blst` in the same font for example. The following sounds are triggered along with blade animations. The buttons, gestures, or actions used to trigger them is specific to the prop file being used. See [The-CONFIG_PROP-section](/config/the-config_prop-section.html) for a list of prop files included with ProffieOS. Additional sounds are available when using some props, such as `quote`. Each prop will have instructions in the top comment section for how to use it. If you are using the default saber.h prop, you can also read [How to use ProffieOS](/howto/how-to-use-it.html) for more details. ## List of Names and Effects | Monophonic Filename | Polyphonic Filename | Effect | |---|---|---| | `boot` | `boot` | Played when ProffieOS boots up. | | `swing` | `swng` | Accent swing sounds that play near the peak of a swing motion.| | N/A | `swingl` | If present with `swingh`, the [SmoothSwing algorithm](#smoothswing-configuration) will be used to generate swing sounds from these files when the saber is moved around. | | N/A | `swingh` | If present with `swingl`, the [SmoothSwing algorithm](#smoothswing-configuration) will be used to generate swing sounds from these files when the saber is moved around. | | `hum` | `hum` | Played when the saber is on and stationary (looped) | | `poweron` | `out` | Extension sound when you ignite the blade. | | `poweroff`, `pwroff` | `in` | Retraction sound when the blade is shut off. | | `clash` | `clsh` | Played when you hit something with the saber | | `force` | `force` | Force use sound.| | `slsh` | `slsh` | Played when you make a swing that is accelerating faster than the threshold set in either config.ini or smoothsw.ini (OS3.x and up) | | `stab` | `stab` | Played when you make a stabbing motion (OS3.x and up) | | `blaster` | `blst` | Blaster deflection sound. | | `lockup` | `lock` | Sound when blades come together and struggle. | | `bgnlock` | `bgnlock` | Played when lockup starts | | `endlock` | `endlock` | Played when lockup ends (if not present, clash is used) | | `drag` | `drag` | Sound for dragging the tip of the saber blade. | | `bgndrag` | `bgndrag` | Begin drag | | `enddrag` | `enddrag` | End drag | | | `lb ` | Force lightning block. | | | `bgnlb` | Begin lightning block. | | | `endlb` | End lightning block. | | | `melt` | Simulate stabbing and melting an object with blade tip.| | | `bgnmelt` | Begin melt | | | `endmelt` | End melt | | `poweronf` | N/A | Force power on. (not yet implemented in ProffieOS) | | `font` | `font` | Played when you switch to this preset. | | N/A | `ccbegin` | Played when entering color change mode. | | N/A | `ccend` | Played when exiting color change mode | | N/A | `ccchange` | Played when changing color in "stepped" color change mode | | `preon` | `preon` | Played before the blade turns on | | `pstoff` | `pstoff` | Played after retraction when the blade turns off | | `altchng` | `altchng` | Played when the alt is changed. (OS7+) | #### Thermal Detonator Props * `bgnarm` - when the td is arming * `armhum` - when the td is armed (looped) * `endarm` - when the td is disarmed * `boom` - when the td blows up #### Blaster Props * `bgnauto` * `auto` * `endauto` * `blast` * `clipin` * `clipout` * `empty` * `fire` * `full` * `jam` * `unjam` * `mode` * `plioff` * `plion` * `range` * `stun` * `reload` As of OS6: * `mdkill` * `mdstun` * `mdauto` ## SmoothSwing Configuration When one or more set of `swingl`/`swingh` files are present, ProffieOS will activate the SmoothSwing algorithms. To decide if it should use V1 or V2, it will read a file called "smoothsw.ini". More information on how to configure this file can be found on [the smoothswing page](/sound/smoothsw.ini.html). #### SmoothSwing V1 [Demo Video](https://www.youtube.com/watch?v=4AAYGw09bu0) ([Thexter's description](https://www.fx-sabers.com/forum/index.php?topic=51430)) Many thanks to Thexter for his excellent work on this algorithm. Smoothswing V1 doesn't actually use any of the variables from the configuration file. The swingl and swingh files are played in a loop. The software will then place a rotating plane through the blade of your saber, and if the saber swings in one direction across the plane, we'll play more of swingl and less of the background hum. If we swing in the other direction, we'll play more of swingh and less of the hum. The fade will never blend swingl and swingh directly, it will essentially cross-fade between the regular hum and one of swingl/swingh based on direction and strength of the swing. #### SmoothSwing V2 [Demo Video](https://www.youtube.com/watch?v=LHpzbtBo-5w) ([Thexter's description](http://therebelarmory.com/thread/9138/smoothswing-v2-algorithm-description)) Smoothswing V2 has some similarties to V1, but is much better at producing natural swing- and spin-like sounds, and also produces more variety than the V1 algorithm. To do this, the swinglNN.wav and swinghNN.wav files are paired up. Whenever a swing is not going on (swing speed < SwingStrengthThreshold) a new pair if selected randomly. As we start swinging, we keep track of how many degrees the saber has swung so far, and at a randomly selected threshold, we start a cross-fade to go from swingl to swingh. The transition lasts for Transition1Degrees, and if the swing continues, we will eventually cross-fade back from swingh to swingl 180 degrees after the first threshold. The second transition is generally wider and is controlled by Transition2Degrees. The combined swing sound is then cross-faded with the regular hum based on the swing strength. TeensySaber V3 and Proffieboards uses a digital amplifier that works best with 4 ohm speakers. Higher ohm values are ok, but lower are not. The amplifier can put out 3 watts, which can overload or destroy small speakers, which is why the default volume is set fairly low. (1000) Assuming your speaker can handle it, volume values up to 2200, or possibly even 2500 can be used. (There is no actual upper limit, higher volumes just increase the chance of distortion from clipping.) One potential workaround for the limits of small speakers would be to use two 8-ohm speakers in parallel. It is currently not known if that will actually make the sound better or not. It probably depends a lot on how they are mounted. If they face one another, it is recommended to wire one of them 180 degrees out-of-phase by reversing the + and - leads. This will allow the air waves from each speaker to work with one another, not fight against each other, especially in a mostly closed tube that is a saber hilt. Sometimes, ProffieOS will run slowly, because it has too many things to do and too little time to do it. Here is a list of possible things you can do about it. ### Use the "top" command to identify what is using up all the CPU time. Note that "top" will not be available if you have `#define DISABLE_DIAGNOSTICS_COMMANDS` active in your config file. Also note that "top" produces very different numbers when the saber is on and when it's off. Finally, "top" shows the CPU statistics since the last time you ran it, so generally you will want to turn the saber on, run "top", wait a few seconds, then run "top" again. ### Turn on Optimization There are 4 levels to choose from under Arduino menu Tools>Optimize, however, the labels are a bit misleading. - “Smallest Code” uses the -Os flag, which is similar to -O2, but the goal of the optimizations is to make the code smaller instead of making the code faster. - “Fast” means that the we’ll use the -O0 flag when calling gcc, which actually means “don’t do any optimization at all." - “Faster” means we’ll use the -O2 flag which means, “do lots of optimizations." - “Fastest” means use -O3, which means even more optimizations. For a better description, check out actual documentation: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html Lots of things gets faster when you turn on optimization. However, they also get bigger, so you may run out of flash memory. See the [Saving Memory](saving-memory.html) page for how to reduce flash memory usage. ### Use ProffieOS 5.x or later ProffieOS 5.x has a better WS281X driver which is both faster and uses less RAM. In addition, if you set maxLedsPerStrip to a number a little higher than it needs to be, ProffieOS 5.x will be able to run styles and feed out data more effectively in parallel. ### Overclock pixel strips While nearly all WS281X are specified to run at 800kHz, most of them can run faster than that, so you can get things to run a little faster and smoother by feeding out bits faster. To do so, you would change a typical blade definition from: WS281XBladePtr<529, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>() to: WS281XBladePtr<529, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>, DefaultPinClass, 1000000>() ### Speed up the SD card A slow SD card can slow down ProffieOS a lot. So make sure that your SD card is fast enough. In addition, there are things you can do to make it easier for ProffieOS to find files on the SD card, which is a small, but helpful speedup: * Don't move files back-and-forth, rename and copy and do lots of operations on the SD card. These operations may grow the directory tables and make finding files takes longer. If you have done a lot of these sort of operations on your SD card, you might want to copy all the files from the SD card to your computer, format the SD card and copy the files back. After doing that, only the directory entries that are required will be on the SD card. * Don't have a lot of extra files in the font and root directories on the SD card. If you put them in a sub-directory, it is fine. * Don't put font deeply into the directory structure. If your font is in "fonts/obi/ep4/font11", it will take longer to open the files than if the font was simply called "obi11". * Don't use long filenames. Long filenames use up more directory entries and will make it take slightly longer to find *other* files in the same directory. However, making file names shorter than 8 characters, plus 3 characters for the extension has no effect on speed. * Prefer using the "EffectName/NNN.wav" structure over "EffectNameNNN.wav". Because of the way FAT32 works, having lots and lots of files in the same directory will make some of those files take longer to open. By creating sub-directories for each effect name (if that effect has more than one file) it will make finding files easier. For more info see [Faster Performance of fonts and blade animations](https://pod.hubbe.net/sound/faster-fonts.html) Finally, sometimes SD cards become slow as they get older. Doing the format-and-replace-all-the-files maneuver might fix such problems, but at some point, you may need to just replace the SD card even if it was working fine in the past. SpiBladePtr can have up to 10 arguments, but only the first three are required. SpiBladePtr<leds, data_pin, clock_pin, byte_order, power_pins, max_frequency, pin_class, power_off_delay> * leds - number of leds in this pixel string, must be less or equal to maxLedsPerSrtring * data_pin - pin to output SPI data * clock_pin - pin to output SPI clock * byte_order - specifies in which orders the colors are sent to the pixels * power_pins - which pads powers the string, defaults to PowerPINS<bladePowerPin1, bladePowerPin2, bladePowerPin3> * max_frequency - maximum data rate, defaults to 800000 * pin_class - This is the driver class, defaults to SpiLedPin * power_off_delay - milliseconds before turning off the power data_pin and clock_pin is normally one of: bladePin blade2Pin blade3Pin blade4Pin blade5Pin blade6Pin blade7Pin Other pins may or may not work depending on what board and driver is being used. byte_order depends on what kind of pixel strip is used, these values are possible: Color8::BGR Color8::BRG Color8::GBR Color8::GRB Color8::RBG Color8::RGB Color8::BGRW Color8::BRGW Color8::GBRW Color8::GRBW Color8::RBGW Color8::RGBW Color8::WBGR Color8::WBRG Color8::WGBR Color8::WGRB Color8::WRBG Color8::WRGB Color8::BGRw Color8::BRGw Color8::GBRw Color8::GRBw Color8::RBGw Color8::RGBw Color8::wBGR Color8::wBRG Color8::wGBR Color8::wGRB Color8::wRBG Color8::wRGB By far the most common byte order is GRB, but some pixel strips use RGB byte order. The four-letter byte orders are used for RGBW strips, the most common of those are GRBW and RGBW. The byte orders will capitol W will use both RGB AND W for white colors, while byte orders will lower-case w will only turn on the white LED for white colors. Thus RGBw is more power efficient than RGBW, but not as bright. The V3 Proffieboard has a Status led. That LED can provide a fair amount of information about what the board is doing. Let this page be your decoder wheel for understanding what it's doing. ## Blinks If the LED is blinking (not pulsing) then it's trying to show you an error code. The number of blinks tells you what the error is, according to the following table: 1. Low Battery 2. SD Card Not Found 3. Error in Blade Array ## OFF The LED will be off if the saber is completely idle in order to save power. ## Pulsing When the saber is doing something, the LED will be pulsing. The speed of the pulse will tell you how busy the saber is. If it's pulsing fast, then the saber is working hard, if it's pulsing slowly, it is not. When USB is connected, the shape of the pulse will change from a triangle wave ( &#8896;&#8896;&#8896;&#8896; ) to a sawtooth wave ( &#10840;&#10840;&#10840;&#10840; ). When ignited, the brightness of the LED will increase. When charging, there will be an extra "blip" every 2 seconds on the Status LED. So to summarize: Triangle Pulse (fade in, fade out) = USB is not connected. Pulse is faster when the CPU is busy. Sawtooth Pulse (fade in, fade in) = USB IS connected. Pulse is faster when the CPU is busy. It’s brighter when ignited. Brief blinks every 2 seconds when charging. ## Controlling the LED yourself If you don't like how the Status LED behaves by default, you can add #define NO_STATUS_LED to your config file. Then you can add a blade to control the status LED like this: ```cpp SimpleBlade<CH2LED, NoLED, NoLED, NoLED, StatusLEDPin, -1, -1, -1>() ``` Blade styles should then use Green or White to drive the Status LED. StringBladePtr is meant for old-style segmented blades and take 3 arguments, but only one is required: StringBladePtr<LED, clash_pin, clash_led> * LED - led struct for the segments (see [LED configuration](/config/blades/led-configuration.html)) * clash_pin - pin that drives the clash string, if present, defaults to -1 (no clash string) * clash_led - led struct for the clash string (see [LED configuration](/config/blades/led-configuration.html)) defaults to NoLED Styles in ProffieOS can use arguments to make them more useful. Arguments can be integers or colors that can be changed by using the edit mode, or the ProffieOS workbench. There are two style templates that make this possible: ```cpp RgbArg<ARGUMENT_NUMBER, DEFAULT_COLOR> or IntArg<ARGUMENT_NUMBER, DEFALUT_VALUE> ``` While you don't have to use these arguments, they can be very useful for saving memory and making your saber or prop more dynamic and configurable. Let's consider a simple preset, and I want a red, a green, and a blue preset, I would do: ```cpp {"font1", "tracks/track1.wav", StylePtr<EasyBlade<Red, White, 800, 300>>(), "label"}, {"font2", "tracks/track2.wav", StylePtr<EasyBlade<Green, White, 800, 300>>(), "label"}, {"font3", "tracks/track3.wav", StylePtr<EasyBlade<Blue, White, 800, 300>>(), "label"}, ``` Not a problem, right? Since these are simple styles, they won't take up much space, and because they were made without arguments, they cannot be modified at run time. Using arguments, I could instead write this as a single preset: ```cpp {"font1", "tracks/track1.wav", StylePtr<EasyBlade<RgbArg<BASE_COLOR_ARG, Red>, White, 800, 300>>(), "label"}, ``` Then I could use edit mode or the ProffieOS workbench to copy this preset two more times, and change the fonts and the color for each preset. These copies would not take up any extra FLASH memory, which means I can use that memory for something else. (Like more styles...) From ProffieOS 7.x, this gets even better, because you can specify the default arguments in the config file, like this: ```cpp {"font1", "tracks/track1.wav", StylePtr<EasyBlade<RgbArg<BASE_COLOR_ARG, Red>, White, 800, 300>>("65535,0,0"), "label"}, {"font2", "tracks/track2.wav", StylePtr<EasyBlade<RgbArg<BASE_COLOR_ARG, Red>, White, 800, 300>>("0,65535,0"), "label"}, {"font3", "tracks/track3.wav", StylePtr<EasyBlade<RgbArg<BASE_COLOR_ARG, Red>, White, 800, 300>>("0,0,65535"), "label"}, ``` **Note the use of Rgb16 values* Because were using the very same style each time, it doesn't actually use up any more memory, and we don't have to use the style editor or the proffieos workbench to do the edits. It can all be done in the config file. Also, if we mess something up using edit mode, we can delete presets.ini and presets.tmp from the SD card, without losing the defaults. If you don't know what string to put between the parenthesis, you can use edit mode/workbench to configure it the way you want it, then open up presets.ini/tmp and check the strings saved in there, then copy them to the config file. By convention, these are the arguments we normally use in proffieos: * BASE_COLOR_ARG = 1, // Primary Base Color * ALT_COLOR_ARG = 2, // Alternate or Force Color (free-use) * STYLE_OPTION_ARG = 3, // Style Option * IGNITION_OPTION_ARG = 4, // Ignition Options * IGNITION_TIME_ARG = 5, // used in IgnitionTime alias * IGNITION_DELAY_ARG = 6, // Ignition Delay Time * IGNITION_COLOR_ARG = 7, // Ignition "Power Up" Color * IGNITION_POWER_UP_ARG = 8, // Ignition "Power Up" Options * BLAST_COLOR_ARG = 9, // Blast Color * CLASH_COLOR_ARG = 10, // Clash Color * LOCKUP_COLOR_ARG = 11, // Lockup Color * LOCKUP_POSITION_ARG = 12, // Clash/Lockup Location for Responsive Effects (mid-point) * DRAG_COLOR_ARG = 13, // Drag Color * DRAG_SIZE_ARG = 14, // Drag Size * LB_COLOR_ARG = 15, // Lightning Block Color * STAB_COLOR_ARG = 16, // Stab / Melt Color * MELT_SIZE_ARG = 17, // Stab / Melt Size * SWING_COLOR_ARG = 18, // Swing Color (Responsive Swing Effects) * SWING_OPTION_ARG = 19, // Swing Options (Responsive Swing Effects) * EMITTER_COLOR_ARG = 20, // Emitter Color (Emitter Spark) can be used for PostOff * EMITTER_SIZE_ARG = 21, // Emitter Size (Emitter Spark), can be used for PostOff * PREON_COLOR_ARG = 22, // PreOn Color * PREON_OPTION_ARG = 23, // PreOn Option * PREON_SIZE_ARG = 24, // PreOn Size * RETRACTION_OPTION_ARG = 25, // Retraction Options * RETRACTION_TIME_ARG = 26, // used in RetractionTime alias * RETRACTION_DELAY_ARG = 27, // Retraction Delay Time * RETRACTION_COLOR_ARG = 28, // Retraction "Cool Down" Color * RETRACTION_COOL_DOWN_ARG = 29, // Retraction "Cool Down" Options * POSTOFF_COLOR_ARG = 30, // PostOff Color * OFF_COLOR_ARG = 31, // Off Color (Color when blade is Off for crystals and accents) * OFF_OPTION_ARG = 32, // Off Options (when blade is Off, for crystals and accents) * // Arguments 33 and up are new in ProffieOS 7.x * ALT_COLOR2_ARG = 33, // Generic 2nd Alt Color * ALT_COLOR3_ARG = 34, // Generic 3rd Alt Color * STYLE_OPTION2_ARG = 35, // Generic 2nd Style Option * STYLE_OPTION3_ARG = 36, // Generic 3rd Style Option * IGNITION_OPTION2_ARG = 37, // Ignition BEND Option * RETRACTION_OPTION2_ARG = 38, // Retraction BEND Option Note that this is just convetion. You *can* use IntArg<1, 1> in your style if you want to, but it will probably not work correctly with edit mode and the workbench. This feature is new in ProffieOS 7.x Normally, when you make a sound font effect, you will create more than one of each type of sound, and ProffieOS will select one of those randomly. However, more and more features are showing up which lets you actually select which of the random sounds to be played. Here is a brief list of those features: * TrDoEffect * Using effect.Select() from the prop * sound pairing * strength-based accent swings When one of these features are used, the selection of sounds isn't random anymore. Most of the time, this is fine and intended, but sometimes it can be boring, because it will make things sound the same every time. For instance, if you enable strength-based accent swings, and you swing the saber the same each time, then the accent swing will also sound the same each time. To allow randomness back into the processes, sub-sub sounds adds another sub-directory of sounds. Let's say we want to make our accent swings more random. To do that, we would create a folder structure like this in our font directory: ```txt swng/01/000.wav swng/01/001.wav swng/01/002.wav swng/02/000.wav swng/02/001.wav swng/02/002.wav swng/03/000.wav swng/03/001.wav swng/03/002.wav swng/04/000.wav swng/04/001.wav swng/04/002.wav ``` A few things to note: 1. The file numbers must have three digits and start with 000.wav 2. Each directory must have exactly the same number of wav files in it, or you will get "error in font directory". 3. The directory names follow the same rules as normal effects, so they can start at 01, and 1-8 digits 4. All the features listed above will see this as 4 different sounds (swng01-04). So with the strength-based accent swings example, this means 4 different strength levels, but with 3 varieties of sounds for each level. 5. Out of the three files in the sub-directories, ProffieOS will choose which one to play randomly. SubBlade is used to split a string of pixels into multiple blades which can have their own styles. It takes three arguments: ```cpp SubBlade(first_led, last_led, blade_definition) ``` Note the use of () instead of <>, as SubBlade is a regular function, not a template. If blade_definition is NULL, SubBlade() will use the blade definition from the previous call to SubBlade(). Since you can't have two blade definitions for the same string, you must use NULL to make multiple SubBlades refer to the same string of pixels. Let's say we have a string that has one accent LED, one 8-pixel battery indicator and then a 100-LED blade. The blades[] array could then look something like this: ```cpp SubBlade(9, 108, WS281XBlade<109, bladePin, Color8::GRB>()), SubBlade(0, 0, NULL), SubBlade(1, 8, NULL), ``` Note that the first LED in the string is counted as zero, so there's always a -1 offset to your numbers to the actual pixels as you'd count them. Also, The code doesn't really know what the "main blade" is. They do not need to be in sequential order either. The first style simply matches up with the first blade in the blades[] array, second style matches the second blade in the blades[] array, etc. Some more clarification and example:<br/>The data travels in series, one direction starting from the board, usually through accents and crystal chambers, and lastly the main blade. This is why it's important to wire your LED strips following the arrows' direction.<br/> For a blade with 130 pixels, the _first_led_ is 0, the _last_led_ is 129.<br/> For a "blade" with 5 pixels (such as a NPXL hilt PCB connector), the _first_led_ is 0, the _last_led_ is 4.<br/> Below we have a total of 135 pixels.<br/> The first SubBlade is for the main blade which has 134 pixels. It starts at 1 and ends at 134.<br/> The second SubBlade is for the accent led / crystal chamber which has 1 pixel. It starts and ends at 0.<br/> They both use bladePin (data pad 1) and run in series. Power (-) for all pixels in series uses bladePowerPin2 and bladePowerPin3 (LED2 and LED3 pads, usually bridged). ```cpp BladeConfig blades[] = { { 0, SubBlade(1, 134, WS281XBladePtr<135, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>()), SubBlade(0, 0, NULL), CONFIGARRAY(presets), } }; ```` ## SubBladeWithStride SubBladeWithStride lets you interleave multiple SubBlades. Basically, it lets you make a blade out of every other pixel along the blade (or whatever interval you set). It's mostly intended for using with the KR "Pixel Stick" blades which have 264 pixels wired in series, alternating between the top and bottom side. By using SubBladeWithStride, you can make each side behave as it's own blade. This alleviates the issue of animations rendering slower than intended due to the extra distance the blade presents within the same overall length. Blade styles that have something like fire or stripes that move along the blade will appear slow travelling along 264 pixels. So instead of editing every single argument that pertains to speed throughout the presets, we can make the blade appear as standard back-to-back 132 pixel strips by using SubBladeWithStride, and use blade styles as they are written for standard blades. ## SubBladeWithStride usage Same as above, but an additional argument of stride length is added like this: ```cpp SubBladeWithStride(first_led, last_led, stride_length, blade_definition) ``` So to split the 264 pixel strip into 2 x 132 pixel blades, we would do this : ```cpp BladeConfig blades[] = { { 0, SubBladeWithStride (0, 262, 2, WS281XBladePtr<264, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >() ), SubBladeWithStride (1, 263, 2, NULL), CONFIGARRAY(presets), } }; ``` ## SubBladeZZ SubBladeZZ is similar to SubBladeWithStride, but each row changes direction. This is useful when pixels are arranged in some sort of grid, and the data signal goes up, down, up, down or left, right, left, right. SubBladeZZ was added in ProffieOS 7.x. The usage is similar to SubBladeWithStride, but adds a "column" parameter, because you can't just adjust "first_led" to select which column you want. ```cpp SubBladeZZ(first_led, last_led, stride, column, blade_definition) ``` So, if we have a grid of 3x5 leds, where data is going left, then right, alternatenating for each column. Our blade definition might look something like: ``` BladeConfig blades[] = { { 0, SubBladeZZ(0, 14, 3, 0, WS281XBladePtr<15, bladePin, Color8::GRB, PowerPINS<bladePowerPin6> >() ), SubBladeZZ(0, 14, 3, 1, NULL), SubBladeZZ(0, 14, 3, 2, NULL) CONFIGARRAY(presets), } }; ``` Now we have one blade for each column in the grid. SubBladeReverse is works exactly like [SubBlade](/config/blades/subblade.html), except, that the pixels in the indexed range are addressed in reverse order. This can be useful to create zig-zag blades, where the data travels up one strip, than DOWN the other one. Such a blade lets you address all the pixels individually without needing more data lines. Example, if you have a 100-pixel zig-zag blade: ```cpp SubBlade(0, 99, WS281XBladePtr<200, bladePtr, Color8::GRB>()), SubBladeReverse(100, 199, NULL) ``` Note that you'll need to increase maxLedsPerString to 200. Also, the first LED in the string is counted as zero, so there's always a -1 offset to your numbers to the actual pixels as you'd count them. While the Proffie OS was developed, a couple of hardware variants followed it. They are all PCB extensions of the Teensy 3.2 Development board. ProffieBoard is the latest variant using its own dedicated CPU and removing the need of "Sandwitch build" installs. ## Selecting hardware To configure your program to run on specific hardware make sure to have its include header in your configuration file: * `#include "v1_config.h"` * `#include "v2_config.h"` * `#include "v3_config.h"` * `#include "proffieboard_v1_config.h"` * `#include "proffieboard_v2_config.h"` * `#include "proffieboard_v3_config.h"` *** ## [Teensy Saber V1](https://fredrik.hubbe.net/lightsaber/electronics.html) [![Teensy + Prop Shield (v1)](https://fredrik.hubbe.net/lightsaber/ratsnest.jpg)](https://fredrik.hubbe.net/lightsaber/electronics.html) ## [Teensy Saber V2](https://fredrik.hubbe.net/lightsaber/v2/) [![TeensySaberV2](https://fredrik.hubbe.net/lightsaber/v2/TeensySaberV2.2.jpg)](https://fredrik.hubbe.net/lightsaber/v2/) ## [Teensy Saber V3](https://fredrik.hubbe.net/lightsaber/v3/) [![TeensySaberV3](https://fredrik.hubbe.net/lightsaber/v3/TeensySaberV3Front.jpg)](https://fredrik.hubbe.net/lightsaber/v3/) ## [ProffieBoard V1.5](https://fredrik.hubbe.net/lightsaber/v4/) [![ProffieBoard](https://fredrik.hubbe.net/lightsaber/v4/_DSC1630_CROPPED.JPG)](https://fredrik.hubbe.net/lightsaber/v4/) ## [ProffieBoard V2.2](https://fredrik.hubbe.net/lightsaber/v5/) [![ProffieBoard](https://fredrik.hubbe.net/lightsaber/v5/pbv22.jpg)](https://fredrik.hubbe.net/lightsaber/v5/) ## [ProffieBoard V3.9](https://fredrik.hubbe.net/lightsaber/v6/) [![ProffieBoard](https://fredrik.hubbe.net/lightsaber/v6/pb37.jpg)](https://fredrik.hubbe.net/lightsaber/v6/) Sometimes, a [FET](/glossary.html#fet) goes gets damaged. Or, maybe a solder pad gets ripped out, or something else happens that means that one of the LED1-6 pads can't be used anymore. In most cases, there is an unused LED pad or two that can be used instead. For now, let's assume that something bad happend to LED2 and LED3, and that we need to move the main blade over to use LED4 and LED5 instead. The soldering part is fairly obvious, just cut or de-solder the wire from LED2/LED3 and solder it to LED4 and LED5 instead. Now, we just need to update the blades array so that the Proffieboard knows to use the new pads. The blades array in the config file might look like this: ```cpp BladeConfig blades[] = { { 0, WS281XBladePtr<144, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(), CONFIGARRAY(presets) }, }; ``` We just need to search & replace bladePowerPin2 with bladePowerPin4 and bladePoerPin3 with bladePowerPin5, so the results looks like this: ```cpp BladeConfig blades[] = { { 0, WS281XBladePtr<144, bladePin, Color8::GRB, PowerPINS<bladePowerPin4, bladePowerPin5> >(), CONFIGARRAY(presets) }, }; ``` Upload ProffieOS to your saber using the updated config file, and everything should work just fine. See also [how to test a FET](/troubleshooting/fet-testing.html) to find out how to check if a FET is not working. If your WS281X pixels don't light up, it's often hard to know why. It could be the data, it could be the power, or a burnt out pixel. To test the power, see [the FET testing](/troubleshooting/fet-testing.html) page. To check if the data is working, keep reading. 1. get a multimeter 2. set it to measure AC voltage 3. Put one probe on the GND pad on the board 4. Put the other one on the data pad you want to test. 5. Check the measurement. If data is flowing, you should see a fluctuating value somewhere around one volt. The actual value will depend on the color, and also on the meter. It's not very important what the value is, as long as you see a distinct difference when data is flowing and data is not flowing. Data should be flowing when the board is on and ignited unless you use styles which allows the blade to turn off, like `StylePtr<Black>()` in your config file. If data is not flowing there are a couple of things to check: * the config file might have an error in it causing the blade to not work. To rule this out, replace your config file with a super-simple one, like the default_proffieboard_config.h, or one that comes from the proffieboard configurator. * There may be a short somewhere permanently making that particular pin fixed at a particular voltage. Try checking for continuity between the data pin and GND, 3.3v or BATT+. * The pin is burnt out and you should try a different one. To try a different one, you will need to update your config file to use the new pin. Let's say your blades[] array looks like this: ``` BladeConfig blades[] = { { 0, WS281XBladePtr<144, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(), CONFIGARRAY(presets) }, }; ``` To change it to use the Data2 pin instead of Data1, you should change the blades array to: ``` BladeConfig blades[] = { { 0, WS281XBladePtr<144, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(), CONFIGARRAY(presets) }, }; ``` Note that Data2 does not have a built-in resistor like Data1 does, so you will need to add a resistor when switing from Data1 to Data2. While EVERYTHING in ProffieOS is possible to change, most of the time, only the config file needs to be changed. The config file is really just some C++ code that specifies how the rest of the code should behave, but since many ProffieOS users are not C++ experts, this page describes the ProffieOS config files in more detail. First, let's take a look at a typical config file: ```cpp #ifdef CONFIG_TOP #include "proffieboard_v1_config.h" #define NUM_BLADES 1 #define NUM_BUTTONS 2 #define VOLUME 1000 const unsigned int maxLedsPerStrip = 144; #define CLASH_THRESHOLD_G 1.0 #define ENABLE_AUDIO #define ENABLE_MOTION #define ENABLE_WS2811 #define ENABLE_SD #endif #ifdef CONFIG_PRESETS Preset presets[] = { { "TeensySF", "tracks/venus.wav", StyleNormalPtr<CYAN, WHITE, 300, 800>(), "cyan"}, { "SmthJedi", "tracks/mars.wav", StylePtr<InOutSparkTip<EASYBLADE(BLUE, WHITE), 300, 800> >(), "blue"}, { "TthCrstl", "tracks/mars.wav", StylePtr<InOutHelper<EASYBLADE(OnSpark<GREEN>, WHITE), 300, 800> >(), "green"}, { "TthCrstl", "tracks/uranus.wav", StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>(), "strobe"}, { "TeensySF", "tracks/venus.wav", &style_pov, "POV"}, { "SmthJedi", "tracks/mars.wav", &style_charging, "Battery\nLevel"} }; BladeConfig blades[] = { { 0, WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB>(), CONFIGARRAY(presets) }, }; #endif #ifdef CONFIG_BUTTONS Button PowerButton(BUTTON_POWER, powerButtonPin, "pow"); Button AuxButton(BUTTON_AUX, auxPin, "aux"); #endif ``` As you can see, this file has three sections: TOP, PRESETS and BUTTONS. Each section looks something like this: ```cpp #ifdef CONFIG_NAME Some stuff goes here #endif ``` Where "NAME" is the name of the section. While this file has three sections, some have four, and more may be possible in the future. While each section can technically contain any valid C++ code, it is recommended to use the sections as intended. Each section is explained in it's own page, to find out more, follow the links below: * [The CONFIG_TOP section](/config/the-config_top-section.html) * [The CONFIG_PRESETS section](/config/the-config_presets-section.html) * [The CONFIG_BUTTONS section](/config/the-config_buttons-section.html) * [The CONFIG_PROP section](/config/the-config_prop-section.html) * [The CONFIG_STYLES section](/config/the-config_styles-section.html) The CONFIG_BUTTONS is probably the simplest of all the sections in the config file. While it doesn't have to contain anything at all, it's purpose is to contain the buttons. The buttons are global variables in in C++, and we just create the variables directly in the config file. The general format looks like: TYPE Name(BUTTON, PIN, "name"); For buttons, the Name is not used, so it can be anything you like. (Well, anything that is allowed by C++ as least.) The type, should be one of Button, LatchingButton, InvertedLatchingButton or TouchButton. The BUTTON argument should be one of: BUTTON_POWER BUTTON_AUX BUTTON_AUX2 BUTTON_UP BUTTON_DOWN BUTTON_LEFT BUTTON_RIGHT BUTTON_SELECT Although most sabers only use the first three. This specifies what type of event this button will generate when activated. The PIN is the pad wired to the button. Most of the time it will be one of these symbolic names: powerButtonPin auxPin aux2Pin These symbolic names are mapped to numbers by the proffieboard config file which is normally included in the CONFIG_TOP section.<br/> Button pins, data pins and rx/tx pins could all be used as buttons. The "name" is not very important, but is used to identify the button in error messages, top and commands. For TouchButton, there is a fourth argument (a number), which must be tweaked to make the button work well. To establish what value to use, use the serial monitor and type "monitor touch". Pay attention to the values printed out when touching and not touching the button, then choose a threshold value somewhere in between. Simple two-button example: ```cpp #ifdef CONFIG_BUTTONS Button PowerButton(BUTTON_POWER, powerButtonPin, "pow"); Button AuxButton(BUTTON_AUX, auxPin, "aux"); #endif ``` The main purpose of the CONFIG_PRESETS section, is to define the blades[] array. However, the blades[] array contains pointers to the presets[] array(s), so we must also define those in this section. It is also possible to put custom LED structs, style aliases and other such things in this section. First, let's explain what an array is: It is a repeated list of data. The general format of an array is something like: ```cpp TYPE NAME[] = { first_entry, second_entry, third_entry }; ``` The TYPE specifies what kind of data goes in each entry. For the blades[] array, the type is BladeConfig, and for the presets[] array, the type is Preset. A BladeConfig looks something like this: ```cpp { 0, // Blade ID resistance blade definitions, // NUM_BLADES specifies how many blade definitions there are CONFIGARRAY(presets), } ``` If there are multiple BladeConfigs, ProffieOS will measure the resistance between the **blade data pin and GND** and use the BladeConfig that has the closest [Blade ID](/blade-id.html). This decides what blade definitions and preset arrays to use.<br/> Also, if you use #define SAVE_STATE in your config, you can save states in a subfolder on your SD card for each blade array by adding a quoted save name to the end of the BladeConfig [] array, similar to the quoted "name" at the end of a preset. For example: ```cpp BladeConfig blades[] = { { 0, WS281XBladePtr<0, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(), CONFIGARRAY(NBpresets), "No_Blade_save", }, { 33000, WS281XBladePtr<123, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(), CONFIGARRAY(34presets), "My34inch_blade_save", }, }; ``` will create 2 folders on the SD card named No_Blade_save and My34inch_blade_save, each containing the last used preset, color change state, and last used volume with each blade. Each blade definition should use one of the following: (click for more info) * [WS281XBladePtr](/config/blades/ws281xbladeptr.html) - new style pixel blade definition * [WS2811BladePtr](/config/blades/ws2811bladeptr.html) - old style pixel blade definition * [SimpleBladePtr](/config/blades/simplebladeptr.html) - blade for single LEDs and LED stars * [StringBladePtr](/config/blades/stringbladeptr.html) - blade for old-fashioned 6-segment blades (or more with external FETs) * [SubBlade](/config/blades/subblade.html) - A blade from a sub-section of a pixel string * [SubBladeReverse](/config/blades/subbladereverse.html) - Like SubBlade, but reverses indexing for zig-zag blades * [FASTLEDBladePtr](/config/blades/fastledbladeptr.html) - EXPERIMENTAL, used for dotstar blades * [DimBlade](/config/blades/dimblade.html) - Similar to SubBlade, but reduces the brightness of the blade. * [SpiBladePtr](/config/blades/spibladeptr.html) - Non-experimental, but somewhat slow dotstar support. The Preset array is made up of Presets, see [Preset Configuration](/config/preset-configuration.html) for details. Note that that there can be multiple preset arrays, and the name of the preset array is not important, as long as the blade array uses the right name. Example: ```cpp Preset p1[] = { {"font1", "track1.wav", StyleNormalPtr<BLUE, WHITE, 800, 300>(), "blue preset"} }; Preset p2[] = { {"font2", "track2.wav", StyleNormalPtr<RED, WHITE, 800, 300>(), "red preset"} }; BladesConfig blades[] = { { 5000, WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB>(), CONFIGARRAY(p1) }, { 10000, WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB>(), CONFIGARRAY(p2) } }; ``` In this example, the Blade ID is used to select between the red and blue presets. Also note that spaces and newlines are basically ignored, so we are free to write the configuration on one line or many lines as we please. Finally, please note that you cannot have two identical blades in the same bladeconfig, it will crash ProffieOS. If you have RFID_SERIAL in [the CONFIG_TOP section](/config/the-config_top-section.html), then you will also need to have a RFID_Commands array, which could look like this: ```cpp RFID_Command RFID_Commands[] = { { 0x0000000C04ULL, "change_preset", "0" }, { 0x09003A8CDCULL, "change_preset", "1" }, }; ``` This will change preset to 0 when the RFID reader sees card with ID C04 (which happens to be a green crystal) and change to preset 1 when it sees something with a card ID of 3a8cdc. Any serial monitor command can be used. The CONFIG_PROP section is relatively new, and a lot of config files don't use it. The purpose of the CONFIG_PROP section is to specify which class is given control of what everything does. Most of the time, this is done by simply including a file from the ProffieOS/props directory in your config file, like this: ```cpp #ifdef CONFIG_PROP #include "../props/detonator.h" #endif ``` However, it would be perfectly fine to define your own prop class in this section and then define PROP_CLASS to be the name of your class. Learning how to do that is outside the scope of this tutorial though. Here is a list of prop files that come with ProffieOS, each file will have some additional instructions at the top. * [saber.h](https://github.com/profezzorn/ProffieOS/blob/master/props/saber.h) - this is the default, you don't need a CONFIG_PROP section to use this. * [saber_sa22c_buttons.h](https://github.com/profezzorn/ProffieOS/blob/master/props/saber_sa22c_buttons.h) - saber prop with button assignments designed by sa22c. * [saber_shtok_buttons.h](https://github.com/profezzorn/ProffieOS/blob/master/props/saber_shtok_buttons.h) - saber prop with button assignments designed by Dmitry Shtok. * [saber_fett263_buttons.h](https://github.com/profezzorn/ProffieOS/blob/master/props/saber_fett263_buttons.h) - saber prop with button assignments designed by fett263, includes battle mode. * [saber_BC_buttons.h](https://github.com/profezzorn/ProffieOS/blob/master/props/saber_BC_buttons.h) - (ProffieOS 6 or later) saber prop with button assignments and features designed by Brian Conner. * [detonator.h](https://github.com/profezzorn/ProffieOS/blob/master/props/detonator.h) - thermal detonator prop. * [blaster.h](https://github.com/profezzorn/ProffieOS/blob/master/props/blaster.h) - blaster prop. * [audiofx.h](https://github.com/profezzorn/ProffieOS/blob/master/props/audiofx.h) - similar to an adafruit audiofx board. * [micom.h](https://github.com/profezzorn/ProffieOS/blob/master/props/micom.h) - voice/dialog prop. Please note, the CONFIG_STYLES section requires ProffieOS 7.x or later. The CONFIG_STYLES section is a convenience location for placing custom style templates and aliases in your config file. In ProffieOS 6.x and older, you would need to put these sort of statements in the CONFIG_PRESETS section, somewhere before the presets[] array. While this is still entirely possible, it can be inconvenient, because the styles are often large and unchanging, while the presets may be tweaked a lot more often. By putting the styles in their own section, we now have the option of putting them anywhere we want in the config file, since sections can be written in any order. Normally, the CONFIG_STYLES section is expected to be near the bottom of the config file. Here is an example of what it could look like: ```cpp #ifdef CONFIG_STYLES using BatteryLevelStyle = InOutHelperX<Gradient<Red,Orange,Yellow,Green,Green,Green,Green>,BatteryLevel>; #endif ``` Then in the preset you would apply that aliased style like this: ```cpp StylePtr<BatteryLevelStyle>(), ``` Please not that there is no actual difference between putting things at the top of the CONFIG_PRESETS section and putting them in the CONFIG_STYLES section, it is merely provided to make it easier to keep your config file organized. The CONFIG_TOP section is primarily used to set up defines which enable and disable features in the code. However, it is also used to include a board specific config file. Let's start with the required parts: First, we must include a board config file, basically, we have to pick one of these lines: ```cpp #include "v1_config.h" // TeensySaber V1 #include "v2_config.h" // TeensySaber V2 #include "v3_config.h" // TeensySaber V3 #include "proffieboard_v1_config.h" // Proffieboard V1 #include "proffieboard_v2_config.h" // Proffieboard V2 #include "proffieboard_v3_config.h" // Proffieboard V3 ``` Note that if you include the proffieboard_config.h file (no version in the filename), the appropriate board version will be chosen for you based on which board is being programmed. This allows you to use your config on multiple versions of Proffieboards without needing to change this line to match. ### NUM_BLADES Next we must define how many blades there are. Note that accent LEDs, crystal chambers and light-up buttons also counts as blades. ```cpp #define NUM_BLADES 1 ``` ### NUM_BUTTONS And we must also specify how many buttons we have. Note that this is just used to change how some of the buttons behave, and nothing will actually break if you specify a number different from your actual number of buttons. ```cpp #define NUM_BUTTONS 2 ``` ### VOLUME Then we specify the volumes. Generally values between 0 and 3000 are useful, but it may depend on what kind of board you have. To set the maximum volume of the saber, use this with the value of your choice: ```cpp #define VOLUME 1000 ``` With some [prop files](/config/the-config_prop-section.html), you can use a volume menu to adjust the sound level of the saber. This menu's maximum volume is set by the above define. Sometimes (like late night for example) you may want to boot the saber at a lower volume level, which can be adjusted up to the maximum later using volume menu. To do that, use this with the value of your choice: ```cpp #define BOOT_VOLUME 300 ``` ### maxLedsPerStrip I don't remember why, but this next number is a constant instead of a define. It specifies how many pixels we can have in a single strip. Note that if you use RGBW pixels, this number needs to be 25% bigger than your actual number of pixels. There is no need to make this smaller if your strips are not 144 pixels long, but you do need to make it bigger if they are more than 144 pixels long. ```cpp const unsigned int maxLedsPerStrip = 144; ``` ### CLASH_THRESHOLD_G Next, we have the clash threshold. When two consecutive accelerometer readings differ by this much, a clash is triggered. The unit is in Gs. (About 9.81 newtons.) Larger values will make clashes harder to trigger, smaller values will make clashes easier to trigger. ```cpp #define CLASH_THRESHOLD_G 1.0 ``` Please note that in ProffieOS 6.x, some changes were made to the motion detection system. This tended to make clash detection more sensetive, so it's not uncommon to have to increase the clash threshold when upgrading from 5.x to 6.x. In ProffieOS 7.x, the clash detection was modified in ways that makes it less sensetive to false clashes. This change also means that the CLASH_THRESHOLD_G might have to be changed when upgrading from 6.x to 7.x. However, in this case you will probably be adjusting the clash threshold downwards rather than upwards. Finally, we have a set of defines that enable standard features. It's on my TODO list to make these not required: ```cpp #define ENABLE_AUDIO #define ENABLE_MOTION #define ENABLE_WS2811 #define ENABLE_SD ``` # OPTIONAL defines ### ENABLE_SSD1306 This define enables the OLED display code. ```cpp #define ENABLE_SSD1306 ``` ### OLED_FLIP_180 This code will flip the OLED displayed content 180 degrees. ```cpp #define OLED_FLIP_180 ``` ### OLED_MIRRORED Shows the OLED displayed content in reverse (for scopes that might use HUD 45 degree mirrors for example). ```cpp #define OLED_MIRRORED ``` ### PLI_OFF_TIME Duration that the Power Level Indicator (battery level meter) will show on the OLED when blade is turned off. Example below show 10 seconds set. ```cpp #define PLI_OFF_TIME 10000 ``` ### SHARED_POWER_PINS This code makes it possible to use the same power pins for multiple blades. ```cpp #define SHARED_POWER_PINS ``` ### Orientation defines If your board is installed in a different orientation than normal, you may need to add one of the following lines to make ProffieOS behave properly: ```cpp #define ORIENTATION ORIENTATION_NORMAL // USB connector points away from blade #define ORIENTATION ORIENTATION_FETS_TOWARDS_BLADE #define ORIENTATION ORIENTATION_USB_TOWARDS_BLADE #define ORIENTATION ORIENTATION_USB_CCW_FROM_BLADE #define ORIENTATION ORIENTATION_USB_CW_FROM_BLADE #define ORIENTATION ORIENTATION_TOP_TOWARDS_BLADE #define ORIENTATION ORIENTATION_BOTTOM_TOWARDS_BLADE ``` Here's a visual reference (viewed from above with the blade to the right): <img src="https://pod.hubbe.net/images/board_orientations.png" width=400 alt="board orientation_defines"> ### ORIENTATION_ROTATION For Curved hilts, or where the board is not parallel with the blade (for Twist on/off particularly) This will rotate the orientation of the board 20 degrees around the Y axis. Depending on the orientation of the board, you might need -20 degrees instead. (Or 15 degrees? or 30?) ```cpp #define ORIENTATION_ROTATION 0,20,0 ``` ### DUAL_POWER_BUTTONS This one means that clicking the AUX will also turn the saber on. If not defined, AUX will go to next preset when off. ```cpp #define DUAL_POWER_BUTTONS ``` ### ENABLE_SERIAL This enables the serial port, which can be used to talk to a BLE chip. ```cpp #define ENABLE_SERIAL ``` If you have a redbear BLE nano bluetooth chip, you'll need the following three defines to configure it: ```cpp #define BLE_PASSWORD "password" #define BLE_NAME "saber" #define BLE_SHORTNAME "saber" ``` The BLE_PASSWORD must be 20 characters or less. BLE_SHORTNAME must be 8 characters or less. ### ENABLE_SERIALFLASH This is only for TeensySaber V1 and enables the serialflash chip on the PJRC prop board ```cpp #define ENABLE_SERIALFLASH ``` ### ENABLE_FASTLED This enables the FastLED blade driver, which can be used to drive dotstar blades. This is experimental and may not work properly. ```cpp #define ENABLE_FASTLED ``` ### ENABLE_POWER_FOR_ID To use blade ID in a 3-pin connector, the GND leg of the resistor has to be hooked up to the part that is controlled by FETs. That means that those FETs has to be powered on in order for blade ID to work. This define lets you do that by specifying which FETs needs to be powered while the blade is identified. ```cpp #define ENABLE_POWER_FOR_ID PowerPINS<bladePowerPin1,bladePowerPin2,bladePowerPin3> ``` See [the blade ID page](../blade-id.html) for more information. # ProffieOS 3.x defines ### ENABLE_DEVELOPER_COMMANDS By default, some commands which are only useful for developers are normally not compiled into the final binary to save memory, if you want them, add this define to enable them. ```cpp #define ENABLE_DEVELOPER_COMMANDS ``` Plase beware that this turns off some useful commands, like "sdtest" and "monitor". ### DISABLE_DIAGNOSTIC_COMMANDS To save even more memory, you can disable some diagnostic commands like "monitor", "top" and "sdtest" using this define: ```cpp #define DISABLE_DIAGNOSTIC_COMMANDS ``` ### BLADE_ID_CLASS Proffieboards have some challenges when it comes to BladeID, but it's possible to work around them by adding a bridge to another pin, or by adding a pullup resistor. However, when you do so, you have to use the BLADE_ID_CLASS to specify how the OS should calculate the Blade ID. Chose one of: ```cpp #define BLADE_ID_CLASS BridgedPullupBladeID<bladeIdentifyPin, BRIDGED_PIN> #define BLADE_ID_CLASS ExternalPullupBladeID<bladeIdentifyPin, PULLUP_RESISTANCE> ``` See [the blade ID page](/blade-id.html) for more information. ### IDLE_OFF_TIME ProffieOS has pretty good standby idle time, but if you have accent LEDs that glow even when the saber is off, that will make your saber run out of batteries pretty fast. This define lets you specify a timeout for such accent LEDs (in milliseconds), this example would set it to 10 minutes: ```cpp #define IDLE_OFF_TIME 60 * 10 * 1000 ``` ### DISABLE_COLOR_CHANGE If you think color change is annoying, or you just need to save some memory, you can disable the color change feature with this define: ```cpp #define DISABLE_COLOR_CHANGE ``` ### BLADE_DETECT_PIN This define lets you use a pin to detect when a blade is present or not. The pin will work kind of like a latching button which is pressed when there is a blade in the saber. When there is no blade in the saber, NO_BLADE (one billion) will be added to the blade ID. ```cpp #define BLADE_DETECT_PIN PIN ``` See [the Blade Detect page](/blade-detect.html) for more information. ### SAVE_COLOR_CHANGE On-the-fly color changing is new in 3.x. If you want it to save the color change state, add this define to your config file: ```cpp #define SAVE_COLOR_CHANGE ``` ### SAVE_VOLUME Start with the volume used last ```cpp #define SAVE_VOLUME ``` ### SAVE_PRESET Start at the last preset when you turn the saber on: ```cpp #define SAVE_PRESET ``` ### SAVE_STATE Save state is one define to encompass SAVE_COLOR_CHANGE, SAVE_VOLUME and SAVE_PRESET. (From ProffieOS 7.8 onward, this also encompasses SAVE_BLADE_DIMMING) ```cpp #define SAVE_STATE ``` # ProffieOS 4.x defines ### KEEP_SAVEFILES_WHEN_PROGRAMMING From OS4.7 onward: After uploading, all .INI file will be deleted from the SD card. These files may contain modifications to your uploaded config file such as saved colorcahngemode info, volume etc. To retain this additional information even after re-flashing ProffieOS to the board, use: ```cpp #define KEEP_SAVEFILES_WHEN_PROGRAMMING ``` Please use this define with caution. If you leave this define in your config file when you are tring to make changes to your saber, weird things tends to happen. See [this page](/config/keeping-edits-when-uploading.html) for further information. ### ORIENTATION_ROTATION If your board is not mounted at 90 degree angles to the hilt, you can use this define: ```cpp #define ORIENTATION_ROTATION X,Y,Z ``` The X, Y and Z are floating point numbers which specify how many degrees to rotate all measurements. # ProffieOS 5.x defines: ### RFID_SERIAL Add an RFID reader. To configure the RFID reader, you will need an RFID_Commands array in [the CONFIG_PRESETS section](/config/the-config_presets-section.html). ```cpp #define RFID_SERIAL Serial3 ``` ### SPEAK_TOUCH_VALUES To calibrate your touch buttons, you can temporarily add this to your config to have ProffieOS say the touch values out loud. Can be confusing if you have more than one touch button. If you have more than one, calibrate one at a time and comment out the rest temporarily. ```cpp #define SPEAK_TOUCH_VALUES ``` ### ENABLE_I2S_OUT This enables I2S output, Data3 is SCK, Data4 is FS and Button2/aux is DATA ```cpp #define ENABLE_I2S_OUT ``` ### ENABLE_SPDIF_OUT This enables SPDIF output. The SPDIF signal will come out at 3.3 volts on Button2/AUX. ```cpp #define ENABLE_SPDIF_OUT ``` ### LINE_OUT_VOLUME If you use ENABLE_I2S_OUT or ENABLE_SPDIF_OUT, you can control the volume with this define: ```cpp #define LINE_OUT_VOLUME 2000 ``` The default is 2000. If you want the line out volume to follow the master volume, you do: ```cpp #define LINE_OUT_VOLUME dynamic_mixer.get_volume() ``` # ProffieOS 6.x defines: Enables dynamic blade dimming / blade length / clash threshold, controllable from ProffieOS Workbench or some props. ```cpp #define DYNAMIC_BLADE_DIMMING #define DYNAMIC_BLADE_LENGTH #define DYNAMIC_CLASH_THRESHOLD ``` Enable storing the dynamic dimming / clash threshold. Doesn't do anything unless the corresponding DYNAMIC_* define is also used. ```cpp #define SAVE_BLADE_DIMMING #define SAVE_CLASH_THRESHOLD ``` ### INCLUDE_SSD1306 Includes support for ssd1306 displays, but does not automatically enable it. This lets you declare your own display and set the size and controller for the display. ```cpp #define INCLUDE_SSD1306 ``` ### FILTER_CUTOFF_FREQUENCY If present, these defines enable a butterworth highpass filter with the given order and cutoff frequency. The idea is to remove frequencies that your speaker can't reproduce anyways to put less stress on the speaker. The filter order defaults to 8. A reasonable cutoff frequncy might be 100Hz. The filter does not affect I2C or S/PDIF output if enabled. ```cpp #define FILTER_CUTOFF_FREQUENCY #define FILTER_ORDER ``` ### NO_REPEAT_RANDOM This define will make ProffieOS remember which file (of each effect) was played last and avoid playing it again next time. If there are only 2 of a particular sound, there is still a chance that the same sound is played to avoid simply flipping between them in a predictable pattern. ```cpp #define NO_REPEAT_RANDOM ``` ### FEMALE_TALKIE_VOICE Uses a female talkie voice, only affects built-in error messages, for other sounds, go check out the Sound Library. ```cpp #define FEMALE_TALKIE_VOICE ``` ### DISABLE_BASIC_PARSER_STYLES Saves memory by disabling old-fashioned styles. With this define, these styles will not be available in the ProffieOS Workbench. ```cpp #define DISABLE_BASIC_PARSER_STYLES ``` ### ENABLE_ALL_EDIT_OPTIONS The following "umbrella" define is equivalent to separately defining: DYNAMIC_BLADE_LENGTH DYNAMIC_BLADE_DIMMING DYNAMIC_CLASH_THRESHOLD SAVE_VOLUME SAVE_BLADE_DIMMING SAVE_CLASH_THRESHOLD SAVE_COLOR_CHANGE *Note - `#define SAVE_STATE` is different, as that encompasses: SAVE_VOLUME SAVE_PRESET SAVE_COLOR_CHANGE SAVE_BLADE_DIMMING (From ProffieOS 7.9 onward) ```cpp #define ENABLE_ALL_EDIT_OPTIONS ``` # ProffieOS 7.x defines ### BOOT_VOLUME Let's you specify what volume should be used at boot. Note that if `#define SAVE_VOLUME` is active (or SAVE_STATE or ENABLE_ALL_EDIT_OPTIONS since they also encompass SAVE_VOLUME), BOOT_VOLUME wil be overridden by your saved value. ```cpp #define BOOT_VOLUME 300 ``` ### KILL_OLD_PLAYERS When playing overlapping effects, you can sometimes run out of available wav players. When this define is enabled, ProffieOS will find the oldest playing overlapping effect and stop that sound to make room for the new sound to play. The result is that the new sound always plays. ```cpp #define KILL_OLD_PLAYERS ``` ### DISABLE_TALKIE Saves 7.5kB of flash memory by disabling the spoken error codes that ProffieOS uses. The spoken error codes will be replaced with beeps, and you can use the ("What is it beeping?" page)[/troubleshooting/beep_codes.html] to figure out what the sounds mean. You can also see the errors in the (serial monitor)[/tools/serial-monitor.html]. ```cpp #define DISABLE_TALKIE ``` ### BLADE_ID_TIMES This define tells ProffieOS to run the blade ID multiple times and then average the results. This is particularly helpful when using BLADE_ID_SCAN_MILLIS, as the results tends to be very noisy otherwise. ```cpp #define BLADE_ID_TIMES 10 ``` ### BLADE_ID_SCAN_MILLIS With this define, blade ID will run all the time, even when the blade is on. The define specifies how many milliseconds in between each blade ID scan. Reasonable values might be 100 to 5000 ms. If the computed blade ID is different from the previous ones, then the saber will re-load blade definitions and presets, as if a Blade Detect event had occured. ```cpp #define BLADE_ID_SCAN_MILLIS 500 ``` Please note, you will most likely need BLADE_ID_TIMES and SHARED_POWER_PINS to use this define. Also, it currently only works with pixel blades. ### AUDIO_CLASH_SUPPRESSION_LEVEL This define lets you adjust how much harder it is to do a clash when the audio is loud. The useful range is roughly 1 to 50, and the default is 10. ```cpp #define AUDIO_CLASH_SUPPRESSION_LEVEL 20 ``` ### PROFFIEOS_DONT_USE_GYRO_FOR_CLASH This define allows you to use only Accelerometer for Clash Detection (OS6 or earlier algorithm), instead of Accelerometer and Gyro combined (OS7 algorithm). ```cpp #define PROFFIEOS_DONT_USE_GYRO_FOR_CLASH ``` ### POV_INCLUDE_FILE This define lets you include some other POV data instead of the default star wars logo. To learn how to generate pov data, go check out the [POV tools](/tools/pov.html) ```cpp #define POV_INCLUDE_FILE "jedi_logo.h" ``` ProffieOS supports touch buttons. They work both with Proffieboards and with Teensy based builds, but slightly differently, for now this page will focus on Proffieboards. On a Proffieboard, the three button pads all support touch buttons. To use a touch button you need to specify it in your config file, like: TouchButton PowerButton(BUTTON_POWER, powerButtonPin, 1700, "pow"); As with regular button, the first argument specifies what kind of event this button will generate, the second argument specifies which pad to use. The third argument however, is only for touch buttons and specifies a threshold that separate pressed values from non-pressed values. Note that Teensysabers and Proffieboards work differently, on a Proffieboard, small values means the button is pressed and high values means the button is not pressed. On a TeensySaber, it's the other way around. To build a touch button, all you need is a piece of metal that is insulated from the rest of the saber. Surprisingly, the button will also need to be insulated from your fingers, otherwise static electricity can damage the board. A common way to do this is to use a clamp card as your touch button. The clamp card can be wrapped in packing tape, which forms a thin insulating barrier between the clamp and the card, and also your finger and the card. The thinner the barrier is, the better the touch button will work. ![clamp card wrapped in tape](/hardware/touchbutton.jpg) Once everything is hooked up, we'll need to calibrate the button. To do this, connect the usb cable to your computer and enter the "monitor touch" command in the serial monitor. Note that won't work if you have the DISABLE_DIAGNOSTICS_COMMAND in your config file, if so you'll need to change that first. ProffieOS will continuously print out the touch readout values in the serial monitor, now all you need to do is to note the typical values when you touch the button and when you don't touch the button, and then set the threshold in the config file to something in between. (Preferably a little closer to the 'touch' values, than the 'no-touch' values to avoid accidental activation.) These touch buttons might seem like magic, but they really aren't. Basically what they are is half a capacitor, and the capacitance of the capacitor depends on what the other half of the capacitor, which is your finger when you touch the button and air when you don't. The Proffieboard will measure the capacitance of the capacitor repeatedly, and the values you see when you use "monitor touch" are based on those measurements. The Fett263 prop file (/props/saber_fett263_buttons.h) introduces a Track Player capability that allows unlimited tracks and 4 playback methods for ProffieOS6. All presets should be set up as follows and a "common" folder should be added to the SD card with the Voice Prompts ([http://fredrik.hubbe.net/lightsaber/sound/](http://fredrik.hubbe.net/lightsaber/sound/)) *** { "font;common", "font/tracks/trackname.wav", StylePtr<...>(), "preset name" }, *** The default track in each preset should be set up the same as always, and all other tracks should be put in either "font/tracks/" if you want the tracks to be specific to a font/preset or "common/tracks/" if you want the tracks to be available universally for all presets. Track files can be named anything so long as the entire string "font/tracks/trackname.wav" doesn't exceed 128 characters, although it's recommended to avoid spaces or special characters. They do not need to be named sequentially but you can if it is easier to identify. The Track Player looks in both the "font/tracks/" and "common/tracks" folder and if any track files are found they can be selected using the Dial menu. If there are no wav files or "/tracks" is missing in both the font and common folder the default track will "Loop" in place of the Track Player. After rotating through Tracks there are 4 playback methods: * Play Once * Loop - plays selected track on a loop until stopped * Rotate - begins with selected track and rotates sequentially through each track until stopped * Random - begins with selected track and randomly selects tracks until stopped *** **Track Player Controls (2 Button) While Off** NEW! Track Player* = Long Click PWR parallel *requires tracks in either font/tracks/ or common/tracks/ *if no tracks in font or common will "Loop" default track Turn Right (Stepped) = Next Track Turn Left (Stepped) = Previous Track Click PWR = Play Current Track Once Click AUX = Random (will play current track and then randomly select next tracks) Hold PWR + Turn Right = Rotate (will play current track and then next sequential tracks) Hold PWR + Turn Left = Loop Current Track Long Click PWR = Stop Track Player *** **Track Player Controls (1 Button) While Off** NEW! Track Player* = Double Click PWR (parallel or down) *if only default track exists in current preset, track will "Loop" Turn Right (Stepped) = Next Track Turn Left (Stepped) = Previous Track Click PWR = Play Current Track Once Hold PWR = Random (will play current track and then randomly select next tracks) Hold PWR + Turn Right = Rotate (will play current track and then next sequential tracks) Hold PWR + Turn Left = Loop Current Track Any processor that has a direct USB connection can pretend to be anything. It can work like a mouse, a keyboard, a drive, a microphone, a serial port, or any combinations of these things. Every USB device has a descriptor. The descriptor is just a chunk of data that is downloaded from the device when you first connect it. The descriptor tells the OS what kind of device is connected. The descriptor has a list of end points in it. Each end point ends up becoming a separate device on the host computer. This is how a USB device can implement multiple devices as the same time. The descriptor depends on the program that is uploaded. For instance, in ProffieOS, you can select which endpoints to make available in Arduino -> Tools -> USB Type. Usually, what you want to select is "Serial + WebUSB + Mass storage", which means that there will be three endpoints. One that looks like a serial port, one that looks like a WebUSB endpoint, and one that looks like a drive. The descriptor also provides some other information, like who made the device, what it's called and so forth. All this information can be changed by reprogramming the device. If the program running on the Proffieboard is not working properly, either because the program has a bug in it, or because it was corrupted somehow. Then the computer may be unable to communicate properly whith the board. This may happen even before it downloads the descriptor, in which case the computer won't even be able to identify the board at all. Without doing something about it, the computer will be unable to communicate with the board when this happens. Fortunately, Proffieboards have a fall-back option called "bootloader mode". This is simply another program programmed into the board which cannot be changed. The bootloader code is a part of the CPU, and is not special to Proffieboards. Any board that uses a STM32 processor will have a similar bootloader. By holding BOOT while the board is booting (which we can make it do by pressing and releasing RESET), we can tell the board to ignore any uploaded program, and run the bootloader code instead. When the board is running in bootloader mode, it doesn't actually know that it is a Proffieboard, and the descriptor it presents to the OS is very different. It calls itself "STM32 BOOTLOADER", and it only has one endpoint. That endpoint is a special device called a "DFU" device. It's not a standardized device, which is why we sometimes needs to install a special driver to be able to talk to it. On windows, this is accomplished by using [Zadig](/tools/zadig.html). Note that the operating system has no idea that the "STM32 BOOTLOADER" and the "Proffieboard" are actually the same physical device. To the computer, it looks like you disconnected the Proffieboard and connected some other device. This is why you cannot run Zadig on the Proffieboard device and expect it to work when the Proffieboard is in bootloader mode. Any changes applied to one of these devices does not affect the other at all. ## Uploads Normally, when you upload a program from Arduino, both the "ProffieOS" device, and the "bootloader device" comes into play. It goes something like this: When you hit upload in Arduino. Arduino will check what port you selected under Arduino -> Tools -> Port. Then it will send a special sequence to that port which is intended to cause the connected board to reboot into bootloader mode. This sequence is the same for nearly all Arduino boards. Once the reboot happens, the port goes away. Arduino then proceeds to run the upload program, which is not the same for all boards. The Proffieboard upload programs waits until the board has rebooted and the computer has identified the bootloader device. If this takes a long time, or if it fails for some reason, you'll seee a 1-10 countdown in the Arduino window, and the upload will fail. Once the bootloader device bcomes available, the upload process starts, and you'll see a 0-100% progress bar in the Arduino window. Once the upload is done, the board is rebooted again, but this time, it starts the new program that was just uploaded. If everything goes well, the board plays a boot sound and the port shows up in Arduino -> Tools -> Port again. In order to be able to upload programs to a Proffieboard or Teensy, your computer must be able to talk to it. While there are various drivers permission issues that may need to be solved, this page explains how to tell if he connection is working at all. Most operating systems have a way to view all connected devices. When a Proffieboard is connected, it should show up as either a "Proffieboard" or "STM32 BOOTLOADER". A bad program may lock the processor in a loop, preventing it from communicating with the computer, if that happens, press RESET while holding BOOT, and it should show up as "STM32 BOOTLOADER". Here is how to check connected devices on... ## Windows 10 / 11 Go to Start Menu->Control Panel->Devices and Printers ## Windows 7 Go to Control Panel -> Devices and Printers ## Mac Apple Menu -> About this Mac -> System Report -> USB ## Linux Open up a shell and type "lsusb" Now, if nothing shows up, try a different USB cable, as some micro-USB cables are charge-only. If you need to buy a new cable, I recommend buying one that is USB-IF certified. Once you have verified that the board shows up properly, proceed to [Where's my Port?](/troubleshooting/wheres-my-port.html). dual_prop.h allows for 2 discrete prop files to be used, alternating on a latched switch (Blade Detect). This is useful when you want a saber to toggle to a blaster for example, and you want the buttons to take on different behaviors. How to: Use the following lines where you set your prop file in your config. ```cpp #ifdef CONFIG_PROP #include "../props/dual_prop.h" #include "../props/saber_sa22c_buttons.h" #include "../props/blaster.h" #undef PROP_TYPE #define PROP_TYPE SaberBlasterProp<SaberSA22CButtons, Blaster> #endif ``` ** Note the prop file SaberSA22CButtons here would change to the file name of the prop you choose. Then setup your config file for 2 states: Bladein preset bank, and a BladeOut preset bank. Give the BladeConfig 2 sets of descriptions, and #define BLADE_DETECT_PIN properly. Read more about [blade detect here](/blade-detect.html). There has been some confusion about ProffieOS and Proffieboard version numbers, so I thought I'd write down how they are intended to work. # Version numbers are not decimal numbers Version numbers are two separate numbers separated by a dot. This means that after 2.9 comes 2.10, and 2.25 is a much later version than 2.3. The first number is called the "major" version, and the second number is called the "minor" version. # Versions are orthogonal Think of as a street. As you go down the street, you see first avenue (version), then second avenue (version), etc. If you turn down one of the streets, you'll see version 1.1, 1.2, 1.3, etc. Unlike a city grid, there is no relation between the numbers on each street, so version 4.5 and version 6.5 have no connection in any way. This also means that 3.0 does not follow the last version of the 2.x series. Instead it is most closely related to 2.0. # Minor revisions are meant to be harmless Only bugfixes are allowed when the minor version changes. So it should always be safe to upgrade to a later version of the same major version. (Like from 6.7 to 6.9) Only exception to this rule is in the beginning of the release cycle when we're still in alpha or beta stage. # Proffieboards Proffieboards also have versions, although it's much less obvious what they do since they rarely change. Generally, when I design a new Proffieboard I start with a new major number, and every time I make some changes I change the minor version. Usually all of this happens before the board is ever released, which is why we get "1.5", "2.2" and "3.9" versions. However, if a problem/bug is found, we may see new revisions after the initial release. # Versions are not releated. Even though ProffieOS, Proffieboards and the Arduino-Proffieboard plugin all have similar version numbers, they can all mix or match. Just because you have a V3 proffieboard, doesn't mean you need to use version 3 of the Arduino-proffieboard plugin, or version 3 of ProffieOS. Voltage drops can occur in any circuit, but the problem becomes more common the more current is going through the circuit. In a lightsaber, this generally means that all the components that provide power to the blade(s) may cause voltage drops. Depending on how severe they are, voltage drops can cause the blade to not light up, only show some colors (red) or become flickery or unreliable. In partcular, only showing red colors is a very strong indication that voltage drops are occurring, so now it's just a matter of figuring out what is causing it. Any component can cause voltage drops, this includes battery, wires, solder joints, connectors, charge ports, pogo pins, pogo pin PCBs, FETs, and anything else that is involved with transmitting or regulating the power. Fortunately, the procedure for finding where the problem occurs doesn't care what kind of component it is. In most sabers, the power circuit looks something like this: [![power path](/images/power-path.webp)](/images/power-path.webp) Note that this just shows the path of the battery power to and from the blade, all other connections have been omitted. Also, your circuit might look slightly different, but that's ok, this is just an example. 1. Turn the saber on and ignite it with the blade connected. 2. Start at the battery (position 1 and 7), measure the voltage betweend + and -. Is it low? (Meaning less than 3.5 volts.) Then the battery is the problem. Try charging it. If that doesn't help, get a new battery. 3. Leave the negative probe on the battery -, and move the positive probe from + to the next step in the circuit. If the voltage changed by more than 0.1 volt, you have found a problem. 4. Once you reach the LED strip (7), move the positive probe back to (1), and then start moving the negative probe instead. Again, if you see a drop greater than 0.1 volts, you have found a problem. ## Ok, so I found the problem, now what? Well, it depends on what the problem is of course, here are a list of common voltage drop issues and what you can do about them: ### Bad / weak battery or battery protection circuit. Get a new battery. You want a battery which is rated for at least 10A. ### Wires are too thin. Use better wires. Minmum for saber wiring is AWG 24. ### Bad (cold) solder joints. Usually this happens because the solder joints were not heated up enough, you should be able to fix it by just re-heating it, let the solder melt and then let it re-solidify. ### Shorts Sometimes voltage drops happen because the power is shorted to another part of the circuit. The short will need to be fixed if that is the case. ### Insufficient FETs. Some people only hook up a single FET (led pads) to power a blade. Sometimes that works ok, sometimes it doesn't. Use two or more FETs. ### Bad FETs. FETs can become damaged if shorted. Check [the FET testing page](/troubleshooting/fet-testing.html) to learn how to check if they are working properly or not. ### Insufficient pogo pins If you have a high-power blade, a 7-pin pogo pin adapter might not be sufficient, get one with 9 or 11 pins instead. ### Dirty / oxidized pogo pins or blade PCB Try cleaning them. :) ### Voltage drops on the LED strip Either you trimmed the LED strip too much, or you have a cheap strip with insufficient copper in it. Get new, better LED strips. ### Charge port voltage drops. Make sure you have one that is rated for high amperes. Check that the spring contacts aren't bent back. If this doesn't help, replace it. ### Frayed wires This tends to happen near solder joints, the copper strands break and only a few of them actually connect to the copper. Sometimes you need good magnification to see what is going on. If you have frayed wires, you'll have to cut, strip resolder or replace the wire. ## What is WavLen<>? WavLen (length of wav file) takes the duration of a wav file sound and can be used to replace time integer arguments in a blade style. For example, this is a simple InOutTrL that animates the ignition and retraction of the blade: ``` InOutTrL<TrWipe<300>,TrWipeIn<500>> ``` The retraction is currently set to WipeIn for 500 milliseconds. Let's say you have an in.wav file that is 1000ms long. As is, the blade retraction animation will reach the hilt and be "off" before the sound finishes. The sound and transition are out of sync. If we tell WavLen to listen to the wav playing during retraction, it would look like this instead. ``` InOutTrL<TrWipe<300>,TrWipeInX<WavLen<EFFECT_RETRACTION>>> ``` Now, the animation of the WipeIn is timed to the total length of whichever wav gets chosen and stays in sync. This is perfect for when there are various versions of in.wavs in a font, but they differ in duration. WavLen<> can be used in place of any Int<>, however it makes most sense to use it in a transition for one of the effect events so that there's actually a sound playing. For a fade time of a clash for example: ``` ResponsiveClashL<White,TrInstant,TrFadeX<WavLen<EFFECT_CLASH>>,Int<26000>>, ``` ## Syntax - Integer not number Most transitions used in blade styles are aliased templates that have been shortcut to keep things a bit simpler. "Under the hood" though, they have an expanded syntax which needs to be understood a little to start substituting in WavLen for timings. TrFade<500> has 500 as a NUMBER. WavLen needs to replace an INTEGER. To expand TrFade<500> out to a format that takes an Int (so we can swap in WavLen) TrFade<> becomes TrFadeX<> and 500 Becaomes Int<500>, so it is now `TrFadeX<Int<500>>` It can be easy to forget there is now a new set of internal brackets around the Int<> value, so be sure to keep track of what you're writing. ## Using WavLen in a TransitionEffectL When used inside a TransitionEffectL whose EFFECT is already specified at the end, WavLen<> will automatically use the right effect, so one does not need to be specified. This means it would be written as just `WavLen<>` like this: ``` TransitionEffectL<TrConcat<TrWipex<WavLen<>>,White,TrWipeX<WavLen<>>>,EFFECT_BLAST> ``` ## Using Percentage<> with WavLen<> To use WavLen for an animation containing a chain of events in a TrConcat for example, the time can be calculated and a Percentage of the wav can be used in each transition. This force effect would fade in an unstable looking blade, then fade back out to reveal the base blade color again: ``` TransitionEffectL<TrConcat<TrFade<1000>,BrownNoiseFlicker<Red,Rgb<150,0,0>,500>,TrFade<1000>>,EFFECT_FORCE> ``` Since it's a 2 part effect, we can keep the half and half ratio of fade in/fade out equal to the sound duration time, even though the force.wav lengths may vary. In this case, we'd want each fade to take 1/2 the sound's duration. This is where Percentage gets applied. It gets wrapped around the WavLen, so in plain English it could read as "Get the percentage< of the <wav length of <the current force effect sound>> that is equal to 50" ``` TransitionEffectL<TrConcat<TrFadeX<Percentage<WavLen<>,50>>,BrownNoiseFlicker<Red,Rgb<150,0,0>,500>,TrFadeX<Percentage<WavLen<>,50>>>,EFFECT_FORCE> ``` Percentage can also be >100, so to have a transition take twice as long as the sound for example, the Percentage would be 200. An expanded how-to video on this subject here: https://www.youtube.com/watch?v=5_Mn9KOyLb4 WebUSB is a standard that lets browsers talk to USB devices directly. ProffieOS uses this to let you control and configure the board from a browser. To make WebUSB work, you need: 1. A Proffieboard, WebUSB currently does not work with Teensys connected via USB, it does work for both Teensy and Proffieboard via BLE connection. 2. ProffieOS 1.312 or later 3. 0.1.7 or later of the [proffieboard-arduino](https://github.com/profezzorn/arduino-proffieboard) plugin. 4. A browser that supports WebUSB, such as Chrome. see here for more information: https://caniuse.com/webusb 5. A USB cable (not charge-only!), or BLE connection. Depending on how you want to connect the WebUSB app to your saber make sure to set the configuration for the serial port as follows; Proffieboard connected via USB to WebUSB app; - Select : USB type: "Serial + WebUSB" in the Arduino IDE, or "Serial + Mass Storage + WebUSB if you also want to access the SD card without removing it -Teensy based sabers connected via USB to the WebUSB app are not yet supported. Proffieboard or Teensysaber connected via BLE to WebUSB app; - Make sure #define ENABLE_SERIAL is in your config file, and your Bluetooth device is working. - USB type : "Serial" will work for both Teensy and Proffieboard After that, plug in the board to a computer or phone if you want to use the USB connection, or connect via BLE from within a webpage that can control the board, such as: https://profezzorn.github.io/lightsaber-web-bluetooth/app.html ### Troubleshooting ProffieOS has some code that allows Windows 8.1+ assign the right driver automatically to make WebUSB work. Unfortunately, that code does not work with Windows 7. so if you're using Windows 7 you have to use zadig to make WebUSB work: * Run [Zadig](/tools/zadig.html) * Select Options->List All Devices * Select "CDC Data (interface 2)" * Check that the USB ID is 1209 6668 02 * Select WinUSB (v6.1.7600.16385) as new driver * Click Replace Driver If you're having problems with making WebUSB work on Windows 10, it may be because of having used zadig to override the windows defaults for the proffieboard device. If so, this is how you undo zadig overrides: https://github.com/pbatard/libwdi/wiki/FAQ#Help_Zadig_replaced_the_driver_for_the_wrong_device_How_do_I_restore_it The WebUSB app will work on Windows, Linux and Android, but to get BLE working on IOS, you might need to install a WebBLE enabled browser on you IOS device (chrome for IOS does not suppert WebBLE yet). Update 2022-06: Bluefy (free) from the appstore used to work perfect with the WebUSB app. Unfortunately that is no longer the case as of beginning of 2021. An alternative for IOS users is the WebBLE app, and has been tested with the latest IOS version. https://apps.apple.com/us/app/webble/id1193531073 Here's a tutorial for how to get around the ProffieOS Workbench webpage: https://fredrik.hubbe.net/lightsaber/webusb.html ProffieOS has several spoken error messages. While spoken error messages are meant to be user friendly, it can sometimes be difficult to hear what it's actually saying. Luckily, there is a fairly short list of actual error messages: ### Font directory not found This happens when the font specified in your your current preset cannot be found on the SD card. A common reason for this is mispelling the font name in one of the 2 places; the SD card or the preset. They need to be identically spelled with no spaces preferably. It may also be a path problem. For example "Greyscale/CODA" is not the same as "CODA". The preset's font path must match the folder structure on the SD card. It could also be if "ProffieOS_SD_Card" sounds were downloaded and put incorrectly on the SD card. What you're supposed to do is to just copy the contents of that directory to the root level of the SD. ### Font directory too long - Teensysaber boards only as of ProffieOS 6.x. If your font directory can't be found AND the name is longer than 8 characters, you may get this error message. Check the path and name of the font folder you specified in the preset and make sure it matched exactly on the SD card. ### SD card not found This means that the board cannot detect the SD card. Either the SD card is not present, it's not formatted as FAT32, or something electrical is wrong. ### Error in font directory This means that one or more sound effect files are missing or incorrectly numbered. For instance, if you have hum1.wav, hum2.wav and hum4.wav (but no hum3.wav) you will get this error message. ### Error in blade array This happens if the blade array is not configured correctly. The reasons may be complicated, so ask for help if you can't figure it out. ### Low battery Charge it! ### Something else If you hear it saying something else, this page may be out of date and will need to be updated, please remind me to do so. If the Proffieboard Port doesn't show up in Arduino->Tools->Port, don't worry, most of the time you just need to press BOOT+RESET and hit upload. After the board is programmed, the port will show up again. If programming works, but the port still doesn't show up, it's possible that you you need to install a driver. If you're on a Mac, you may need to upgrade to a later version of OSX. On linux, make sure you have the udev rules installed. See [Proffieboard Setup](/proffieboard-setup.html) If you're on Windows 7, follow the usb serial driver instructions here: [Proffieboard Setup](/proffieboard-setup.html) On Windows 10, it *should* just work. If it still doesn't work, it's possible that some other software has messed things up, or perhaps you used zadig incorrectly and changed the driver for the Proffieboard serial device. Here is how you check what driver is used on Windows 10: * Go to Settings->Devices * Scroll down and click on "Devices and printers" * In the "Unspecified" category, find "Proffieboard". (If it's not there, go back and program the board first.) * Double-click the proffieboard device. * Select the "Hardware" tab. * You should see a list of device functions, which should contain "USB Composite Device" and "USB Serial Device" * Double-click the "USB Serial Device" * Select the Driver tab * Click "Driver Details" * It should say "C:\WINDOWS\system32\DRIVERS\usbser.sys" It's possible that usbser.sys lives in a different location, and that's probably fine. However, if you see "winusb.sys" or some completely different driver, you probably ran zadig on the wrong device at some point. Here is how you undo it: https://github.com/pbatard/libwdi/wiki/FAQ#Help_Zadig_replaced_the_driver_for_the_wrong_device_How_do_I_restore_it Here is a video that shows how to check and fix the serial port driver: https://www.youtube.com/watch?v=XgT8dq4rhPk The ProffieOS Workbench is a WebApp that uses WebUSB to talk to your Proffieboard and lets you control basic settings and edit fonts and presets. This page will show you how to use it. If you're wondering how to set it up, see [the webusb page](/troubleshooting/webusb.html). ## Making the connection If the Proffieboard is currently connected to your computer or phone, and the SD card is mounted, make sure to eject it or the app will not work properly. Click [HERE](https://profezzorn.github.io/lightsaber-web-bluetooth/app.html) to start the ProffieOS Workbench. You should see something like this: ![choice](https://fredrik.hubbe.net/lightsaber/webusb_screen1.png) Depending on the capabilities of your browser, you may see only one or none of these buttons. See the end of this page for how to get it working. Pick USB or BLE (bluetooth). Note that using BLE is only possible if your saber has a bluetooth module. To use the USB button, make sure that the computer/phone is connected to the proffieboard with a data-capable USB cable. Your browser will now ask you to select the proffieboard you want to connect to. Usually there is only one: ![connect screen](https://fredrik.hubbe.net/lightsaber/webusb_screen2.png) At this point you should be connected. ## Control interaface Once connected, you should see something like this: ![first page](https://fredrik.hubbe.net/lightsaber/webusb_screen3.png) On the top left you'll see a slider for adjusting the volume and the current battery voltage. On the top right you'll see a pen button which takes you to the editing interface. Below those you'll see three columns: * Presets, clicking them selects that preset. * Tracks, clicking the track starts playing the track * Actions, Lets you turn the saber on/off and trigger clashes, blasts and other effects. ## Editing interaface ![editing view](https://fredrik.hubbe.net/lightsaber/webusb_screen4.png) On the left you'll see all your presets, a plus and a trash can. You can re-order the presets by dragging them. You can delete presets by clicking the trash can or dragging presets onto the trash can. You can create new presets by clicking the plus button or dragging presets onto the plus icon. On the right you can see all the individual fields that make up a preset: * Name: The name of the preset. This is really only used to identify the preset in this app. * Font: The sound font for this preset. * Track: The sound track to use with this preset. * Styles: These specify the style and color for the blade. If your saber has multiple blades or accents, there can be multiple styles in each preset. In this example there are two styles. * Variation: Depending on the style, this lets you change the style or color of the blade. All changes you make are saved immediately. When done, click the pen icon in the top right corner again to return to the control interface. ## How to add a new font 1. Upload the font to the SD card. Assuming that your saber is configured with mass storage support, plug the USB cable into your saber and wait for the SD card to show on your desktop. Drag the font folder to the SD card, and then eject the drive from your computer safely. Please note that this can take a couple of minutes to complete. 2. Now start from the top of this page and navigate to the Editing Interface. 3. Pick a preset that may match the font you are adding. 4. Press the "+" button. This will duplicate the preset you had selected. 5. Now select the newly added font from the "font" dropdown in the right column. 6. Done, although you may optionally change other parts of the preset like blade color and style. ## How do I reset it back to factory settings? 1. Plug in the USB cable and wait for the SD card to show up on your desktop. 2. Open up the drive and delete "presets.ini" and "presets.tmp". 3. Eject the SD card drive from your computer. 4. Unplug the USB cable and insert your kill key, flip your kill switch or press the reset button on the proffieboard. ## Troubleshooting ### I get this message"This browser supports neither webusb nor web bluetooth." See "No USB button" below. ### No USB button Make sure to select a [browser that supports WebUSB.](https://caniuse.com/webusb). ### No BLE button. Make sure you use a a [browser that supports Web-bluetooth](https://caniuse.com/web-bluetooth). Note that it seems that with chrome on linux you have to enable "experimental web platform features" in about:flags. On IOS, you need to install an app called "Bluefly" to use Web-bluetooth. ### Board doesn't show up after clicking USB button * Make sure you have a working USB cable. * Make sure your board was programmed with WebUSB support. (Webusb was selected in Arduino->Tools->Usb type) * For windows7, you need to use zadig to make WebUSB work, [here is how](/troubleshooting/webusb.html) ### Board doesn't show up after clicking the BLE button * Does your saber actually have a bluetooth module? * Is it a supported module? (FSC-BT630, FSC-BT909 or RedBear BLE Nano 2) * Is the bluetooth module on? Is bluetooth on on the device you're trying to connect from? ## I want more options! Proffieboards can be programmed to do just about anything from Arduino. While not immensly complicated it does require more work than the methods described on this page. If you're still interested, check out the [ProffieOS page](https://fredrik.hubbe.net/lightsaber/proffieos.html). WS2811BladePtr is an older version of [WS281XBladePtr](/config/blades/ws281xbladeptr.html). I recommend using WS281XBladePtr instead this documentation can be helpful to understand older config files though. WS2811BladePtr takes 7 arguments, but only two are actually required. WS2811BladePtr<leds, config, data_pin, power_pins, pin_class, reset_us, t1h, t0h> All the arguments except for "config" behave the same as in [WS281XBladePtr](/config/blades/ws281xbladeptr.html). The config specifies both the byte order and the frequency. The byte order is one of: WS2811_RGB WS2811_RBG WS2811_GRB WS2811_GBR If no byte order, it defaults to RGB, which is probably not what you want. The frequency is one of: WS2811_800kHz WS2811_400kHz WS2813_800kHz WS2811_580kHz WS2811_ACTUALLY_800kHz Note that the 800kHz ones actually use 740kHz. And the WS2811 and WS2813 ones are identical since all of them use a timeout of 300us. The frequency and byte order are combined by using the | operator, like this: WS2811_800kHz | WS2811_GRB WS281XBladePtr can have up to 10 arguments, but only the first three are required. WS281XBladePtr<leds, data_pin, byteorder, power_pins, pin_class, frequency, reset_us, t1h, t0h> * leds - number of leds in this pixel string, must be less or equal to maxLedsPerSrtring * data_pin - pin to output ws281x data * byte_order - specifies in which orders the colors are sent to the pixels * power_pins - which pads powers the string, defaults to PowerPINS<bladePowerPin1, bladePowerPin2, bladePowerPin3> * pin_class - This is the driver class, defaults to DefaultPinClass * frequency - data rate, defaults to 800000 * reset_us - how many us is needed to reset the pixels, defaults to 300 * t1h - how long to keep the signal high for a 1, note that this is is always out of 1200, even if the frequency changes, defaults to 394 * t0h - how long to keep the signal high for a 0, defaults to 894 data_pin is normally one of: bladePin blade2Pin blade3Pin blade4Pin blade5Pin blade6Pin blade7Pin Other pins may or may not work depending on what board and driver is being used. byte_order depends on what kind of pixel strip is used, these values are possible: Color8::BGR Color8::BRG Color8::GBR Color8::GRB Color8::RBG Color8::RGB Color8::BGRW Color8::BRGW Color8::GBRW Color8::GRBW Color8::RBGW Color8::RGBW Color8::WBGR Color8::WBRG Color8::WGBR Color8::WGRB Color8::WRBG Color8::WRGB Color8::BGRw Color8::BRGw Color8::GBRw Color8::GRBw Color8::RBGw Color8::RGBw Color8::wBGR Color8::wBRG Color8::wGBR Color8::wGRB Color8::wRBG Color8::wRGB By far the most common byte order is GRB, but some pixel strips use RGB byte order. The four-letter byte orders are used for RGBW strips, the most common of those are GRBW and RGBW. The byte orders with a capital W will use both RGB AND W LEDs for white colors, while byte orders with lower-case w will turn on only the white LEDs for white colors. Thus RGBw is more power efficient than RGBW, but not as bright. Most of the time it does not make sense to change the pin_class, but if you have a Teensy, and you have problems with glitches, you might want to try the serial pixel driver by setting pin_class to WS2811SerialPin. You'll also need to use a data pin that is serial-capable, which may mean that you can't use the serial port for something else. Note that WS2811SerialPin ignores t0h and t1h. It's unlikely that you will need to change any of the last four parameters, the timing is suitable for almost all types of WS2811-compatible pixels. Once you have Arduino installed and configured, it's time to download ProffieOS and set it up with a config file for your particular saber or prop. This page isn't meant to show you all the ways you can customize a config file, for now we're just going to start with something simple, and we can customize and configure it later. ## Where to get a config file. While it's possible to just open up a text editor and write a config file, I wouldn't recommend it. Instead, I would go with one of these options: * If you bought your saber from somewhere, the seller or installer usually saves the config file, or a copy of ProffieOS with a config file in it on the SD card. If you need help finding it, check [this page](/config/get-from-sd-card.html) Note that not all sellers/installers do this, and if that is the case, you should contact them and get the file directly from them. * If you are installing your own Proffieboard, you can use the [configuration generator web page](/config/generator.html) to generate a config file for your board. * You can take an existing, similar config file and modify it. (If necessary) * You can use the [Fett263 configuration helper tool](https://www.fett263.com/fett263-os7-config-helper.html), but please beware that it requires you to input the blade configuration, so it's usually best to start with one of the other methods above, and then use the Fett263 tool to generate a *better* config file. * There is also the [ProffieConfig tool](https://github.com/ryancog/ProffieConfig), which aims to streamline this entire process, including uploads to the board. ## Configuring ProffieOS to use your config file. 1. Go to the ProffieOS directory and click on ProffieOS.ino (.ino might be hidden on Windows) 2. This should open up ProffieOS.ino in arduino. Arduino might show another file too, like README.md, if so, just click on the ProffieOS.ino tab. 3. Scroll down to the `CONFIG_FILE` define, it will be a line that looks like this: ```cpp // #define CONFIG_FILE "config/YOUR_CONFIG_FILE_NAME_HERE.h" ``` 4. Now change this line to: ```cpp #define CONFIG_FILE "config/my_saber_config.h" ``` Of course, replace my_saber_config with the actual name of your config file. Zadig is a program that let's you update or replace device drivers for specific USB devices on Windows. For Proffieboards, we can Zadig to install a driver that lets us talk to the STM32 BOOTLOADER. However, it's easier to just use [proffie-dfu-setup.exe](https://fredrik.hubbe.net/lightsaber/proffie-dfu-setup.exe). If proffie-defu-setup.exe doesn't work, or you just prefer to do things the hard way, here is how you do it with Zadig: 1. Download [Zadig](https://zadig.akeo.ie/) 2. Plugin the Proffieboard and toggle the RESET button while holding down the BOOT button 3. Let Windows finish searching for drivers 4. Start ```Zadig``` 5. Select ```Options -> List All Devices``` 6. Select ```STM32 BOOTLOADER``` from the device dropdown 7. **Verify that the USB ID is ```0483 df11```, if it is not, do not proceed!** 8. Select ```WinUSB (v6.1.7600.16385)``` as new driver 9. Click ```Replace Driver``` Done. Once zadig has been run, you shouldn't have to do it again. Your computer should remember what driver to use for the proffieboard bootloader from now on. Note that on Windows 7, you will probably also need to update the ACM serial device driver, but that is done with a separate program. Zadig doesn't have an undo, or revert button, but if you run Zadig on the wrong device, here is how you revert it: https://github.com/pbatard/libwdi/wiki/FAQ#Help_Zadig_replaced_the_driver_for_the_wrong_device_How_do_I_restore_it # Making changes to this site If you find something wrong, or have an idea for how to improve the documentation on this site. Just find the right page and click the pencil in the top right corner. This will take you to the right place on github. If you don't have a github account, you'll need to create one. Once you are signed it, github will ask you to fork the ProffieOSDocs repository, and you'll need to do that. After forking, you can make edits. Make sure to check the "Preview" tab to see approximately how your changes will look once they appear on the POD site. For more information about how to make it look the way you want, try [this site](https://www.markdownguide.org/tools/github-pages/). Once you are happy with your changes, write a comment describing your changes below and hit the "propose" button. Proposing the changes will not send them directly to the POD site though. Instead, the changes will be saved in a branch on your fork of the ProffieOSDocs repository. If you don't know what any of that means, don't worry about it. After pressing the "propose changes" button, github will show you a button to create a pull request. You should click this button and create the pull request. Someone will review your changes and approve them before they will show up on the site. This may take some time, but it also means that you don't have to worry about making any major mistakes or breaking the site somehow. Of course, if you already know how to use github, you can use any tools you want to fork, edit and upload pull requests. ## Best practices Don't add newlines unless you need it. In the github editor, set it to "Soft wrap" and just write long lines to make paragraphs. This makes page resizing work better. ### Images To make things look good in PDFs, print and retina displays, all images should be uploaded at the highest resolution available. That might come out too large when shown on the screen, and the solution is to use an "image" tag instead of using the markdown for an image. So instead of this: ``` ![alt text](/images/someimage.jpg) ``` you do: ``` <image src="/images/someimage.jpg" width=400 height=200 alt="alt text" /> ``` This will make the browser scale the image to 400 x 200 instead of whatever size the image was when you uploaded it, but print and retina displays will use the extra pixels to make things look good. Uploading screenshots is good for pointing out where buttons and menues are, but not to show an error message or something like that. Information that is fundamentally text should use text, not images. ### Code Write code blocks like this: ``` ```cpp #define EXAMPLE_DEFINE ``` ``` This will make it highlighted as C++, with a copy button, like this: ```cpp #define EXAMPLE_DEFINE ``` ## Searching for dead links (on Linux) PS: Here is a useful linux command for finding broken links: ``` wget --spider -r -nd -nv -l 3 https://pod.hubbe.net/ 2>&1 | grep -B1 'broken link' ``` You'll need to use grep or something to find where the broken links come from though. If you have the ProffieOSDocs github repository, you can do that with git grep, like this: ``` wget --spider -r -nd -nv -l 3 https://pod.hubbe.net/ 2>&1 | grep -B1 'broken link' | sed -n 's@https://pod.hubbe.net/\(.*\):@\1@gp' | while read LINK ; do echo "=== $LINK ===" ; git grep $LINK ; done ``` # Fett263 Prop File with "Battle Mode" and Gesture Controls for ProffieOS5.x Instructions for including in your config at bottom of the page. ## New features: - "Battle Mode" - gesture controlled Lockup, Melt, Drag - "Force Push" - a new gesture during Battle Mode, pushing your hilt towards you opponent quickly will trigger a force push sound (push.wav or force.wav) (this is optional with a define) - Gesture Ignitions and Retractions - Swing On, Stab On, Thrust On and Twist On with Twist Off - "Fast On" for Gesture Ignitions - ignored preon.wav and Preon effects and just ignites the blade on a gesture movement. By default all Gesture Ignitions will use Fast On and ignore Preon sounds and effects (this is customizable with defines if you want to enable Preons with Gestures) - On Demand "Power Save" and "Battery Level" effects - enable a dimming effect on your presets (via styles) to dim the blade brightness and save power on demand and view your current Battery Level with a custom style with a button press. - Multi-Phase - change presets while the blade is ignited - Multi-Blast Mode (from OS4.8 but can be used with Battle Mode) - activate to enable a blast effect for every blade swing/deflection - New Mode, Menu and Feature sound effects (add these new sounds to your font/preset for additional customization) > * On Demand Power Save - dim.wav > * On Demand Battery Level - battery.wav > * Battle Mode On (on toggle) - bmbegin.wav > * Battle Mode Off (on toggle) - bmend.wav > * Enter Volume Menu - vmbegin.wav > * Exit Volume Menu - vmend.wav > * Fast On (optional) - faston.wav > * Multi-Blast Mode On - blstbgn.wav > * Multi-Blast Mode Off - blstend.wav ## While in Battle Mode - Lockup, Drag and Melt are all controlled by gestures only, no buttons are needed: - Lockup is initiated with a clash, if you hold your saber against your opponent's (or keep relatively still) Lockup will be active, to disengage Lockup you will pull your saber away from the opponents. During Lockup you can move your saber against your opponents and the Responsive effects will still respond to blade angle as you "struggle" the "pull away" motion is a deliberate change in angle (this can take a little practice). - Clash in "Battle Mode" is actually Begin Lockup/End Lockup in quick succession based on clashing your saber and pulling away immediately. As a result, your style needs to include LOCKUP_BEGIN and LOCKUP_END transitions, the combination of these transitions will create your "clash" effect. I have updated my library to now allow you to choose several options for both the begin and end Lockup in the Enhancement screen. You can mix and match as you like although some combinations work better together than others so test and decide for yourself. NOTE: bgnlock.wav and endlock.wav will be used, in testing you can rename your clsh.wav sounds to bgnlock.wav to your preference, some work better than others so it's ultimately up to the user. While in Battle Mode your actual Clash effects and Sounds are not used. I have timed out the Begin and End transitions on the library but you can customize to shorten or lengthen the visual effect, there is also a control factor in that if you don't pull away immediately the actual Lockup effect will appear so learning to control the saber is a part of the effect. - NOTE: OS 5.7 added an update for swinging through the clash. If you have a glancing clash or continue a swing after a clash your saber will do a traditional clash, if your blade comes to a stop or slows down it will go into Begin Lockup/End Lockup. - There is a new threshold for use with the Battle Mode features, it mostly affects "Lockup/Clash" as when you normally clash two sabers together there is a "bounce" that happens, the threshold wil let you ignore the "bounce" so Lockup can properly engage but if you have it too high then "clash" is harder to perform. I have defaulted to the "Goldilocks" zone I found in testing. If you wish to change you will use: >> #define FETT263_LOCKUP_DELAY 200 >> (200 is the default, increasing will allow for more time to determine Lockup, decreasing will shorten) > > This works in conjunction with the CLASH_THRESHOLD_G define, CLASH_THRESHOLD_G is the level to recognize the clash/stab event occured if the effects trigger too easily you will increase this value, if they are not triggering easily you will lower this value. After the Clash occurs the LOCKUP_THRESHOLD is used as noted above. The combination of these two thresholds is then used with your control of the saber for "pulling away" and the styles in your preset to create Clash/Lockup. - Drag in "Battle Mode" is activated by Stabbing down, this is to allow you to clash and lockup with your blades below horizontal like in the films. The Stab motion is a linear thrust down with contact (or an abrupt end). While Drag is active you can "drag" it along the floor to intimidate your opponent. To disengage Drag you only need to lift the blade from the floor at an angle. Drag (and Melt) have a lower threshold than Lockup so you won't need as deliberate a movement to "pull away". - Melt in "Battle Mode" is activated by stabbing horizontal or up, you can use the Responsive Melt to heat up the surface by turning your hilt and you can drag your saber along the wall/object, to disengage Melt you will pull away from the wall or object at an angle. NOTE: Stab is not active during Battle Mode, if you do a quick Melt/Drag and pull away you can get a quasi-Stab effect. To use Stab (particularly for the new Summon and Release effects) you will exit "Battle Mode" by holding Aux and Swinging. ## DEFAULT 2 BUTTON CONTROLS (PWR and AUX): * "Battle Mode" - hold AUX and Swing while blade is ON to toggle mode ON/OFF * Ignite (ON) - click PWR while OFF (Swing On, Twist On, Thrust On and Stab On available with defines) * Muted Ignition (ON) - double click PWR while OFF * Retract (OFF) - click PWR while ON (disabled during swinging, Twist Off available with define) * Play/Stop Music Track - hold and release PWR while OFF or hold and release PWR while pointing blade straight up while ON * Blast - click AUX while ON * Multi-Blast Mode - hold and release AUX while ON to enter mode, Swing to initiate Blasts, click Aux to exit mode (lockup, clash, stab, melt, drag or any button presses automatically exits mode) * Clash - clash blade while ON, in Battle Mode clash and pull away quickly for "Clash" (requires BEGIN_LOCKUP and END_LOCKUP styles and sounds) * Lockup - hold AUX and clash while ON, in Battle Mode clash and hold steady to activate, pull away to disengage * Drag - hold AUX and stab down while ON, in Battle Mode stab down, pull away to disengage * Melt - hold PWR (or AUX) and thrust forward and clash while ON in Battle Mode thrust and clash to engage, pull away to disengage * Lightning Block - hold PWR and click AUX while ON * Force - hold and release PWR while ON (except while pointing blade straight up) * Stab - thrust forward and clash blade while ON - deactivated in Battle Mode * Power Save - hold Aux and click PWR while ON (pointing up) to use Power Save (requires style) * Color Change - hold AUX and click PWR while ON (parallel or down) to enter CCWheel, turn hilt to rotate through colors, click PWR to select/exit if using COLOR_CHANGE_DIRECT each button press advances one Color at a time * Next Preset - click AUX while OFF (parallel or up) * Previous Preset - click Aux while OFF (pointing down) * MULTI_PHASE Next Preset - hold AUX and TWIST while ON (use define to enable) * MULTI_PHASE Previous Preset - hold PWR and TWIST while ON (use define to enable) * Battery Level - hold AUX and click PWR while OFF (requires style) * Enter SA22C Volume Menu - hold and release AUX while OFF * Volume Up (10% increment, 100% max) - click PWR while in Volume Menu while OFF * Volume Down (10% increment) - click AUX while in Volume Menu while OFF * Exit Volume Menu - hold and release AUX while in Volume Menu while OFF ## OPTIONAL DEFINES (added to CONFIG_TOP in config.h file) **#define FETT263_BATTLE_MODE_ALWAYS_ON** Battle Mode is always on, toggle controls deactivated, This will disable traditional Clash and Stab effects, (cannot be used with #define FETT263_BATTLE_MODE_START_ON) or **#define FETT263_BATTLE_MODE_START_ON** Battle Mode is active with each ignition by default but can be toggled using Aux + Swing control, (cannot be used with #define FETT263_BATTLE_MODE_ALWAYS_ON) **#define FETT263_LOCKUP_DELAY 200** This is the "delay" in millis to determine Clash vs Lockup **#define FETT263_BM_DISABLE_OFF_BUTTON** During Battle Mode Power Button Retraction is disabled **#define FETT263_SWING_ON** To enable Swing On Ignition control (automatically enters Battle Mode, uses Fast On) or **#define FETT263_SWING_ON_PREON** Disables Fast On ignition for Swing On so Preon is used (cannot be used with #define FETT263_SWING_ON) **#define FETT263_SWING_ON_NO_BM** To enable Swing On Ignition control but not activate Battle Mode, (Combine with #define FETT263_SWING_ON or FETT263_SWING_ON_PREON to enable, cannot be used with #define FETT263_BATTLE_MODE_ALWAYS_ON or #define FETT263_BATTLE_MODE_START_ON) **#define FETT263_SWING_ON_SPEED 250** Adjust Swing Speed required for Ignition 250 ~ 500 recommended **#define FETT263_TWIST_OFF** To enable Twist Off Retraction control **#define FETT263_TWIST_ON** To enable Twist On Ignition control (automatically enters Battle Mode, uses Fast On) or **#define FETT263_TWIST_ON_PREON** Disables Fast On ignition for Twist On so Preon is used (cannot be used with #define FETT263_TWIST_ON) **#define FETT263_TWIST_ON_NO_BM** To enable Twist On Ignition control but not activate Battle Mode, (Combine with #define FETT263_TWIST_ON or FETT263_TWIST_ON_PREON to enable, cannot be used with #define FETT263_BATTLE_MODE_ALWAYS_ON or #define FETT263_BATTLE_MODE_START_ON) **#define FETT263_STAB_ON** To enable Stab On Ignition control (automatically enters Battle Mode, uses Fast On) or **#define FETT263_STAB_ON_PREON** Disables Fast On ignition for Stab On so Preon is used (cannot be used with #define FETT263_STAB_ON) **#define FETT263_STAB_ON_NO_BM** To enable Stab On Ignition control but not activate Battle Mode, (Combine with #define FETT263_STAB_ON or FETT263_STAB_ON_PREON, cannot be used with #define FETT263_BATTLE_MODE_ALWAYS_ON or #define FETT263_BATTLE_MODE_START_ON) **#define FETT263_THRUST_ON** To enable Thrust On Ignition control (automatically enters Battle Mode, uses Fast On) or **#define FETT263_THRUST_ON_PREON** Disables Fast On ignition for Thrust On so Preon is used (cannot be used with #define FETT263_THRUST_ON) **#define FETT263_THRUST_ON_NO_BM** Combine with #define FETT263_THRUST_ON or FETT263_THRUST_ON_PREON, (cannot be used with #define FETT263_BATTLE_MODE_ALWAYS_ON or #define FETT263_BATTLE_MODE_START_ON) **#define FETT263_FORCE_PUSH** To enable gesture controlled Force Push during Battle Mode, (will use push.wav or force.wav if not present) **#define FETT263_FORCE_PUSH_ALWAYS_ON** To enable gesture controlled Force Push full time, (will use push.wav or force.wav if not present) **#define FETT263_FORCE_PUSH_LENGTH 5** Allows for adjustment to Push gesture length in millis needed to trigger Force Push Recommended range 1 ~ 10, 1 = shortest, easiest to trigger, 10 = longest **#define FETT263_MULTI_PHASE** This will enable a preset change while ON to create a "Multi-Phase" saber effect **#define MOTION_TIMEOUT 60 * 15 * 1000** This extends the motion timeout to 15 minutes to allow gesture ignition to remain active, Increase/decrease the "15" value as needed ## Including prop file in config.h To use this prop file you will include in your config and list the defines from above based on the controls and features you wish to enable. (see example below) ## Example config (top section): *** #ifdef CONFIG_TOP #include "proffieboard_v2_config.h" #define NUM_BLADES 1 #define NUM_BUTTONS 2 #define VOLUME 1500 const unsigned int maxLedsPerStrip = 144; #define CLASH_THRESHOLD_G 2.0 #define ENABLE_AUDIO #define ENABLE_MOTION #define ENABLE_WS2811 #define ENABLE_SD #define COLOR_CHANGE_DIRECT #define DISABLE_DIAGNOSTIC_COMMANDS **#define FETT263_THRUST_ON** // enables Thrust On Ignition **#define FETT263_SWING_ON** // enables Swing On Ignition **#define FETT263_TWIST_ON** // enables Twist On Ignition **#define FETT263_TWIST_OFF** // enables Twist Off Retraction **#define FETT263_FORCE_PUSH** // enables Force Push gesture/sound during Battle Mode **#define MOTION_TIMEOUT 60 * 15 * 1000** // keeps motion chip active for 15 minutes while blade is Off **#define FETT263_MULTI_PHASE** // enables Multi-Phase preset changing while blade is ON #endif **#ifdef CONFIG_PROP** **#include "../props/saber_fett263_buttons.h"** **#endif** #ifdef CONFIG_PRESETS Preset presets[] = {... *** ## GESTURE CONTROLS [PDF Version](https://fett263.s3.us-east-2.amazonaws.com/fett263-proffieOS5-gesture-controls.pdf) ![Gesture Controls](/props/fett263/fett263-proffieOS5-gesture-controls.jpg) # Menu Prompts and Sounds for ProffieOS6 The following sound files should be included in "common" folder on SD card (but can also exist in each font folder as needed). The sounds can be downloaded at the following page, where you can choose from a variety of versions and languages: https://fredrik.hubbe.net/lightsaber/sound/ Example: * PHRASE (or sound) = "filename" // notes if applicable ## Menu Prompts / Sounds: * Accept = "maccept.wav" * Adjust Black Level = "mblack.wav" * Adjust Color Hue = "mhue.wav" * Adjust White Level = "mwhite.wav" * Alt Color = "malt.wav" * Auto = "mauto.wav" * Base Color = "mbase.wav" * Blast Color = "mblast.wav" * Cancel = "mcancel.wav" * Choreography Begin = "chreobgn.wav" * Choreography End = "chreoend.wav" * Clash Color = "mclash.wav" * Clash Detection Level = "mbmclash.wav" * Clash Lockup Position = "mlockpos.wav" * Color List = "mcolorlt.wav" * Color Menu = "mcolorsb.wav" * Color Options = "mcolorop.wav" * Confirm = "mconfirm.wav" * Confirm Selection = "maffirm.wav" * Cool Down Options = "mcooldwn.wav" * Copy Colors = "mcopyc.wav" * Copy Preset = "mcopy.wav" * Delete Preset = "mdelete.wav" * Disabled = "mfalse.wav" * Down = "mdown.wav" // Sound for decrease * Drag Color = "mdrag.wav" * Drag Size = "mdragsz.wav" * Edit Blade Length = "mlength.wav" * Edit Brightness = "mdim.wav" * Edit Clash Threshold = "mclashth.wav" * Edit Color = "mcolor.wav" * Edit Control Settings = "mcontrol.wav" * Edit Font = "mfont.wav" * Edit Mode = "medit.wav" // 1-sec leading silence delay * Edit Settings = "msetting.wav" * Edit Style = "mstyle.wav" * Edit StyleSettings = "mstylset.wav" * Edit Track = "mtrack.wav" * Edit Volume = "mvolume.wav" * Emitter Color = "memitter.wav" * Emitter Size = "memitsz.wav" * Enabled = "mtrue.wav" * Enter Volume Menu = "vmbegin.wav" * Exit = "mexit.wav" * Force Push = "mpush.wav" * Force Push Length = "mpushlen.wav" * Gesture Menu = "mgestsub.wav" * Gestures Off = "mgestoff.wav" * Gestures On = "mgeston.wav" * Ignition Color = "mignite.wav" * Ignition Delay = "migdelay.wav" * Ignition Options = "migopt.wav" * Ignition Time = "mouttime.wav" * Keep Rehearsal = "rehrsold.wav" * LightningBlock Color = "mlb.wav" * Lockup Color = "mlockup.wav" * Lockup Delay = "mlockdly.wav" * Loop = "mloop.wav" * Main Menu = "mmain.wav" * Maximum = "mmax.wav" * Maximum Clash Strength = "maxclash.wav" * Maximum Volume = "volmax.wav" * Melt Size = "mmeltsz.wav" * Minimum = "mmin.wav" * Mininum Volume = "volmin.wav" * No Choreography Available = "nochreo.wav" * Off Color = "moff.wav" * Option = "moptnum.wav" * Post Off Color = "mpstoff.wav" * Power Lock = "mpwrlock.wav" * Power Up Options = "mpwrup.wav" * Preon Color = "mpreon.wav" * Preon Options = "mpreopt.wav" * Preon Size = "mpreonsz.wav" * Random = "mrandom.wav" * Rehearse Begin = "rehrsbgn.wav" * Rehearse End = "rehrsend.wav" * Rehearse New = "rehrsnew.wav" // rename? * Reset Colors = "mresetc.wav" * Retraction Color = "mretract.wav" * Retraction Delay = "mrtdelay.wav" * Retraction Options = "mrtopt.wav" * Retraction Time = "mintime.wav" * Revert = "mrevert.wav" * Rotate = "mrotate.wav" * Save = "msave.wav" * Select = "mselect.wav" // Sound for OK / Affirmative / Enter * Select Blade = "mblade.wav" * Select Effect = "meffect.wav" * Select Option = "moption.wav" * Select Preset = "mpreset.wav" * Select Style = "mstylsel.wav" * Settings Menu = "msetsub.wav" * Stab Ignition = "mstabon.wav" * Stab Color = "mstab.wav" * Style = "mstylnum.wav" * Style Menu = "mstylesb.wav" * Style Options = "mstylopt.wav" * Style Settings = "stylstm.wav" * Swing Color = "mswing.wav" * Swing Ignition = "mswingon.wav" * Swing On Speed = "mswingsp.wav" * Thrust Ignition = "mthrston.wav" * Twist Ignition = "mtwiston.wav" * Twist Retraction = "mtwstoff.wav" * Up = "mup.wav" // Sound for increase * Volume Down = "voldown.wav" // Sound for decreasing volume * Volume Up = "volup.wav" // Sound for increasing volume * Zooming In = "mzoom.wav" // Sound for color menu "zooming in" ## Color List Colors (default): /clrlst folder * RED = "clrlst01.wav" * ORANGERED = "clrlst02.wav" * DARKORANGE = "clrlst03.wav" * ORANGE = "clrlst04.wav" * GOLD = "clrlst05.wav" * YELLOW = "clrlst06.wav" * GREENYELLOW = "clrlst07.wav" * GREEN = "clrlst08.wav" * AQUAMARINE = "clrlst09.wav" * CYAN = "clrlst10.wav" * DEEPSKYBLUE = "clrlst11.wav" * DODGERBLUE = "clrlst12.wav" * BLUE = "clrlst13.wav" * ICEBLUE = "clrlst14.wav" * INDIGO = "clrlst15.wav" * PURPLE = "clrlst16.wav" * DEEPPURPLE = "clrlst17.wav" * MAGENTA = "clrlst18.wav" * DEEPPINK = "clrlst19.wav" * SILVER = "clrlst20.wav" * GLACIER = "clrlst21.wav" * ICEWHITE = "clrlst22.wav" * LIGHTCYAN = "clrlst23.wav" * MOCCASIN = "clrlst24.wav" * LEMONCHIFFON = "clrlst25.wav" * NAVAJOWHITE = "clrlst26.wav" * WHITE = "clrlst27.wav" ## Numbers 1 ~ 20: /mnum folder * "mnum1.wav" ~ "mnum20.wav" ## Additional numbers / values: * Zero "mzero.wav" * Thirty = "thirty.wav" * Forty = "forty.wav" * Fifty = "fifty.wav" * Sixty = "sixty.wav" * Seventy = "seventy.wav" * Eighty = "eighty.wav" * Ninety = "ninety.wav" * Hundred = "hundred.wav" * Thousand = "thousand.wav" * Milliseconds = "mmillis.wav" * Percent = "mpercent.wav" * Point (decimal) = "mpoint.wav" * Volts = "mvolts.wav"