blackbox/lowlevel.c

changeset 10
6d6e982bbc41
parent 7
f4e250d5402b
child 33
c261350bb394
--- a/blackbox/lowlevel.c	Wed Nov 16 17:04:10 2011 +0100
+++ b/blackbox/lowlevel.c	Fri Nov 18 08:42:24 2011 +0100
@@ -116,8 +116,12 @@
 
 void check_rails_shortcut(void) {
     // check for short circuit on the rails
+    uint8_t i = 100;
     if ((PIN(RAIL_DETECT_PORT) & _BV(RAIL_DETECT)) == 0) {
-        _delay_ms(2);
+        while (i>0) {
+            if ((PIN(RAIL_DETECT_PORT) & _BV(RAIL_DETECT)) != 0) return 0;
+            _delay_us(20);
+        }
         if ((PIN(RAIL_DETECT_PORT) & _BV(RAIL_DETECT)) == 0) {
             cli(); // disable ALL Interrupts
             RAIL_POWER_PORT &= ~_BV(RAIL_POWER); // disable rails power

mercurial