summaryrefslogtreecommitdiff
path: root/digital/avr
diff options
context:
space:
mode:
authorNicolas Schodet2009-08-18 01:54:51 +0200
committerNicolas Schodet2009-08-18 01:54:51 +0200
commit1145f47faf3c4841c89446e6730ecea2eea4c290 (patch)
treef0cff1ff9545baaed2608807f31b19dd5346ae52 /digital/avr
parenta86c3ca8c5f5d7c2e4df0c7fb7ef306f868abf02 (diff)
* digital/avr/modules/path:
- use define instead of 0xffff for infinite validity.
Diffstat (limited to 'digital/avr')
-rw-r--r--digital/avr/modules/path/path.c3
-rw-r--r--digital/avr/modules/path/path.h5
-rw-r--r--digital/avr/modules/path/path.txt4
3 files changed, 8 insertions, 4 deletions
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.