调整 G402设备没有最大幅面的问题

This commit is contained in:
13038267101 2023-06-28 11:20:15 +08:00
parent 4f40dfc11a
commit fa2165e527
2 changed files with 31 additions and 1 deletions

View File

@ -161,7 +161,7 @@ hg_scanner::hg_scanner(ScannerSerial serial, const char* dev_name, usb_io* io, i
, is_auto_paper_scan_exit_time(60), is_read_int(true), is_auto_feedmode_(false) , is_auto_paper_scan_exit_time(60), is_read_int(true), is_auto_feedmode_(false)
, firmware_sup_wait_paper_(false),firmware_sup_pick_strength_(false),firmware_sup_log_export_(false),firmware_sup_color_corr_(false),firmware_sup_wake_device_(false) , firmware_sup_wait_paper_(false),firmware_sup_pick_strength_(false),firmware_sup_log_export_(false),firmware_sup_color_corr_(false),firmware_sup_wake_device_(false)
, firmware_sup_double_img(false),firmware_sup_devs_lock_(false),firmware_sup_dpi_300(false),firmware_sup_dpi_600(false),firmware_sup_auto_speed_(false),firmware_sup_morr_(false) , firmware_sup_double_img(false),firmware_sup_devs_lock_(false),firmware_sup_dpi_300(false),firmware_sup_dpi_600(false),firmware_sup_auto_speed_(false),firmware_sup_morr_(false)
, firmware_sup_color_fill_(false),firmware_sup_history_cnt(false) , firmware_sup_color_fill_(false),firmware_sup_history_cnt(false), have_max_size(false)
{ {
#if !defined(_WIN32) && !defined(_WIN64) &&defined(x86_64) #if !defined(_WIN32) && !defined(_WIN64) &&defined(x86_64)
isx86_Advan_ = false; isx86_Advan_ = false;
@ -1366,6 +1366,23 @@ int hg_scanner::set_color_change(void)
} }
bool hg_scanner::jsn_reorganize() bool hg_scanner::jsn_reorganize()
{ {
string str;
int len = setting_jsn_.at(SANE_STD_OPT_NAME_PAPER).at("range").size();
int max_papers[] = { PAPER_MAX_SIZE, PAPER_MAX_SIZE_CLIP, PAPER_TRIGEMINY };
for (auto& v : max_papers)
{
std::string paper(paper_string(v));
for (int i = 0; i < len; i++)
{
setting_jsn_.at(SANE_STD_OPT_NAME_PAPER).at("range").at(i).get_to(str);
if (str.compare(paper) == 0)
{
have_max_size = true;
break;
}
}
}
if (!firmware_sup_wait_paper_ && pid_ == 0x239) if (!firmware_sup_wait_paper_ && pid_ == 0x239)
{ {
erase_option(SANE_STD_OPT_NAME_WAIT_TO_SCAN); erase_option(SANE_STD_OPT_NAME_WAIT_TO_SCAN);
@ -1794,6 +1811,10 @@ int hg_scanner::setting_resolution(void* data, long* len)
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change resolution from %d to %d = %s\n", old, *((int*)data), hg_scanner_err_name(ret)); VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "Change resolution from %d to %d = %s\n", old, *((int*)data), hg_scanner_err_name(ret));
//*((int*)data) = resolution_; //*((int*)data) = resolution_;
if (!have_max_size)
{
return ret;
}
#ifdef DYN_JSON_BETWEEN_PAPER_AND_DPI #ifdef DYN_JSON_BETWEEN_PAPER_AND_DPI
int max_papers[] = { PAPER_MAX_SIZE, PAPER_MAX_SIZE_CLIP, PAPER_TRIGEMINY }; int max_papers[] = { PAPER_MAX_SIZE, PAPER_MAX_SIZE_CLIP, PAPER_TRIGEMINY };
@ -2945,6 +2966,7 @@ void hg_scanner::init_settings(const char* json_setting_text)
jsn_children_.clear(); jsn_children_.clear();
setting_jsn_ = jsonconfig::load_json_from_text(json_setting_text, &jsn_children_); setting_jsn_ = jsonconfig::load_json_from_text(json_setting_text, &jsn_children_);
} }
jsn_reorganize(); jsn_reorganize();
VLOG_MINI_1(LOG_LEVEL_ALL, "Initialize %d settings ...\n", jsn_children_.size() - 1); VLOG_MINI_1(LOG_LEVEL_ALL, "Initialize %d settings ...\n", jsn_children_.size() - 1);
@ -2954,6 +2976,11 @@ void hg_scanner::init_settings(const char* json_setting_text)
if (lang_get_cur_code_page() != DEFAULT_CODE_PAGE) if (lang_get_cur_code_page() != DEFAULT_CODE_PAGE)
on_language_changed(); on_language_changed();
notify_setting_result_ = true; notify_setting_result_ = true;
//setting_jsn_
} }
int hg_scanner::init_settings(int pid) int hg_scanner::init_settings(int pid)
{ {

View File

@ -90,6 +90,9 @@ class hg_scanner
bool save_sizecheck; bool save_sizecheck;
bool read_over_with_no_data_; // 针对第三方调用在最后一段数据时是否返回“SCANNER_ERR_NO_DATA” bool read_over_with_no_data_; // 针对第三方调用在最后一段数据时是否返回“SCANNER_ERR_NO_DATA”
int is_color_type_;//保存最后下发到设备的颜色类型 int is_color_type_;//保存最后下发到设备的颜色类型
bool have_max_size; //条目是否存在最大尺寸
sane_callback ui_ev_cb_; sane_callback ui_ev_cb_;
do_when_born_and_dead<hg_scanner>* scan_life_; do_when_born_and_dead<hg_scanner>* scan_life_;