Open drinkingcode opened 8 years ago
private Runnable mLoop = new Runnable() {
@Override
public void run() {
int len=0;
byte[] rbuf = new byte[USB_READ_BUFFER_SIZE];
for (;;) {// this is the main loop for transferring
try {
len = mConnection.bulkTransfer(mEndpointIn,
rbuf, rbuf.length, 50);
} catch(Exception e) {
Log.e(TAG, e.toString());
}
if (len > 0) {
mBuffer.add(rbuf, len);
for(int i=0; i<len; i++){
Log.v("rbuf",""+((char)rbuf[i]));
}
onRead(len);
}
if (mReadThreadStop) {
return;
}
//当数据量大时,有时mEndpointIn的最大缓存已满,而此时在sleep中,所以
try { //就会覆盖一部分数据,所以这里的这个延迟需要去掉;
Thread.sleep(50);
} catch (InterruptedException e) {
}
}
} // end of run()
}; // end of runnable
it should be modifid as following :
private Runnable mLoop = new Runnable() {
@Override
public void run() {
int len=0;
byte[] rbuf = new byte[USB_READ_BUFFER_SIZE];
for (;;) {// this is the main loop for transferring
try {
len = mConnection.bulkTransfer(mEndpointIn,
rbuf, rbuf.length, 50);
} catch(Exception e) {
Log.e(TAG, e.toString());
}
if (len > 0) {
mBuffer.add(rbuf, len);
for(int i=0; i<len; i++){
Log.v("rbuf",""+((char)rbuf[i]));
}
onRead(len);
}
if (mReadThreadStop) {
return;
}
/* //当数据量大时,有时mEndpointIn的最大缓存已满,而此时在sleep中,所以
try { //就会覆盖一部分数据,所以这里的这个延迟需要去掉;
Thread.sleep(50);
} catch (InterruptedException e) {
}
*/
}
} // end of run()
}; // end of runnable
when the count of files from SD Card on 3D printer is few, i can get all the correct file name of SD Card, but when the count of files from SD Card is many, i just get a part of file name , do you meet the same problem ? if you know that, please tell me