Browse Source

Merge branch 'master' of ssh://git.okoyono.de:222/klaute/xcopter

klaute 1 year ago
parent
commit
c1f673b88a
1 changed files with 8 additions and 5 deletions
  1. 8
    5
      esp_rc_ctrl/esp_rc_ctrl.ino

+ 8
- 5
esp_rc_ctrl/esp_rc_ctrl.ino View File

@@ -249,10 +249,13 @@ void loop()
249 249
         uint8_t timeout = 0;
250 250
         char c = -1;
251 251
         do {
252
-            c = Serial.read();
253
-            sock.write(c);
252
+            if (Serial.available() > 0)
253
+            {
254
+                c = Serial.read();
255
+                sock.write(c);
256
+            }
254 257
             timeout++;
255
-        } while(c > -1 && timeout < 100);
258
+        } while(c > -1 && timeout < 2*MSG_LENGTH);
256 259
 
257 260
     }
258 261
 
@@ -263,7 +266,7 @@ void loop()
263 266
 
264 267
     digitalWrite(LED_PIN, led_toggle);
265 268
 
266
-    delay(10); // delay to generate a 5Hz loop
269
+    //delay(10); // delay not required
267 270
 }
268 271
 
269
-/*****************************************************************************/
272
+/*****************************************************************************/

Loading…
Cancel
Save