[riot-devel] Blinking LEDs with xtimer

Joakim NohlgÄrd joakim.nohlgard at eistec.se
Wed Feb 24 11:59:41 CET 2016


Thank you for your bug report, I think your analysis is correct. Do
you mind creating a pull request on Github to get your change merged
into our master branch?

Best regards,
Joakim

On Tue, Feb 23, 2016 at 9:10 PM, malo <malo at 25cmsquare.io> wrote:
> Hello riots,
>
> just joined the list, have been playing with riot for few days already.
> at first - all the admiration for the hard and good work!
>
> while playing with msp430 and blinking LED threads have noticed two
> "glitches" in xtimer_core.
>
> If somebody more familiar with code could have look at it, since maybe Im
> missing something...
>
> here is the proposed change
> @@ -217,8 +217,9 @@ static void _add_timer_to_list(xtimer_t **list_head,
> xtimer_t *timer)
>  static void _add_timer_to_long_list(xtimer_t **list_head, xtimer_t *timer)
>  {
>      while (*list_head
> -            && (*list_head)->long_target <= timer->long_target
> -            && (*list_head)->target <= timer->target) {
> +            && (((*list_head)->long_target < timer->long_target)
> +            || ((*list_head)->long_target == timer->long_target
> +            && (*list_head)->target <= timer->target))) {
>          list_head = &((*list_head)->next);
>      }
>
> example: there is already long list head -> long target  = 1 and target = 5
> while adding new timer with long target = 0 and target  = 6
>
> one more improvement would be
> @@ -179,7 +179,7 @@ int _xtimer_set_absolute(xtimer_t *timer, uint32_t
> target)
>          timer->long_target++;
>      }
>
> -    if ( !_this_high_period(target) ) {
> +    if ( timer->long_target > _long_cnt || !_this_high_period(target) ) {
>          DEBUG("xtimer_set_absolute(): the timer doesn't fit into the
> low-level timer's mask.\n");
>          _add_timer_to_long_list(&long_list_head, timer);
>      }
>
> since xtimer_set_wakeup - xtimer_set  can be called with 0xFFFFFFFF offset.
>
> wbr
> malo
>
>
>
>
>
> _______________________________________________
> devel mailing list
> devel at riot-os.org
> https://lists.riot-os.org/mailman/listinfo/devel
>


More information about the devel mailing list