增加USB收图延时,避免2倍A3数据无法收完。

This commit is contained in:
lovelyyoung 2020-04-03 09:26:07 +08:00
parent 08577df257
commit 19ce266a4d
1 changed files with 3 additions and 1 deletions

View File

@ -312,6 +312,7 @@ void GScanO200::usbmain()
case HAVE_IMAGE:
{
int totalNum = usbcb.u32_Count;
m_usb->set_timeout(1500);
imgData = Get_Img_Data(totalNum);
if (!imgData->size()) {
Stop_scan();
@ -323,6 +324,7 @@ void GScanO200::usbmain()
static int rawdataindex = 0;
FileTools::write_log("out.txt", "Enquque rawbuffer index " + std::to_string(++rawdataindex));
#endif // LOG
m_usb->set_timeout(200);
Pop_Image();
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));
StopWatch sw;
int readed = 0;
while (readed < bufferSize && sw.elapsed_ms() < 3000){
while (readed < bufferSize && sw.elapsed_ms() < 5000){
USBCB usbcb = { GET_IMAGE,0,(UINT32)bufferSize };
m_usb->write_bulk(&usbcb, sizeof(usbcb));
readed = m_usb->read_bulk(imData->data(), bufferSize);