Compare commits

...

3 Commits

Author SHA1 Message Date
13038267101 8c3165aef0 调整402 403实例化错误 2023-03-03 14:12:00 +08:00
13038267101 f2cf983bdd 微调日志 2023-03-03 09:54:37 +08:00
13038267101 433bfbf543 调整设备返回信息退出流程,等收到stop才退出,新增设备自适应(需测试一下双张存图) 2023-03-03 09:52:39 +08:00
5 changed files with 31 additions and 15 deletions

View File

@ -360,7 +360,7 @@ protected:
bool is_kernelsnap3288_230210_; //G300 3288 在230210版本支持真实600dpi
bool is_kernelsnap_220430_; //待纸扫描
bool is_kernelsnap_devsislock; //支持设备锁的版本
bool is_kernelsnap_3C_cccc; //支持偏色校正的版本
bool is_kernelsnap_3C_cccc; //支持偏色校正的版本,自适应配置
SCANCONF img_conf_; //此参数外部不做任何改变请在writedown_image_configuration做修改
std::string img_type_;

View File

@ -457,8 +457,9 @@ void hg_scanner_239::init_version(void)
is_kernelsnap_220430_ = date >= "A0430" ? true : false;
is_kernelsnap_3C_cccc = year >= "3C" ? true : false;
}
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "Firmware version : %s,is_kernelsnap_211209_:%d ,is_kernelsnap_220830_:%d,is_kernelsnap_221027_:%d,is_kernelsnap_220430_:%d\n",
fv.c_str(), is_kernelsnap_211209_, is_kernelsnap_220830_, is_kernelsnap_221027_, is_kernelsnap_220430_);
VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO,
"Firmware version : %s,is_kernelsnap_211209_:%d ,is_kernelsnap_220830_:%d,is_kernelsnap_221027_:%d,is_kernelsnap_220430_:%d,is_kernelsnap_3C_cccc:%d\n",
fv.c_str(), is_kernelsnap_211209_, is_kernelsnap_220830_, is_kernelsnap_221027_, is_kernelsnap_220430_, is_kernelsnap_3C_cccc);
//if (fv.length() >= 10 && (fv[5] > 'A' && atoi(fv.substr(6, 4).c_str()) >= 1209))
// is_kernelsnap_211209_ = atoi(get_fpga().c_str()) >= 35211210;
@ -510,6 +511,11 @@ int hg_scanner_239::writedown_device_configuration(bool type, setting_hardware:
{
dev_conf->params_3399.enable_sizecheck = false;
}
if (is_kernelsnap_3C_cccc && image_prc_param_.bits.paper == PAPER_AUTO_MATCH)
{
dev_conf->params_3399.is_fixedpaper = false;
dev_conf->params_3399.en_autosize = true;
}
ret = write_register(setting3399::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));
@ -1014,8 +1020,8 @@ void hg_scanner_239::thread_get_dves_image(void)
to_cnt = 0,
count = 0;
int auoto_paper_indx = 0;
//status_ = SCANNER_ERR_DEVICE_BUSY;
svdevs_err_.clear();
while (run_)//&& !user_cancel_
{
size = sizeof(buf);
@ -1114,9 +1120,10 @@ void hg_scanner_239::thread_get_dves_image(void)
}
status_ = st;
}
svdevs_err_.push_back(status_);
VLOG_MINI_1(LOG_LEVEL_WARNING, "\346\211\253\346\217\217\345\244\261\350\264\245, read interrupt\350\277\224\345\233\236\347\212\266\346\200\201\344\270\272\357\274\232%s\n", hg_scanner_err_description(status_));
break;
//break; //这个时候退出的话消息就还没读完错误信息先保存下来只有获取到stop时才退出如果没获取完退出可能会导致第二次扫描直接返回扫描完成
//设备返回stop就是告诉我设备已经准备好可以进行下来操作。
}
if (info->From == setting3399::IMG)
@ -1140,14 +1147,19 @@ void hg_scanner_239::thread_get_dves_image(void)
}
else if (info->From == setting3399::STOPSCAN)
{
if (!svdevs_err_.empty())
{
status_ = svdevs_err_.front();
svdevs_err_.clear();
}
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "received 'STOPSCAN' message in usb thread, check remaining image and finish scanning ...\n");
// fetch all buffered images and exit ...
//while(!is_dev_image_process_done())
if (img_conf_.resolution_dst > 200 && is_quality_ == IMG_QUALITY)
/* if (img_conf_.resolution_dst > 200 && is_quality_ == IMG_QUALITY)
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
else
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::this_thread::sleep_for(std::chrono::milliseconds(2000));*/
while (get_image_count() > 0)
{

View File

@ -9,7 +9,7 @@
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <list>
#include "hg_scanner.h"
//#ifdef OEM_HANWANG
@ -27,6 +27,7 @@ class hg_scanner_239 : public hg_scanner
bool rewrite_conf_;
bool reset_;
bool is_start_status;
std::list<int> svdevs_err_;
std::string control_fetch(int addr, int val, int size);
std::string get_fpga(void);
@ -121,7 +122,7 @@ public:
virtual int set_speed_mode(int data) override; //设置速度模式 /*/ data:100,110,120
virtual int get_speed_mode(int& data)override; //获取速度模式 /*/ data:100,110,120
virtual int set_distortion_check_val(int data) override; //设置畸变矫正值
virtual int set_distortion_check_val(int data) override; //设置畸变矫正值
virtual int get_dpi_color_check_val(int &data); //获取畸变矫正
virtual int set_auto_flat(void); //设置自动平场校正
};

View File

@ -180,10 +180,13 @@ hg_scanner_302::hg_scanner_302(const char* dev_name, int pid, usb_io* io) : hg_s
#ifndef MAPPING_FUNCTION_IN_BASE
init_setting_map(setting_map_, ARRAY_SIZE(setting_map_));
#endif
if(init_settings(pid_))
init_settings((jsontext1 + jsontext2).c_str());
else
init_settings((jsontext3 + jsontext4).c_str());
if (init_settings(pid_))
{
if (pid_ == 0x302)
init_settings((jsontext1 + jsontext2).c_str());
else
init_settings((jsontext3 + jsontext4).c_str());
}
//writedown_device_configuration(); // initialize the hardware settings
init_version();
}

View File

@ -262,7 +262,7 @@ hg_scanner* hg_scanner_mgr::create_scanner_g302(const char* name, usb_io* io, sc
}
hg_scanner* hg_scanner_mgr::create_scanner_g402(const char* name, usb_io* io, scanner_handle* h)
{
hg_scanner_302* s = new hg_scanner_302(name, 0x402, io);
hg_scanner_302* s = new hg_scanner_302(name, 0x302, io);
if (h)
*h = s;