Loading ...
Sorry, an error occurred while loading the content.

15355Re: [tracker2] How can I test the current speed in a script?

Expand Messages
  • James Ewen
    Mar 15, 2013
      On Thu, Mar 14, 2013 at 11:52 AM, francois.rogez <ffdef@...> wrote:

      > I am looking for advice/examples on detecting condition based on
      > a speed threshold in a script.

      As stated, speed is not a variable that can be accessed in a script
      currently, but it can be tested against via profile switching.

      > My current setup uses a speed threshold to transition between the 2 profiles, but I would like
      > this transition to only happen if the speed is below the threshold for a given number of minutes.
      > I think a script is needed.

      Sounds like it...

      > Any ideas?

      It all depends upon what you need this routine to do, and how much you
      are changing between the profiles.

      Let's pretend that you want to change the path used from WIDE2-2 while
      moving to WIDE2-1 when sitting still, but only after sitting still for
      5 minutes.

      So set both profiles up identically, with WIDE2-2 as the path. Set up
      the profile switching so that you switch to profile 2 when speed is
      below 5 mph. Switch to profile 1 when speed is above 10 mph.

      So, you're thinking... that's silly, why have two profiles the same
      and switch between them based on speed?

      We'll we can't test against speed in a script, but we can test against
      which profile we are in, and we can set which profile we are in based
      on speed, so really it's kind of a derivative work, but we can test
      against speed in a round-about way. With both profiles identical, you
      can't tell that there is a change, except that the tracker has
      internally switched profiles.

      So now what?

      Well, set up a script that tests against being in profile 2, and while
      in profile 2, start a timer. Increment the timer every second, and
      when the timer reaches 300 (5 minutes * 60 seconds), execute the
      command to change the path to WIDE2-1.

      You'll need to test if you switch back to profile 1, and if you do,
      clear the timer value to zero, and set the path in profile 2 back to
      WIDE2-2. You can set a variable to check to see if you've changed
      parameters while in profile 2 or not so you don't do unnecessary

      There you go, profile switching based on speed...

      You can change as many parameters as required and desired.

      Be aware that every time you write a parameter change, you wear out
      the memory slightly. That would be why you would want to keep track of
      whether you need to reset parameters back when in profile 1 or not. No
      need wearing the thing out prematurely.

      So, what do you want to do, and how often do you want to do it?

    • Show all 8 messages in this topic