Ver código fonte

try to fix inpuit detection when generating substates

Baglio Tabifata 4 anos atrás
pai
commit
d42c468656

+ 2 - 1
src/net/hkzlab/dupal/App.java

@@ -11,7 +11,8 @@ public class App {
         DuPALManager dpm = new DuPALManager("/dev/ttyUSB0");
         //PALSpecs pspecs = new PAL16R6Specs();
         PALSpecs pspecs = new PAL16R4Specs();
-        DuPALAnalyzer dpan = new DuPALAnalyzer(dpm, pspecs);
+        //DuPALAnalyzer dpan = new DuPALAnalyzer(dpm, pspecs);
+        DuPALAnalyzer dpan = new DuPALAnalyzer(dpm, pspecs, 0x80);
 
         if(!dpm.enterRemoteMode()) {
             System.out.println("Unable to enter remote mode!");

+ 4 - 6
src/net/hkzlab/dupal/boardio/DuPALAnalyzer.java

@@ -305,18 +305,16 @@ public class DuPALAnalyzer {
         pins_1 = readPINs();
         
         // Check that inputs really are inputs
-        if((pins_1 & pspecs.getIO_READMask() & ~IOasOUT_Mask) != (((idx & pspecs.getIO_WRITEMask()) >> 10) & IOasOUT_Mask)) {
-            logger.warn("Detected an input that is acting as output when in MS ["+ms+"] -> " + String.format("%02X", 
-            (pins_1 & pspecs.getIO_READMask() & ~IOasOUT_Mask) ^ (((idx & pspecs.getIO_WRITEMask()) >> 10) & IOasOUT_Mask)));
+        if((pins_1 & (pspecs.getIO_READMask() & ~IOasOUT_Mask)) != ((idx >> 10) & (pspecs.getIO_READMask() & ~IOasOUT_Mask))) {
+            logger.warn("Detected an input that is acting as output when in MS ["+ms+"] -> " + String.format("%02X", pins_1) + " expected outs: " + String.format("%02X", IOasOUT_Mask));
         }
         
         writePINs(idx | (IOasOUT_Mask << 10));
         pins_2 = readPINs();
 
         // Check that inputs really are inputs
-        if((pins_2 & pspecs.getIO_READMask() & ~IOasOUT_Mask) != (((idx & pspecs.getIO_WRITEMask()) >> 10) & IOasOUT_Mask)) {
-            logger.warn("Detected an input that is acting as output when in MS ["+ms+"] -> " + String.format("%02X", 
-            (pins_2 & pspecs.getIO_READMask() & ~IOasOUT_Mask) ^ (((idx & pspecs.getIO_WRITEMask()) >> 10) & IOasOUT_Mask)));
+        if((pins_2 & (pspecs.getIO_READMask() & ~IOasOUT_Mask)) != ((idx >> 10) & (pspecs.getIO_READMask() & ~IOasOUT_Mask))) {
+            logger.warn("Detected an input that is acting as output when in MS ["+ms+"] -> " + String.format("%02X", pins_2) + " expected outs: " + String.format("%02X", IOasOUT_Mask));
         }
 
         hiz_pins = (pins_1 ^ pins_2) & IOasOUT_Mask;