From 88f755e4c41f374f54bead631c8c19c00dd8c9a2 Mon Sep 17 00:00:00 2001 From: 13038267101 Date: Thu, 16 Mar 2023 18:49:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=87=AA=E5=8A=A8=E5=88=86?= =?UTF-8?q?=E7=BA=B8=E5=BC=BA=E5=BA=A6=EF=BC=8C=E6=AD=AA=E6=96=9C=E6=A3=80?= =?UTF-8?q?=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/hgdev/common_setting.h | 2 +- hgdriver/hgdev/hg_scanner_239.cpp | 46 ++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/hgdriver/hgdev/common_setting.h b/hgdriver/hgdev/common_setting.h index 0a5b368..5be7845 100644 --- a/hgdriver/hgdev/common_setting.h +++ b/hgdriver/hgdev/common_setting.h @@ -996,7 +996,7 @@ namespace setting3399 SR_SET_SLEEPTIME, SR_GET_SLEEPTIME, SR_GET_SLEEP_STAUTUS, //返回1不在睡眠状态 0反之 - SR_GET_IMAGEPROCESSDONE, + SR_GET_IMAGEPROCESSDONE,//指设备所有图像处理完成没有 SR_GET_KEEP_LAST_PAPER, SR_GET_PAPERON, SR_SET_SPEEDMODE, diff --git a/hgdriver/hgdev/hg_scanner_239.cpp b/hgdriver/hgdev/hg_scanner_239.cpp index 326e164..6fe8d80 100644 --- a/hgdriver/hgdev/hg_scanner_239.cpp +++ b/hgdriver/hgdev/hg_scanner_239.cpp @@ -846,11 +846,29 @@ int hg_scanner_239::on_skew_check_changed(bool& check) int hg_scanner_239::on_skew_check_level_changed(int& check) { int ret = SCANNER_ERR_OK, - val = check, + val = check - 1,//上面设置的是1 - 5 ,接受范围值为0 - 4,默认2 old = dev_conf_.params_3399.screw_detect_level; setting_hardware::HGSCANCONF_3399 cf; - cf.params_3399.screw_detect_level = -1; + if (val < 0 && val>5) + { + check = 3; + ret = SCANNER_ERR_NOT_EXACT; + } + if (val != dev_conf_.params_3399.screw_detect_level) + { + dev_conf_.params_3399.screw_detect_level = val; + ret = writedown_device_configuration(); + if (ret) + { + check = dev_conf_.params_3399.screw_detect_level = old; + check += 1; + } + + } + + + /*cf.params_3399.screw_detect_level = -1; if (val < 0) { @@ -873,7 +891,7 @@ int hg_scanner_239::on_skew_check_level_changed(int& check) { check = val; ret = SCANNER_ERR_NOT_EXACT; - } + }*/ return ret; } @@ -919,13 +937,15 @@ int hg_scanner_239::on_pick_paper(bool autostrength) } int hg_scanner_239::on_pick_paper_threshold(double threshold) { - threshold *= 10; - int val = 0, - ret = write_register(setting3399::SR_SET_AUTOMATICCONTROLFEEDMODE_THRESHOLD, threshold); + float f = threshold; + //threshold *= 10; + int val = *(int*)&f; + int ret = write_register(setting3399::SR_SET_AUTOMATICCONTROLFEEDMODE_THRESHOLD, val); if (ret != SCANNER_ERR_OK) return ret; ret = read_register(setting3399::SR_GET_AUTOMATICCONTROLFEEDMODE_THRESHOLD,&val); + float v = *(float*)&val; return ret; } int hg_scanner_239::on_is_auto_paper(bool isautopaper) @@ -1048,7 +1068,7 @@ void hg_scanner_239::thread_get_dves_image(void) if (ret == SCANNER_ERR_TIMEOUT) { - if (img_conf_.resolution_dst == 600.0 && ++to_cnt > 50 && !is_auto_paper_scan) + if (img_conf_.resolution_dst == 600.0 && ++to_cnt > 60 && !is_auto_paper_scan) { status_ = ret; notify_ui_working_status(hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME), SANE_EVENT_ERROR, ret); // 取图通信超时 @@ -1068,12 +1088,6 @@ void hg_scanner_239::thread_get_dves_image(void) stop(); notify_ui_working_status(from_default_language(STATU_DESC_SCANNER_ERR_DEVICE_EXIT_WAIT_SCAN), SANE_EVENT_ERROR, status_); } - - if ((get_status() & 0x03) == 0) - { - status_ = SCANNER_ERR_OK; - //break; - } if (user_cancel_ && is_auto_paper_scan) { size = sizeof(buf); @@ -1081,6 +1095,11 @@ void hg_scanner_239::thread_get_dves_image(void) info->From = setting3399::STOPSCAN; LOG_INFO(LOG_LEVEL_DEBUG_INFO, "User cancelled (checked when read INT timeout), we faked a 'STOP' messag to enter exiting process ...\n"); } + if ((get_status() & 0x03) == 0) + { + status_ = SCANNER_ERR_OK; + //break; + } else continue; } @@ -1140,6 +1159,7 @@ void hg_scanner_239::thread_get_dves_image(void) break; } status_ = st; + //break; } svdevs_err_.push_back(status_); VLOG_MINI_1(LOG_LEVEL_WARNING, "\346\211\253\346\217\217\345\244\261\350\264\245, read interrupt\350\277\224\345\233\236\347\212\266\346\200\201\344\270\272\357\274\232%s\n", hg_scanner_err_description(status_));