Bypassing Motion and Idle time off

I would hope i am doing this right by adding // to bypass a #define. If i have
//#define MOTION_TIMEOUT 60 * 15 * 1000
//#define IDLE_OFF_TIME 5 * 60 * 1000
Why would the board still time out? I dont see any other defines relating to this. There is no saved state or save programming define listed in my config.
I am using the Shtok Zero button prop. Thanks in advance.

MOTION_TIMEOUT has a default value in the shtok prop:

Try setting it to a very large value instead. (But less than 2 billiion)

Ok. I see. But just to clarify, is there a way to defeat the timeouts all together reguardless of prop?

The line of code (and any similar lines of code if they’re done correctly) profezzorn highlighted shows that the value shtok’s prop assigns is only set if you have not already set it in your config.

In order to override the setting, you define it, not comment it out. If you set it to a large value like what profezzorn has suggested, e.g.:

#define MOTION_TIMEOUT 2147483647
#define IDLE_OFF_TIME 2147483647
#define PLI_OFF_TIME 2147483647

Putting that in your config’ll make everything stay on for approximately 25 days. That’d be the maximum timeout you can set. Practically that’s probably long enough? If not then Fredrik might have other avenues.

Ok. Thanks for the reply.

So MOTION_TIMEOUT is only really overriding a default time of 20 seconds with a custom time instead.
It is only used in the prop for SWING_ON so that you can still swing to turn on if more than 20 seconds has expired since turning off the blade, up to your custom defined time.
Regardless, a 20 second timeout minimum still exists in saber base in the following code block.
However, if NUM_BUTTONS == 0, I don’t think it should ever time out in the first place?

  static bool MotionRequested() {
#if NUM_BUTTONS == 0
    return true;
#else
    return IsOn() || (millis() - last_motion_request_) < 20000;
#endif
  }

Anyway, if you really wanted to, you could just remove the MOTION_TIMEOUT check all together by taking away the outer most condition here:

      if (millis() - saber_off_time_ < MOTION_TIMEOUT) {
        SaberBase::RequestMotion();
        if (swinging_ && fusor.swing_speed() < 100) {
          swinging_ = false;
        }
        if (!swinging_ && fusor.swing_speed() > 500) {
          swinging_ = true;
          Event(BUTTON_NONE, EVENT_SWING);
        }
      }

so that it’s just

        SaberBase::RequestMotion();
        if (swinging_ && fusor.swing_speed() < 100) {
          swinging_ = false;
        }
        if (!swinging_ && fusor.swing_speed() > 500) {
          swinging_ = true;
          Event(BUTTON_NONE, EVENT_SWING);
        }

This would effectively be constantly setting last_motion_request_ = millis();, so you’d never reach the default 20000ms, not use any MOTION_TIMEOUT, and the saber would just always respond to motion as long as there is power available.

-or-
as pointed out above, just set the MOTION_TIMEOUT to something ridiculously high and be done. :upside_down_face:

Thank you for this. I was just looking at this section last night and though here it is but didnt know what to do with it…lol…i think ill just set it high. Im not really using the hilt as a regular but this will help the second half work right!