Font code help

I’m building a saber font for use with Edit mode, and I’m having a little trouble with one of my font options, in Ignition options. When ever the saber switches to that option in Edit mode, the board freezes up/solid tone sound from the speaker, like it’s locked up. I have to remove the battery and clear the config files in the root of the SD Card that EDIT mode uses to get it working again. (probably froze in the middle of writing a file)

Here’s the relevant code:

	InOutTrL<
		TrSelect<
			IntArg<IGNITION_OPTION_ARG, 0>, 
			TrInstant,
			TrConcat <
				TrFade<300>,
				StrobeL<RgbArg<IGNITION_COLOR_ARG, Rgb<255, 255, 255>>, Int<0>, IgnitionTime<300>>,
				TrFade<300>
			>
		>,

Arduiuno compiles and uploads the code with no errors, and all the other options on the board work. So, am I doing something specific niche that arduiuno isn’t programmed to catch?

First of all, you are building a blade style, not a (sound) font. Not a problem in this case, but I wanted to correct the terminology to avoid future confusion.

The snippet of style code looks reasonable to me.
However, if you can provide a complete config file, I can try to see if I can reproduce the crash on my board. If I can do that I can use a debugger to find out exactly where the crash occurred, which should make it easy to fix.

Sure. I have my WIP code on a Github repo.

I use Visual Studio to edit/write the style code.

In Edit mode, the crash occurred twice in a row for me, when cycling Ignition Effect Style option, when it cycled to option 7.

The code uses the “using” method to break things up into re-usable bits/functions.

To use it on a saber, simply include the “Master_v2.h” (for proffieboard v2) or Master_v3.h (for proffieboard v3) and call it as you would a “using” function.

// Master Font for Edit mode, create /customize your own blade styles using StylePtr<MasterStyle>() and Fett263's Edit Menu.
#include "master/Master_v2.h"

// Font Presets. Just load as many font folders as you want with Master Style.
Preset presets[] = {

// Basic blade style.
{ "WHITE;common","tracks/fates.wav",
	StylePtr <MasterStyle>
	()  //, "white"
},

Should this topic be moved to ProffieOS section?

Style code

Line number:

File with Ignition options:

It’s the last one in Ignition options, “Flash On”. Trying to figure out if this is a bug, or if I coded the ignition style wrong.

Found the problem.

StrobeL<RgbArg<IGNITION_COLOR_ARG, Rgb<255, 255, 255>>, Int<0>, IgnitionTime<300>>,

STROBE_FREQUENCY cannot be 0. Causes a Divide by 0 error in ProffieOS\functions\strobe.h line 21:

 (uint32_t timeout = strobe_ ?  strobe_millis : (1000 / strobe_frequency);)

and / or line 24:

if (m - strobe_start_ > strobe_millis + (1000 / strobe_frequency))
2 Likes

Fix here: