确认畸变值改为仅从设备获取

This commit is contained in:
yangjiaxuan 2023-06-19 18:48:07 +08:00
parent 2e5dd36607
commit fedc708206
1 changed files with 11 additions and 31 deletions

View File

@ -1,4 +1,4 @@
#include"test_base.h" #include"test_base.h"
#include<string> #include<string>
#include <stdio.h> #include <stdio.h>
#include <windows.h> #include <windows.h>
@ -1165,9 +1165,8 @@ public:
int ret = SCANNER_ERR_OK, int ret = SCANNER_ERR_OK,
dpi = 0; dpi = 0;
SANE_Bool type = true; float distortion = 0;
unsigned int len = sizeof(SANE_Bool), unsigned int len = sizeof(int);
llen = sizeof(int);
size_t strl = 0; size_t strl = 0;
ret = wchar_to_char(str, p, &strl); ret = wchar_to_char(str, p, &strl);
if (ret == ERROR_INSUFFICIENT_BUFFER) if (ret == ERROR_INSUFFICIENT_BUFFER)
@ -1182,39 +1181,20 @@ public:
} }
if (dpi > 0) if (dpi > 0)
{ {
ret = helper_->io_control(IO_CTRL_CODE_SET_DPI, &dpi, &llen); ret = helper_->io_control(IO_CTRL_CODE_SET_DPI, &dpi, &len);
} }
ret = helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_IMAGE, &type, &len); ret = helper_->io_control(IO_CTRL_CODE_GET_DISTORTION_DEVS_CHECK_VAL, &distortion, &len);
if (ret != SCANNER_ERR_OK) if (ret == SCANNER_ERR_OK)
{ {
return ret; wchar_t buf[64];
} swprintf(buf, 64, L"设备畸变值为:%.4f", distortion);
int cnt = 0;
SANE_DISTORTION_VAL dis = { 0 }; helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)buf, true);
while (ret == SCANNER_ERR_OK)
{
if (is_distortion_get_image)
{
ret = helper_->io_control(IO_CTRL_CODE_GET_PC_DISTORTION_CHECK_VAL, &dis, &llen);
break;
}
else if (cnt == 30)
break;
if (is_distortion_get_image_abnormal)
return -1;
Sleep(1000);
cnt++;
}
if (dis.h > 0 && dis.scaleXY < 10)
{
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_DISTORTION_VAL, (void *)&dis, true);
} }
else else
{ {
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT,(void*)L"自动计算畸变值获取失败", false); helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT,(void*)L"获取设备畸变值失败", false);
} }
return ret; return ret;
} }