优化扫描流程;多流输出配置使能项
This commit is contained in:
parent
6655847110
commit
e3e218f086
|
@ -531,6 +531,7 @@ int scanner_hw::scan_one_turn(LPPACKIMAGE img, safe_fifo<int>* cism, int* cism_c
|
||||||
DBG_PRINT("\n\t%d: to rebuild spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
DBG_PRINT("\n\t%d: to rebuild spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
||||||
mem->release();
|
mem->release();
|
||||||
mem = nullptr;
|
mem = nullptr;
|
||||||
|
retrieve_v4l2_mem(cism, cism_cnt);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
int fatal = 0;
|
int fatal = 0;
|
||||||
|
@ -564,11 +565,7 @@ int scanner_hw::scan_one_turn(LPPACKIMAGE img, safe_fifo<int>* cism, int* cism_c
|
||||||
pass = watch.elapse_ms();
|
pass = watch.elapse_ms();
|
||||||
img->pos.paper_ind++;
|
img->pos.paper_ind++;
|
||||||
|
|
||||||
if(count_mode_)
|
if(!count_mode_)
|
||||||
{
|
|
||||||
devui::send_message(devui::UI_STATUS_PAPER_CNT, (uint8_t*)&pass, sizeof(pass));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
img->height = get_image_real_height(minh);
|
img->height = get_image_real_height(minh);
|
||||||
DBG_PRINT("\t%d: to get_image_real_height spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
DBG_PRINT("\t%d: to get_image_real_height spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
||||||
|
@ -607,6 +604,7 @@ int scanner_hw::scan_one_turn(LPPACKIMAGE img, safe_fifo<int>* cism, int* cism_c
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef REBUILD_IN_CIS_THREAD
|
||||||
// retrieve V4L2 memory ...
|
// retrieve V4L2 memory ...
|
||||||
retrieve_v4l2_mem(cism, cism_cnt);
|
retrieve_v4l2_mem(cism, cism_cnt);
|
||||||
DBG_PRINT("\t%d: to retrieve_v4l2_mem spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
DBG_PRINT("\t%d: to retrieve_v4l2_mem spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
||||||
|
@ -617,6 +615,11 @@ int scanner_hw::scan_one_turn(LPPACKIMAGE img, safe_fifo<int>* cism, int* cism_c
|
||||||
utils::to_log(LOG_LEVEL_FATAL, "Scanning stopped for that V4L2 is out of memory!\n");
|
utils::to_log(LOG_LEVEL_FATAL, "Scanning stopped for that V4L2 is out of memory!\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
devui::send_message(devui::UI_STATUS_PAPER_CNT, (uint8_t*)&pass, sizeof(pass));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ret || fatal == MOTOR_BORD_EVENT_SCAN_DONE)
|
if(ret || fatal == MOTOR_BORD_EVENT_SCAN_DONE)
|
||||||
|
@ -666,10 +669,20 @@ int scanner_hw::get_image_real_height(int minh)
|
||||||
|
|
||||||
while(h < minh && watch.elapse_ms() < 500)
|
while(h < minh && watch.elapse_ms() < 500)
|
||||||
{
|
{
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
img_controller_->read(14, h);
|
img_controller_->read(14, h);
|
||||||
}
|
}
|
||||||
h = img_controller_->get_real_height();
|
if(h >= minh)
|
||||||
|
{
|
||||||
|
unsigned int v8 = 0;
|
||||||
|
|
||||||
|
img_controller_->read(8, v8);
|
||||||
|
img_controller_->write(8, v8 & ~8);
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||||
|
img_controller_->read(8, v8);
|
||||||
|
img_controller_->write(8, v8 | 8);
|
||||||
|
}
|
||||||
|
// h = img_controller_->get_real_height();
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
@ -678,6 +691,7 @@ void scanner_hw::retrieve_v4l2_mem(safe_fifo<int>* mem, int* used)
|
||||||
int u = *used,
|
int u = *used,
|
||||||
ind = 0;
|
ind = 0;
|
||||||
|
|
||||||
|
#ifndef REBUILD_IN_CIS_THREAD
|
||||||
while(u >= camera_->get_mem_count() - 2)
|
while(u >= camera_->get_mem_count() - 2)
|
||||||
{
|
{
|
||||||
if(mem->size())
|
if(mem->size())
|
||||||
|
@ -693,6 +707,7 @@ void scanner_hw::retrieve_v4l2_mem(safe_fifo<int>* mem, int* used)
|
||||||
break;
|
break;
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
while(mem->take(ind, false))
|
while(mem->take(ind, false))
|
||||||
{
|
{
|
||||||
u--;
|
u--;
|
||||||
|
|
|
@ -993,8 +993,8 @@ bool MotorBoard::wait_event(int event, int *evdata, int to_ms, int* fatal_ev, in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\twait event %d = %s: evdata = %d, fatal_ev = %d\n", event, waited ? "true" : "false"
|
// printf("\twait event %d = %s: evdata = %d, fatal_ev = %d\n", event, waited ? "true" : "false"
|
||||||
, *evdata, *fatal_ev);
|
// , *evdata, *fatal_ev);
|
||||||
|
|
||||||
return waited;
|
return waited;
|
||||||
}
|
}
|
|
@ -80,7 +80,7 @@ int multi_out::set_value(const char* name/*nullptr for all options*/, void* val/
|
||||||
|
|
||||||
if(strcmp(name, SANE_OPT_NAME(IS_MULTI_OUT)) == 0)
|
if(strcmp(name, SANE_OPT_NAME(IS_MULTI_OUT)) == 0)
|
||||||
{
|
{
|
||||||
multi_ = *(bool*)val;
|
enabled_ = multi_ = *(bool*)val;
|
||||||
refresh_final_mode();
|
refresh_final_mode();
|
||||||
}
|
}
|
||||||
else if(strcmp(name, SANE_OPT_NAME(MULTI_OUT_TYPE)) == 0)
|
else if(strcmp(name, SANE_OPT_NAME(MULTI_OUT_TYPE)) == 0)
|
||||||
|
|
Loading…
Reference in New Issue