From 14ef905a235eaee1708c5d8136b3387165922fb0 Mon Sep 17 00:00:00 2001 From: masayume <1936714878@qq.com> Date: Mon, 9 May 2022 15:47:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0300/400=203399=E9=80=9F?= =?UTF-8?q?=E5=BA=A6=E6=A8=A1=E5=BC=8F=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HuaGoCorrect/A3.cpp | 47 ++++++++++++++++++----- HuaGoCorrect/HuaGoCorrect.vcxproj | 2 + HuaGoCorrect/HuaGoCorrect.vcxproj.filters | 6 +++ HuaGoCorrect/HuaGoCorrectDlg.cpp | 1 + HuaGoCorrect/IScanner.h | 1 + HuaGoCorrect/gscan3399.cpp | 2 +- HuaGoCorrect/id_config.cpp | 20 ++++++---- HuaGoCorrect/id_config.h | 1 + 8 files changed, 61 insertions(+), 19 deletions(-) diff --git a/HuaGoCorrect/A3.cpp b/HuaGoCorrect/A3.cpp index f9268f7..f8a9fdf 100644 --- a/HuaGoCorrect/A3.cpp +++ b/HuaGoCorrect/A3.cpp @@ -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); } diff --git a/HuaGoCorrect/HuaGoCorrect.vcxproj b/HuaGoCorrect/HuaGoCorrect.vcxproj index c60ce25..1f966ae 100644 --- a/HuaGoCorrect/HuaGoCorrect.vcxproj +++ b/HuaGoCorrect/HuaGoCorrect.vcxproj @@ -222,6 +222,7 @@ opencv_imgproc2410d.lib;%(AdditionalDependencies) + @@ -250,6 +251,7 @@ opencv_imgproc2410d.lib;%(AdditionalDependencies) + diff --git a/HuaGoCorrect/HuaGoCorrect.vcxproj.filters b/HuaGoCorrect/HuaGoCorrect.vcxproj.filters index abf502f..c6fe13c 100644 --- a/HuaGoCorrect/HuaGoCorrect.vcxproj.filters +++ b/HuaGoCorrect/HuaGoCorrect.vcxproj.filters @@ -126,6 +126,9 @@ 头文件 + + 头文件 + @@ -182,6 +185,9 @@ 源文件 + + 源文件 + diff --git a/HuaGoCorrect/HuaGoCorrectDlg.cpp b/HuaGoCorrect/HuaGoCorrectDlg.cpp index 49ab0dc..fd0e81f 100644 --- a/HuaGoCorrect/HuaGoCorrectDlg.cpp +++ b/HuaGoCorrect/HuaGoCorrectDlg.cpp @@ -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())); diff --git a/HuaGoCorrect/IScanner.h b/HuaGoCorrect/IScanner.h index 562f911..8b692ff 100644 --- a/HuaGoCorrect/IScanner.h +++ b/HuaGoCorrect/IScanner.h @@ -73,4 +73,5 @@ public: unsigned short VID; unsigned short PID; unsigned short CPU; + unsigned short Driver_type; }; \ No newline at end of file diff --git a/HuaGoCorrect/gscan3399.cpp b/HuaGoCorrect/gscan3399.cpp index d997314..32ac82e 100644 --- a/HuaGoCorrect/gscan3399.cpp +++ b/HuaGoCorrect/gscan3399.cpp @@ -355,7 +355,7 @@ bool gscan3399::Updata(std::string filename, std::function fun if (!scanner_read_reg(m_usb, 0x101)) return false; auto now = std::chrono::steady_clock::now(); - while (std::chrono::duration(std::chrono::steady_clock::now() - now).count() < 60) + while (std::chrono::duration(std::chrono::steady_clock::now() - now).count() < 70) { int status= scanner_read_reg(m_usb, 0x102); if (status == 2) diff --git a/HuaGoCorrect/id_config.cpp b/HuaGoCorrect/id_config.cpp index 721d4d2..19a8d1c 100644 --- a/HuaGoCorrect/id_config.cpp +++ b/HuaGoCorrect/id_config.cpp @@ -46,7 +46,7 @@ void id_config::SaveConfig(std::vector 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; } diff --git a/HuaGoCorrect/id_config.h b/HuaGoCorrect/id_config.h index 1d6a03f..c7a8bea 100644 --- a/HuaGoCorrect/id_config.h +++ b/HuaGoCorrect/id_config.h @@ -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