All pastes #845868 Raw Copy code Copy link Edit

Anonymous

public unlisted text v1 · immutable
#845868 ·published 2008-01-07 22:45 UTC
rendered paste body
--- emc/usr_intf/keystick.cc.old	2008-01-07 17:43:26.000000000 -0500
+++ emc/usr_intf/keystick.cc	2008-01-07 17:44:14.000000000 -0500
@@ -1586,6 +1586,63 @@
   return 0;;
 }
 
+int tryNml()
+{
+    double end;
+    int good;
+#define RETRY_TIME 10.0		// seconds to wait for subsystems to come up
+#define RETRY_INTERVAL 1.0	// seconds between wait tries for a subsystem
+
+    if (EMC_DEBUG & EMC_DEBUG_NML == 0) {
+	set_rcs_print_destination(RCS_PRINT_TO_NULL);	// inhibit diag
+	// messages
+    }
+    end = RETRY_TIME;
+    good = 0;
+    do {
+	if (0 == emcTaskNmlGet()) {
+	    good = 1;
+	    break;
+	}
+	esleep(RETRY_INTERVAL);
+	end -= RETRY_INTERVAL;
+    } while (end > 0.0);
+    if (EMC_DEBUG & EMC_DEBUG_NML == 0) {
+	set_rcs_print_destination(RCS_PRINT_TO_STDOUT);	// inhibit diag
+	// messages
+    }
+    if (!good) {
+	return -1;
+    }
+
+    if (EMC_DEBUG & EMC_DEBUG_NML == 0) {
+	set_rcs_print_destination(RCS_PRINT_TO_NULL);	// inhibit diag
+	// messages
+    }
+    end = RETRY_TIME;
+    good = 0;
+    do {
+	if (0 == emcErrorNmlGet()) {
+	    good = 1;
+	    break;
+	}
+	esleep(RETRY_INTERVAL);
+	end -= RETRY_INTERVAL;
+    } while (end > 0.0);
+    if (EMC_DEBUG & EMC_DEBUG_NML == 0) {
+	set_rcs_print_destination(RCS_PRINT_TO_STDOUT);	// inhibit diag
+	// messages
+    }
+    if (!good) {
+	return -1;
+    }
+
+    return 0;
+
+#undef RETRY_TIME
+#undef RETRY_INTERVAL
+}
+
 int main(int argc, char *argv[])
 {
   int dump = 0;
@@ -1723,13 +1780,17 @@
   // init NML
   if (! dump)
     {
-      if (emcTaskNmlGet())
+      /*if (emcTaskNmlGet())
         {
           exit(1);
         }
       if (emcErrorNmlGet())
         {
           exit(1);
+        }*/
+        if(tryNml())
+        {
+          exit(1);
         }
     }