changeset 56:008236195f5a

fix serial arduino code
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sun, 24 Aug 2014 14:48:44 +0200
parents 5ce82161111d
children 9c412415a8c1
files servo/servo.ino
diffstat 1 files changed, 7 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/servo/servo.ino	Sun Aug 24 14:27:09 2014 +0200
+++ b/servo/servo.ino	Sun Aug 24 14:48:44 2014 +0200
@@ -174,38 +174,28 @@
     switch (serial_command) {
         case 0x00:
             /* No command, read one. */
-            if (Serial.available() < 1) {
-                return;
-            }
+            if (Serial.available() < 1) { return; }
             serial_command = Serial.read();
-            break;
+            return;
         case 0xff:
             /* Move a single servo by degrees. */
-            if (Serial.available() < 2) {
-                return;
-            }
+            if (Serial.available() < 2) { return; }
             do_servo_degrees();
             break;
         case 0xfe:
             /* Move all servos by degrees. */
-            if (Serial.available() < MAX_SERVO) {
-                return;
-            }
+            if (Serial.available() < MAX_SERVO) { return; }
             serial_command = 0;
             do_servos_degrees();
             break;
         case 0xfd:
             /* Move a single servo by microseconds. */
-            if (Serial.available() < 3) {
-                return;
-            }
+            if (Serial.available() < 3) { return; }
             do_servo_microseconds();
             break;
         case 0xfc:
             /* Move all servos by microseconds. */
-            if (Serial.available() < MAX_SERVO * 2) {
-                return;
-            }
+            if (Serial.available() < MAX_SERVO * 2) { return; }
             do_servos_microseconds();
             break;
         case 0xfb:
@@ -221,9 +211,7 @@
             break;
         case 0xf1:
             /* Beep. */
-            if (Serial.available() < 3) {
-                return;
-            }
+            if (Serial.available() < 3) { return; }
             do_beep();
             break;
     }