Compare commits

...

6 Commits

Author SHA1 Message Date
yangjiaxuan 5b86b51d4b 微调 2023-03-01 17:40:56 +08:00
13038267101 46ae654ac6 调整多线程互斥 2023-03-01 17:34:07 +08:00
13038267101 af2b076a81 微调 2023-03-01 15:41:04 +08:00
13038267101 ca96accbbc 调整获取畸变时,出现走纸等错误,返回信息过慢 2023-03-01 15:36:05 +08:00
13038267101 a93a8dffa4 Merge branch 'master' of http://192.168.10.5:8099/sane/code_production 2023-03-01 11:05:54 +08:00
13038267101 7cc2cd6a7c 调整设置参数问题 2023-03-01 11:05:47 +08:00
3 changed files with 37 additions and 17 deletions

View File

@ -84,15 +84,15 @@ void hgscanner::test_callback(const wchar_t* name, test_event ev, void* data, si
if (data != nullptr) if (data != nullptr)
{ {
info = QObject::tr("failed: ") + QString::fromStdWString((const wchar_t*)data); info = QObject::tr("failed: ") + QString::fromStdWString((const wchar_t*)data);
}
if (m_interface != nullptr) if (m_interface != nullptr)
{ {
emit m_interface->testResult(info); emit m_interface->testResult(info);
} }
else if (m_burnMode != nullptr) else if (m_burnMode != nullptr)
{ {
emit m_burnMode->testResult(flag); emit m_burnMode->testResult(flag);
}
} }
} }
else if (ev == TEST_EVENT_MANUAL_CONFIRMATION) else if (ev == TEST_EVENT_MANUAL_CONFIRMATION)

View File

@ -1,4 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommand>ProductionTool.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>C:\Program Files (x86)\HGProductionTool\ProductionTool.exe</LocalDebuggerWorkingDirectory>
<LocalDebuggerAttach>true</LocalDebuggerAttach>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerDebuggerType>NativeOnly</LocalDebuggerDebuggerType>
</PropertyGroup>
</Project> </Project>

View File

@ -120,7 +120,10 @@ int get_json_config_file()
std::cout << buf << std::endl; std::cout << buf << std::endl;
} }
static std::wstring set_test_name_ =L""; static std::wstring set_test_name_ =L"";
bool is_distortion_get_image = false; //bool is_distortion_get_image = false;
//bool is_distortion_get_image_abnormal = false;
std::atomic<bool> is_distortion_get_image_abnormal(false);
std::atomic<bool> is_distortion_get_image(false);
class test class test
{ {
ui_helper* helper_; ui_helper* helper_;
@ -372,6 +375,7 @@ public:
{ {
type = false; type = false;
is_distortion_get_image = false; is_distortion_get_image = false;
is_distortion_get_image_abnormal = true;
wcscpy(buf, L"畸变修正值获取失败,原因--->"); wcscpy(buf, L"畸变修正值获取失败,原因--->");
} }
else else
@ -379,9 +383,9 @@ public:
is_distortion_get_image = true; is_distortion_get_image = true;
//type = true; //type = true;
//wcscpy(buf, L"畸变修正值获取完成:"); //wcscpy(buf, L"畸变修正值获取完成:");
//break; break;
} }
break; //break;
//ret = h->io_control(IO_CTRL_CODE_GET_DPI_COLOR_CHECK_VAL, &close, &closelen);//结束恢复默认 //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_COLOR_QUALITY) == 0 else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_COLOR_QUALITY) == 0
@ -563,10 +567,11 @@ public:
if (wcscmp(name, HGPDTTOOLDB_NAME_SET_JSON_SN) == 0 if (wcscmp(name, HGPDTTOOLDB_NAME_SET_JSON_SN) == 0
|| wcscmp(name, HGPDTTOOLDB_NAME_GET_DEVICE_CONFIG) == 0 || wcscmp(name, HGPDTTOOLDB_NAME_GET_DEVICE_CONFIG) == 0
|| wcscmp(name, HGPDTTOOLDB_NAME_CONFIGURE_SPEED_MODE) == 0) || wcscmp(name, HGPDTTOOLDB_NAME_CONFIGURE_SPEED_MODE) == 0
|| wcscmp(name, WRITE_CFG_NAME) == 0)
{ {
std::string fw1(get_firmware_version()); std::string fw1(get_firmware_version());
if (fw1.empty()) if (!fw1.empty())
{ {
if ("G1" == fw1.substr(0, 2)) if ("G1" == fw1.substr(0, 2))
fw_ = 1; fw_ = 1;
@ -594,7 +599,11 @@ public:
helper_->test_callback(name, ui_helper::TEST_EVENT_NOT_FIND_TEST, NULL, false); helper_->test_callback(name, ui_helper::TEST_EVENT_NOT_FIND_TEST, NULL, false);
return ret; return ret;
} }
if (ret != SCANNER_ERR_OK && ret != -1) if (ret == SCANNER_ERR_DEVICE_NOT_SUPPORT
|| ret == SCANNER_ERR_IO
|| ret == SCANNER_ERR_TIMEOUT
|| ret == SCANNER_ERR_NO_DATA
)
{ {
helper_->test_callback(name, ui_helper::TEST_EVENT_IO_FAIL, NULL, ret); helper_->test_callback(name, ui_helper::TEST_EVENT_IO_FAIL, NULL, ret);
} }
@ -1000,16 +1009,19 @@ public:
else if (cnt == 30) else if (cnt == 30)
break; break;
if (is_distortion_get_image_abnormal)
return -1;
Sleep(1000); Sleep(1000);
cnt++; cnt++;
} }
if (dis.h > 0 && dis.scaleXY < 10) if (dis.h > 0 && dis.scaleXY < 10)
{ {
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_DISTORTION_VAL, (void *)&dis, true); 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;
} }
@ -1267,6 +1279,8 @@ DECL_API(int) func_test_go(const wchar_t* NAME, const wchar_t* oper, ui_helper*
//helper->add_ref(void *data); //helper->add_ref(void *data);
is_distortion_get_image = false; is_distortion_get_image = false;
is_distortion_get_image_abnormal = false;
int ret = 0; int ret = 0;
SANE_Bool type = false; SANE_Bool type = false;
unsigned int len = sizeof(SANE_Bool); unsigned int len = sizeof(SANE_Bool);