You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by "David G. Simmons" <sa...@mac.com> on 2016/10/21 18:17:59 UTC

os_time_delay() changed?

Has there been a change in os_time_delay()? os_time_delay(500) used to be a half-second delay. Now it is a 5-second delay. 

dg
--
David G. Simmons
(919) 534-5099
Web <https://davidgs.com/> • Blog <https://davidgs.com/davidgs_blog> • Linkedin <http://linkedin.com/in/davidgsimmons> • Twitter <http://twitter.com/TechEvangelist1> • GitHub <http://github.com/davidgs>
/** Message digitally signed for security and authenticity.  
* If you cannot read the PGP.sig attachment, please go to 
 * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
 * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
**/
♺ This email uses 100% recycled electrons. Don't blow it by printing!

There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.



Re: os_time_delay() changed?

Posted by Christopher Collins <cc...@apache.org>.
On Fri, Oct 21, 2016 at 11:20:00AM -0700, will sanfilippo wrote:
> Yes, possibly. We never should have used 500 there. It should be in
> terms of OS_TICKS_PER SEC. Some bsps now use 128 ticks per second
> 
> So that is probably it.

To add to Will's answer, if you are dealing with large time values that
may not survive a conversion without overflow, you will probably want to
use the following function:

    int
    os_time_ms_to_ticks(uint32_t ms, uint32_t *out_ticks)

This function returns a nonzero value if the result won't fit in the
destination uint32_t.

Chris

Re: os_time_delay() changed?

Posted by will sanfilippo <wi...@runtime.io>.
Yes, possibly. We never should have used 500 there. It should be in terms of OS_TICKS_PER SEC. Some bsps now use 128 ticks per second

So that is probably it.


> On Oct 21, 2016, at 11:17 AM, David G. Simmons <sa...@mac.com> wrote:
> 
> Has there been a change in os_time_delay()? os_time_delay(500) used to be a half-second delay. Now it is a 5-second delay. 
> 
> dg
> --
> David G. Simmons
> (919) 534-5099
> Web <https://davidgs.com/> • Blog <https://davidgs.com/davidgs_blog> • Linkedin <http://linkedin.com/in/davidgsimmons> • Twitter <http://twitter.com/TechEvangelist1> • GitHub <http://github.com/davidgs>
> /** Message digitally signed for security and authenticity.  
> * If you cannot read the PGP.sig attachment, please go to 
> * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
> * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
> **/
> ♺ This email uses 100% recycled electrons. Don't blow it by printing!
> 
> There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.
> 
> 


Re: os_time_delay() changed?

Posted by Kevin Townsend <ke...@adafruit.com>.
You need to update your code to something like this, I had the same 
problem a week or two back:

         /* Wait one second */
         int32_t delay = OS_TICKS_PER_SEC * 1;
         os_time_delay(delay);


On 21/10/16 20:17, David G. Simmons wrote:
> Has there been a change in os_time_delay()? os_time_delay(500) used to be a half-second delay. Now it is a 5-second delay.
>
> dg
> --
> David G. Simmons
> (919) 534-5099
> Web <https://davidgs.com/> \u2022 Blog <https://davidgs.com/davidgs_blog> \u2022 Linkedin <http://linkedin.com/in/davidgsimmons> \u2022 Twitter <http://twitter.com/TechEvangelist1> \u2022 GitHub <http://github.com/davidgs>
> /** Message digitally signed for security and authenticity.
> * If you cannot read the PGP.sig attachment, please go to
>   * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
>   * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
> **/
> \u267a This email uses 100% recycled electrons. Don't blow it by printing!
>
> There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.
>
>
>