智学网在设置待纸扫描时可能要扫描单张,此时取消待纸扫描功能,待恢复到连续扫描时再恢复待纸扫描状态(中间如果用户通过协议设置了待纸扫描,则不恢复之前的状态)

This commit is contained in:
gb 2023-10-16 15:34:23 +08:00
parent dad78e3b20
commit 6e43985480
2 changed files with 30 additions and 0 deletions

View File

@ -162,6 +162,7 @@ hg_scanner::hg_scanner(ScannerSerial serial, const char* dev_name, usb_io* io, i
, 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_color_fill_(false),firmware_sup_history_cnt(false), have_max_size(false), is_discardblank(false)
, auto_scan_restore_(false), auto_scan_prev_(is_auto_paper_scan)
{
#if !defined(_WIN32) && !defined(_WIN64) &&defined(x86_64)
isx86_Advan_ = false;
@ -2352,10 +2353,34 @@ int hg_scanner::setting_scan_mode(void* data, long* len)
if (strcmp(str.c_str(), hg_log::lang_load(ID_OPTION_VALUE_SMZS_LXSM)) == 0)
{
scan_count_ = -1;
// restore AutoScan ?
if (auto_scan_restore_)
{
long len = sizeof(auto_scan_prev_);
setting_auto_paper_scan(&auto_scan_prev_, &len);
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Restore 'AutoScan' to '%s' for user changes scan mode to '%s'\n"
, auto_scan_prev_ ? "true" : "false", str.c_str());
}
}
else
{
setting_jsn_.at(SANE_STD_OPT_NAME_SCAN_COUNT).at("cur").get_to(scan_count_);
// 智学网设置该参数时,程序取消待纸扫描
if (!auto_scan_restore_) // 连续调用时,保留最初状态
{
auto_scan_restore_ = auto_scan_prev_ = is_auto_paper_scan;
if (auto_scan_restore_)
{
bool v = false;
long len = sizeof(v);
setting_auto_paper_scan(&v, &len);
auto_scan_restore_ = true;
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Disable 'AutoScan' for user changes scan mode to '%s'\n", str.c_str());
}
}
}
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "set scanning pages to %d\n", scan_count_);
@ -2634,6 +2659,9 @@ int hg_scanner::setting_auto_pick_paper_threshold(void* data, long* len)
}
int hg_scanner::setting_auto_paper_scan(void* data, long* len)
{
hg_log::log(LOG_LEVEL_DEBUG_INFO, "No 'AutoScan' restroing for setting_auto_paper_scan invoked.\n");
auto_scan_restore_ = false;
is_auto_paper_scan = *((bool *)data);
if (!firmware_sup_wait_paper_ && is_auto_paper_scan)
{

View File

@ -322,6 +322,8 @@ protected:
int feedmode_; // 分纸强度
int sleeptime_; // 睡眠时间
bool is_auto_paper_scan; // 待纸扫描
bool auto_scan_prev_; // 保留待纸扫描程序改变状态之前的值 - 2023-10-16: 智学网根据扫描张数来打开或关闭待纸扫描
bool auto_scan_restore_; // 是否需要恢复待纸扫描状态 - 2023-10-16: 智学网根据扫描张数来打开或关闭待纸扫描
bool size_check; // 尺寸检测
bool save_feedmode_type_; //保存分支强度狀態