I’m having a problem with resuming the motion detection after the saber stays idle for a while and it seems I can’t find a solution.
Basically, I turn off the blade and leave the saber alone.
Other times I’m attending classes and using the saber while the blade is inactive, so it sould detect motion.
After a while in this scenario (probably 15 minutes or so) the only way to activate the blade is to push the button, it does not react to twists.
Pushing the button the blade ignites but the motion detection engine seems to stay off. The saber plays only the hum and not effects occur on the blade even while spinning or hitting something.
I tried to troubleshoot the issue with the serial monitor but it didn’t help.
I can see the motion being disabled after a while, but when I press the button the motion resume just fine, which is not happening when the USB cable is not connected.
Welcome to ProffieOS v6.5. Type 'help' for more info.
TWIST
EVENT: Twist millis=19625
Ignition.
unit = 0 vol = 0.50, Playing Fates/poweron2.wav
channels: 1 rate: 22050 bits: 16
unit = 1 vol = 0.00, Playing Fates/lswing3.wav
channels: 1 rate: 44100 bits: 16
unit = 2 vol = 0.00, Playing Fates/hswing3.wav
channels: 1 rate: 44100 bits: 16
Battery voltage: 3.97
Playing Fates/hum.wav
channels: 1 rate: 22050 bits: 16
unit = 2 vol = 0.00, Playing Fates/lswing3.wav
channels: 1 rate: 44100 bits: 16
unit = 1 vol = 0.00, Playing Fates/hswing3.wav
channels: 1 rate: 44100 bits: 16
unit = 2 vol = 0.00, Playing Fates/lswing5.wav
channels: 1 rate: 44100 bits: 16
unit = 1 vol = 0.00, Playing Fates/hswing5.wav
channels: 1 rate: 44100 bits: 16
TWIST
EVENT: Twist ON millis=22725
unit = 3 vol = 0.50, Playing Fates/poweroff.wav
channels: 1 rate: 22050 bits: 16
No sounds found: pstoff
Amplifier off.
Unmounting SD Card.
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Motion disable.
I2C sleeping..
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
Battery voltage: 4.00
EVENT: Power-Pressed#1 millis=1076825
EVENT: Power-Pressed millis=1076825
Motion setup ... I2C init..
done.
EVENT: Swing mods Power millis=1076841
EVENT: Power-Released#1 millis=1077051
EVENT: Power-Released millis=1077051
EVENT: Power-Shortclick#1 millis=1077051
EVENT: Power-Shortclick millis=1077051
EVENT: Power-SavedShortclick#1 millis=1077126
Ignition.
unit = 0 vol = 0.50, Playing Fates/poweron4.wav
channels: 1 rate: 22050 bits: 16
unit = 2 vol = 0.00, Playing Fates/lswing3.wav
channels: 1 rate: 44100 bits: 16
unit = 1 vol = 0.00, Playing Fates/hswing3.wav
channels: 1 rate: 44100 bits: 16
TWIST
EVENT: Twist ON millis=1078188
unit = 3 vol = 0.50, Playing Fates/pwroff2.wav
channels: 1 rate: 22050 bits: 16
No sounds found: pstoff
Amplifier off.
Battery voltage: 4.00
Unmounting SD Card.
TWIST
EVENT: Twist millis=1080451
Ignition.
unit = 0 vol = 0.50, Playing Fates/poweron2.wav
channels: 1 rate: 22050 bits: 16
unit = 1 vol = 0.00, Playing Fates/lswing4.wav
channels: 1 rate: 44100 bits: 16
unit = 2 vol = 0.00, Playing Fates/hswing4.wav
channels: 1 rate: 44100 bits: 16
unit = 1 vol = 0.00, Playing Fates/lswing5.wav
channels: 1 rate: 44100 bits: 16
unit = 2 vol = 0.00, Playing Fates/hswing5.wav
channels: 1 rate: 44100 bits: 16
Playing Fates/hum.wav
channels: 1 rate: 22050 bits: 16
TWIST
EVENT: Twist ON millis=1081985
unit = 3 vol = 0.50, Playing Fates/pwroff2.wav
channels: 1 rate: 22050 bits: 16
No sounds found: pstoff
Amplifier off.
Unmounting SD Card.
Battery voltage: 4.00
I really don’t understand if I’m facing a real bug or if I have something nasty in my config. The board is a Proffie V1.
// Fencer
#ifdef CONFIG_TOP
#include "proffieboard_config.h"
//#define IDLE_OFF_TIME 120 * 60 * 1000 // min * 60 sec * millis
#define NUM_BLADES 2
#define NUM_BUTTONS 1
#define VOLUME 100
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 2.7
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#define SAVE_PRESET
#define DISABLE_DIAGNOSTIC_COMMANDS
#define DISABLE_BASIC_PARSER_STYLES // required for memory saving and using built-in styles for ProffieOS Workbench
#define DISABLE_DIAGNOSTIC_COMMANDS // recommended for additional memory saving, will disable most Serial Monitor commands.
#define FETT263_TWIST_ON
#define FETT263_TWIST_ON_NO_BM
#define FETT263_TWIST_OFF
#endif
#ifdef CONFIG_PROP
#include "../props/saber_fett263_buttons.h"
#endif
#ifdef CONFIG_PRESETS
Preset presets[] = {
{ "Fates;common", "tracks/mars.wav", //DeepSkyBlue
StylePtr<InOutHelper<EasyBlade<AudioFlicker<RandomFlicker<DeepSkyBlue,Rgb16<0,10724,42307>>,Rgb16<635,20393,65535>>,Rgb16<35025,49761,65535>,Rgb16<35025,49761,65535>>,300,800>>(),
StylePtr<InOutHelper<AudioFlicker<Red,Black>,400,800,Pulsing<Red,Black,5000>>>(), "Fates"},
{ "Shatter;common", "tracks/mars.wav", //DeepPurple
StylePtr<InOutHelper<EasyBlade<AudioFlicker<RandomFlicker<Rgb16<30324,0,49768>,Rgb16<7994,78,13896>>,Rgb16<12482,128,21919>>,Rgb16<45487,14885,59477>,Rgb16<45487,14885,59477>>,300,800>>(),
StylePtr<InOutHelper<AudioFlicker<Red,Black>,400,800,Pulsing<Red,Black,5000>>>(), "Shatter"},
{ "Revenge;common", "tracks/mars.wav", //Red
StylePtr<InOutHelper<EasyBlade<AudioFlicker<RandomFlicker<Red,Rgb16<37981,0,0>>,Rgb16<65535,431,431>>,Rgb16<65535,33124,33124>,Rgb16<65535,33124,33124>>,300,800>>(),
StylePtr<InOutHelper<AudioFlicker<Red,Black>,400,800,Pulsing<Red,Black,5000>>>(), "Revenge"},
{ "Bespin;common", "tracks/mars.wav", //Cyan Rgb<0,255,80>
StylePtr<InOutHelper<EasyBlade<AudioFlicker<RandomFlicker<Rgb<0,255,80>,Rgb16<0,45025,3813>>,Rgb16<269,65535,7994>>,Rgb16<45951,65535,65535>,Rgb16<45951,65535,65535>>,300,800>>(),
StylePtr<InOutHelper<AudioFlicker<Red,Black>,400,800,Pulsing<Red,Black,5000>>>(), "Bespin"},
{ "Corell;common", "tracks/mars.wav", //DarkOrange
StylePtr<InOutHelper<EasyBlade<AudioFlicker<RandomFlicker<DarkOrange,Rgb16<22863,1113,0>>,Orange>,NavajoWhite,NavajoWhite>,300,800>>(),
StylePtr<InOutHelper<AudioFlicker<Red,Black>,400,800,Pulsing<Red,Black,5000>>>(), "Corellia"},
{ "SmthJedi;common", "tracks/mars.wav", //Green
StylePtr<InOutHelper<EasyBlade<AudioFlicker<RandomFlicker<Green,Rgb16<0,30086,0>>,Rgb16<169,65535,169>>,Rgb16<28108,65535,28108>,Rgb16<28108,65535,28108>>,300,800>>(),
StylePtr<InOutHelper<AudioFlicker<Red,Black>,400,800,Pulsing<Red,Black,5000>>>(), "Smooth Jedi"},
{ "RgueCmdr;common", "tracks/mars.wav", //Gold
StylePtr<InOutHelper<EasyBlade<AudioFlicker<RandomFlicker<Rgb16<46260,33410,0>,Rgb16<36260,23410,0>>,Rgb16<46260,33410,0>>,Rgb16<65535,48313,28252>,Rgb16<65535,48313,28252>>,300,800>>(),
StylePtr<InOutHelper<AudioFlicker<Red,Black>,400,800,Pulsing<Red,Black,5000>>>(), "Rougue Comm"},
{ "Spitfire;common", "tracks/mars.wav", //Chartreuse
StylePtr<InOutHelper<EasyBlade<AudioFlicker<RandomFlicker<Chartreuse,Rgb16<1373,36732,0>>,Rgb16<4838,65535,431>>,Rgb16<35307,65535,20732>,Rgb16<35307,65535,20732>>,300,800>>(),
StylePtr<InOutHelper<AudioFlicker<Red,Black>,400,800,Pulsing<Red,Black,5000>>>(), "Spitfire"}
};
struct AVRedLED {
static constexpr float MaxAmps = 0.02;
static constexpr float MaxVolts = 2.0;
static constexpr float P2Amps = 0.01;
static constexpr float P2Volts = 1.8;
static constexpr float R = 150.0; // Resistor value
static const int Red = 255;
static const int Green = 0;
static const int Blue = 0;
};
BladeConfig blades[] = {
{ 0,
SimpleBladePtr<CreeXPE2RedTemplate<1200>, CreeXPE2GreenTemplate<510>, CreeXPE2BlueTemplate<510>, CreeXPE2WhiteTemplate<510>, bladePowerPin1, bladePowerPin2, bladePowerPin3, bladePowerPin4>(),
SimpleBladePtr<AVRedLED, NoLED, NoLED, NoLED, bladePowerPin6, -1, -1, -1>(),
CONFIGARRAY(presets) },
};
#endif
#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
#endif