优化扫描流程;多流输出配置使能项

This commit is contained in:
gb 2024-03-09 17:47:57 +08:00
parent 6655847110
commit e3e218f086
3 changed files with 25 additions and 10 deletions

View File

@ -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);
mem->release();
mem = nullptr;
retrieve_v4l2_mem(cism, cism_cnt);
}
#endif
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();
img->pos.paper_ind++;
if(count_mode_)
{
devui::send_message(devui::UI_STATUS_PAPER_CNT, (uint8_t*)&pass, sizeof(pass));
}
else
if(!count_mode_)
{
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);
@ -607,6 +604,7 @@ int scanner_hw::scan_one_turn(LPPACKIMAGE img, safe_fifo<int>* cism, int* cism_c
break;
}
#ifndef REBUILD_IN_CIS_THREAD
// retrieve V4L2 memory ...
retrieve_v4l2_mem(cism, cism_cnt);
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");
break;
}
#endif
}
else
{
devui::send_message(devui::UI_STATUS_PAPER_CNT, (uint8_t*)&pass, sizeof(pass));
}
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)
{
std::this_thread::sleep_for(std::chrono::milliseconds(3));
std::this_thread::sleep_for(std::chrono::milliseconds(1));
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;
}
@ -678,6 +691,7 @@ void scanner_hw::retrieve_v4l2_mem(safe_fifo<int>* mem, int* used)
int u = *used,
ind = 0;
#ifndef REBUILD_IN_CIS_THREAD
while(u >= camera_->get_mem_count() - 2)
{
if(mem->size())
@ -693,6 +707,7 @@ void scanner_hw::retrieve_v4l2_mem(safe_fifo<int>* mem, int* used)
break;
std::this_thread::sleep_for(std::chrono::milliseconds(3));
}
#endif
while(mem->take(ind, false))
{
u--;

View File

@ -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"
, *evdata, *fatal_ev);
// printf("\twait event %d = %s: evdata = %d, fatal_ev = %d\n", event, waited ? "true" : "false"
// , *evdata, *fatal_ev);
return waited;
}

View File

@ -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)
{
multi_ = *(bool*)val;
enabled_ = multi_ = *(bool*)val;
refresh_final_mode();
}
else if(strcmp(name, SANE_OPT_NAME(MULTI_OUT_TYPE)) == 0)