mirror of http://192.168.1.51:8099/lmh188/twain3.0
增加USB收图延时,避免2倍A3数据无法收完。
This commit is contained in:
parent
08577df257
commit
19ce266a4d
|
@ -312,6 +312,7 @@ void GScanO200::usbmain()
|
||||||
case HAVE_IMAGE:
|
case HAVE_IMAGE:
|
||||||
{
|
{
|
||||||
int totalNum = usbcb.u32_Count;
|
int totalNum = usbcb.u32_Count;
|
||||||
|
m_usb->set_timeout(1500);
|
||||||
imgData = Get_Img_Data(totalNum);
|
imgData = Get_Img_Data(totalNum);
|
||||||
if (!imgData->size()) {
|
if (!imgData->size()) {
|
||||||
Stop_scan();
|
Stop_scan();
|
||||||
|
@ -323,6 +324,7 @@ void GScanO200::usbmain()
|
||||||
static int rawdataindex = 0;
|
static int rawdataindex = 0;
|
||||||
FileTools::write_log("out.txt", "Enquque rawbuffer index " + std::to_string(++rawdataindex));
|
FileTools::write_log("out.txt", "Enquque rawbuffer index " + std::to_string(++rawdataindex));
|
||||||
#endif // LOG
|
#endif // LOG
|
||||||
|
m_usb->set_timeout(200);
|
||||||
Pop_Image();
|
Pop_Image();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -370,7 +372,7 @@ std::shared_ptr<std::vector<char>> GScanO200::Get_Img_Data(int bufferSize)
|
||||||
std::shared_ptr<std::vector<char>> imData(new std::vector<char>(bufferSize));
|
std::shared_ptr<std::vector<char>> imData(new std::vector<char>(bufferSize));
|
||||||
StopWatch sw;
|
StopWatch sw;
|
||||||
int readed = 0;
|
int readed = 0;
|
||||||
while (readed < bufferSize && sw.elapsed_ms() < 3000){
|
while (readed < bufferSize && sw.elapsed_ms() < 5000){
|
||||||
USBCB usbcb = { GET_IMAGE,0,(UINT32)bufferSize };
|
USBCB usbcb = { GET_IMAGE,0,(UINT32)bufferSize };
|
||||||
m_usb->write_bulk(&usbcb, sizeof(usbcb));
|
m_usb->write_bulk(&usbcb, sizeof(usbcb));
|
||||||
readed = m_usb->read_bulk(imData->data(), bufferSize);
|
readed = m_usb->read_bulk(imData->data(), bufferSize);
|
||||||
|
|
Loading…
Reference in New Issue