调整校正流程,解决校正信息采集有误的问题

This commit is contained in:
yangjiaxuan 2023-11-21 17:16:10 +08:00
parent 9ecaf00146
commit e79bed40dd
2 changed files with 15 additions and 12 deletions

View File

@ -1132,16 +1132,17 @@ int hg_scanner_239::on_scanner_closing(bool force)
}
void hg_scanner_239::thread_correction(void)
{
StopWatch sw;
char buf[64];
setting3399::HGEIntInfo* info = (setting3399::HGEIntInfo*)buf;
int size = sizeof(buf),
ret = SCANNER_ERR_OK;
StopWatch sw;
unsigned char buf[64];
//setting3399::HGEIntInfo* info = (setting3399::HGEIntInfo*)buf;
int size = sizeof(buf);
int ret = SCANNER_ERR_OK;
bool autoFaltFinish = false;
while (run_)
{
size = sizeof(buf);
memset(buf, 0, sizeof(buf));
{
std::lock_guard<std::mutex> lock(io_lock_);
@ -1152,7 +1153,7 @@ void hg_scanner_239::thread_correction(void)
if (ret == SCANNER_ERR_TIMEOUT)
{
if (autoFaltFinish || sw.elapsed_s() > 120)
if (autoFaltFinish || sw.elapsed_s() > 60)
{
is_auto_falt = false;
status_ = SCANNER_ERR_DEVICE_AUTO_FAIL_OVER;
@ -1166,13 +1167,14 @@ void hg_scanner_239::thread_correction(void)
}
if (size == sizeof(buf))
{
if (setting3399::AutoCorrect ==info->From)
setting3399::HGEIntInfo info = *(setting3399::HGEIntInfo*)&buf;
if (setting3399::AutoCorrect == info.From)
{
std::lock_guard<std::mutex> lock(io_lock_);
status_ == SCANNER_ERR_DEVICE_AUTO_FAIL_INFO;
sw.reset();
std::string sinfo;
int len = info->Img_Index;
int len = info.Img_Index;
sinfo.resize(len);
io_->read_bulk(&sinfo[0],&len);
@ -1181,18 +1183,18 @@ void hg_scanner_239::thread_correction(void)
notify_ui_working_status(buf, SANE_EVENT_STATUS, status_);
printf("%s\r\n", sinfo.c_str());
if (info->Code == 4)
if (info.Code == 4)
{
is_auto_falt = false;
status_ = SCANNER_ERR_DEVICE_AUTO_FAIL_OVER;
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "固件层判断校正结束,返回码 Code: %d \n", info->Code);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "固件层判断校正结束,返回码return Code: %d \n", info.Code);
//notify_ui_working_status(buf, SANE_EVENT_STATUS, status_);
break;
}
if (NULL != strstr(sinfo.c_str(), "******Correct Done******"))
{
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Recived : ******Correct Done****** , return Code: %d \n", info->Code);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Recived : ******Correct Done****** , return Code: %d \n", info.Code);
autoFaltFinish = true;
}
//break;

View File

@ -128,7 +128,8 @@ hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) :
init_setting_map(setting_map_, ARRAY_SIZE(setting_map_));//优先初始化
#endif
update_boarddatetime();//暂未考虑版本兼容情况
if (firmware_sup_boardTime)
update_boarddatetime();//暂未考虑版本兼容情况
//wait_read_int.notify();
status_ = SCANNER_ERR_OK;
}