Swing_On is working only by a second swing

Hi guys,

I got a nut to crack and I just don’t get it.

It is about “Swing_ON”. I got the SWING_ON in my defines but when I swing the first time, nothing happens. If I swing the second time with the same speed the saber ignites. I can reproduce it anytime.

OS6.7 is being used.

I tried the sample config from fett263 too, same issue.

With OS5.9 I don’t have this bug. First swing going over the threshold, it ignites as it should.

Maybe one of you knows what could cause it.


Monitor: After twisting the saber Off, I want to reactivate it with a proper swing. After the second swing it is igniting. The first is not doing it. Just for that you know where to look at in the lines.

CONFIG67.h (182.0 KB)
Monitor.txt (4.3 KB)

There is a 2000 ms delay after retraction, is that what you’re referring to? Your Serial Monitor shows you’re trying to ignite immediately after retraction, that’s a little different than your original description.

Yes, you are right. It is not the first swing but the first swing after retraction OR switching the profile. That is why I thought that it is the first swin in generl.

So, you mean that there is a time frame of 2 sec after retraction or profile change in which I’m not allowed to start another swing_on, right?

Should only be retraction, there’s nothing in the prop that delays for preset change unless your SD is slow and the new font isn’t done loading. You can run ‘sdtest’ in Serial Monitor.

I’ll have a look at it again for OS7, maybe we can shorten a bit. It’s intended to prevent the saber igniting while the motion chip starts up or if a user is moving the saber while retracting to prevent false ignitions.

I found already the line in your prop file.
I changed it to 200 ms and it is reacting like with OS5.9

    // Due to motion chip startup on boot creating false ignition we delay Swing On at boot or motion restart for 2000ms

    if (!menu_ && millis() - saber_off_time_millis_ > 2000) {

Thanks a lot!!! This drove me crazy.

You’re welcome, if you start getting false ignitions on boot you may meed to increase, in testing my sabers would get false ignitions between 1000 and 1800 ms so I set it to 2000 to prevent. Will still look at other solutions for OS7.

Isn’t the SWING_ON_SPEED another security level to prevent this from happening?
I set it up to 375 and it is working just fine.

It can be, but for users who set it lower it can trigger easily so had to account for. I think I have an alternative solution working, just need to beat it up a bit but I’ll look at including in OS7.