Motion doesn't resume after standby?

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

So, if you wait 15 minutes, then turn it on, motion works right? Like clashes and stuff?
But then when you turn it off, gestures are not working?
If you plug it in in to USB in this state, does it start working?
If not, we can try some diagnostic commands, like “whatison” to try to figure out what is going on.

When the issue is present, I can turn the blade on with the button but there are no clashes, swings or twists at all.
I can turn on ond off the blade how many time I please, but still there are no clashes, swings or twists.
At this point if I power cycle the saber everything starts working fine again.

Following your suggestion I did some additional tests to try and better understand what is going on. I also realized I had DISABLE_DIAGNOSTIC_COMMANDS declared twice in my config, just fixed it.

First test

I connected the saber to the serial monitor and left it alone.
It took roughly 15 minutes for the motion to go offline, you can see it at 11:09:19.997.
At this point I turned the blade on with the button and motion was restored (11:11:10.330).
I was able to turn off and on the blade with twists as aspected.

10:55:21.279 -> EVENT: Clash millis=132661
10:55:28.611 -> Battery voltage: 3.90
10:55:48.636 -> Battery voltage: 3.90
10:56:08.627 -> Battery voltage: 3.90
10:56:28.621 -> Battery voltage: 3.90
10:56:48.611 -> Battery voltage: 3.90
10:57:08.639 -> Battery voltage: 3.90
10:57:28.628 -> Battery voltage: 3.90
10:57:48.635 -> Battery voltage: 3.90
10:58:08.626 -> Battery voltage: 3.90
10:58:28.626 -> Battery voltage: 3.90
10:58:48.639 -> Battery voltage: 3.90
10:59:08.635 -> Battery voltage: 3.90
10:59:28.631 -> Battery voltage: 3.90
10:59:48.641 -> Battery voltage: 3.90
11:00:08.637 -> Battery voltage: 3.90
11:00:28.642 -> Battery voltage: 3.90
11:00:48.633 -> Battery voltage: 3.90
11:01:08.644 -> Battery voltage: 3.90
11:01:28.642 -> Battery voltage: 3.90
11:01:48.622 -> Battery voltage: 3.90
11:02:08.642 -> Battery voltage: 3.90
11:02:28.639 -> Battery voltage: 3.90
11:02:48.638 -> Battery voltage: 3.90
11:03:08.635 -> Battery voltage: 3.90
11:03:28.627 -> Battery voltage: 3.90
11:03:48.619 -> Battery voltage: 3.90
11:04:08.639 -> Battery voltage: 3.90
11:04:28.638 -> Battery voltage: 3.90
11:04:48.625 -> Battery voltage: 3.90
11:05:08.636 -> Battery voltage: 3.90
11:05:28.639 -> Battery voltage: 3.91
11:05:48.638 -> Battery voltage: 3.90
11:06:08.621 -> Battery voltage: 3.90
11:06:28.649 -> Battery voltage: 3.90
11:06:48.630 -> Battery voltage: 3.90
11:07:08.637 -> Battery voltage: 3.90
11:07:28.644 -> Battery voltage: 3.90
11:07:48.636 -> Battery voltage: 3.90
11:08:08.629 -> Battery voltage: 3.90
11:08:28.638 -> Battery voltage: 3.90
11:08:48.634 -> Battery voltage: 3.90
11:09:08.634 -> Battery voltage: 3.90
11:09:19.997 -> Motion disable.
11:09:21.975 -> I2C sleeping..
11:09:28.628 -> Battery voltage: 3.90
11:09:48.629 -> Battery voltage: 3.90
11:10:08.640 -> Battery voltage: 3.90
11:10:28.634 -> Battery voltage: 3.90
11:10:48.632 -> Battery voltage: 3.90
11:10:57.856 -> Saber bases: On
11:10:57.856 -> Beeper: Off
11:10:57.856 -> Talker: Off
11:10:57.856 -> Wav player 0: Off (eof =  1 volume = 0.00 refs = 0 fade speed = 0.00 filename=Fates/hum.wav)
11:10:57.856 -> Wav player 1: Off (eof =  1 volume = 0.00 refs = 1 fade speed = 0.00 filename=Fates/hswing1.wav)
11:10:57.856 -> Wav player 2: Off (eof =  1 volume = 0.00 refs = 1 fade speed = 0.00 filename=Fates/lswing1.wav)
11:10:57.856 -> Wav player 3: Off (eof =  1 volume = 0.47 refs = 1 fade speed = 0.00 filename=Fates/poweroff.wav)
11:10:57.856 -> Wav player 4: Off (eof =  1 volume = 0.50 refs = 0 fade speed = 0.00 filename=)
11:10:57.856 -> Wav player 5: Off (eof =  1 volume = 0.50 refs = 0 fade speed = 0.00 filename=)
11:10:57.856 -> Wav player 6: Off (eof =  1 volume = 0.50 refs = 0 fade speed = 0.00 filename=)
11:11:08.656 -> Battery voltage: 3.90
11:11:10.330 -> EVENT: Power-Pressed#1 millis=1081735
11:11:10.330 -> EVENT: Power-Pressed millis=1081735
11:11:10.330 -> Motion setup ... I2C init..
11:11:10.330 -> done.
11:11:10.330 -> EVENT: Swing mods Power millis=1081751
11:11:10.602 -> EVENT: Power-Released#1 millis=1082006
11:11:10.602 -> EVENT: Power-Released millis=1082006
11:11:10.602 -> EVENT: Power-Shortclick#1 millis=1082006
11:11:10.602 -> EVENT: Power-Shortclick millis=1082006
11:11:10.636 -> EVENT: Power-SavedShortclick#1 millis=1082036
11:11:10.636 -> Ignition.
11:11:10.636 -> unit = 0 vol = 0.50, Playing Fates/poweron4.wav
11:11:10.636 -> channels: 1 rate: 22050 bits: 16
11:11:10.670 -> unit = 1 vol = 0.00, Playing Fates/lswing1.wav
11:11:10.670 -> channels: 1 rate: 44100 bits: 16
11:11:10.670 -> unit = 2 vol = 0.00, Playing Fates/hswing1.wav
11:11:10.670 -> channels: 1 rate: 44100 bits: 16
11:11:11.557 -> Playing Fates/hswing1.wav
11:11:11.557 -> channels: 1 rate: 44100 bits: 16
11:11:12.137 -> Playing Fates/hum.wav
11:11:12.137 -> channels: 1 rate: 22050 bits: 16
11:11:14.353 -> unit = 2 vol = 0.00, Playing Fates/lswing1.wav
11:11:14.353 -> channels: 1 rate: 44100 bits: 16
11:11:14.353 -> unit = 1 vol = 0.00, Playing Fates/hswing1.wav
11:11:14.353 -> channels: 1 rate: 44100 bits: 16
11:11:14.353 -> TWIST
11:11:14.353 -> EVENT: Twist ON millis=1085771
11:11:14.353 -> unit = 3 vol = 0.50, Playing Fates/pwroff2.wav
11:11:14.353 -> channels: 1 rate: 22050 bits: 16
11:11:15.309 -> No sounds found: pstoff
11:11:15.343 -> Amplifier off.
11:11:16.161 -> TWIST
11:11:16.161 -> EVENT: Twist millis=1087562
11:11:16.161 -> Ignition.
11:11:16.161 -> unit = 0 vol = 0.50, Playing Fates/poweron4.wav
11:11:16.161 -> channels: 1 rate: 22050 bits: 16
11:11:16.161 -> unit = 2 vol = 0.00, Playing Fates/lswing5.wav
11:11:16.161 -> channels: 1 rate: 44100 bits: 16
11:11:16.161 -> unit = 1 vol = 0.00, Playing Fates/hswing5.wav
11:11:16.161 -> channels: 1 rate: 44100 bits: 16
11:11:17.659 -> Playing Fates/hum.wav
11:11:17.659 -> channels: 1 rate: 22050 bits: 16
11:11:19.468 -> Playing Fates/hswing5.wav
11:11:19.468 -> channels: 1 rate: 44100 bits: 16
11:11:20.115 -> Playing Fates/lswing5.wav
11:11:20.115 -> channels: 1 rate: 44100 bits: 16
11:11:24.244 -> Saber bases: On
11:11:24.244 -> Beeper: Off
11:11:24.244 -> Talker: Off
11:11:24.244 -> Wav player 0: On (eof =  0 volume = 0.47 refs = 1 fade speed = 0.00 filename=Fates/hum.wav)
11:11:24.244 -> Wav player 1: On (eof =  0 volume = 0.00 refs = 1 fade speed = 0.00 filename=Fates/hswing5.wav)
11:11:24.244 -> Wav player 2: On (eof =  0 volume = 0.00 refs = 1 fade speed = 0.00 filename=Fates/lswing5.wav)
11:11:24.244 -> Wav player 3: Off (eof =  1 volume = 0.47 refs = 0 fade speed = 0.00 filename=Fates/pwroff2.wav)
11:11:24.244 -> Wav player 4: Off (eof =  1 volume = 0.50 refs = 0 fade speed = 0.00 filename=)
11:11:24.244 -> Wav player 5: Off (eof =  1 volume = 0.50 refs = 0 fade speed = 0.00 filename=)
11:11:24.244 -> Wav player 6: Off (eof =  1 volume = 0.50 refs = 0 fade speed = 0.00 filename=)
11:11:24.622 -> Playing Fates/lswing5.wav
11:11:24.622 -> channels: 1 rate: 44100 bits: 16
11:11:27.288 -> Playing Fates/hswing5.wav
11:11:27.288 -> channels: 1 rate: 44100 bits: 16
11:11:28.075 -> unit = 2 vol = 0.00, Playing Fates/lswing2.wav
11:11:28.075 -> channels: 1 rate: 44100 bits: 16
11:11:28.075 -> unit = 1 vol = 0.00, Playing Fates/hswing2.wav
11:11:28.075 -> channels: 1 rate: 44100 bits: 16
11:11:28.659 -> Battery voltage: 3.79
11:11:30.743 -> unit = 1 vol = 0.00, Playing Fates/lswing5.wav
11:11:30.743 -> channels: 1 rate: 44100 bits: 16
11:11:30.778 -> unit = 2 vol = 0.00, Playing Fates/hswing5.wav
11:11:30.778 -> channels: 1 rate: 44100 bits: 16
11:11:30.949 -> TWIST
11:11:30.949 -> EVENT: Twist ON millis=1102373
11:11:30.949 -> unit = 3 vol = 0.50, Playing Fates/pwroff2.wav
11:11:30.949 -> channels: 1 rate: 22050 bits: 16
11:11:31.904 -> No sounds found: pstoff
11:11:31.938 -> Amplifier off.
11:11:32.926 -> Unmounting SD Card.

Second test

I disconnected from the USB cable, power cycled and left the saber alone.
After 15 minutes I plugged in the USB cable and pressed the button.
As you can see, also in this case the motion was restored (11:32:56.300).

11:32:48.665 -> Battery voltage: 3.90
11:32:52.908 -> Saber bases: On
11:32:52.908 -> Beeper: Off
11:32:52.908 -> Talker: Off
11:32:52.908 -> Wav player 0: Off (eof =  1 volume = 0.00 refs = 0 fade speed = 0.00 filename=Fates/hum.wav)
11:32:52.908 -> Wav player 1: Off (eof =  1 volume = 0.00 refs = 1 fade speed = 0.00 filename=Fates/hswing2.wav)
11:32:52.908 -> Wav player 2: Off (eof =  1 volume = 0.00 refs = 1 fade speed = 0.00 filename=Fates/lswing2.wav)
11:32:52.908 -> Wav player 3: Off (eof =  1 volume = 0.47 refs = 1 fade speed = 0.00 filename=Fates/pwroff2.wav)
11:32:52.908 -> Wav player 4: Off (eof =  1 volume = 0.50 refs = 0 fade speed = 0.00 filename=)
11:32:52.908 -> Wav player 5: Off (eof =  1 volume = 0.50 refs = 0 fade speed = 0.00 filename=)
11:32:52.908 -> Wav player 6: Off (eof =  1 volume = 0.50 refs = 0 fade speed = 0.00 filename=)
11:32:56.300 -> EVENT: Power-Pressed#1 millis=2387738
11:32:56.300 -> EVENT: Power-Pressed millis=2387738
11:32:56.300 -> Motion setup ... I2C init..
11:32:56.300 -> done.
11:32:56.300 -> EVENT: Swing mods Power millis=2387754
11:32:56.506 -> EVENT: Power-Released#1 millis=2387953
11:32:56.506 -> EVENT: Power-Released millis=2387954
11:32:56.506 -> EVENT: Power-Shortclick#1 millis=2387954
11:32:56.506 -> EVENT: Power-Shortclick millis=2387954
11:32:56.610 -> EVENT: Power-SavedShortclick#1 millis=2388039
11:32:56.610 -> Ignition.
11:32:56.610 -> unit = 0 vol = 0.50, Playing Fates/poweron.wav
11:32:56.610 -> channels: 1 rate: 22050 bits: 16
11:32:56.644 -> unit = 1 vol = 0.00, Playing Fates/lswing2.wav
11:32:56.644 -> channels: 1 rate: 44100 bits: 16
11:32:56.644 -> unit = 2 vol = 0.00, Playing Fates/hswing2.wav
11:32:56.644 -> channels: 1 rate: 44100 bits: 16
11:32:58.111 -> Playing Fates/hum.wav
11:32:58.111 -> channels: 1 rate: 22050 bits: 16
11:32:59.712 -> unit = 2 vol = 0.00, Playing Fates/lswing3.wav
11:32:59.712 -> channels: 1 rate: 44100 bits: 16
11:32:59.712 -> unit = 1 vol = 0.00, Playing Fates/hswing3.wav
11:32:59.712 -> channels: 1 rate: 44100 bits: 16
11:32:59.916 -> TWIST
11:32:59.916 -> EVENT: Twist ON millis=2391366
11:32:59.916 -> unit = 3 vol = 0.50, Playing Fates/poweroff.wav
11:32:59.951 -> channels: 1 rate: 22050 bits: 16
11:33:00.939 -> No sounds found: pstoff
11:33:00.973 -> Amplifier off.
11:33:01.968 -> Unmounting SD Card.
11:33:08.674 -> Battery voltage: 3.90
11:33:22.514 -> Whut? :monitor
11:33:28.668 -> Battery voltage: 3.90

Third test

I power cycled and left the saber alone, disconnected from the USB.
After 15 minutes I pressed the button to turn the blade on and verified that there were no clashes, swings or twists.
Then I plugged the USB cable, tried some commands (monitor seems to do nothing) and verified that clashes, swings and twists were still missing.
So, I pressed the button to turn the blade off and then pressed it once more to turn it on again.
As you can see when turning on the motion setup did not occur.

12:06:45.519 -> Playing Fates/hswing5.wav
12:06:45.519 -> channels: 1 rate: 44100 bits: 16
12:06:46.135 -> Playing Fates/lswing5.wav
12:06:46.135 -> channels: 1 rate: 44100 bits: 16
12:06:50.669 -> Playing Fates/lswing5.wav
12:06:50.669 -> channels: 1 rate: 44100 bits: 16
12:06:52.442 -> Battery voltage: 3.76
12:06:52.889 -> Playing Fates/hum.wav
12:06:52.889 -> channels: 1 rate: 22050 bits: 16
12:06:53.370 -> Playing Fates/hswing5.wav
12:06:53.370 -> channels: 1 rate: 44100 bits: 16
12:06:54.739 -> Saber bases: On
12:06:54.739 -> Beeper: Off
12:06:54.739 -> Talker: Off
12:06:54.739 -> Wav player 0: Off (eof =  1 volume = 0.47 refs = 0 fade speed = 0.00 filename=Fates/pwroff2.wav)
12:06:54.739 -> Wav player 1: On (eof =  0 volume = 0.00 refs = 1 fade speed = 0.00 filename=Fates/hswing5.wav)
12:06:54.739 -> Wav player 2: On (eof =  0 volume = 0.00 refs = 1 fade speed = 0.00 filename=Fates/lswing5.wav)
12:06:54.739 -> Wav player 3: On (eof =  0 volume = 0.50 refs = 1 fade speed = 0.00 filename=Fates/hum.wav)
12:06:54.739 -> Wav player 4: Off (eof =  1 volume = 0.50 refs = 0 fade speed = 0.00 filename=)
12:06:54.739 -> Wav player 5: Off (eof =  1 volume = 0.50 refs = 0 fade speed = 0.00 filename=)
12:06:54.739 -> Wav player 6: Off (eof =  1 volume = 0.50 refs = 0 fade speed = 0.00 filename=)
12:06:55.217 -> Playing Fates/lswing5.wav
12:06:55.217 -> channels: 1 rate: 44100 bits: 16
12:06:59.723 -> Playing Fates/lswing5.wav
12:06:59.723 -> channels: 1 rate: 44100 bits: 16
12:07:01.234 -> Playing Fates/hswing5.wav
12:07:01.234 -> channels: 1 rate: 44100 bits: 16
12:07:04.278 -> Playing Fates/lswing5.wav
12:07:04.278 -> channels: 1 rate: 44100 bits: 16
12:07:08.783 -> Playing Fates/lswing5.wav
12:07:08.783 -> channels: 1 rate: 44100 bits: 16
12:07:09.089 -> Playing Fates/hswing5.wav
12:07:09.089 -> channels: 1 rate: 44100 bits: 16
12:07:11.350 -> Playing Fates/hum.wav
12:07:11.350 -> channels: 1 rate: 22050 bits: 16
12:07:12.439 -> Battery voltage: 3.75
12:07:13.327 -> Playing Fates/lswing5.wav
12:07:13.327 -> channels: 1 rate: 44100 bits: 16
12:07:13.700 -> Whut? :monitor
12:07:16.198 -> Whut? :mon
12:07:16.914 -> Playing Fates/hswing5.wav
12:07:16.914 -> channels: 1 rate: 44100 bits: 16
12:07:17.871 -> Playing Fates/lswing5.wav
12:07:17.871 -> channels: 1 rate: 44100 bits: 16
12:07:21.858 -> EVENT: Power-Pressed#1 ON millis=1009487
12:07:21.858 -> EVENT: Power-Pressed ON millis=1009487
12:07:22.164 -> EVENT: Power-Held#1 ON millis=1009788
12:07:22.164 -> EVENT: Power-Held ON millis=1009788
12:07:22.371 -> Playing Fates/lswing5.wav
12:07:22.371 -> channels: 1 rate: 44100 bits: 16
12:07:22.882 -> EVENT: Power-HeldMedium#1 ON millis=1010489
12:07:22.882 -> EVENT: Power-HeldMedium ON millis=1010489
12:07:23.872 -> EVENT: Power-HeldLong#1 ON millis=1011488
12:07:23.872 -> unit = 0 vol = 0.50, Playing Fates/poweroff.wav
12:07:23.872 -> channels: 1 rate: 22050 bits: 16
12:07:24.178 -> EVENT: Power-Released#1 millis=1011789
12:07:24.178 -> EVENT: Power-Released millis=1011789
12:07:24.893 -> No sounds found: pstoff
12:07:24.927 -> Amplifier off.
12:07:25.919 -> Unmounting SD Card.
12:07:32.445 -> Battery voltage: 3.85
12:07:37.053 -> EVENT: Power-Pressed#1 millis=1024677
12:07:37.053 -> EVENT: Power-Pressed millis=1024677
12:07:37.292 -> EVENT: Power-Released#1 millis=1024916
12:07:37.292 -> EVENT: Power-Released millis=1024916
12:07:37.292 -> EVENT: Power-Shortclick#1 millis=1024916
12:07:37.292 -> EVENT: Power-Shortclick millis=1024917
12:07:37.360 -> EVENT: Power-SavedShortclick#1 millis=1024978
12:07:37.360 -> Ignition.
12:07:37.394 -> unit = 3 vol = 0.50, Playing Fates/poweron4.wav
12:07:37.394 -> channels: 1 rate: 22050 bits: 16
12:07:37.394 -> unit = 1 vol = 0.00, Playing Fates/lswing3.wav
12:07:37.394 -> channels: 1 rate: 44100 bits: 16
12:07:37.394 -> unit = 2 vol = 0.00, Playing Fates/hswing3.wav
12:07:37.394 -> channels: 1 rate: 44100 bits: 16
12:07:38.862 -> Playing Fates/hum.wav
12:07:38.862 -> channels: 1 rate: 22050 bits: 16
12:07:40.472 -> Playing Fates/lswing3.wav
12:07:40.472 -> channels: 1 rate: 44100 bits: 16
12:07:48.161 -> Playing Fates/lswing3.wav
12:07:48.161 -> channels: 1 rate: 44100 bits: 16
12:07:49.079 -> EVENT: Power-Pressed#1 ON millis=1036709
12:07:49.079 -> EVENT: Power-Pressed ON millis=1036709
12:07:49.389 -> EVENT: Power-Held#1 ON millis=1037010
12:07:49.389 -> EVENT: Power-Held ON millis=1037010
12:07:50.072 -> EVENT: Power-HeldMedium#1 ON millis=1037710
12:07:50.072 -> EVENT: Power-HeldMedium ON millis=1037710
12:07:51.091 -> EVENT: Power-HeldLong#1 ON millis=1038711
12:07:51.091 -> unit = 0 vol = 0.50, Playing Fates/poweroff.wav
12:07:51.091 -> channels: 1 rate: 22050 bits: 16
12:07:51.398 -> EVENT: Power-Released#1 millis=1039013
12:07:51.398 -> EVENT: Power-Released millis=1039013
12:07:52.116 -> No sounds found: pstoff
12:07:52.150 -> Amplifier off.
12:07:52.422 -> Battery voltage: 3.83
12:07:53.138 -> Unmounting SD Card.

Do you have any other suggestion to proceed with the troubleshooting?

I think the i2cstate command is going to give the most information. However, you need to add the ENABLE_DEVELOPER_COMMANDS define to your config file to use that command. So:

  1. add ENABLE_DEVELOPER_COMMANDS
  2. make sure that the i2cstate command works.
  3. redo test 3 and run i2cstate.

I did enable developer commands and repeated Test 3, same method as before.
This is the log taken after connecting the USB with blade on and no motion:

16:39:18.597 -> Playing Fates/hswing1.wav
16:39:18.597 -> channels: 1 rate: 44100 bits: 16
16:39:19.146 -> I2CBUS: last_request = 1149140 (now = 1149140) i2c_detected_ = 1 used = 1
16:39:19.146 -> I2C STATE: 8
16:39:19.146 -> current: 536881528 id= 106 next= 0
16:39:19.146 -> LSM6DS3H: last_event_ 819292 LINE: 194
16:39:19.146 -> last: 536881528 id= 106 next= 0
16:39:19.146 -> LSM6DS3H: last_event_ 819292 LINE: 194
16:39:19.146 -> Motion requested: 1 (millis() - last_motion_request=29191)
16:39:19.963 -> Playing Fates/lswing1.wav
16:39:19.963 -> channels: 1 rate: 44100 bits: 16
16:39:22.706 -> Playing Fates/hswing1.wav
16:39:22.706 -> channels: 1 rate: 44100 bits: 16
16:39:24.244 -> Playing Fates/lswing1.wav
16:39:24.244 -> channels: 1 rate: 44100 bits: 16
16:39:24.892 -> EVENT: Power-Pressed#1 ON millis=1154877
16:39:24.892 -> EVENT: Power-Pressed ON millis=1154877
16:39:25.199 -> EVENT: Power-Held#1 ON millis=1155178
16:39:25.199 -> EVENT: Power-Held ON millis=1155178
16:39:25.879 -> EVENT: Power-HeldMedium#1 ON millis=1155878
16:39:25.879 -> EVENT: Power-HeldMedium ON millis=1155878
16:39:26.801 -> Playing Fates/hswing1.wav
16:39:26.801 -> channels: 1 rate: 44100 bits: 16
16:39:26.869 -> EVENT: Power-HeldLong#1 ON millis=1156878
16:39:26.869 -> unit = 4 vol = 0.50, Playing Fates/pwroff2.wav
16:39:26.902 -> channels: 1 rate: 22050 bits: 16
16:39:27.585 -> EVENT: Power-Released#1 millis=1157582
16:39:27.585 -> EVENT: Power-Released millis=1157582
16:39:27.860 -> No sounds found: pstoff
16:39:27.894 -> Amplifier off.
16:39:28.856 -> Unmounting SD Card.

This is definitely a bug, it might take me a little time to figure out what’s going on though. I will let you know if I need any more information. What you have provided so far has been very helpful though.

So, I’ve been thinking about this bug today, read some code, but I’m still not sure what causes it. I’m going to write down what I’ve found, but it’s probably a bit esoteric, feel free to ignore it if it doesn’t make any sense. It’s just me thinking “out loud”…

From the output of “i2cstate”, it would appear that ProffieOS started an i2c transaction, but never got a callback. This should normally never happen, as an i2c transaction should always succeed or fail, and both of those conditions should cause a callback.

There are two things that indicate that this is what is happening:

  1. the I2C state is 8, which means I2C_STATE_MASTER_TRANSMIT
  2. I2CBUS->current points to the LSM6DSH3 class, which would be the case while we’re waiting for the i2c transaction to finish.

One more clue: This seems to happen only when USB is NOT connected. One of the few things that is different when USB is/is not connection is the clock settings for the chip. When USB is not connected, the code clocks the chip all the way down to 1Mhz. When connected to USB, we the clock needs to stay at 16Mhz or higher, or USB won’t work properly.

Now, the I2C harware is clocked by something called the HSI16 clock, which I think is independent from the clocks(s) reconfigured to save power, so I’m not sure how this actually happens. Maybe the CPU can’t keep up when it’s running at 1Mhz? Maybe there is a problem when transitioning between frequencies?

Anyways, this is what I’ve found so far.
If I can’t figure out how this happens, I’ll just have to work around it by manually resetting the transaction if it takes too long, but it would be nicer to actually fix it properly…

Well, it may make sense.
I’ve also read the other thread, looks similar.
Later today I will try to load OS 6.5 on my wife’s saber, which is equipped with a Proffie v.2 with a very similar build (1 button, three-Cree LED, no accent LED).
So far I spared it waiting to solve the problem, but perhaps it is a good idea to verify what happens.

I tried several times, but it seems I cannot replicate the issue with the Proffie v.2.
At this point there are high chances that the problem is related to Proffie v.1 only.

For reference this is the config file for the v.2 saber.

// Marghi Apprentice

#ifdef CONFIG_TOP
#include "proffieboard_config.h"

//#define IDLE_OFF_TIME 120 * 60 * 1000 // min * 60 sec * millis
#define NUM_BLADES 1
#define NUM_BUTTONS 1
#define VOLUME 900
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_BASIC_PARSER_STYLES // required for memory saving and using built-in styles for ProffieOS Workbench
#define FETT263_TWIST_ON
#define FETT263_TWIST_ON_NO_BM
#define FETT263_TWIST_OFF
//#define DISABLE_DIAGNOSTIC_COMMANDS
#define ENABLE_DEVELOPER_COMMANDS
#endif

#ifdef CONFIG_PROP
#include "../props/saber_fett263_buttons.h"
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
	{ "Bespin;common", "tracks/venus.wav", //SpringGreen
		StylePtr<InOutHelper<EasyBlade<AudioFlicker<SpringGreen,Rgb16<0,40982,1587>>,MintCream,MintCream>,300,800>>(), "Bespin"},

	{ "Fates;common", "tracks/venus.wav", //Aqua
		StylePtr<InOutHelper<EasyBlade<AudioFlicker<Aqua,Rgb16<0,44108,44108>>,MintCream,MintCream>,300,800>>(), "Fates"},

 	{ "Shatter;common", "tracks/mars.wav", //corallo Rgb<75,39,14>
		StylePtr<InOutHelper<EasyBlade<AudioFlicker<Rgb<75,39,14>,Rgb16<5401,1305,148>>,MintCream,MintCream>,300,800>>(), "Shatter"},

	{ "RgueCmdr;common", "tracks/uranus.wav", //red
		StylePtr<InOutHelper<EasyBlade<AudioFlicker<Red,Rgb16<25487,0,0>>,MintCream,MintCream>,300,800>>(), "RgueCmdr"},

	{ "SmthJedi;common", "tracks/mars.wav", //verdinoghita Rgb<11,192,53>
		StylePtr<InOutHelper<EasyBlade<AudioFlicker<Rgb<11,192,53>,Rgb16<78,25151,1514>>,MintCream,MintCream>,300,800>>(), "SmthJedi"},

	{ "Corell;common", "tracks/uranus.wav", //DodgerBlue
		StylePtr<InOutHelper<EasyBlade<AudioFlicker<DodgerBlue,Rgb16<0,2716,45951>>,MintCream,MintCream>,300,800>>(), "Corell"}
};

BladeConfig blades[] = {
 { 0, SimpleBladePtr<CreeXPE2RedTemplate<2000>, CreeXPE2GreenTemplate<220>, CreeXPE2BlueTemplate<220>, NoLED, bladePowerPin1, bladePowerPin2, bladePowerPin3, -1>(), CONFIGARRAY(presets) },
};
#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
#endif

Well that’s weird.
I can’t think of a reason why that would be, but I will poke around a bit and see if I can find one.

While we wait for a fix, there is any way to try and disable the function that brings down motion after 15 minutes?
Alternatively I could try and increase the timeout, if feasible.
I don’t mind having to charge the saber more often, but disabling it would help me a lot.

You can try:

#define MOTION_TIMEOUT 48 * 60 * 60 * 1000

This makes the timeout two days.
Note that it will increase the battery draw in standby mode.

So, I’ve looked at the v1/v2 motion chip setup, and there is no difference, so either this is a coincidence, or it’s caused by something else, like maybe some electrical differences.

I’m going to have a look at resetting the transaction now…

I did some more testing and had some luck enabling FETT263_MOTION_WAKE_POWER_BUTTON.

With this define enabled, when the motion is disabled I can wake it up and gesture detection resumes.

However, looks like FETT263_MOTION_WAKE_POWER_BUTTON has a small bug of his own. When the feature kicks in, after playing font.wav the saber starts playing the hum, but it can easily be cleared by turning the blade on and off.

20:49:11.164 -> Welcome to ProffieOS v6.5. Type 'help' for more info.
20:49:12.308 -> Battery voltage: 3.74
20:49:14.046 -> EVENT: Power-Pressed#1 millis=561780
20:49:14.046 -> EVENT: Power-Pressed millis=561780
20:49:14.215 -> EVENT: Power-Released#1 millis=561945
20:49:14.215 -> EVENT: Power-Released millis=561946
20:49:14.215 -> EVENT: Power-Shortclick#1 millis=561946
20:49:14.215 -> EVENT: Power-Shortclick millis=561946
20:49:14.352 -> EVENT: Power-SavedShortclick#1 millis=562081
20:49:14.386 -> unit = 0 vol = 0.50, Playing Fates/boot.wav
20:49:14.386 -> channels: 1 rate: 22050 bits: 16
20:49:15.962 -> Playing Fates/hum.wav
20:49:15.962 -> channels: 1 rate: 22050 bits: 16

I guess you can consider this thread a kind of regression testing.

I’m starting to think that motion disable is a symptom but not the culprit.
On friday I did apply a 4 hours motion timeout and went to class.

#define MOTION_TIMEOUT 4 * 60 * 60 * 1000

During class, I guess after 30-45 minutes, I noticed that motion was gone.
I had to cycle the power to restore it.

So, today I did a an additional test at home and configured a 20 minutes motion timeout.

#define MOTION_TIMEOUT 1 * 20 * 60 * 1000

I left the saber alone but once again after 15 minutes I wasn’t able to ignite with twists.
Pushing the button I can resume motion detection due to #define MOTION_TIMEOUT 1 * 20 * 60 * 1000.

Interesting. Wonder if it happens randomly or after a specific amount of time?

I did several tests and in the end I tend to say that it happens randomly.
It went down to 3-4 minutes in one occasion, but wasn’t a consistent result.
The next time after 10 minutes twists were still working.

What is sure so far is that when it happens the I2CState is 8.
Additionally, if the MOTION_TIMEOUT is not expired yet, FETT263_MOTION_WAKE_POWER_BUTTON doesn’t fix it.

All this define does is allow you to click PWR button to wake up motion detection without igniting the blade. Normally any button press wakes up motion but, particularly, for 1 button sabers this would ignite the blade, so this define was added to let users wake up motion without ignition so they can then use a gesture ignition instead. The function RequestMotion() is the same with or without this define so not sure how this define is relevant to the issue.

That’s a good point.
And if the motion timeout hasn’t expired, then pressing the button will still ignite the blade.

Both points are correct.

However, when the issue is present twist ignition doesn’ work.
If I press the power button the blade ignites and the hum starts, but there are no effects driven by motion (swings, clashes, etc).
This is also valid when the issue is present and the motion timeout is not expired yet.

Somehow, adding the define FETT263_MOTION_WAKE_POWER_BUTTON is a workaround and helps with restarting the motion engine.
When the issue is present, pressing the button I can ignite the blade with twists and I get swings, clashes, etc.

Would be possible that without defining FETT263_MOTION_WAKE_POWER_BUTTON the function RequestMotion() is not called when pressing the power button?