增加G100和G200的速度设置功能

This commit is contained in:
yangjiaxuan 2024-07-09 11:32:54 +08:00
parent 6c8a6f2226
commit 7ddf7cf0bc
4 changed files with 57 additions and 63 deletions

View File

@ -196,8 +196,8 @@ int Dialog_InputSerialNum::getSpeedMode()
unsigned int len = sizeof(SANE_Int); unsigned int len = sizeof(SANE_Int);
sane_io_control(m_handle, IO_CTRL_CODE_GET_SPEED_MODE, &speedMode, &len); sane_io_control(m_handle, IO_CTRL_CODE_GET_SPEED_MODE, &speedMode, &len);
const wchar_t G100[6] = { 70,80,90,110 }; const wchar_t G100[6] = { 60,70,80,90,110 };
const wchar_t G200[6] = { 100,110,120,130 }; const wchar_t G200[6] = { 90,100,110,120,130 };
const wchar_t G300[6] = { 40,50,60,70,80,90 }; const wchar_t G300[6] = { 40,50,60,70,80,90 };
const wchar_t G306[6] = { 30,40,50,60,70 }; const wchar_t G306[6] = { 30,40,50,60,70 };
const wchar_t G400[6] = { 40,50,60,70,80,90 }; const wchar_t G400[6] = { 40,50,60,70,80,90 };

View File

@ -607,8 +607,8 @@ QString Form_mainInterface::getSpeedMode()
unsigned int len = sizeof(SANE_Int); unsigned int len = sizeof(SANE_Int);
sane_io_control(m_handle, IO_CTRL_CODE_GET_SPEED_MODE, &speedMode, &len); sane_io_control(m_handle, IO_CTRL_CODE_GET_SPEED_MODE, &speedMode, &len);
const wchar_t G100[6] = { 70,80,90,110 }; const wchar_t G100[6] = { 60,70,80,90,110 };
const wchar_t G200[6] = { 100,110,120,130 }; const wchar_t G200[6] = { 90,100,110,120,130 };
const wchar_t G300[6] = { 40,50,60,70,80,90 }; const wchar_t G300[6] = { 40,50,60,70,80,90 };
const wchar_t G306[6] = { 30,40,50,60,70 }; const wchar_t G306[6] = { 30,40,50,60,70 };
const wchar_t G400[6] = { 40,50,60,70,80,90 }; const wchar_t G400[6] = { 40,50,60,70,80,90 };

View File

@ -242,9 +242,9 @@ class test
unsigned int len = sizeof(int); unsigned int len = sizeof(int);
int speed_mode = *((int*)data); int speed_mode = *((int*)data);
bool type = false; bool type = false;
const char G139[6] = { 70,80,90,110 }; const char G139[6] = { 60,70,80,90,110 };
const char G239[6] = { 100,110,120,130 }; const char G239[6] = { 90,100,110,120,130 };
const char G300[6] = { 40,50,60,70 }; const char G300[6] = { 40,50,60,70,80,90 };
const char G306[6] = { 30,40,50,60,70 }; const char G306[6] = { 30,40,50,60,70 };
const char G400[6] = { 40,50,60,70,80 }; const char G400[6] = { 40,50,60,70,80 };
@ -253,16 +253,35 @@ class test
{ {
return -1; return -1;
} }
std::string str = fv.substr(0, 4); std::string str = fv.substr(0, 2);
std::string str2 = fv.substr(3, 1); std::string str2 = fv.substr(3, 1);
if (str != "G439" && str != "G239" && str != "G139")
{
str = fv.substr(0, 2);
}
if (str2 == "Z" && speed_mode >= 30 && speed_mode <= 70) //设置速度模式为1 2 3 4 5
if (str == "G1" && speed_mode >= 60 && speed_mode <= 110)
{ {
for (size_t i = 0; i < sizeof(G306) / sizeof(G306[0]); i++)//306设置速度模式为1 2 3 4 5 for (size_t i = 0; i < sizeof(G139) / sizeof(G139[0]); i++)
{
if (G139[i] == speed_mode)
{
speed_mode = i + 1;
break;
}
}
}
else if (str == "G2" && speed_mode >= 90 && speed_mode <= 130)
{
for (size_t i = 0; i < sizeof(G239) / sizeof(G239[0]); i++)
{
if (G239[i] == speed_mode)
{
speed_mode = i + 1;
break;
}
}
}
else if (str2 == "Z" && speed_mode >= 30 && speed_mode <= 70)
{
for (size_t i = 0; i < sizeof(G306) / sizeof(G306[0]); i++)
{ {
if (G306[i] == speed_mode) if (G306[i] == speed_mode)
{ {
@ -271,9 +290,20 @@ class test
} }
} }
} }
else if (str == "G3" || str == "G4" && speed_mode >= 40 && speed_mode <= 80) else if (str == "G3" && speed_mode >= 40 && speed_mode <= 90)
{ {
for (size_t i = 0; i < sizeof(G400) / sizeof(G400[0]); i++)//3288设置速度模式为1 2 3 4 5 for (size_t i = 0; i < sizeof(G300) / sizeof(G300[0]); i++)
{
if (G300[i] == speed_mode)
{
speed_mode = i + 1;
break;
}
}
}
else if (str == "G4" && speed_mode >= 40 && speed_mode <= 80)
{
for (size_t i = 0; i < sizeof(G400) / sizeof(G400[0]); i++)
{ {
if (G400[i] == speed_mode) if (G400[i] == speed_mode)
{ {
@ -282,51 +312,9 @@ class test
} }
} }
} }
int ret = helper_->io_control(IO_CTRL_CODE_SET_SPEED_MODE, &speed_mode, &len); int ret = helper_->io_control(IO_CTRL_CODE_SET_SPEED_MODE, &speed_mode, &len);
if (ret != SCANNER_ERR_OK) return ret;
{
return ret;
}
SANE_Int num = 0;
unsigned int l = sizeof(SANE_Int);
ret = helper_->io_control(IO_CTRL_CODE_GET_SPEED_MODE, &num, &l);
int save_num = 0;
if (str == "G3" || str == "G4" && num > 0 && num < 6)
{
for (size_t i = 0; i < sizeof(G400) / sizeof(G400[0]); i++)//3288设置速度模式为1 2 3 4 5
{
if ((num - 1) == i)
{
save_num = G400[i];
break;
}
}
}
else
save_num = num;
wchar_t* infocat = NULL;
wchar_t c[6];
if (num != speed_mode)
{
wchar_t buf[30] = L"设置速度模式失败...现在速度是:";
type = false;
wsprintfW(c, L"%dppm", save_num);
wcscat(buf, c);
infocat = buf;
}
else
{
wchar_t buf[30] = L"设置速度模式成功...现在速度是:";
type = true;
wsprintfW(c, L"%dppm", save_num);
wcscat(buf, c);
infocat = buf;
}
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_MANUAL_CONFIRMATION, (void*)infocat, type);
return SCANNER_ERR_OK;
} }
public: public:
@ -1474,8 +1462,8 @@ public:
fvv = fw.substr(0, 2); fvv = fw.substr(0, 2);
} }
const wchar_t G139[6] = { 70,80,90,110 }; const wchar_t G139[6] = { 60,70,80,90,110 };
const wchar_t G239[6] = { 100,110,120,130 }; const wchar_t G239[6] = { 90,100,110,120,130 };
const wchar_t G300[6] = { 40,50,60,70 }; const wchar_t G300[6] = { 40,50,60,70 };
const wchar_t G400[6] = { 40,50,60,70,80 }; const wchar_t G400[6] = { 40,50,60,70,80 };
SANE_Int num = 0; SANE_Int num = 0;
@ -1627,7 +1615,11 @@ public:
} }
else else
{ {
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"设置固件语言模式成功,重启设备生效", true); helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"设置固件语言模式成功,设备即将重启", true);
int val = 0;
unsigned int len = sizeof(int);
int ret = helper_->io_control(IO_CTRL_CODE_SET_DEVS_REBOOT, &val, &len);
} }
return ret; return ret;

View File

@ -130,6 +130,8 @@
#define HGPDTTOOLDB_NAME_COUNTING_MODE L"COUNTING_MODE" #define HGPDTTOOLDB_NAME_COUNTING_MODE L"COUNTING_MODE"
/* 歪斜检测 */ /* 歪斜检测 */
#define HGPDTTOOLDB_NAME_SKEW_DETECTION L"SKEW_DETECTION" #define HGPDTTOOLDB_NAME_SKEW_DETECTION L"SKEW_DETECTION"
/* 显示屏装配检查 */
#define HGPDTTOOLDB_NAME_SCREEN L"SCREEN"
/* 分纸电机检测 */ /* 分纸电机检测 */
#define HGPDTTOOLDB_NAME_SEPARATER_MOTOR L"SEPARATER_MOTOR" #define HGPDTTOOLDB_NAME_SEPARATER_MOTOR L"SEPARATER_MOTOR"
/* CIS原图初检 */ /* CIS原图初检 */