添加300/400 3399速度模式设置

This commit is contained in:
masayume 2022-05-09 15:47:56 +08:00
parent debf85dd63
commit 14ef905a23
8 changed files with 61 additions and 19 deletions

View File

@ -299,12 +299,27 @@ void CA3::updatespeedmode(bool get)
bool bfound = false;
for (size_t i = 0; i < speedmodeMap.size(); i++)
{
if (parent->m_drv->PID == 0x0139 || parent->m_drv->PID == 0x0239
|| parent->m_drv->PID == 0x8739
|| parent->m_drv->PID == 0x8629)
if (parent->m_drv->CPU == 3399)
{
if((parent->m_drv->PID == 0x239) && (i<4))
if ((parent->m_drv->Driver_type == 200) && (i < 4))
continue;
if ((parent->m_drv->Driver_type == 300) && (i < 8))
continue;
if ((parent->m_drv->Driver_type == 400) && (i < 12))
continue;
if ((parent->m_drv->Driver_type == 400) || (parent->m_drv->Driver_type == 300))
{
switch (speedmode)
{
case 40:speedmode = 1; break;
case 50:speedmode = 2; break;
case 60:speedmode = 3; break;
case 70:speedmode = 4; break;
case 80:speedmode = 5; break;
default:
break;
}
}
if (speedmodeMap[i].Speedmode == speedmode)
{
m_cmbSpeedmode.SetCurSel(i);
@ -314,11 +329,11 @@ void CA3::updatespeedmode(bool get)
break;
}
}
else if (parent->m_drv->PID == 0x0300 || parent->m_drv->PID == 0x0400)
else if ((parent->m_drv->Driver_type == 300 || parent->m_drv->Driver_type == 400)||(parent->m_drv->CPU == 3288))
{
if ((parent->m_drv->PID == 0x0400) && (i < 12))
if ((parent->m_drv->Driver_type == 400) && (i < 12))
continue;
int startindex = parent->m_drv->PID == 0x0300 ? 7: 11;
int startindex = parent->m_drv->Driver_type == 300 ? 7: 11;
m_cmbSpeedmode.SetCurSel(startindex+ speedmode);
bfound = true;
break;
@ -333,14 +348,26 @@ void CA3::updatespeedmode(bool get)
if (cmbindex != -1)
{
auto t_speedmode = speedmodeMap[cmbindex];
if (parent->m_drv->PID == 0x0139 || parent->m_drv->PID == 0x0239 ||
parent->m_drv->PID == 0x8739 || parent->m_drv->PID == 0x8629)
if (parent->m_drv->CPU == 3399)
{
if ((parent->m_drv->Driver_type == 400) || (parent->m_drv->Driver_type == 300))
{
switch (speedmode)
{
case 1:speedmode = 40; break;
case 2:speedmode = 50; break;
case 3:speedmode = 60; break;
case 4:speedmode = 70; break;
case 5:speedmode = 80; break;
default:
break;
}
}
parent->m_drv->GetSpeedMode(t_speedmode.Speedmode, false);
parent->m_drv->SetSptime(0, t_speedmode.GraySp);
parent->m_drv->SetSptime(1, t_speedmode.ColorSp);
}
else if (parent->m_drv->PID == 0x0300 || parent->m_drv->PID == 0x0400)
else if ((parent->m_drv->Driver_type == 300 || parent->m_drv->Driver_type == 400) || (parent->m_drv->CPU == 3288))
{
parent->m_drv->GetSpeedMode(t_speedmode.Speedmode, false);
}

View File

@ -222,6 +222,7 @@ opencv_imgproc2410d.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ClInclude Include="gscn_drv.h" />
<ClInclude Include="HuaGoCorrect.h" />
<ClInclude Include="HuaGoCorrectDlg.h" />
<ClInclude Include="id_config.h" />
<ClInclude Include="ImageMatQueue.h" />
<ClInclude Include="imageprocess.h" />
<ClInclude Include="IScanner.h" />
@ -250,6 +251,7 @@ opencv_imgproc2410d.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ClCompile Include="gscn_drv.cpp" />
<ClCompile Include="HuaGoCorrect.cpp" />
<ClCompile Include="HuaGoCorrectDlg.cpp" />
<ClCompile Include="id_config.cpp" />
<ClCompile Include="ImageMatQueue.cpp" />
<ClCompile Include="imageprocess.cpp" />
<ClCompile Include="JpegBuffer.cpp" />

View File

@ -126,6 +126,9 @@
<ClInclude Include="ScannerTypeConfig.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="id_config.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="HuaGoCorrect.cpp">
@ -182,6 +185,9 @@
<ClCompile Include="ScannerTypeConfig.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="id_config.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="HuaGoCorrect.rc">

View File

@ -632,6 +632,7 @@ void CHuaGoCorrectDlg::OnCbnSelchangeCmbUsbs()
m_drv->CPU = tmp.cpu_type;
m_drv->VID = tmp.vid;
m_drv->PID = tmp.pid;
m_drv->Driver_type = tmp.driver_type;
m_drv->open(i->vid, i->pid, 0);
USES_CONVERSION;
std::string savepath(W2A(GetMainApp()->path.GetBuffer()));

View File

@ -73,4 +73,5 @@ public:
unsigned short VID;
unsigned short PID;
unsigned short CPU;
unsigned short Driver_type;
};

View File

@ -355,7 +355,7 @@ bool gscan3399::Updata(std::string filename, std::function<void(long, long)> fun
if (!scanner_read_reg(m_usb, 0x101))
return false;
auto now = std::chrono::steady_clock::now();
while (std::chrono::duration<double>(std::chrono::steady_clock::now() - now).count() < 60)
while (std::chrono::duration<double>(std::chrono::steady_clock::now() - now).count() < 70)
{
int status= scanner_read_reg(m_usb, 0x102);
if (status == 2)

View File

@ -46,7 +46,7 @@ void id_config::SaveConfig(std::vector<ID_Config> configs)
json j = json::array();
for (int i = 0; i < configs.size(); i++)
{
j.push_back(to_json({configs[i].vid,configs[i].pid,configs[i].cpu_type}));
j.push_back(to_json({configs[i].vid,configs[i].pid,configs[i].cpu_type,configs[i].driver_type}));
}
std::ofstream ofs(ID_JSON_PATH);
ofs << std::setw(4) << j << std::endl;
@ -61,12 +61,14 @@ void id_config::SaveConfig(json j)
json id_config::GetDefaultJson()
{
json j = json::array();
j.push_back(to_json({ 0x3072, 0x239,3399 }));
j.push_back(to_json({ 0x3072, 0x139,3399 }));
j.push_back(to_json({ 0x3072, 0x300,3288 }));
j.push_back(to_json({ 0x3072, 0x400,3288 }));
j.push_back(to_json({ 0x31c9, 0x8629,3399 }));
j.push_back(to_json({ 0x31c9, 0x8739,3399 }));
j.push_back(to_json({ 0x3072, 0x239, 3399, 200 }));
j.push_back(to_json({ 0x3072, 0x139, 3399, 100 }));
j.push_back(to_json({ 0x3072, 0x300, 3288, 300 }));
j.push_back(to_json({ 0x3072, 0x400, 3288, 400 }));
j.push_back(to_json({ 0x3072, 0x339, 3399, 300 }));
j.push_back(to_json({ 0x3072, 0x439, 3399, 400 }));
j.push_back(to_json({ 0x31c9, 0x8629,3399, 100 }));
j.push_back(to_json({ 0x31c9, 0x8739,3399, 200 }));
return j;
}
@ -84,7 +86,8 @@ json id_config::to_json(ID_Config param)
return json{
{"vid",param.vid},
{"pid",param.pid},
{"cpu",param.cpu_type}};
{"cpu",param.cpu_type},
{"type",param.driver_type} };
}
ID_Config id_config::to_param(json j)
@ -93,5 +96,6 @@ ID_Config id_config::to_param(json j)
j.at("vid").get_to(tmp.vid);
j.at("pid").get_to(tmp.pid);
j.at("cpu").get_to(tmp.cpu_type);
j.at("type").get_to(tmp.driver_type);
return tmp;
}

View File

@ -10,6 +10,7 @@ struct ID_Config
std::uint16_t vid;
std::uint16_t pid;
std::uint16_t cpu_type;
std::uint16_t driver_type;
};
class id_config