From 6a0ecd826c92ccca5c1a1ccc322ae0b4bf8e76de Mon Sep 17 00:00:00 2001 From: masayume <1936714878@qq.com> Date: Thu, 27 Jan 2022 09:50:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=8D=E5=90=8Cdpi?= =?UTF-8?q?=E7=95=B8=E5=8F=98=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HuaGoCorrect/commondef.h | 12 ++++++++++++ HuaGoCorrect/gscan3399.cpp | 16 ++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/HuaGoCorrect/commondef.h b/HuaGoCorrect/commondef.h index f3ef036..fc65d6e 100644 --- a/HuaGoCorrect/commondef.h +++ b/HuaGoCorrect/commondef.h @@ -329,6 +329,18 @@ enum Scanner_Reg_Defs SR_CLR_ROLLER_NUM, SR_GET_ROLLER_NUM, SR_CLR_SCANN_NUM, + SR_GET_H_200_RATIO, + SR_SET_H_200_RATIO, + SR_GET_V_200_RATIO, + SR_SET_V_200_RATIO, + SR_GET_H_300_RATIO, + SR_SET_H_300_RATIO, + SR_GET_V_300_RATIO, + SR_SET_V_300_RATIO, + SR_GET_H_600_RATIO, + SR_SET_H_600_RATIO, + SR_GET_V_600_RATIO, + SR_SET_V_600_RATIO, SR_UPDATA_START = 0x100, SR_UPDATA_STAUTUS = 0x101, SR_UPDATA_MD5_RELUST = 0x102, diff --git a/HuaGoCorrect/gscan3399.cpp b/HuaGoCorrect/gscan3399.cpp index 10098c6..2f2d7ce 100644 --- a/HuaGoCorrect/gscan3399.cpp +++ b/HuaGoCorrect/gscan3399.cpp @@ -200,11 +200,23 @@ std::string gscan3399::GetKernelVersion() void gscan3399::SetRatio(int tyepe, int ration,int dpi) { scanner_write_reg(m_usb, tyepe == 0 ? SR_SET_H_RATIO : SR_SET_V_RATIO, ration); - + if (dpi == 1) + scanner_write_reg(m_usb, tyepe == 0 ? SR_SET_H_200_RATIO : SR_SET_V_200_RATIO, ration); + else if(dpi == 2) + scanner_write_reg(m_usb, tyepe == 0 ? SR_SET_H_300_RATIO : SR_SET_V_300_RATIO, ration); + else + scanner_write_reg(m_usb, tyepe == 0 ? SR_SET_H_600_RATIO : SR_SET_V_600_RATIO, ration); } void gscan3399::GetRatio(int type, int& ratio,int dpi) { - ratio = scanner_read_reg(m_usb, type == 0 ? SR_GET_H_RATIO : SR_GET_V_RATIO); + if (dpi == 1) + ratio = scanner_read_reg(m_usb, type == 0 ? SR_GET_H_200_RATIO : SR_GET_V_200_RATIO); + else if (dpi == 2) + ratio = scanner_read_reg(m_usb, type == 0 ? SR_GET_H_300_RATIO : SR_GET_V_300_RATIO); + else + ratio = scanner_read_reg(m_usb, type == 0 ? SR_GET_H_600_RATIO : SR_GET_V_600_RATIO); + if(*((float*)&ratio) >1.2 || *((float*)&ratio) < 0.8) + ratio = scanner_read_reg(m_usb, type == 0 ? SR_GET_H_RATIO : SR_GET_V_RATIO); } void gscan3399::Reboot(bool loader)