altos: Use 'HAS_ORIENT' to enable orientation selection in pyro code
authorKeith Packard <keithp@keithp.com>
Mon, 16 Jul 2012 22:27:58 +0000 (15:27 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 16 Jul 2012 22:27:58 +0000 (15:27 -0700)
Don't expose orientation options when no orientation data is available

Signed-off-by: Keith Packard <keithp@keithp.com>
src/core/ao_pyro.c

index b0d45162525f1c839525142190dee85a7f00eca8..162f5e1ea978a8fcc8430f8d801fdaf57059c180 100644 (file)
@@ -66,14 +66,16 @@ ao_pyro_ready(struct ao_pyro *pyro)
                                continue;
                        break;
 
+#if HAS_ORIENT
                case ao_pyro_orient_less:
-//                     if (ao_orient <= pyro->orient_less)
+                       if (ao_orient <= pyro->orient_less)
                                continue;
                        break;
                case ao_pyro_orient_greater:
-//                     if (ao_orient >= pyro->orient_greater)
+                       if (ao_orient >= pyro->orient_greater)
                                continue;
                        break;
+#endif
 
                case ao_pyro_time_less:
                        if ((int16_t) (ao_time() - ao_boost_tick) <= pyro->time_less)
@@ -102,8 +104,8 @@ ao_pyro_ready(struct ao_pyro *pyro)
                        /* handled separately */
                        continue;
                        
-               case ao_pyro_none:
-                       break;
+               default:
+                       continue;
                }
                return FALSE;
        }
@@ -234,7 +236,7 @@ const struct {
        { "h<", ao_pyro_height_less,    offsetof(struct ao_pyro, height_less), HELP("height less (m)") },
        { "h>", ao_pyro_height_greater, offsetof(struct ao_pyro, height_greater), HELP("height greater (m)") },
 
-#if 0
+#if HAS_ORIENT
        { "o<", ao_pyro_orient_less,    offsetof(struct ao_pyro, orient_less), HELP("orient less (deg)") },
        { "o>", ao_pyro_orient_greater, offsetof(struct ao_pyro, orient_greater), HELP("orient greater (deg)")  },
 #endif
@@ -281,6 +283,7 @@ ao_pyro_show(void)
        uint8_t         v;
        struct ao_pyro  *pyro;
 
+       printf ("Pyro-count: %d\n", AO_PYRO_NUM);
        for (p = 0; p < AO_PYRO_NUM; p++) {
                printf ("Pyro %2d: ", p);
                pyro = &ao_config.pyro[p];