解决待纸扫描未到时间,就提前报扫描完成的问题,获取图像超时60s改为120s

This commit is contained in:
yangjiaxuan 2023-11-24 15:45:24 +08:00
parent 2400239e55
commit 52097e47e7
1 changed files with 6 additions and 2 deletions

View File

@ -1338,6 +1338,7 @@ void hg_scanner_239::thread_get_dves_image(void)
svdevs_err_.clear(); svdevs_err_.clear();
StopWatch sw; StopWatch sw;
StopWatch sw1;
bool is_quit_wait_paper_scan = false; bool is_quit_wait_paper_scan = false;
while (run_)//&& !user_cancel_ while (run_)//&& !user_cancel_
@ -1354,7 +1355,7 @@ void hg_scanner_239::thread_get_dves_image(void)
if (ret == SCANNER_ERR_TIMEOUT) if (ret == SCANNER_ERR_TIMEOUT)
{ {
std::this_thread::sleep_for(std::chrono::milliseconds(400)); std::this_thread::sleep_for(std::chrono::milliseconds(400));
if (sw.elapsed_s() > 60 && !is_auto_scan()) if (sw.elapsed_s() > 120 && !is_auto_scan())
{ {
status_ = ret; status_ = ret;
notify_ui_working_status(from_default_language(STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, ret); // 取图通信超时 notify_ui_working_status(from_default_language(STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, ret); // 取图通信超时
@ -1362,7 +1363,7 @@ void hg_scanner_239::thread_get_dves_image(void)
break; break;
} }
if (is_auto_scan() && sw.elapsed_s() >= is_auto_paper_scan_exit_time && is_auto_paper_scan_exit_time != 0) if (is_auto_scan() && sw1.elapsed_s() >= is_auto_paper_scan_exit_time && is_auto_paper_scan_exit_time != 0)
{ {
is_quit_wait_paper_scan = true;//标记待纸扫描时间到了自动结束 is_quit_wait_paper_scan = true;//标记待纸扫描时间到了自动结束
do_stop(); do_stop();
@ -1504,7 +1505,10 @@ void hg_scanner_239::thread_get_dves_image(void)
str += ":" + to_string(++auoto_paper_indx); str += ":" + to_string(++auoto_paper_indx);
if (!user_cancel_ && is_auto_scan() && svdevs_err_.empty() && !is_quit_wait_paper_scan) if (!user_cancel_ && is_auto_scan() && svdevs_err_.empty() && !is_quit_wait_paper_scan)
{
sw1.reset();
notify_ui_working_status(str.c_str(), SANE_EVENT_ERROR, status_); notify_ui_working_status(str.c_str(), SANE_EVENT_ERROR, status_);
}
else else
break; break;
} }