校正结束时如果固件未返回信号,则通过指定字符串判断是否结束

This commit is contained in:
yangjiaxuan 2023-11-06 15:28:54 +08:00
parent d5d33d8bdb
commit 4a94b460dd
1 changed files with 9 additions and 2 deletions

View File

@ -1148,6 +1148,7 @@ void hg_scanner_239::thread_correction(void)
int size = sizeof(buf),
ret = SCANNER_ERR_OK;
bool autoFaltFinish = false;
while (run_)
{
size = sizeof(buf);
@ -1158,12 +1159,13 @@ void hg_scanner_239::thread_correction(void)
io_->set_timeout(1000);
printf("size:%d\r\n",size);
}
if (ret == SCANNER_ERR_TIMEOUT)
{
if (sw.elapsed_s() > 10)
if (sw.elapsed_s() > 30 || autoFaltFinish)
{
is_auto_falt = false;
status_ = SCANNER_ERR_TIMEOUT;
status_ = SCANNER_ERR_DEVICE_AUTO_FAIL_OVER;
//notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_FAIL_OUTTIME), SANE_EVENT_ERROR, ret); // 通信超时
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "设备校正超时 '%s'\n", hg_scanner_err_name(status_));
break;
@ -1188,6 +1190,11 @@ void hg_scanner_239::thread_correction(void)
notify_ui_working_status(buf, SANE_EVENT_STATUS, status_);
printf("%s\r\n", sinfo.c_str());
if (NULL != strstr(sinfo.c_str(), "******Correct Done******"))
{
autoFaltFinish = true;
}
if (info->Code == 4)
{
is_auto_falt = false;