From aa17d7556b3c7435aea2a449ec7af5b96afcce9e Mon Sep 17 00:00:00 2001 From: 13038267101 Date: Thu, 5 Jan 2023 20:19:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=B8=E5=8F=98=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/base/test_base.cpp | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/code/base/test_base.cpp b/code/base/test_base.cpp index a0a8411..8572c49 100644 --- a/code/base/test_base.cpp +++ b/code/base/test_base.cpp @@ -366,13 +366,17 @@ public: if (strcmp((char*)data, STATU_DESC_SCAN_STOPPED) != 0 || strcmp((char*)data, STATU_DESC_SCANNER_ERR_DEVICE_DISTORTION) == 0) { type = false; + is_distortion_get_image = false; wcscpy(buf, L"畸变修正值获取失败,原因--->"); } else { - type = true; - wcscpy(buf, L"畸变修正值获取完成:"); + is_distortion_get_image = true; + //type = true; + //wcscpy(buf, L"畸变修正值获取完成:"); + break; } + //ret = h->io_control(IO_CTRL_CODE_GET_DPI_COLOR_CHECK_VAL, &close, &closelen);//结束恢复默认 } else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_QUALITY) == 0) @@ -867,25 +871,34 @@ public: SANE_Bool type = true; unsigned int len = sizeof(SANE_Bool), llen = sizeof(int); - helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_IMAGE, &type, &len); - while (1) + ret = helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_IMAGE, &type, &len); + if (ret != SCANNER_ERR_OK) { - if (is_distortion_get_image) + return ret; + } + int cnt = 0; + while (ret == SCANNER_ERR_OK) + { + if (is_distortion_get_image ) { ret = helper_->io_control(IO_CTRL_CODE_GET_DISTORTION_CHECK_VAL, &val, &llen); break; } - Sleep(2); + else if (cnt == 10) + break; + + Sleep(1000); + cnt++; } if (val > 0) { float f = *(float*)&val; helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_DISTORTION_VAL, (void *)&f, true); } - else - { - helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT,(void*)L"自动计算畸变值获取失败", false); - } + //else + //{ + // helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT,(void*)L"自动计算畸变值获取失败", false); + //} return ret; } int test_set_auto_distortion(void* data)