MOTION_TIMOUT: Could it be used for Deep Sleep Lite?

I was just thinking about the MOTION_TIMEOUT define… From what I gather, it only applies to swing-on gestures currently, and things like twist-on are not subject to it. But I’m wondering if it could be used to create a kind of faux deep sleep?

What I mean by that is if someone is carrying a hilt in a bag to a con or something, and they drop the bag and it rolls, this could ignite the saber with a gesture. This also applies to sabers in the post, and although hilts should never be shipped powered up, they frequently are, especially by the Chinese giants whose hilts often don’t have kill switches.

If we shut off the motion chip after, say, 15 minutes of inactivity across all gestures, that would sort the problem. We could also add a new audio file called motion.wav on the first button press to confirm that the motion chip is now active again. (And if we wanted to get really carried away, we could even have a motionof.wav that would play when the chip shuts off, though that might require some more complex core code as it wouldn’t be linked to a gesture or button press, so probably not worth it).

I guess my question is, would this need system-wide mods or can it be done from the prop file alone? My guess is the former. Which raises the next question - do we think it’s worth it?

The gestures should all be off. The motion chip is completely turned off after MOTION_TIMEOUT as far as I’m aware… at least that’s how I remember it working. It wouldn’t make any sense that some gestures would turn off but not all of them (because then the IMU would never be turned off).

If what I said above is true, then that’s already what happens. SD power being turned off, idle off to turn off accents, and motion timeout to save a bit of power from the IMU all are “sleep” for Proffie.

I’m not sure if you’re aware (if this is what you’re basing this idea off of already or not), but Fett263’s prop has an option like this, so a button press on power re-enables the IMU and plays boot.wav.

A new sound(s) would be neat though, and more streamlining into core code for other props to easily implement such a thing.

As I understand the ProffieOS code it actually shouldn’t be, but I know very little and Fredrik certainly can say for sure.

1 Like

My prop already handles all of this if you need a roadmap. MOTION_TIMEOUT is for all motion (twist, swing, clash, etc.)

Normally any button press will re-activate motion, but for users who only wanted to “wake up” detection but not necessarily ignite so they could use gesture ignitions after MOTION_TIMEOUT, I added this define, it wakes up motion, plays boot sound but does not ignite the saber.

FETT263_MOTION_WAKE_POWER_BUTTON

My prop already has 15 minutes defaulted if a user doesn’t define on their own, I believe the other props that used my gesture and Battle Mode code already have this also, but that was OS5 I believe, so I don’t recall everything the other props adopted.

2 Likes

Thanks guys.
Though I’m slightly confused. Based on this thread, by default, the motion chip times out after 20 seconds with props other than yours Fernando, and Dmitry’s:

Surely that means that by default, after just 20 seconds of inactivity, any gesture ignition won’t work? But that doesn’t appear to be the case…?

What am I missing here?

BC’s mention of Swing On “only” I think was just poor word choice due to the particular issue in that thread. It applies for all gestures.

Not sure about the default timeout.

sa22c adopted my v1 Battle Mode and Gesture controls so it’s defaulted to 15 minutes also.

And BC used either mine or via sa22c so it’s there also:

The newer props (after OS5 I’m not sure on but I believe they all ended up adopting either directly or indirectly).

It all came from the introduction of gesture ignitions and Battle Mode in my prop circa OS5

The “Wake Up” is defaulted to Button Press by resetting the saber_off_time and using SaberBase::RequestMotion();

 // Events that need to be handled regardless of what other buttons are pressed.
      case EVENTID(BUTTON_POWER, EVENT_PRESSED, MODE_OFF):
      case EVENTID(BUTTON_AUX, EVENT_PRESSED, MODE_OFF):
      case EVENTID(BUTTON_AUX2, EVENT_PRESSED, MODE_OFF):
        saber_off_time_ = millis();
        SaberBase::RequestMotion();
        return true;

This should appear in all of the props that adopted, but may have been changed over time, but I believe most of the OS5 props included this also.

OK, I’ve done some more digging and it seems the motion timeout is actually across all gestures, not just swing, it defaults to 15 minutes set in my prop (a hangover from SA22C as you mentioned Fernando), not 20 seconds, and it does already do exactly what I was proposing (apart from playing the motion.wav file). I’d just never really clocked it before and I was at work when my minded drifted into the idea and didn;t have a sber to hand to test it.

ProffieOS - one step ahead as always! LOL! (Though now I’m liking the idea of a motion.wav! I might build that in for OS-9! LOL!).

1 Like