diff --git a/huagao/Device/GScanO1003399.cpp b/huagao/Device/GScanO1003399.cpp index 829c3835..24a8c69e 100644 --- a/huagao/Device/GScanO1003399.cpp +++ b/huagao/Device/GScanO1003399.cpp @@ -457,10 +457,20 @@ void GScanO1003399::usb_run() } else { while (!scanner_read_reg(m_usb, SR_GET_IMAGEPROCESSDONE)) - this_thread::sleep_for(chrono::microseconds(30)); - if (m_param.is_duplex) + this_thread::sleep_for(chrono::microseconds(30)); + if (scanner_read_reg(m_usb, SR_GET_KEEP_LAST_PAPER)) + { + this_thread::sleep_for(chrono::milliseconds(100)); + im_rx(); + if (m_param.is_duplex) + pop_dev_im(); pop_dev_im(); - pop_dev_im(); + } + else + { + keeplastimg = false; + im_rx(); + } } scanflag = false; if ((devState != DEV_WRONG) && (get_ErrorCode()<=0)) @@ -569,10 +579,40 @@ void GScanO1003399::im_rx() else image++; UpdateScanInfo(countNReaded(), get_imgTransfered()); - imgs.Put(buffi); + if (m_param.resolution_dst > 200.0f || m_param.papertype == 52 || m_param.papertype == 54 || m_param.papertype == 131) + { + auto path = cv::tempfile(); + auto fd = fopen(path.c_str(), "wr+"); + if (fd) + { + fwrite(buffi->data(), buffi->size(), 1, fd); + fclose(fd); + m_paths.push(path); + } + else { + FileTools::writelog(log_ERROR, "img temp file save error flie name =" + path); + } + } + else { + imgs.Put(buffi); + } fu_imgpro.push(m_imgprocthread.enqueue([this] { - imgproce(imgs.Take()); - })); + if (m_param.resolution_dst > 200.0f || m_param.papertype == 52 || m_param.papertype == 54 || m_param.papertype == 131) + { + if (m_imagedata.Size() > 1) + { + this_thread::sleep_for(chrono::milliseconds(10)); + } + else + { + + } + } + else + { + imgproce(imgs.Take()); + } + })); while (fu_imgpro.size()>1) { fu_imgpro.front().get(); diff --git a/huagao/Device/GScanO1003399.h b/huagao/Device/GScanO1003399.h index 10a3e0e1..ab91748b 100644 --- a/huagao/Device/GScanO1003399.h +++ b/huagao/Device/GScanO1003399.h @@ -85,6 +85,8 @@ private: ThreadPool m_imgprocthread; std::shared_ptr m_usbthread; std::shared_ptr> im_data; + + std::queue m_paths; BlockingQueue>> m_imagedata; std::atomic_int image; void* huagods; diff --git a/huagao/Device/IConfig.h b/huagao/Device/IConfig.h index 8baa3a11..e6a156a5 100644 --- a/huagao/Device/IConfig.h +++ b/huagao/Device/IConfig.h @@ -179,6 +179,7 @@ enum Scanner_Reg_Defs SR_GET_SLEEPTIME, SR_GET_SLEEP_STAUTUS, SR_GET_IMAGEPROCESSDONE, + SR_GET_KEEP_LAST_PAPER, SR_GET_CUO_ERROR = 0x50, SR_GET_DOU_ERROR, SR_GET_JAM_ERROR,