添加尺寸检测

This commit is contained in:
masayume_ht 2021-08-08 17:07:12 +08:00
parent c2d230d199
commit aa72fa4e41
6 changed files with 34 additions and 7 deletions

View File

@ -85,7 +85,7 @@ BOOL CTwainUI::OnInitDialog()
UpdateUI();
UpdateListConfig();
dataChangeFunction();
setvisable_size(false);
//setvisable_size(false);
#ifdef G200
setvisable_sleepmode(false);
#endif // G200

View File

@ -191,6 +191,14 @@ public:
{
return ++imgtransfered;
};
/// <summary>
/// 获取折角或者尺寸不符的图像索引
/// </summary>
/// <param name="aquire"></param>
/// <param name="updata"></param>
int geterrorindex() {
return error_index;
};
void UpdateScanInfo(int aquire, int updata)
{
@ -256,5 +264,6 @@ protected:
int scannum;
int lose_image_num;
bool is_AndroidOrLinux;
int error_index;
};

View File

@ -318,6 +318,7 @@ void GScanO1003399::config_params(GScanCap& param)
void GScanO1003399::Scanner_StartScan(UINT16 count)
{
error_index = 0;
roller_num = this->count();
scanflag = true;
while (m_paths.Size() > 0)
@ -619,8 +620,8 @@ void GScanO1003399::im_rx()
if(im_dev_count()<2)
return;
}
//std::shared_ptr<std::vector<char>> buffi(new std::vector<char>);
auto& buffi = im_data;
std::shared_ptr<std::vector<char>> buffi(new std::vector<char>);
//auto& buffi = im_data;
int count = front_datasize();
buffi->resize(count);
rx_cmd();
@ -708,7 +709,7 @@ int GScanO1003399::im_dev_count()
{
return scanner_read_reg(m_usb, SR_IM_COUNT); //!< to-list ;
}
static int num = 0;
void GScanO1003399::imgproce(std::shared_ptr<std::vector<char>>& buff)
{
auto& buffs= G400Decode(buff).getImageBuffs();
@ -859,8 +860,12 @@ int GScanO1003399::codeconvter(HGEIntInfo code)
{
switch (code.Code)
{
case 0:
case 1:
error_index = code.Img_Index;
return HAVE_DOGEAR;
case 2:
error_index = code.Img_Index;
return SIZE_ERROR;
default:
break;
}

View File

@ -127,6 +127,7 @@ struct HGEIntInfo
{
HGType From;
unsigned int Code;
unsigned int Img_Index;
};
#define USB_REQ_GET_FPGA_REGS 0x40

View File

@ -1964,6 +1964,12 @@ Result HuagaoDs::pendingXfersEnd(const Identity&, PendingXfers& data) {
if (guiIndicator->GetSafeHwnd())
guiIndicator->ShowWindow(SW_HIDE);
if (ret != -1) {
int index = scanner->geterrorindex();
if (ret == 82)
showmsg("警告", "在第" + to_string(index) + "页检测到折角,停止扫描!", ret);
else if(ret==75)
showmsg("警告", "在第" + to_string(index) + "页检测到尺寸不符,停止扫描!", ret);
else
showmsg("¾¯¸æ", msgs[(UsbSupported)ret], ret);
FileTools::writelog(log_ERROR, msgs[(UsbSupported)ret]);
#ifndef G200
@ -2574,7 +2580,13 @@ Twpp::Result HuagaoDs::startScan()
m_memXferYOff = 0;
m_haveError = true;
//ShellExecute(guiTwain ? guiTwain->m_hWnd : NULL, TEXT("open"), GetHidedlgPath(), str, NULL, SW_HIDE);
showmsg("¾¯¸æ", msgs[(UsbSupported)retCode]);
int index = scanner->geterrorindex();
if (retCode == 82)
showmsg("警告", "在第" + to_string(index) + "页检测到折角,停止扫描!", retCode);
else if (retCode == 75)
showmsg("警告", "在第" + to_string(index) + "页检测到尺寸不符,停止扫描!", retCode);
else
showmsg("警告", msgs[(UsbSupported)retCode], retCode);
FileTools::writelog(log_ERROR, msgs[(UsbSupported)retCode]);
#ifndef G200
scanner->clear_hwerror();

Binary file not shown.