Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : Serial.list() question

$
0
0
Hey I'm new here.
 I also have a problem with "Serial.list".


Applet starts up very slowly (30sec). It seems to be due to this code (1).
  1.       for(int z = 0; z < Serial.list().length; z++){
            String pn = shortifyPortName(Serial.list()[z], 13);
              if (pn.length() > 0 )
              comListbox.addItem(pn, z); // addItem(name,value)
              {       
                  comListMax = z;
              }
          }      
  2. String shortifyPortName(String portName, int maxlen) 
    {
    String shortName = portName;
    if(shortName.startsWith("/dev/")) shortName = shortName.substring(5); 
    if(shortName.startsWith("tty.")) shortName = shortName.substring(4); // get rid of leading tty. part of device name
    if(portName.length()>maxlen) shortName = shortName.substring(0,(maxlen-1)/2) + "~" +shortName.substring(shortName.length()-(maxlen-(maxlen-1)/2));
    if(shortName.startsWith("cu.")) shortName = "";// only collect the corresponding tty. devices
    text("InitSerial -  "+shortName, 300, 550);
    return shortName;
    }
I use Processing 2.0b8 32bit
       Eclipse Juno 32bit
      Native lib Version = RXTX-2.1-7
      Java lib Version   = RXTX-2.1-7
       OS Windows 7 64bit

Does anyone have a tip for me? On the 32bit labtop the problem does not occur.

Best Regards Willi

Viewing all articles
Browse latest Browse all 1768

Trending Articles