From 718e7968797aba96aa018ee71ebdb3a325630358 Mon Sep 17 00:00:00 2001 From: 13038267101 Date: Sun, 25 Jun 2023 10:52:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=20=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E5=9C=A8=E4=B8=80=E4=BA=9B=E5=9B=BA?= =?UTF-8?q?=E4=BB=B6=E7=89=88=E6=9C=AC=E4=B8=8A=E5=88=A0=E9=99=A4json?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/hgdev/hg_scanner.cpp | 38 ++++++++++++++++++++++------------- hgdriver/hgdev/hg_scanner.h | 1 + 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/hgdriver/hgdev/hg_scanner.cpp b/hgdriver/hgdev/hg_scanner.cpp index cb058dc..58646ca 100644 --- a/hgdriver/hgdev/hg_scanner.cpp +++ b/hgdriver/hgdev/hg_scanner.cpp @@ -1362,6 +1362,29 @@ int hg_scanner::set_color_change(void) return SCANNER_ERR_OK; } +bool hg_scanner::jsn_reorganize() +{ + bool enble = false; + if (!is_kernelsnap_239_220830_ && pid_ == 0x239) + { + erase_option(SANE_STD_OPT_NAME_WAIT_TO_SCAN); + erase_option(SANE_STD_OPT_NAME_IS_AUTO_FEED_STRENGTH); + erase_option(SANE_STD_OPT_NAME_FEED_STRENGTH); + enble = true; + } + if (!is_kernelsnap_239_220429_ && pid_ == 0x239) + { + erase_option(SANE_STD_OPT_NAME_IS_FILL_COLOR); + enble = true; + } + if (pid_ == 0x239 || pid_ == 0x439) + { + erase_option(SANE_STD_OPT_NAME_RID_GRID); + erase_option(SANE_STD_OPT_NAME_RID_MORR); + enble = true; + } + return enble; +} int hg_scanner::hgpaper_to_devspaper(Paper_Map papermap[], int len, int& paper, bool* exact, TwSS* type) { int ind = 0; @@ -2915,20 +2938,7 @@ void hg_scanner::init_settings(const char* json_setting_text) jsn_children_.clear(); setting_jsn_ = jsonconfig::load_json_from_text(json_setting_text, &jsn_children_); } - if (!is_kernelsnap_239_220830_ && pid_ == 0x239) - { - //setting_jsn_.erase(SANE_STD_OPT_NAME_WAIT_TO_SCAN); - //setting_jsn_.erase(SANE_STD_OPT_NAME_IS_AUTO_FEED_STRENGTH); - //setting_jsn_.erase(SANE_STD_OPT_NAME_FEED_STRENGTH); - erase_option(SANE_STD_OPT_NAME_WAIT_TO_SCAN); - erase_option(SANE_STD_OPT_NAME_IS_AUTO_FEED_STRENGTH); - erase_option(SANE_STD_OPT_NAME_FEED_STRENGTH); - } - if (!is_kernelsnap_239_220429_ && pid_ == 0x239) - { - //setting_jsn_.erase(SANE_STD_OPT_NAME_IS_FILL_COLOR); - erase_option(SANE_STD_OPT_NAME_IS_FILL_COLOR); - } + jsn_reorganize(); VLOG_MINI_1(LOG_LEVEL_ALL, "Initialize %d settings ...\n", jsn_children_.size() - 1); notify_setting_result_ = false; diff --git a/hgdriver/hgdev/hg_scanner.h b/hgdriver/hgdev/hg_scanner.h index 20e52f6..95be7cf 100644 --- a/hgdriver/hgdev/hg_scanner.h +++ b/hgdriver/hgdev/hg_scanner.h @@ -130,6 +130,7 @@ class hg_scanner void reset_custom_area_range(int paper); float reset_custom_area_jsn_value(const char* name, double& var, float range_l, float range_u, float value_l, float value_u); // return cur value int set_color_change(void); + bool jsn_reorganize(); // 固件版本不同 初始化json要做出相对应的删除 public: