Blade ID Continuous Scanning Not Working?

I’m trying to get blade ID to work on my v3.9, and while it seems to be able to detect and differentiate between the 3 blades I’m using, I can’t seem to get continuous scanning to work (I don’t have an emitter that supports blade detect). It only updates the blade when manually told to do so with scanid, or on reset/boot. The docs make it sound like all I have to do to get it to work is define BLADE_ID_SCAN_MILLIS and BLADE_ID_TIMES for it to be enabled, but even when the blade is left in the saber for a minute or two it doesn’t seem to update the blade. Is there something I’m not doing correctly? Attached is my current config file (minus the styles, ofc).

/*
 * This configuration file was generated by ProffieConfig, created by Ryryog25.
 * ProffieConfig is an All-In-One utility for managing your Proffieboard.
 * https://proffieconfig.kafrenetrading.com/
 *
 * Version: 1.8.5, Generator Version: 1.0.8
 */

#ifdef CONFIG_TOP
//PROFFIECONFIG ENABLE_WEBUSB
//PROFFIECONFIG OS_VERSION 7.15
#include "proffieboard_v3_config.h"
const unsigned int maxLedsPerStrip = 144;
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#define SHARED_POWER_PINS
#define NUM_BLADES 2
#define NUM_BUTTONS 1
#define BLADE_ID_CLASS BridgedPullupBladeID<bladeIdentifyPin, bladePin>

#define ENABLE_POWER_FOR_ID PowerPINS<bladePowerPin2, bladePowerPin3>

#define BLADE_ID_SCAN_MILLIS 100
#define BLADE_ID_TIMES 5
#define VOLUME 1500
#define BOOT_VOLUME 200
#define CLASH_THRESHOLD_G 1
#define PLI_OFF_TIME 60000
#define IDLE_OFF_TIME 60 * 1000
#define MOTION_TIMEOUT 60 * 1000
#define DISABLE_COLOR_CHANGE
#define SAVE_VOLUME
#define SAVE_PRESET
#define SAVE_COLOR_CHANGE
#define FEMALE_TALKIE_VOICE
#define KILL_OLD_PLAYERS
#define NO_REPEAT_RANDOM
#define FETT263_EFFECT_INTERACTIVE_BLAST 
#define EXTRA_COLOR_BUFFER_SPACE  60
#define FETT263_SWING_ON_SPEED 500
#define FETT263_SPECIAL_ABILITIES
#define FETT263_DISABLE_MULTI_BLAST
#define FETT263_TWIST_OFF
#define FETT263_TWIST_ON
#define FETT263_SWING_ON_NO_BM
#define FETT263_DISABLE_CHANGE_FONT
#define FETT263_DISABLE_CHANGE_STYLE
#define FETT263_TWIST_ON_NO_BM
#define FETT263_SWING_ON
#define FETT263_DISABLE_COPY_PRESET
#define FETT263_MOTION_WAKE_POWER_BUTTON
#endif

#ifdef CONFIG_PROP
#include "../props/saber_fett263_buttons.h"
#endif
#ifdef CONFIG_PRESETS
Preset blade_in[] = {
     ...
};
BladeConfig blades[] = {
	{ 2915,
		WS281XBladePtr<116, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>(),
		SimpleBladePtr<CreeXPE2WhiteTemplate<50>, NoLED, NoLED, NoLED, bladePowerPin4, -1, -1, -1>(),
		CONFIGARRAY(blade_in), "full_txq"
	},
	{ 3340,
		WS281XBladePtr<21, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>(),
		SimpleBladePtr<CreeXPE2WhiteTemplate<50>, NoLED, NoLED, NoLED, bladePowerPin4, -1, -1, -1>(),
		CONFIGARRAY(blade_in), "seventeen_cm"
	},
	{ 5715,
		WS281XBladePtr<4, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>(),
		SimpleBladePtr<CreeXPE2WhiteTemplate<50>, NoLED, NoLED, NoLED, bladePowerPin4, -1, -1, -1>(),
		CONFIGARRAY(blade_in), "blade_plug"
	},
	{ NO_BLADE,
		WS281XBladePtr<144, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>(),
		SimpleBladePtr<CreeXPE2WhiteTemplate<50>, NoLED, NoLED, NoLED, bladePowerPin4, -1, -1, -1>(),
		CONFIGARRAY(blade_in), "no_blade"
	},
};
#endif

#ifdef CONFIG_BUTTONS
Button Button1{BUTTON_POWER, powerButtonPin, "pow"};
#endif

Seems like it should work.
Might want to try the 8.x beta and see if it works better, but it should work with 7.15.

I see that you have IDLE_OFF_TIME set to 60 seconds, and I don’t think it will work after that timeout. (edit: this might be wrong when I think about it, I’ll check the code…)

Presumably with BLADE_ID_SCAN_MILLIS set to 100 and BLADE_ID_TIMES set to 5, it should take considerably shorter than a minute to read, right? I was definitely swapping the blades while it was active. I’ll see if I can get 8.x up and running.

Well yes, the actual reading should only take a few milliseconds, and it should be done ~10 times per second if you set BLADE_ID_SCAN_MILLIS to 100.

I’m just saying that that there is a chance that it won’t if you wait 60 seconds before removing or inserting the blade.

Got the latest commit running on my saber, and it seems to work just fine if I disable continuous scanning, but with it enabled it just does this (epilepsy warning): Imgur: The magic of the Internet. I’m assuming that’s the the scanning frequency, cause when i increase it it repeats less often.

That’s pretty weird.
Can you check what the serial monitor says? It almost looks like it is trying turn the blade on?
Either that, or the blade is interpreting the scanning itself like it is data and doing stuff.
Or… the LEDs in your blade come on blue when given power.

If you enable sound, it’s playing (what I presume to be) the ignition sound (cutting out when the blade does).

1 Like

Oh yeah sorry, it only does that when I ignite the blade, not when it boots. It’s trying to ignite. It plays preon sounds just fine, and I can navigate between soundfonts and all that jazz, until I try to ignite it, and then it loops like that and I have to forcefully reset it.

Is the blade detect somehow shorted to button 1?

Blade detect isn’t enabled at all, I don’t have a setup that supports it.

That makes more sense actually.
Probably what is happening is that the load of turning the blade on alters the blade ID, and then it switches to a different blade setting. But doing so causes the blade to be turned off, and then the blade ID goes back to the previous value.

Check the serial monitor!

It doesn’t seem to be swapping blades at all, it’s all blade = 0

unit = 0 vol = 0.00, Playing TXQ Angry Anakin/hum01.wav
channels: 1 rate: 44100 bits: 16
unit = 1 vol = 0.50, Playing TXQ Angry Anakin/out/out05.wav
channels: 1 rate: 44100 bits: 16
humstart: 900
unit = 2 vol = 0.00, Playing TXQ Angry Anakin/swingl/swingl01.wav
channels: 1 rate: 44100 bits: 16
unit = 3 vol = 0.00, Playing TXQ Angry Anakin/swingh/swingh01.wav
channels: 1 rate: 44100 bits: 16
BLADE ID: 2882.14
blade = 0
WS2811 Blade with 116 leds.
Simple Blade
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
unit = 4 vol = 0.50, Playing TXQ Angry Anakin/in/in02.wav
channels: 1 rate: 44100 bits: 16
Style RAM = 1524
Style RAM = 8
Scanning sound font: boot
 done
Scanning sound font: TXQ Angry Anakin
 done
Scanning sound font: common
 done
Activating polyphonic font.
Activating SmoothSwing V2
Accent Swings Enabled.
Polyphonic swings: 16
Monophonic swings: 0
Accent Slashes Enabled.
Polyphonic slashes: 15
Voice pack version 1 found.
Ignition.
unit = 0 vol = 0.00, Playing TXQ Angry Anakin/hum01.wav
channels: 1 rate: 44100 bits: 16
unit = 1 vol = 0.50, Playing TXQ Angry Anakin/out/out01.wav
channels: 1 rate: 44100 bits: 16
humstart: 900
unit = 2 vol = 0.00, Playing TXQ Angry Anakin/swingl/swingl04.wav
channels: 1 rate: 44100 bits: 16
unit = 3 vol = 0.00, Playing TXQ Angry Anakin/swingh/swingh04.wav
channels: 1 rate: 44100 bits: 16
unit = 4 vol = 0.50, Playing TXQ Angry Anakin/font/font.wav
channels: 1 rate: 44100 bits: 16
BLADE ID: 2924.27
blade = 0
WS2811 Blade with 116 leds.
Simple Blade
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
unit = 5 vol = 0.50, Playing TXQ Angry Anakin/in/in01.wav
channels: 1 rate: 44100 bits: 16
Style RAM = 1524
Style RAM = 8
Scanning sound font: boot
 done
Scanning sound font: TXQ Angry Anakin
 done
Scanning sound font: common
 done
Activating polyphonic font.
Activating SmoothSwing V2
Accent Swings Enabled.
Polyphonic swings: 16
Monophonic swings: 0
Accent Slashes Enabled.
Polyphonic slashes: 15
Voice pack version 1 found.
Ignition.
unit = 0 vol = 0.00, Playing TXQ Angry Anakin/hum01.wav
channels: 1 rate: 44100 bits: 16
unit = 1 vol = 0.50, Playing TXQ Angry Anakin/out/out02.wav
channels: 1 rate: 44100 bits: 16
humstart: 900
unit = 2 vol = 0.00, Playing TXQ Angry Anakin/swingl/swingl01.wav
channels: 1 rate: 44100 bits: 16
unit = 3 vol = 0.00, Playing TXQ Angry Anakin/swingh/swingh01.wav
channels: 1 rate: 44100 bits: 16
unit = 4 vol = 0.50, Playing TXQ Angry Anakin/font/font.wav
channels: 1 rate: 44100 bits: 16
BLADE ID: 2886.42
blade = 0
WS2811 Blade with 116 leds.
Simple Blade
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
unit = 5 vol = 0.50, Playing TXQ Angry Anakin/in/in02.wav
channels: 1 rate: 44100 bits: 16
Style RAM = 1524
Style RAM = 8
Scanning sound font: boot
 done
Scanning sound font: TXQ Angry Anakin
 done
Scanning sound font: common
 done
Activating polyphonic font.
Activating SmoothSwing V2
Accent Swings Enabled.
Polyphonic swings: 16
Monophonic swings: 0
Accent Slashes Enabled.
Polyphonic slashes: 15
Voice pack version 1 found.
Ignition.
unit = 0 vol = 0.00, Playing TXQ Angry Anakin/hum01.wav
channels: 1 rate: 44100 bits: 16
unit = 1 vol = 0.50, Playing TXQ Angry Anakin/out/out01.wav
channels: 1 rate: 44100 bits: 16
humstart: 900
unit = 2 vol = 0.00, Playing TXQ Angry Anakin/swingl/swingl01.wav
channels: 1 rate: 44100 bits: 16
unit = 3 vol = 0.00, Playing TXQ Angry Anakin/swingh/swingh01.wav
channels: 1 rate: 44100 bits: 16
unit = 4 vol = 0.50, Playing TXQ Angry Anakin/font/font.wav
channels: 1 rate: 44100 bits: 16
BLADE ID: 2899.00
blade = 0
WS2811 Blade with 116 leds.
Simple Blade
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
unit = 5 vol = 0.50, Playing TXQ Angry Anakin/in/in01.wav
channels: 1 rate: 44100 bits: 16
Style RAM = 1524
Style RAM = 8
Scanning sound font: boot
 done
Scanning sound font: TXQ Angry Anakin
 done
Scanning sound font: common
 done
Activating polyphonic font.
Activating SmoothSwing V2
Accent Swings Enabled.
Polyphonic swings: 16
Monophonic swings: 0
Accent Slashes Enabled.
Polyphonic slashes: 15
Voice pack version 1 found.
Ignition.
unit = 0 vol = 0.00, Playing TXQ Angry Anakin/hum01.wav
channels: 1 rate: 44100 bits: 16
unit = 1 vol = 0.50, Playing TXQ Angry Anakin/out/out04.wav
channels: 1 rate: 44100 bits: 16
humstart: 900
unit = 2 vol = 0.00, Playing TXQ Angry Anakin/swingl/swingl03.wav
channels: 1 rate: 44100 bits: 16
unit = 3 vol = 0.00, Playing TXQ Angry Anakin/swingh/swingh03.wav
channels: 1 rate: 44100 bits: 16
unit = 4 vol = 0.50, Playing TXQ Angry Anakin/font/font.wav
channels: 1 rate: 44100 bits: 16
EVENT: TwistLeft ON millis=78805
EVENT MENU TURN LEFT
BLADE ID: 2907.45
blade = 0
WS2811 Blade with 116 leds.
Simple Blade
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
unit = 5 vol = 0.50, Playing TXQ Angry Anakin/in/in02.wav
channels: 1 rate: 44100 bits: 16
Style RAM = 1524
Style RAM = 8
Scanning sound font: boot
 done
Scanning sound font: TXQ Angry Anakin
 done
Scanning sound font: common
 done
Activating polyphonic font.
Activating SmoothSwing V2
Accent Swings Enabled.
Polyphonic swings: 16
Monophonic swings: 0
Accent Slashes Enabled.
Polyphonic slashes: 15
Voice pack version 1 found.
Ignition.
unit = 0 vol = 0.00, Playing TXQ Angry Anakin/hum01.wav
channels: 1 rate: 44100 bits: 16
unit = 1 vol = 0.50, Playing TXQ Angry Anakin/out/out01.wav
channels: 1 rate: 44100 bits: 16
humstart: 900
unit = 2 vol = 0.00, Playing TXQ Angry Anakin/swingl/swingl01.wav
channels: 1 rate: 44100 bits: 16
unit = 3 vol = 0.00, Playing TXQ Angry Anakin/swingh/swingh01.wav
channels: 1 rate: 44100 bits: 16
unit = 4 vol = 0.50, Playing TXQ Angry Anakin/font/font.wav
channels: 1 rate: 44100 bits: 16
EVENT: TwistLeft ON millis=79235
EVENT MENU TURN LEFT
BLADE ID: 2903.25
blade = 0
WS2811 Blade with 116 leds.
Simple Blade
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
unit = 5 vol = 0.50, Playing TXQ Angry Anakin/in/in01.wav
channels: 1 rate: 44100 bits: 16
Style RAM = 1524
Style RAM = 8
Scanning sound font: boot
 done
Scanning sound font: TXQ Angry Anakin
 done
Scanning sound font: common
 done
Activating polyphonic font.
Activating SmoothSwing V2
Accent Swings Enabled.
Polyphonic swings: 16
Monophonic swings: 0
Accent Slashes Enabled.
Polyphonic slashes: 15
Voice pack version 1 found.
Ignition.
unit = 0 vol = 0.00, Playing TXQ Angry Anakin/hum01.wav
channels: 1 rate: 44100 bits: 16
unit = 1 vol = 0.50, Playing TXQ Angry Anakin/out/out03.wav
channels: 1 rate: 44100 bits: 16
humstart: 900
unit = 2 vol = 0.00, Playing TXQ Angry Anakin/swingl/swingl02.wav
channels: 1 rate: 44100 bits: 16
unit = 3 vol = 0.00, Playing TXQ Angry Anakin/swingh/swingh02.wav
channels: 1 rate: 44100 bits: 16
unit = 4 vol = 0.50, Playing TXQ Angry Anakin/font/font.wav
channels: 1 rate: 44100 bits: 16
BLADE ID: 2873.80
blade = 0
WS2811 Blade with 116 leds.
Simple Blade
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
Turning off 0.00@01
unit = 5 vol = 0.50, Playing TXQ Angry Anakin/in/in02.wav
channels: 1 rate: 44100 bits: 16
Style RAM = 1524
Style RAM = 8
Scanning sound font: boot
 done
Scanning sound font: TXQ Angry Anakin
 done
Scanning sound font: common
 done```

That still makes sense actually.
The continuous scanning is quiet, but happens very often. When it detects a different blade ID, it sets a variable that causes a full “scanid” to happen in the next call to loop().

If you add this:

#define PROFFIEOS_LOG_LEVEL 500

to your config file, then it will print out the ID every time, which may reveal what is happening exactly.

It does look like it’s going up, yeah. I tried raising the scan interval to 1000ms and averages to 25 but it still has the same issue.

Here’s the serial monitor log with just the blade id and blade lines:

BLADE ID: 2886.33
BLADE ID: 2919.94
BLADE ID: 2911.58
BLADE ID: 2907.35
BLADE ID: 2903.12
BLADE ID: 2907.32
BLADE ID: 2890.52
BLADE ID: 2928.39
BLADE ID: 2903.18
BLADE ID: 2911.52
BLADE ID: 2903.15
BLADE ID: 2898.92
BLADE ID: 2894.71
BLADE ID: 2894.73
BLADE ID: 2898.92
BLADE ID: 2898.92
BLADE ID: 2920.01
BLADE ID: 2898.92
BLADE ID: 2907.33
BLADE ID: 2898.92
BLADE ID: 2911.52
BLADE ID: 2894.71
BLADE ID: 2890.59
BLADE ID: 2898.92
BLADE ID: 2898.92
BLADE ID: 2932.60
BLADE ID: 2903.12
BLADE ID: 2898.98
BLADE ID: 2903.18
BLADE ID: 2919.98
BLADE ID: 2907.36
BLADE ID: 2915.75
BLADE ID: 2898.92
BLADE ID: 2907.32
BLADE ID: 2907.47
BLADE ID: 2945.23
BLADE ID: 3004.37
BLADE ID: 3004.33
BLADE ID: 3067.80
BLADE ID: 2983.17
BLADE ID: 3033.90
BLADE ID: 3076.47
BLADE ID: 3174.08
BLADE ID: 2919.99
blade = 0
BLADE ID: 2899.11
BLADE ID: 2941.01
BLADE ID: 2970.73
BLADE ID: 3012.86
BLADE ID: 3068.05
BLADE ID: 3021.28
BLADE ID: 3038.07
BLADE ID: 3114.41
BLADE ID: 3144.16
BLADE ID: 2928.54
blade = 0
BLADE ID: 2886.45
BLADE ID: 2966.29
BLADE ID: 2991.71
BLADE ID: 2995.80
BLADE ID: 3021.16
BLADE ID: 3038.24
BLADE ID: 3131.45
BLADE ID: 2970.58
blade = 0
BLADE ID: 2898.98
BLADE ID: 2928.62
BLADE ID: 3000.20
BLADE ID: 3012.76
BLADE ID: 3105.96
BLADE ID: 3089.16
BLADE ID: 3084.94
BLADE ID: 3169.95
BLADE ID: 2873.87
blade = 0
BLADE ID: 2932.66
BLADE ID: 2932.70
BLADE ID: 2995.99
BLADE ID: 3000.11
BLADE ID: 3072.07
BLADE ID: 3063.60
BLADE ID: 3072.00
BLADE ID: 3084.82
BLADE ID: 3059.31
BLADE ID: 3067.90
BLADE ID: 3161.19
BLADE ID: 2861.21
blade = 0
BLADE ID: 2903.32
BLADE ID: 2970.53
BLADE ID: 3000.15
BLADE ID: 2983.23
BLADE ID: 2957.85
BLADE ID: 3038.11
BLADE ID: 3080.45
BLADE ID: 3131.50
BLADE ID: 2924.39
blade = 0
BLADE ID: 2890.71
BLADE ID: 2928.40
BLADE ID: 2991.70
BLADE ID: 2991.82
BLADE ID: 3067.76
BLADE ID: 2953.77
BLADE ID: 2991.70
BLADE ID: 3152.68
BLADE ID: 2877.98
blade = 0
BLADE ID: 2894.86
BLADE ID: 2970.54
BLADE ID: 3008.59
BLADE ID: 3067.80
BLADE ID: 3017.00
BLADE ID: 3110.16
BLADE ID: 3118.67
BLADE ID: 3139.93
BLADE ID: 2911.62
blade = 0

The problem seems to be that it sometimes measures values that are closer to 3340 than 2915. The cutoff is 3127, so when it measures this:

It’s going to to set the “I need to re-do blade id” variable.
However, when it powers off the blade and measures again it gets this:

Which just re-starts the same blade.

One possible workaround for this is to use the BLADE_ID_STOP_SCAN_WHILE_IGNITED define.
Basically, this is helpful if you really only intend to switch blades when the saber is off.

The BLADE_ID_STOP_SCAN_WHILE_IGNITED define does seem to allow it to ignite, but as soon as you tell it to retract it resets before it can finish in.wav. I think I’ll probably just end up changing the resistor in the other blade. I wonder why it’s not working on 7.15 though, strange.

There has been some changes and fixes to this code in 8.x, but I’m still not sure exactly why it didn’t work with 7.15…

I did end up swapping out the resistor but it didn’t change the ID enough for it to solve the problem (maybe an issue with the pixels in the emitter itself?) but I think that BLADE_ID_STOP_SCAN_WHILE_IGNITED would probably a more elegant solution for this anyway, as I can’t really see a reason why I’d need to swap blades while they’re on. The fact that it samples the blade id while it’s still retracting seems like unintended behaviour, though. Is there a preferred place to report that?

Github:

Actually, it’s already got an issue open:

Opened for a different symptom, but same problem.