From 085cdcc9a3f6be52fde9510ed670e01a1d99e4e0 Mon Sep 17 00:00:00 2001 From: masayume <1936714878@qq.com> Date: Tue, 23 Aug 2022 16:03:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=B7=E4=BA=91=E5=A4=A9=E4=B8=93=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- huagao/CFeedPaperPage.cpp | 15 ++++++++---- huagao/CFeedPaperPage.h | 3 ++- huagao/CTwainUI.cpp | 2 +- huagao/Device/GScanO1003399.cpp | 40 +++++++++++++++++++++++++++----- huagao/Device/GScanO1003399.h | 1 + huagao/Device/UsbScanEx.cpp | 2 +- huagao/GscanJsonConfig.cpp | 2 +- huagao/huagaods.cpp | 6 ++++- huagao/huagaods.hpp | 2 +- huagao/stdafx.h | Bin 25538 -> 25538 bytes 10 files changed, 57 insertions(+), 16 deletions(-) diff --git a/huagao/CFeedPaperPage.cpp b/huagao/CFeedPaperPage.cpp index 98bc1024..08f1a9ff 100644 --- a/huagao/CFeedPaperPage.cpp +++ b/huagao/CFeedPaperPage.cpp @@ -132,7 +132,7 @@ void CFeedPaperPage::OnBnClickedScanMode() m_editNum.EnableWindow(m_radioGroupScanMode); } -void CFeedPaperPage::FeedPaperPageUpdate(int val) +void CFeedPaperPage::FeedPaperPageUpdate(int duplux,int papersize) { //CButton* m_tempBtn = (CButton*)(GetDlgItem(IDC_CKBACKROTATION)); ////int ival = val; @@ -140,10 +140,17 @@ void CFeedPaperPage::FeedPaperPageUpdate(int val) // m_tempBtn->SetCheck(0); //BOOL enable = (val == 0 || val == 4); //m_tempBtn->EnableWindow(!enable); - comboxduplux = val; - if ((val > 0) && (val < 4) && (m_cmBoxOrentation.GetCurSel() != 4)) + comboxduplux = duplux; + comboxpapersize = papersize; + if ((duplux > 0) && (duplux < 4) && (m_cmBoxOrentation.GetCurSel() != 4)) { ((CButton*)(GetDlgItem(IDC_CKBACKROTATION)))->EnableWindow(TRUE); +#ifndef G300 + if (duplux == 1 && (papersize == 3 || papersize == 5 || papersize == 7 || papersize == 9 || papersize == 12 || papersize == 14 || papersize == 16)) + { + ((CButton*)(GetDlgItem(IDC_CKBACKROTATION)))->SetCheck(TRUE); + } +#endif // G300 } else { @@ -184,7 +191,7 @@ void CFeedPaperPage::OnBnClickedCkskewdetect() void CFeedPaperPage::OnCbnSelchangeCmborentation() { // TODO: 在此添加控件通知处理程序代码 - FeedPaperPageUpdate(comboxduplux); + FeedPaperPageUpdate(comboxduplux,comboxpapersize); } diff --git a/huagao/CFeedPaperPage.h b/huagao/CFeedPaperPage.h index 99d5538d..84a4830d 100644 --- a/huagao/CFeedPaperPage.h +++ b/huagao/CFeedPaperPage.h @@ -13,7 +13,7 @@ public: CFeedPaperPage(/*std::function datachange,*/CWnd* pParent = nullptr); // 标准构造函数 virtual ~CFeedPaperPage(); - void FeedPaperPageUpdate(int val); + void FeedPaperPageUpdate(int duplux, int papersize); void FeedAutoDescrewUpdate(int val); void OnInitcmBoxOrentation(int selectIndex); CButton dogear; @@ -44,6 +44,7 @@ protected: private: virtual BOOL PreTranslateMessage(MSG* pMsg); int comboxduplux; + int comboxpapersize; /*std::function m_datachange;*/ public: diff --git a/huagao/CTwainUI.cpp b/huagao/CTwainUI.cpp index f06641d1..27bcfe37 100644 --- a/huagao/CTwainUI.cpp +++ b/huagao/CTwainUI.cpp @@ -57,7 +57,7 @@ BOOL CTwainUI::OnInitDialog() if (m_pageBasic.get() && m_pageImageProc.get() && m_pageBrightness.get() && m_pageFeedPaper.get()) { m_pageImageProc->ImageProcPageUpdate(m_pageBasic->m_cmBoxColorMode->GetCurSel(), m_pageBasic->m_cmBoxSS->GetCurSel(), m_pageBasic->m_cmBoxDuplex->GetCurSel(), (getcombox_ss(m_pageBasic->m_cmBoxSS->GetCurSel()) == TwSS::USStatement) || (getcombox_ss(m_pageBasic->m_cmBoxSS->GetCurSel()) == TwSS::None), m_pageBasic->m_Slider_Dpi.m_iPosition); - m_pageFeedPaper->FeedPaperPageUpdate(m_pageBasic->m_cmBoxDuplex->GetCurSel()); + m_pageFeedPaper->FeedPaperPageUpdate(m_pageBasic->m_cmBoxDuplex->GetCurSel(),m_pageBasic->m_cmBoxSS->GetCurSel()); m_pageImageProc->ImageAutoDescrewUpdate(m_pageBasic->m_cmBoxSS->GetCurSel()); //m_pageFeedPaper->FeedAutoDescrewUpdate(m_pageBasic->m_cmBoxSS->GetCurSel()); UpdateUi(); diff --git a/huagao/Device/GScanO1003399.cpp b/huagao/Device/GScanO1003399.cpp index 2ce64a70..db79b261 100644 --- a/huagao/Device/GScanO1003399.cpp +++ b/huagao/Device/GScanO1003399.cpp @@ -59,7 +59,14 @@ GScanO1003399::~GScanO1003399() m_usb.reset(); scanflag = false; + b_imgprothread = false; + + if (m_aquirethread.get() && m_aquirethread->joinable()) + { + m_aquirethread->join(); + m_aquirethread.reset(); + } imgs.ShutDown(); while (m_paths.Size() > 0) @@ -412,7 +419,26 @@ void GScanO1003399::Scanner_StartScan(UINT16 count) scanflag = false; return; } - + if (m_aquirethread.get() && m_aquirethread->joinable()) + { + scanflag = false; + m_aquirethread->join(); + } + scanflag = true; + m_aquirethread.reset(new std::thread([this] { + while (scanflag) + { + if (im_dev_count() > 0) + { + im_rx(); + } + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + while (im_dev_count() > 0) + { + im_rx(); + } + })); start(); bool procmode = (m_param.resolution_dst > 200.0f || m_param.papertype == 52 || m_param.papertype == 54 || m_param.papertype == 131); if (m_imgprocthread.get() && m_imgprocthread->joinable()) @@ -513,8 +539,8 @@ void GScanO1003399::usb_run() switch (info.From) { case IMG: - if (is_runing() && (im_dev_count()>0)) - im_rx(); + /*if (is_runing() && (im_dev_count()>0)) + im_rx();*/ break; case MtBoard: FileTools::writelog(log_ERROR, "Got MotorBoard error code = " + to_string(info.Code)); @@ -546,7 +572,9 @@ void GScanO1003399::usb_run() FileTools::writelog(log_ERROR, "keep last paper true"); this_thread::sleep_for(chrono::milliseconds(100)); while (im_dev_count() > ((m_param.is_duplex && !m_param.en_fold) ? 2 : 1)) - im_rx(); + { + std::this_thread::sleep_for(std::chrono::milliseconds(100));//im_rx(); + } if (!is_kernelsnap_211209) { if (m_param.is_duplex && !m_param.en_fold) pop_dev_im(); @@ -556,8 +584,8 @@ void GScanO1003399::usb_run() else { keeplastimg = false; - while (im_dev_count()) - im_rx(); + /*while (im_dev_count()) + im_rx();*/ } if ((devState != DEV_WRONG) && (get_ErrorCode()<=0)) devState = DEV_STOP; diff --git a/huagao/Device/GScanO1003399.h b/huagao/Device/GScanO1003399.h index 8e2df037..f4e8ad67 100644 --- a/huagao/Device/GScanO1003399.h +++ b/huagao/Device/GScanO1003399.h @@ -113,6 +113,7 @@ private: //std::shared_ptr m_autotext; std::shared_ptr m_imgprocthread; std::shared_ptr m_usbthread; + std::unique_ptr m_aquirethread; std::shared_ptr> im_data; BlockingQueue>> m_imagedata; std::string fwversion; diff --git a/huagao/Device/UsbScanEx.cpp b/huagao/Device/UsbScanEx.cpp index 340b781b..5e8fcc53 100644 --- a/huagao/Device/UsbScanEx.cpp +++ b/huagao/Device/UsbScanEx.cpp @@ -520,7 +520,7 @@ int UsbScanEx::write_bulk(void* data, int len) #ifdef ANDROIDSERIAL GetOverlappedResult(h_pipe, lp_overlap, &dw_size, TRUE); #else - WaitForSingleObject(lp_overlap->hEvent, 500); + WaitForSingleObject(lp_overlap->hEvent, 1000); GetOverlappedResult(h_pipe, lp_overlap, &dw_size, FALSE); #endif // ANDROIDSERIAL return dw_size; diff --git a/huagao/GscanJsonConfig.cpp b/huagao/GscanJsonConfig.cpp index 6b9b517f..1e4f5817 100644 --- a/huagao/GscanJsonConfig.cpp +++ b/huagao/GscanJsonConfig.cpp @@ -1017,7 +1017,7 @@ json GscanJsonConfig::GetDefaultJson() "iEnhance": 0 , "iSharpen": 0 , "bAutoDescrew": true , - "bFillBlcak": true , + "bFillBlcak": false , "iMultiOutPut": false , "bMultiOut": false , "iMultiOut": 0 , diff --git a/huagao/huagaods.cpp b/huagao/huagaods.cpp index 9f083e52..bacec726 100644 --- a/huagao/huagaods.cpp +++ b/huagao/huagaods.cpp @@ -1411,6 +1411,10 @@ Result HuagaoDs::identityOpenDs(const Identity&) { return badValue(); if (mech == Orientation::Landscape || mech == Orientation::Portrait) { m_scanparam->paperAlign = (PaperAlign)mech; + if (mech == Orientation::Landscape && m_scanparam->is_duplex) + { + m_scanparam->is_backrotate180 = 1; + } return success(); } return badValue(); @@ -1779,7 +1783,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) { m_scanparam->fillbackground = mech; return success(); } - return CapSupGetAllResetEx(msg, data, m_scanparam->fillbackground, true); + return CapSupGetAllResetEx(msg, data, m_scanparam->fillbackground, false); //return CapSupGetAllResetEx(msg, data, { FALSE,TRUE }, m_scanparam->fillbackground, Bool(true), m_scanparam->fillbackground ? 1 : 0, 1); }; diff --git a/huagao/huagaods.hpp b/huagao/huagaods.hpp index 40cc3925..354278ec 100644 --- a/huagao/huagaods.hpp +++ b/huagao/huagaods.hpp @@ -113,7 +113,7 @@ private://field Twpp::PixelType m_capPixelType = Twpp::PixelType::Rgb; unsigned short m_jpegQuality = 80; Twpp::Compression m_compression= Twpp::Compression::None; - bool m_bIndicator = true; + bool m_bIndicator = false; bool m_bCustomDsData = true; bool m_bFeederEnabled = true; bool m_bAutoFeed = true; diff --git a/huagao/stdafx.h b/huagao/stdafx.h index bdedce1b536979c5ef763500051044f83a1bd278..72789f414d4300e9c121c9f25e03b5a259a1d4e5 100644 GIT binary patch delta 31 ncmX?fobk|c#tkhTtVRq53