From 1145f47faf3c4841c89446e6730ecea2eea4c290 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 18 Aug 2009 01:54:51 +0200 Subject: * digital/avr/modules/path: - use define instead of 0xffff for infinite validity. --- digital/avr/modules/path/path.c | 3 ++- digital/avr/modules/path/path.h | 5 ++++- digital/avr/modules/path/path.txt | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'digital/avr') diff --git a/digital/avr/modules/path/path.c b/digital/avr/modules/path/path.c index fcb735c8..835fb30f 100644 --- a/digital/avr/modules/path/path.c +++ b/digital/avr/modules/path/path.c @@ -279,7 +279,8 @@ path_decay (void) uint8_t i; for (i = 0; i < PATH_OBSTACLES_NB; i++) { - if (path.obstacles[i].valid && path.obstacles[i].valid != 0xffff) + if (path.obstacles[i].valid + && path.obstacles[i].valid != PATH_OBSTACLE_VALID_ALWAYS) path.obstacles[i].valid--; } } diff --git a/digital/avr/modules/path/path.h b/digital/avr/modules/path/path.h index 6f41b1d0..e3ec8322 100644 --- a/digital/avr/modules/path/path.h +++ b/digital/avr/modules/path/path.h @@ -25,6 +25,9 @@ * * }}} */ +/** Infinite validity for an obstacle. */ +#define PATH_OBSTACLE_VALID_ALWAYS 0xffff + /** Obstacle. */ struct path_obstacle_t { @@ -46,7 +49,7 @@ void path_endpoints (int16_t sx, int16_t sy, int16_t dx, int16_t dy); /** Set up an obstacle at given position with the given radius and validity - * period, use 0xffff for infinite validity. */ + * period. */ void path_obstacle (uint8_t i, int16_t x, int16_t y, uint16_t r, uint16_t valid); diff --git a/digital/avr/modules/path/path.txt b/digital/avr/modules/path/path.txt index 0d87f3d6..5c779e23 100644 --- a/digital/avr/modules/path/path.txt +++ b/digital/avr/modules/path/path.txt @@ -25,8 +25,8 @@ radius) using ``path_init``. You can place obstacles using the ``path_obstacle`` function. Give it the obstacle index, its position and radius, and its life time. Use a life time -of 0xffff for infinite duration. Call ``path_decay`` regularly to make -obstacles disappear after the given delay. +of PATH_OBSTACLE_VALID_ALWAYS for infinite duration. Call ``path_decay`` +regularly to make obstacles disappear after the given delay. You can also set the source and destination position using the ``path_endpoints`` function. -- cgit v1.2.3