]> git.droids-corp.org - protos/rc_servos.git/commitdiff
rc_servos: use define for bypass command
authorFabrice Desclaux <serpilliere@droids-corp.org>
Sun, 26 Feb 2012 21:51:46 +0000 (22:51 +0100)
committerFabrice Desclaux <serpilliere@droids-corp.org>
Sun, 26 Feb 2012 21:51:46 +0000 (22:51 +0100)
main.c

diff --git a/main.c b/main.c
index b1083ea8d3d1a559ad5fb1547c44b4ca844c5a04..df8fb930b6c0e0f33b8e19d6b994a32faecd168d 100644 (file)
--- a/main.c
+++ b/main.c
@@ -25,6 +25,8 @@ register uint8_t bypass asm("r2");
 register uint8_t done asm("r3");
 register uint8_t portval asm("r4");
 register uint8_t rxidx asm("r5");
+#define BYPASS_ENABLE 14
+#define BYPASS_DISABLE 15
 
 /*
  * SPI protocol:
@@ -94,10 +96,10 @@ static void poll_spi(void)
                        val += byte1.val_lsb;
                        servo_table[byte0.cmd_num].command = val;
                }
-               else if (byte0.cmd_num == 14) {
+               else if (byte0.cmd_num == BYPASS_ENABLE) {
                        bypass = 1;
                }
-               else if (byte0.cmd_num == 15) {
+               else if (byte0.cmd_num == BYPASS_DISABLE) {
                        bypass = 0;
                }
        }
@@ -157,6 +159,7 @@ int main(void)
 
        sei();
 
+       bypass = 0;
        while (1) {
                t = TCNT0;
                for (i = 0; i < NB_SERVO; i++) {