diff --git a/hgdriver/hgdev/hg_scanner_239.cpp b/hgdriver/hgdev/hg_scanner_239.cpp index b5823f1..d5c047c 100644 --- a/hgdriver/hgdev/hg_scanner_239.cpp +++ b/hgdriver/hgdev/hg_scanner_239.cpp @@ -796,7 +796,22 @@ int hg_scanner_239::writedown_device_configuration(HGSCANCONF *dev_conf) //dev_conf_.g200params.is_textcorrect = !keep_watermark_; //printf("dev_conf_.g200params.is_textcorrect =%d\r\n",dev_conf_.g200params.is_textcorrect); } - + if (image_prc_param_.bits.rid_color != RID_COLOR_NONE + && (image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE)) + { + dev_conf->g200params.color = 1; + } + if (image_prc_param_.bits.paper == PAPER_AUTO_MATCH + || image_prc_param_.bits.paper == PAPER_MAX_SIZE + || image_prc_param_.bits.paper == PAPER_MAX_SIZE_CLIP + || image_prc_param_.bits.paper == PAPER_TRIGEMINY + || image_prc_param_.bits.paper == PAPER_16K + || image_prc_param_.bits.paper == PAPER_8K + || image_prc_param_.bits.paper == PAPER_16K_LATERAL + ) + { + dev_conf->g200params.enable_sizecheck = false; + } ret = write_register(SR_CONFIG_SCAN_PARAM, dev_conf->value); VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Writedown scanner configuration(0x%x) = %s\n", dev_conf->value, hg_scanner_err_name(ret)); @@ -1228,30 +1243,30 @@ int hg_scanner_239::on_color_mode_changed(int& color_mode) dev_conf_.g200params.color = 1; } - HGSCANCONF d = dev_conf_; + //HGSCANCONF d = dev_conf_; - if (image_prc_param_.bits.rid_color != RID_COLOR_NONE + /*if (image_prc_param_.bits.rid_color != RID_COLOR_NONE &&(image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE) ) { d.g200params.color = 1; ret = writedown_device_configuration(&d); - } + }*/ - if(image_prc_param_.bits.rid_color != RID_COLOR_NONE - && (image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE) - && color_mode == -1) - { - d.g200params.color = 1; - } - else if (image_prc_param_.bits.rid_color == RID_COLOR_NONE - && (image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE) - && color_mode == -1) - { - d.g200params.color = 0; - } - if(color_mode == -1) - ret = writedown_device_configuration(&d); + //if(image_prc_param_.bits.rid_color != RID_COLOR_NONE + //&& (image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE) + //&& color_mode == -1) + //{ + // d.g200params.color = 1; + //} + //else if (image_prc_param_.bits.rid_color == RID_COLOR_NONE + //&& (image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE) + //&& color_mode == -1) + //{ + // d.g200params.color = 0; + //} + //if(color_mode == -1) + //ret = writedown_device_configuration(&d); return ret; } @@ -1299,19 +1314,19 @@ int hg_scanner_239::on_paper_check_changed(bool& check) check = dev_conf_.g200params.enable_sizecheck; } } - if (image_prc_param_.bits.paper == PAPER_AUTO_MATCH - ||image_prc_param_.bits.paper == PAPER_MAX_SIZE - ||image_prc_param_.bits.paper == PAPER_MAX_SIZE_CLIP - ||image_prc_param_.bits.paper == PAPER_TRIGEMINY - ||image_prc_param_.bits.paper == PAPER_16K - ||image_prc_param_.bits.paper == PAPER_8K - ||image_prc_param_.bits.paper == PAPER_16K_LATERAL - ) - { - HGSCANCONF *d = &dev_conf_; - d->g200params.enable_sizecheck = false; - ret = writedown_device_configuration(d); - } + //if (image_prc_param_.bits.paper == PAPER_AUTO_MATCH + // || image_prc_param_.bits.paper == PAPER_MAX_SIZE + // || image_prc_param_.bits.paper == PAPER_MAX_SIZE_CLIP + // || image_prc_param_.bits.paper == PAPER_TRIGEMINY + // || image_prc_param_.bits.paper == PAPER_16K + // || image_prc_param_.bits.paper == PAPER_8K + // || image_prc_param_.bits.paper == PAPER_16K_LATERAL + // ) + //{ + // HGSCANCONF* d = &dev_conf_; + // d->g200params.enable_sizecheck = false; + // ret = writedown_device_configuration(d); + //} return ret; } int hg_scanner_239::on_resolution_changed(int& dpi) @@ -1732,21 +1747,13 @@ int hg_scanner_239::start(void) val = get_device_sleep_stautus(); if (val == 0) { - status_ = SCANNER_ERR_DEVICE_SLEEPING; - //notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING, SANE_EVENT_ERROR, status_); + status_ = SCANNER_ERR_DEVICE_SLEEPING;; VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING); val = notify_sleep(); notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_NOTIFY_SLEEP, SANE_EVENT_ERROR, status_); return status_; } - //if (val != 1) - //{ - // status_ = SCANNER_ERR_DEVICE_SLEEPING; - // VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "scanner's status(0x%x) is considerring as sleepping.\n", val); - - // return status_; - //} val = get_scan_mode(); if (status_ == SCANNER_ERR_DEVICE_NOT_FOUND) @@ -1762,10 +1769,9 @@ int hg_scanner_239::start(void) } notify_ui_working_status(STATU_DESC_REWRITE_CONFIGURATION); - //if(rewrite_conf_) + if(ret == SCANNER_ERR_OK) { - //协议设置方式一定要注意 1:协议结构体做好,start一起发送 2:每次设置一次发送一次 注意事项:除色时颜色切换维彩色使用的是临时变量,下发一次被释放,如果start再次发就会导致协议层被覆盖 - //ret = writedown_device_configuration(); + ret = writedown_device_configuration(); } if(ret == SCANNER_ERR_OK) @@ -1792,7 +1798,6 @@ int hg_scanner_239::start(void) if (ret == SCANNER_ERR_DEVICE_NO_PAPER) { status_ = ret; - //notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER, SANE_EVENT_ERROR, status_); VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER); return ret; } @@ -1802,7 +1807,6 @@ int hg_scanner_239::start(void) io_->set_timeout(1000); if (ret == SCANNER_ERR_OK) { - //status_ = SCANNER_ERR_DEVICE_BUSY; wait_usb_.notify(); this_thread::sleep_for(chrono::milliseconds(100)); ret = try_third_app_after_start(ret);