20 second gremlin again

So I have #define MOTION_TIMEOUT 60 * 5 * 1000 set in my config, and these cases in the prop file:

// Events that needs 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):
      SaberBase::RequestMotion();
      return true;

and MotionRequested() in saber_base.h is set at 20 seconds:


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

I still get “Motion disable.” happening after 20 seconds. This is interrupting stuff while saber is off, like Volume Menu for example. Look at this:

00:28:57.437 -> EVENT: Clash mods Power millis=1808581
00:28:57.437 -> Enter Volume Menu
00:28:57.437 -> Playing vmbegin.wav, channels: 1 rate: 44100 bits: 16
00:28:57.715 -> EVENT: Power-Released#1 millis=1808863
00:28:57.715 -> EVENT: Power-Released millis=1808863
00:28:58.782 -> Amplifier off.
00:28:59.734 -> Unmounting SD Card.
00:29:09.255 -> Battery voltage: 0.03
00:29:17.111 -> Motion disable.
00:29:19.111 -> I2C sleeping..

So I did it again, this time sending i2cstate every 2 seconds or so. That looks like this:

00:30:23.147 -> EVENT: Clash mods Power millis=1894277
00:30:23.147 -> Enter Volume Menu
00:30:23.147 -> Playing vmbegin.wav, channels: 1 rate: 44100 bits: 16
00:30:23.330 -> EVENT: Power-Released#1 millis=1894478
00:30:23.330 -> EVENT: Power-Released millis=1894478
00:30:24.473 -> Amplifier off.
00:30:25.434 -> Unmounting SD Card.
00:30:25.890 -> I2CBUS: last_request = 1897013 (now = 1897013) i2c_detected_ = 1 used = 1
00:30:25.890 -> I2C STATE: 7
00:30:25.890 -> current: 536880304 id= 106 next= 0
00:30:25.890 -> LSM6DS3H: last_event_ 1897012 LINE: 197
00:30:25.890 -> last: 536880304 id= 106 next= 0
00:30:25.890 -> LSM6DS3H: last_event_ 1897013 LINE: 197
00:30:25.890 -> Motion requested: 1 (millis() - last_motion_request=3098)
00:30:27.877 -> I2CBUS: last_request = 1899010 (now = 1899010) i2c_detected_ = 1 used = 1
00:30:27.877 -> I2C STATE: 3
00:30:27.877 -> current: 0 id= 0 next= 0
00:30:27.877 -> last: 0 id= 0 next= 0
00:30:27.877 -> Motion requested: 1 (millis() - last_motion_request=5095)
00:30:29.269 -> Battery voltage: 0.03
00:30:29.971 -> I2CBUS: last_request = 1901096 (now = 1901096) i2c_detected_ = 1 used = 1
00:30:29.971 -> I2C STATE: 3
00:30:29.971 -> current: 0 id= 0 next= 0
00:30:29.971 -> last: 0 id= 0 next= 0
00:30:29.971 -> Motion requested: 1 (millis() - last_motion_request=7181)
00:30:32.347 -> I2CBUS: last_request = 1903473 (now = 1903473) i2c_detected_ = 1 used = 1
00:30:32.347 -> I2C STATE: 3
00:30:32.347 -> current: 0 id= 0 next= 0
00:30:32.347 -> last: 0 id= 0 next= 0
00:30:32.347 -> Motion requested: 1 (millis() - last_motion_request=9559)
00:30:34.636 -> I2CBUS: last_request = 1905765 (now = 1905765) i2c_detected_ = 1 used = 1
00:30:34.636 -> I2C STATE: 7
00:30:34.636 -> current: 536880304 id= 106 next= 0
00:30:34.636 -> LSM6DS3H: last_event_ 1905765 LINE: 197
00:30:34.636 -> last: 0 id= 0 next= 0
00:30:34.636 -> Motion requested: 1 (millis() - last_motion_request=11850)
00:30:36.934 -> I2CBUS: last_request = 1908062 (now = 1908062) i2c_detected_ = 1 used = 1
00:30:36.934 -> I2C STATE: 3
00:30:36.934 -> current: 0 id= 0 next= 0
00:30:36.934 -> last: 0 id= 0 next= 0
00:30:36.934 -> Motion requested: 1 (millis() - last_motion_request=14147)
00:30:39.045 -> I2CBUS: last_request = 1910191 (now = 1910191) i2c_detected_ = 1 used = 1
00:30:39.045 -> I2C STATE: 3
00:30:39.045 -> current: 0 id= 0 next= 0
00:30:39.045 -> last: 0 id= 0 next= 0
00:30:39.045 -> Motion requested: 1 (millis() - last_motion_request=16276)
00:30:41.317 -> I2CBUS: last_request = 1912450 (now = 1912450) i2c_detected_ = 1 used = 1
00:30:41.317 -> I2C STATE: 3
00:30:41.317 -> current: 0 id= 0 next= 0
00:30:41.317 -> last: 536880304 id= 106 next= 0
00:30:41.317 -> LSM6DS3H: last_event_ 1912450 LINE: 197
00:30:41.317 -> Motion requested: 1 (millis() - last_motion_request=18535)
00:30:42.802 -> Motion disable.
00:30:43.627 -> I2CBUS: last_request = 1913919 (now = 1914756) i2c_detected_ = 1 used = 1
00:30:43.627 -> I2C STATE: 3
00:30:43.627 -> current: 0 id= 0 next= 0
00:30:43.627 -> last: 0 id= 0 next= 0
00:30:43.627 -> Motion requested: 0 (millis() - last_motion_request=20841)
00:30:44.808 -> I2C sleeping..

What am I missing here?
Expected the motion disable to follow the 5 minute timeout set in the #define of course.

MOTION_TIMEOUT is a thing your prop does, in yours it seems to be regulated by setting saber_off_time_, so maybe you should set saber_off_time_ when a button is pressed while off?

thank you.
Yes, missed the reset in newly added code. all good.