Pārlūkot izejas kodu

Make sure the led is turned off

Fabio Battaglia 4 gadi atpakaļ
vecāks
revīzija
e35026edf0

+ 14 - 10
src/main/java/info/hkzlab/dupal/analyzer/board/boardio/DuPALAnalyzer.java

@@ -94,17 +94,21 @@ public class DuPALAnalyzer {
         }
 
         dpci.setLED(led, true);
-        
-        if(ioAsOutMask < 0) {
-            ioAsOutMask = detectIOTypeMask(dpci);
-            logger.info("startAnalisys() -> Detected the following IO Type mask: " + String.format("%06X", ioAsOutMask));
-        }
 
-        OutState[] osArray = OSExplorer.exploreOutStates(dpci, ioAsOutMask);
+        try {
+            if(ioAsOutMask < 0) {
+                ioAsOutMask = detectIOTypeMask(dpci);
+                logger.info("startAnalisys() -> Detected the following IO Type mask: " + String.format("%06X", ioAsOutMask));
+            }
+
+            OutState[] osArray = OSExplorer.exploreOutStates(dpci, ioAsOutMask);
 
-        logger.info("Got " + osArray.length + " output states!");
-        for(OutState os : osArray) logger.info(os.toString());
-        
-        dpci.setLED(led, false);
+            logger.info("Got " + osArray.length + " output states!");
+            for(OutState os : osArray) logger.info(os.toString());
+        } catch(Exception e) {
+            throw e;
+        } finally {
+            dpci.setLED(led, false);
+        }
     }
 }