Browse Source

Set speed at 57600bps and reduce wait time for commands

Baglio Tabifata 4 years ago
parent
commit
01fa95ae39
2 changed files with 4 additions and 4 deletions
  1. 2 2
      .vscode/launch.json
  2. 2 2
      src/net/hkzlab/dupal/boardio/DuPALManager.java

+ 2 - 2
.vscode/launch.json

@@ -9,8 +9,8 @@
             "name": "Debug (Launch) - Current File",
             "request": "launch",
             "mainClass": "${file}",
-            //"args": ["/dev/ttyUSB0", "16R6", "/tmp", "C0"]
-            "args": ["/dev/ttyUSB0", "16R6", "/tmp"]
+            "args": ["/dev/ttyUSB0", "16R6", "/tmp", "C0"]
+            //"args": ["/dev/ttyUSB0", "16R6", "/tmp"]
         },
         {
             "type": "java",

+ 2 - 2
src/net/hkzlab/dupal/boardio/DuPALManager.java

@@ -31,7 +31,7 @@ public class DuPALManager {
 
         if (serport != null) {
             try {
-                serport.setParams(BAUDRATE_38400, DATABITS_8, STOPBITS_1, PARITY_NONE);
+                serport.setParams(BAUDRATE_57600, DATABITS_8, STOPBITS_1, PARITY_NONE);
             } catch (final SerialPortException e) {
                 e.printStackTrace();
                 try {
@@ -72,7 +72,7 @@ public class DuPALManager {
             try {
                 logger.debug("Command -> " + command);
                 serport.writeBytes(command.getBytes(StandardCharsets.US_ASCII));
-                try { Thread.sleep(30); } catch(InterruptedException e) {}; // Wait a bit for execution and response
+                try { Thread.sleep(15); } catch(InterruptedException e) {}; // Wait a bit for execution and response
             } catch (SerialPortException e) {
                 e.printStackTrace();
             }