Blade Detect Fine Tuning

Hey, folks. I just set up my first saber and had some configuration questions. It’s an OS8.10 one-button setup with Fett263’s prop. I have blade detect set up so that the chassis can tell when it’s removed from the hilt, and it mostly works as intended, except a couple things.

  1. It doesn’t boot into the “no blade” preset despite the fact that the chassis has to be removed to access the kill switch. It goes to the first “blade present” preset instead. It does go back to the no blade preset once inserted and then removed from the hilt, but is there a way to get it to boot into the no blade preset?

  2. My understanding is that the “no blade detected” preset turns off gesture controls by default on Fett263’s prop, but I’d like to be able to turn it on and my setup has no button connected with the chassis removed. Is there a way to turn gesture controls back on in this mode? Perhaps adding a define to the config or commenting out/changing something in the prop? I think it has to do with this section of the prop, but I’m not much of a programmer.


#ifdef BLADE_DETECT_PIN
      case EVENTID(BUTTON_BLADE_DETECT, EVENT_LATCH_ON, MODE_ANY_BUTTON | MODE_ON):
      case EVENTID(BUTTON_BLADE_DETECT, EVENT_LATCH_ON, MODE_ANY_BUTTON | MODE_OFF):
        // Might need to do something cleaner, but let's try this for now.
        blade_detected\_ = true;
#ifdef FETT263_SAVE_GESTURE_OFF
        RestoreGestureState();
#else
        saved_gesture_control.gestureon = true;
#endif
        FindBladeAgain();
        SaberBase::DoBladeDetect(true);
        return true;

      case EVENTID(BUTTON_BLADE_DETECT, EVENT_LATCH_OFF, MODE_ANY_BUTTON | MODE_ON):
      case EVENTID(BUTTON_BLADE_DETECT, EVENT_LATCH_OFF, MODE_ANY_BUTTON | MODE_OFF):
        // Might need to do something cleaner, but let's try this for now.
        blade_detected\_ = false;
#ifdef FETT263_SAVE_GESTURE_OFF
        SaveGestureState();
#endif
        saved_gesture_control.gestureon = false;
        FindBladeAgain();
        SaberBase::DoBladeDetect(false);
        return true;
#endif

Apologies for the mess of code. I tried the backtick method and it doesn’t seem to play well with my phone.

You can just toggle Gesture Sleep using the controls to restore. The gestures just “Sleep” when the blade is removed, toggling should reactivate them.

My chassis doesn’t have a button connected when it’s removed, though (the section of the chassis with the button remains in the hilt and there’s a rotary pin connector between them), so gesture controls are the only way I’d be able to “wake” it, unless I’m missing something.

Yeah that makes it hard. You’d have to modify the code then. I “think” what you were looking at above is roughly correct, but you’ll want to try it out and keep track of what you’re modifying in case you get “side effects”. Whenever modifying a prop you can sometimes impact other controls when you’re making changes, it took a long time dial everything in initially so I always caution users when they’re making changes to fully test everything and make sure the other controls still work as expected after you’ve changed something.

Thanks for the advice, @Fett263. I ran some tests, and for the sake of anyone searching for this in the future, I solved these issues as follows:

To boot directly into the “no blade present” preset, you simply reorder your blade configuration to place your “no_blade” definition before your blade present definitions. The config helper defaults to putting the “blade present” definition first, but the OS defaults to boot into the first preset of your first blade definition. So just move the “no blade detected” definition in your blade configuration first.

To keep gesture controls on with no blade detected, you simply change a Boolean in Fett263’s prop. Where it says:

blade_detected_ = false;

#ifdef FETT263_SAVE_GESTURE_OFF

SaveGestureState();

#endif

saved_gesture_control.gestureon = false;

Change that last “false” to “true” to match the blade detected state. Minimally invasive and it’s been working as intended for me so far. I’ll update if I run into any bugs.

I fixed it.

Is this a bugfix or a workaround?