able to get test image :)
This commit is contained in:
parent
d02a40e6dd
commit
d91363b1fe
|
@ -22,7 +22,12 @@ FpgaComm::controller::controller()
|
||||||
status_.reset(new Gpio(PORT_STATUS));
|
status_.reset(new Gpio(PORT_STATUS));
|
||||||
cfg_.reset(new Gpio(PORT_CONFIG));
|
cfg_.reset(new Gpio(PORT_CONFIG));
|
||||||
reload_.reset(new Gpio(PORT_RELOAD));
|
reload_.reset(new Gpio(PORT_RELOAD));
|
||||||
reset_.reset(new Gpio(PORT_RESET));
|
reset_.reset(new GpioOut(PORT_RESET));
|
||||||
|
|
||||||
|
vdd_3voff_.reset(new GpioOut(PORT_VDD_3VOFF));
|
||||||
|
vdd_5ven_.reset(new GpioOut(PORT_VDD_5VEN));
|
||||||
|
init_done_.reset(new Gpio(PORT_INIT_DONE));
|
||||||
|
img_tx_.reset(new Gpio(PORT_IMAGE_TX));
|
||||||
}
|
}
|
||||||
FpgaComm::controller::~controller()
|
FpgaComm::controller::~controller()
|
||||||
{}
|
{}
|
||||||
|
@ -70,6 +75,7 @@ FpgaComm::FpgaComm(int bauds, bool query) : bauds_(bauds)
|
||||||
WR_Reg(AledR);
|
WR_Reg(AledR);
|
||||||
|
|
||||||
controller_->reset();
|
controller_->reset();
|
||||||
|
resetADC();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ typedef struct Frame_FPGA
|
||||||
typedef struct Mode_FPGA
|
typedef struct Mode_FPGA
|
||||||
{
|
{
|
||||||
unsigned short int colorMode : 1;
|
unsigned short int colorMode : 1;
|
||||||
unsigned short int dpi : 2;
|
unsigned short int dpi : 2;//0x01 200dpi 0x02 300dpi 0x03 600dpi
|
||||||
unsigned short int led : 1;
|
unsigned short int led : 1;
|
||||||
unsigned short sample : 9;
|
unsigned short sample : 9;
|
||||||
unsigned short int adcA : 1;
|
unsigned short int adcA : 1;
|
||||||
|
@ -51,14 +51,14 @@ typedef struct Ad_Gain
|
||||||
|
|
||||||
typedef struct CIS_AD_Gain
|
typedef struct CIS_AD_Gain
|
||||||
{
|
{
|
||||||
unsigned short int ad0_value : 8; //!< 数据位
|
unsigned short int ad0_value : 8; //!< æ•°æ<EFBFBD>®ä½?
|
||||||
unsigned short int ad0_reserved : 2; //!< 保留位
|
unsigned short int ad0_reserved : 2; //!< ä¿<EFBFBD>ç•™ä½?
|
||||||
unsigned short int ad0_addr : 5; //!< 寄存器地址
|
unsigned short int ad0_addr : 5; //!< 寄存器地址
|
||||||
unsigned short int ad0_rw : 1; //!< 读写位 1:读, 0:写
|
unsigned short int ad0_rw : 1; //!< 读写� 1:读, 0:�
|
||||||
unsigned short int ad1_value : 8; //!< 数据位
|
unsigned short int ad1_value : 8; //!< æ•°æ<EFBFBD>®ä½?
|
||||||
unsigned short int ad1_reserved : 2; //!< 保留位
|
unsigned short int ad1_reserved : 2; //!< ä¿<EFBFBD>ç•™ä½?
|
||||||
unsigned short int ad1_addr : 5; //!< 寄存器地址
|
unsigned short int ad1_addr : 5; //!< 寄存器地址
|
||||||
unsigned short int ad1_rw : 1; //!< 读写位 1:读, 0:写;
|
unsigned short int ad1_rw : 1; //!< 读写� 1:读, 0:�
|
||||||
} CisAdGain;
|
} CisAdGain;
|
||||||
|
|
||||||
typedef struct CIS_LED_RF
|
typedef struct CIS_LED_RF
|
||||||
|
@ -127,8 +127,10 @@ enum
|
||||||
};
|
};
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
DPI_300 = 0,
|
DPI_200 = 1,
|
||||||
DPI_200,
|
DPI_300 = 2,
|
||||||
|
DPI_600 = 3,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class GpioOut;
|
class GpioOut;
|
||||||
|
@ -146,12 +148,20 @@ class FpgaComm : public IRegsAccess
|
||||||
PORT_STATUS = 69,
|
PORT_STATUS = 69,
|
||||||
PORT_RELOAD = 70,
|
PORT_RELOAD = 70,
|
||||||
PORT_CONFIG = 71,
|
PORT_CONFIG = 71,
|
||||||
|
PORT_VDD_3VOFF = 96,
|
||||||
|
PORT_VDD_5VEN = 98,
|
||||||
|
PORT_INIT_DONE = 99,
|
||||||
|
PORT_IMAGE_TX = 101,
|
||||||
PORT_RESET = 232,
|
PORT_RESET = 232,
|
||||||
};
|
};
|
||||||
std::unique_ptr<Gpio> status_; // status reader - port 69
|
std::unique_ptr<Gpio> status_; // status reader - port 69
|
||||||
std::unique_ptr<Gpio> reload_; // codes reload - port 70
|
std::unique_ptr<Gpio> reload_; // codes reload - port 70
|
||||||
std::unique_ptr<Gpio> cfg_; // configuration reload - port 71
|
std::unique_ptr<Gpio> cfg_; // configuration reload - port 71
|
||||||
std::unique_ptr<Gpio> reset_; // circuit reset - port Fpga_Reset
|
std::unique_ptr<Gpio> reset_; // circuit reset - port Fpga_Reset
|
||||||
|
std::unique_ptr<Gpio> vdd_3voff_;
|
||||||
|
std::unique_ptr<Gpio> vdd_5ven_;
|
||||||
|
std::unique_ptr<Gpio> init_done_;
|
||||||
|
std::unique_ptr<Gpio> img_tx_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
controller();
|
controller();
|
||||||
|
|
|
@ -141,7 +141,7 @@ void* GVideoISP1::read_frame(int timeout, size_t& size, int& ind) {
|
||||||
size = 0;
|
size = 0;
|
||||||
ind = -1;
|
ind = -1;
|
||||||
if (!wait(timeout)){
|
if (!wait(timeout)){
|
||||||
utils::to_log(LOG_LEVEL_FATAL, "read frame time out!!!\n" );
|
utils::to_log(LOG_LEVEL_FATAL, "GVideoISP1::read_frame time out!!!\n" );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
struct v4l2_plane planes[VIDEO_MAX_PLANES];
|
struct v4l2_plane planes[VIDEO_MAX_PLANES];
|
||||||
|
@ -165,6 +165,7 @@ void* GVideoISP1::read_frame(int timeout, size_t& size, int& ind) {
|
||||||
// }
|
// }
|
||||||
ind = buf.index;
|
ind = buf.index;
|
||||||
size = buffers[ind].length;
|
size = buffers[ind].length;
|
||||||
|
utils::to_log(LOG_LEVEL_DEBUG, "\tvideo buf[%d] = %d\n", ind, size);
|
||||||
|
|
||||||
return buffers[ind].start;
|
return buffers[ind].start;
|
||||||
}
|
}
|
||||||
|
@ -196,7 +197,7 @@ void GVideoISP1::start_capturing(void) {
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
LOG_ERROR(utils::format_string("Unable to queue buffer: %s (%d).\n",strerror(errno), errno));
|
LOG_ERROR(utils::format_string("Unable to queue buffer: %s (%d).\n",strerror(errno), errno));
|
||||||
else
|
else
|
||||||
LOG_TRACE(utils::format_string("buf.index = %d VIDIOC_QBUF sucess.\n",i));
|
LOG_TRACE(utils::format_string("buf.index = %d, length = %d, VIDIOC_QBUF sucess.\n", i, buf_size_));
|
||||||
}
|
}
|
||||||
|
|
||||||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||||
|
@ -214,7 +215,7 @@ void GVideoISP1::stop_capturing(void) {
|
||||||
|
|
||||||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||||
if (-1 == ioctl(fd, VIDIOC_STREAMOFF, &type))
|
if (-1 == ioctl(fd, VIDIOC_STREAMOFF, &type))
|
||||||
LOG_ERROR(utils::format_string("streamo off\n"));
|
LOG_ERROR(utils::format_string("stream off\n"));
|
||||||
|
|
||||||
LOG_TRACE(utils::format_string("gVideo stop_capturing\n"));
|
LOG_TRACE(utils::format_string("gVideo stop_capturing\n"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,11 +316,18 @@ void scanner_hw::thread_image_capture(void)
|
||||||
|
|
||||||
utils::to_log(LOG_LEVEL_DEBUG, "scanning thread working ...\n");
|
utils::to_log(LOG_LEVEL_DEBUG, "scanning thread working ...\n");
|
||||||
memset(&img, 0, sizeof(img));
|
memset(&img, 0, sizeof(img));
|
||||||
|
img.bpp = 8;
|
||||||
|
img.channels = 3;
|
||||||
|
img.resolution_x = 200;
|
||||||
|
img.resolution_y = 200;
|
||||||
|
img.width = 3888;
|
||||||
|
img.height = 16380;
|
||||||
motor_->clear_error();
|
motor_->clear_error();
|
||||||
camera_->start();
|
|
||||||
img_controller_->capture();
|
|
||||||
motor_->start();
|
motor_->start();
|
||||||
mb_events_.take(mbev, true);
|
if(mb_events_.take(mbev, true))
|
||||||
|
utils::to_log(LOG_LEVEL_DEBUG, "take first motorboard event: %d - 0x%08x\n", mbev.first, mbev.second);
|
||||||
|
else
|
||||||
|
utils::to_log(LOG_LEVEL_FATAL, "Wait Lifter event before scanning failed.\n");
|
||||||
while(scanning_ && mbev.first == MOTOR_BORD_EVENT_LIFTER_READY) // auto scan cycle ...
|
while(scanning_ && mbev.first == MOTOR_BORD_EVENT_LIFTER_READY) // auto scan cycle ...
|
||||||
{
|
{
|
||||||
motor_->pick_paper();
|
motor_->pick_paper();
|
||||||
|
@ -330,7 +337,7 @@ void scanner_hw::thread_image_capture(void)
|
||||||
{
|
{
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
int ind = -1;
|
int ind = -1;
|
||||||
void* frame = camera_->read_frame(10 * 1000, size, ind);
|
void* frame = camera_->read_frame(3 * 1000, size, ind);
|
||||||
dyn_mem_shared_ptr mem = nullptr;
|
dyn_mem_shared_ptr mem = nullptr;
|
||||||
|
|
||||||
if(!frame)
|
if(!frame)
|
||||||
|
@ -465,6 +472,7 @@ int scanner_hw::set_value(const char* name, void* val)
|
||||||
int scanner_hw::open(std::function<IMAGE_HANDLER_PROTO> image_handler)
|
int scanner_hw::open(std::function<IMAGE_HANDLER_PROTO> image_handler)
|
||||||
{
|
{
|
||||||
this->close();
|
this->close();
|
||||||
|
int fh = 16380;
|
||||||
|
|
||||||
if(!image_handler)
|
if(!image_handler)
|
||||||
return SCANNER_ERR_INVALID_PARAMETER;
|
return SCANNER_ERR_INVALID_PARAMETER;
|
||||||
|
@ -476,9 +484,9 @@ int scanner_hw::open(std::function<IMAGE_HANDLER_PROTO> image_handler)
|
||||||
|
|
||||||
img_controller_->setColorMode(mode_ == "\345\275\251\350\211\262" ? COLOR_MODE : GRAY_MODE);
|
img_controller_->setColorMode(mode_ == "\345\275\251\350\211\262" ? COLOR_MODE : GRAY_MODE);
|
||||||
img_controller_->setDpi(dpi_ == 200 ? DPI_200 : DPI_300);
|
img_controller_->setDpi(dpi_ == 200 ? DPI_200 : DPI_300);
|
||||||
img_controller_->setFrameHeight(frame_h_);
|
|
||||||
img_controller_->setDelayTime(delay_);
|
img_controller_->setDelayTime(delay_);
|
||||||
img_controller_->setSample(sample_);
|
img_controller_->setSample(sample_);
|
||||||
|
// img_controller_->setSp(2520);
|
||||||
|
|
||||||
void(FpgaComm::* exposure[])(int) = {&FpgaComm::setAExposureB, &FpgaComm::setAExposureG
|
void(FpgaComm::* exposure[])(int) = {&FpgaComm::setAExposureB, &FpgaComm::setAExposureG
|
||||||
, &FpgaComm::setAExposureR, &FpgaComm::setBExposureB, &FpgaComm::setBExposureG, &FpgaComm::setBExposureR};
|
, &FpgaComm::setAExposureR, &FpgaComm::setBExposureB, &FpgaComm::setBExposureG, &FpgaComm::setBExposureR};
|
||||||
|
@ -498,9 +506,6 @@ int scanner_hw::open(std::function<IMAGE_HANDLER_PROTO> image_handler)
|
||||||
for(int i = 0; i < FpgaComm::CIS_SECTOR_COUNT; ++i)
|
for(int i = 0; i < FpgaComm::CIS_SECTOR_COUNT; ++i)
|
||||||
img_controller_->setBOffset(i, off_[SIDE_BACK]);
|
img_controller_->setBOffset(i, off_[SIDE_BACK]);
|
||||||
|
|
||||||
camera_.reset(new GVideoISP1());
|
|
||||||
camera_->open(cis_length_, 1000);
|
|
||||||
|
|
||||||
auto cb = [this](int ev, unsigned int data) -> void
|
auto cb = [this](int ev, unsigned int data) -> void
|
||||||
{
|
{
|
||||||
mb_events_.save(std::make_pair(ev, data), true);
|
mb_events_.save(std::make_pair(ev, data), true);
|
||||||
|
@ -536,6 +541,31 @@ int scanner_hw::open(std::function<IMAGE_HANDLER_PROTO> image_handler)
|
||||||
else
|
else
|
||||||
utils::to_log(LOG_LEVEL_FATAL, "Get motor-board confige failed.\n");
|
utils::to_log(LOG_LEVEL_FATAL, "Get motor-board confige failed.\n");
|
||||||
|
|
||||||
|
camera_.reset(new GVideoISP1());
|
||||||
|
camera_->open(3888, fh);
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||||
|
|
||||||
|
img_controller_->setFrameHeight(frame_h_);
|
||||||
|
img_controller_->capture();
|
||||||
|
size_t size;
|
||||||
|
int _int;
|
||||||
|
auto data = camera_->read_frame(100,size,_int);
|
||||||
|
if(data)
|
||||||
|
camera_->add_v4l2_memory(_int);
|
||||||
|
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||||
|
img_controller_->setFrameHeight(fh / 2 * 3);
|
||||||
|
if(1)
|
||||||
|
{
|
||||||
|
// debug ...
|
||||||
|
unsigned int vals[] = {0x5ffa, 0x3300c9d, 0x1, 0xaa00aa, 0x340030aa, 0x1380193
|
||||||
|
, 0x1270131, 0x340030aa, 0x168000c, 0x168017b, 0, 0x0afa3f
|
||||||
|
, 0x3e8};
|
||||||
|
for(int i = 0; i < _countof(vals); ++i)
|
||||||
|
img_controller_->write(i, vals[i]);
|
||||||
|
img_controller_->update();
|
||||||
|
}
|
||||||
|
|
||||||
return SCANNER_ERR_OK;
|
return SCANNER_ERR_OK;
|
||||||
}
|
}
|
||||||
int scanner_hw::start_scan(void)
|
int scanner_hw::start_scan(void)
|
||||||
|
@ -565,6 +595,7 @@ int scanner_hw::start_scan(void)
|
||||||
return DEV_ERR(NO_PAPER);
|
return DEV_ERR(NO_PAPER);
|
||||||
|
|
||||||
scanning_ = true;
|
scanning_ = true;
|
||||||
|
mb_events_.clear();
|
||||||
scan_thread_.reset(new std::thread(&scanner_hw::thread_image_capture, this));
|
scan_thread_.reset(new std::thread(&scanner_hw::thread_image_capture, this));
|
||||||
|
|
||||||
return SCANNER_ERR_OK;
|
return SCANNER_ERR_OK;
|
||||||
|
@ -572,6 +603,7 @@ int scanner_hw::start_scan(void)
|
||||||
int scanner_hw::stop_scan(void)
|
int scanner_hw::stop_scan(void)
|
||||||
{
|
{
|
||||||
scanning_ = auto_scan_ = false;
|
scanning_ = auto_scan_ = false;
|
||||||
|
mb_events_.trigger();
|
||||||
if(motor_.get())
|
if(motor_.get())
|
||||||
{
|
{
|
||||||
motor_->set_auto_paper(false, false);
|
motor_->set_auto_paper(false, false);
|
||||||
|
@ -580,6 +612,7 @@ int scanner_hw::stop_scan(void)
|
||||||
|
|
||||||
if(camera_.get())
|
if(camera_.get())
|
||||||
camera_->stop();
|
camera_->stop();
|
||||||
|
mb_events_.clear();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
class FpgaComm;
|
class FpgaComm;
|
||||||
class GVideoISP1;
|
class GVideoISP1;
|
||||||
|
class gVideo;
|
||||||
class MotorBoard;
|
class MotorBoard;
|
||||||
|
|
||||||
class scanner_hw : public sane_opt_provider
|
class scanner_hw : public sane_opt_provider
|
||||||
|
@ -31,7 +32,7 @@ class scanner_hw : public sane_opt_provider
|
||||||
volatile bool scanning_ = false;
|
volatile bool scanning_ = false;
|
||||||
int time_to_exit_auto_scan_ = 60; // seconds
|
int time_to_exit_auto_scan_ = 60; // seconds
|
||||||
std::unique_ptr<FpgaComm> img_controller_;
|
std::unique_ptr<FpgaComm> img_controller_;
|
||||||
std::unique_ptr<GVideoISP1> camera_;
|
std::unique_ptr<gVideo> camera_;
|
||||||
std::unique_ptr<MotorBoard> motor_;
|
std::unique_ptr<MotorBoard> motor_;
|
||||||
std::unique_ptr<std::thread> scan_thread_;
|
std::unique_ptr<std::thread> scan_thread_;
|
||||||
safe_fifo<std::pair<int, int>> mb_events_;
|
safe_fifo<std::pair<int, int>> mb_events_;
|
||||||
|
@ -53,7 +54,7 @@ class scanner_hw : public sane_opt_provider
|
||||||
std::string family_ = "G200";
|
std::string family_ = "G200";
|
||||||
volatile bool auto_scan_ = false;
|
volatile bool auto_scan_ = false;
|
||||||
int scan_count_ = -1;
|
int scan_count_ = -1;
|
||||||
int cis_length_ = 1632;
|
int cis_length_ = 3888;
|
||||||
int dpi_ = 300;
|
int dpi_ = 300;
|
||||||
int baud_ = 921600;
|
int baud_ = 921600;
|
||||||
int delay_ = 1000;
|
int delay_ = 1000;
|
||||||
|
@ -115,7 +116,7 @@ public:
|
||||||
// "resolution": {
|
// "resolution": {
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "CIS",
|
// "group": "CIS",
|
||||||
// "title": "分辨率",
|
// "title": "分辨�,
|
||||||
// "desc": "设置镜头工作的分辨率",
|
// "desc": "设置镜头工作的分辨率",
|
||||||
// "type": "int",
|
// "type": "int",
|
||||||
// "fix-id": 34840,
|
// "fix-id": 34840,
|
||||||
|
@ -130,7 +131,7 @@ public:
|
||||||
// "cat": "base",
|
// "cat": "base",
|
||||||
// "group": "feeder",
|
// "group": "feeder",
|
||||||
// "title": "待纸扫描",
|
// "title": "待纸扫描",
|
||||||
// "desc": "启用后,文稿放入扫描仪时将自动启动扫描",
|
// "desc": "å<EFBFBD>¯ç”¨å<EFBFBD>Žï¼Œæ–‡ç¨¿æ”¾å…¥æ‰«æ<EFBFBD><EFBFBD>仪时将自动å<EFBFBD>¯åŠ¨æ‰«æ<EFBFBD>?,
|
||||||
// "type": "bool",
|
// "type": "bool",
|
||||||
// "fix-id": 34873,
|
// "fix-id": 34873,
|
||||||
// "ui-pos": 12,
|
// "ui-pos": 12,
|
||||||
|
@ -142,8 +143,8 @@ public:
|
||||||
// "wait-scan-exit": {
|
// "wait-scan-exit": {
|
||||||
// "cat": "base",
|
// "cat": "base",
|
||||||
// "group": "feeder",
|
// "group": "feeder",
|
||||||
// "title": "待纸扫描退出时间",
|
// "title": "待纸扫æ<EFBFBD><EFBFBD>退出时é—?,
|
||||||
// "desc": "设置结束待纸扫描的时间",
|
// "desc": "设置结æ<EFBFBD>Ÿå¾…纸扫æ<EFBFBD><EFBFBD>çš„æ—¶é—?,
|
||||||
// "type": "string",
|
// "type": "string",
|
||||||
// "fix-id": 34920,
|
// "fix-id": 34920,
|
||||||
// "ui-pos": 13,
|
// "ui-pos": 13,
|
||||||
|
@ -158,7 +159,7 @@ public:
|
||||||
// "cat": "base",
|
// "cat": "base",
|
||||||
// "group": "feeder",
|
// "group": "feeder",
|
||||||
// "title": "扫描张数",
|
// "title": "扫描张数",
|
||||||
// "desc": "选择指定数量扫描或连续扫描",
|
// "desc": "选择指定数é‡<EFBFBD>扫æ<EFBFBD><EFBFBD>或连ç»æ‰«æ<EFBFBD>?,
|
||||||
// "type": "string",
|
// "type": "string",
|
||||||
// "fix-id": 34862,
|
// "fix-id": 34862,
|
||||||
// "ui-pos": 15,
|
// "ui-pos": 15,
|
||||||
|
@ -187,7 +188,7 @@ public:
|
||||||
// "cat": "base",
|
// "cat": "base",
|
||||||
// "group": "feeder",
|
// "group": "feeder",
|
||||||
// "title": "自动分纸强度",
|
// "title": "自动分纸强度",
|
||||||
// "desc": "扫描仪自动修正分纸力度",
|
// "desc": "扫æ<EFBFBD><EFBFBD>仪自动修æ£åˆ†çº¸åŠ›åº?,
|
||||||
// "type": "bool",
|
// "type": "bool",
|
||||||
// "fix-id": 34876,
|
// "fix-id": 34876,
|
||||||
// "ui-pos": 27,
|
// "ui-pos": 27,
|
||||||
|
@ -199,7 +200,7 @@ public:
|
||||||
// "feed-strength-value": {
|
// "feed-strength-value": {
|
||||||
// "cat": "base",
|
// "cat": "base",
|
||||||
// "group": "feeder",
|
// "group": "feeder",
|
||||||
// "title": " 进纸失败率",
|
// "title": " 进纸失败�,
|
||||||
// "desc": "高于该值时扫描仪将调整分纸力度",
|
// "desc": "高于该值时扫描仪将调整分纸力度",
|
||||||
// "type": "float",
|
// "type": "float",
|
||||||
// "fix-id": 34877,
|
// "fix-id": 34877,
|
||||||
|
@ -225,9 +226,9 @@ public:
|
||||||
// "ui-pos": 30,
|
// "ui-pos": 30,
|
||||||
// "auth": 0,
|
// "auth": 0,
|
||||||
// "size": 12,
|
// "size": 12,
|
||||||
// "cur": "一般",
|
// "cur": "一�,
|
||||||
// "default": "一般",
|
// "default": "一�,
|
||||||
// "range": ["弱", "一般", "强"],
|
// "range": ["�, "一�, "�],
|
||||||
// "depend": "is-auto-strength!=true"
|
// "depend": "is-auto-strength!=true"
|
||||||
// },
|
// },
|
||||||
// "time-to-sleep": {
|
// "time-to-sleep": {
|
||||||
|
@ -240,14 +241,14 @@ public:
|
||||||
// "ui-pos": 33,
|
// "ui-pos": 33,
|
||||||
// "auth": 0,
|
// "auth": 0,
|
||||||
// "size": 16,
|
// "size": 16,
|
||||||
// "cur": "不休眠",
|
// "cur": "ä¸<EFBFBD>休çœ?,
|
||||||
// "default": "不休眠",
|
// "default": "ä¸<EFBFBD>休çœ?,
|
||||||
// "range": ["不休眠", "五分钟", "十分钟", "半小时", "一小时", "两小时", "四小时"]
|
// "range": ["ä¸<EFBFBD>休çœ?, "五分é’?, "å<><C3A5>分é’?, "å<>Šå°<C3A5>æ—?, "一å°<C3A5>æ—¶", "两å°<C3A5>æ—?, "å››å°<C3A5>æ—?]
|
||||||
// },
|
// },
|
||||||
// "baud": {
|
// "baud": {
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "CIS",
|
// "group": "CIS",
|
||||||
// "title": "波特率",
|
// "title": "波特�,
|
||||||
// "desc": "CIS控制通信速率",
|
// "desc": "CIS控制通信速率",
|
||||||
// "type": "int",
|
// "type": "int",
|
||||||
// "ui-pos": 20,
|
// "ui-pos": 20,
|
||||||
|
@ -261,7 +262,7 @@ public:
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "CIS",
|
// "group": "CIS",
|
||||||
// "title": "延迟响应",
|
// "title": "延迟响应",
|
||||||
// "desc": "采集头接受命令后的动作延迟时间",
|
// "desc": "采集头接å<EFBFBD>—命令å<EFBFBD>Žçš„动作延迟时é—?,
|
||||||
// "type": "int",
|
// "type": "int",
|
||||||
// "ui-pos": 21,
|
// "ui-pos": 21,
|
||||||
// "auth": 0,
|
// "auth": 0,
|
||||||
|
@ -273,7 +274,7 @@ public:
|
||||||
// "frame-h": {
|
// "frame-h": {
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "CIS",
|
// "group": "CIS",
|
||||||
// "title": "帧高度",
|
// "title": "帧高�,
|
||||||
// "desc": "采集头每一帧的采集高度",
|
// "desc": "采集头每一帧的采集高度",
|
||||||
// "type": "int",
|
// "type": "int",
|
||||||
// "ui-pos": 22,
|
// "ui-pos": 22,
|
||||||
|
@ -297,8 +298,8 @@ public:
|
||||||
// "expo-fb": {
|
// "expo-fb": {
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "CIS",
|
// "group": "CIS",
|
||||||
// "title": "曝光度(正面蓝色通道)",
|
// "title": "æ›<EFBFBD>光度(æ£é<EFBFBD>¢è“<EFBFBD>色通é<EFBFBD>“ï¼?,
|
||||||
// "desc": "正面蓝色通道的曝光强度",
|
// "desc": "æ£é<EFBFBD>¢è“<EFBFBD>色通é<EFBFBD>“çš„æ›<EFBFBD>光强åº?,
|
||||||
// "type": "int",
|
// "type": "int",
|
||||||
// "ui-pos": 32,
|
// "ui-pos": 32,
|
||||||
// "auth": 0,
|
// "auth": 0,
|
||||||
|
@ -314,8 +315,8 @@ public:
|
||||||
// "expo-fg": {
|
// "expo-fg": {
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "CIS",
|
// "group": "CIS",
|
||||||
// "title": "曝光度(正面绿色通道)",
|
// "title": "æ›<EFBFBD>光度(æ£é<EFBFBD>¢ç»¿è‰²é€šé<EFBFBD>“ï¼?,
|
||||||
// "desc": "正面绿色通道的曝光强度",
|
// "desc": "æ£é<EFBFBD>¢ç»¿è‰²é€šé<EFBFBD>“çš„æ›<EFBFBD>光强åº?,
|
||||||
// "type": "int",
|
// "type": "int",
|
||||||
// "ui-pos": 31,
|
// "ui-pos": 31,
|
||||||
// "auth": 0,
|
// "auth": 0,
|
||||||
|
@ -331,8 +332,8 @@ public:
|
||||||
// "expo-fr": {
|
// "expo-fr": {
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "CIS",
|
// "group": "CIS",
|
||||||
// "title": "曝光度(正面红色通道)",
|
// "title": "æ›<EFBFBD>光度(æ£é<EFBFBD>¢çº¢è‰²é€šé<EFBFBD>“ï¼?,
|
||||||
// "desc": "正面红色通道的曝光强度",
|
// "desc": "æ£é<EFBFBD>¢çº¢è‰²é€šé<EFBFBD>“çš„æ›<EFBFBD>光强åº?,
|
||||||
// "type": "int",
|
// "type": "int",
|
||||||
// "ui-pos": 30,
|
// "ui-pos": 30,
|
||||||
// "auth": 0,
|
// "auth": 0,
|
||||||
|
@ -348,8 +349,8 @@ public:
|
||||||
// "expo-bb": {
|
// "expo-bb": {
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "CIS",
|
// "group": "CIS",
|
||||||
// "title": "曝光度(背面蓝色通道)",
|
// "title": "æ›<EFBFBD>光度(背é<EFBFBD>¢è“<EFBFBD>色通é<EFBFBD>“ï¼?,
|
||||||
// "desc": "背面蓝色通道的曝光强度",
|
// "desc": "背é<EFBFBD>¢è“<EFBFBD>色通é<EFBFBD>“çš„æ›<EFBFBD>光强åº?,
|
||||||
// "type": "int",
|
// "type": "int",
|
||||||
// "ui-pos": 35,
|
// "ui-pos": 35,
|
||||||
// "auth": 0,
|
// "auth": 0,
|
||||||
|
@ -365,8 +366,8 @@ public:
|
||||||
// "expo-bg": {
|
// "expo-bg": {
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "CIS",
|
// "group": "CIS",
|
||||||
// "title": "曝光度(背面绿色通道)",
|
// "title": "æ›<EFBFBD>光度(背é<EFBFBD>¢ç»¿è‰²é€šé<EFBFBD>“ï¼?,
|
||||||
// "desc": "背面绿色通道的曝光强度",
|
// "desc": "背é<EFBFBD>¢ç»¿è‰²é€šé<EFBFBD>“çš„æ›<EFBFBD>光强åº?,
|
||||||
// "type": "int",
|
// "type": "int",
|
||||||
// "ui-pos": 34,
|
// "ui-pos": 34,
|
||||||
// "auth": 0,
|
// "auth": 0,
|
||||||
|
@ -382,8 +383,8 @@ public:
|
||||||
// "expo-br": {
|
// "expo-br": {
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "CIS",
|
// "group": "CIS",
|
||||||
// "title": "曝光度(背面红色通道)",
|
// "title": "æ›<EFBFBD>光度(背é<EFBFBD>¢çº¢è‰²é€šé<EFBFBD>“ï¼?,
|
||||||
// "desc": "背面红色通道的曝光强度",
|
// "desc": "背é<EFBFBD>¢çº¢è‰²é€šé<EFBFBD>“çš„æ›<EFBFBD>光强åº?,
|
||||||
// "type": "int",
|
// "type": "int",
|
||||||
// "ui-pos": 33,
|
// "ui-pos": 33,
|
||||||
// "auth": 0,
|
// "auth": 0,
|
||||||
|
@ -483,21 +484,21 @@ public:
|
||||||
// "double-chk": {
|
// "double-chk": {
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "feeder",
|
// "group": "feeder",
|
||||||
// "title": "双张检测",
|
// "title": "å<EFBFBD>Œå¼ 检æµ?,
|
||||||
// "desc": "检测是否有两张或者多张纸同时搓进",
|
// "desc": "检测是否有两张或者多张纸同时搓进",
|
||||||
// "type": "string",
|
// "type": "string",
|
||||||
// "ui-pos": 18,
|
// "ui-pos": 18,
|
||||||
// "auth": 0,
|
// "auth": 0,
|
||||||
// "size": 16,
|
// "size": 16,
|
||||||
// "cur": "超声波",
|
// "cur": "超声�,
|
||||||
// "default": "超声波",
|
// "default": "超声�,
|
||||||
// "range": ["超声波", "禁用"]
|
// "range": ["超声æ³?, "ç¦<C3A7>用"]
|
||||||
// },
|
// },
|
||||||
// "is-staple": {
|
// "is-staple": {
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "feeder",
|
// "group": "feeder",
|
||||||
// "title": "装订检测",
|
// "title": "装订检�,
|
||||||
// "desc": "检测是否有订书钉存在",
|
// "desc": "检测是å<EFBFBD>¦æœ‰è®¢ä¹¦é’‰å˜åœ?,
|
||||||
// "type": "bool",
|
// "type": "bool",
|
||||||
// "fix-id": 34861,
|
// "fix-id": 34861,
|
||||||
// "ui-pos": 20,
|
// "ui-pos": 20,
|
||||||
|
@ -510,7 +511,7 @@ public:
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "feeder",
|
// "group": "feeder",
|
||||||
// "title": "走纸速度",
|
// "title": "走纸速度",
|
||||||
// "desc": "设置走纸电机的速度,张\/分(PPM)",
|
// "desc": "è®¾ç½®èµ°çº¸ç”µæœºçš„é€Ÿåº¦ï¼Œå¼ \/分(PPMï¼?,
|
||||||
// "type": "int",
|
// "type": "int",
|
||||||
// "ui-pos": 25,
|
// "ui-pos": 25,
|
||||||
// "auth": 0,
|
// "auth": 0,
|
||||||
|
@ -534,8 +535,8 @@ public:
|
||||||
// "is-check-askew": {
|
// "is-check-askew": {
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "feeder",
|
// "group": "feeder",
|
||||||
// "title": "歪斜检测",
|
// "title": "æªæ–œæ£€æµ?,
|
||||||
// "desc": "检测进纸是否歪斜",
|
// "desc": "检测进纸是å<EFBFBD>¦æªæ–?,
|
||||||
// "type": "bool",
|
// "type": "bool",
|
||||||
// "fix-id": 34868,
|
// "fix-id": 34868,
|
||||||
// "ui-pos": 22,
|
// "ui-pos": 22,
|
||||||
|
@ -547,7 +548,7 @@ public:
|
||||||
// "askew-range": {
|
// "askew-range": {
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "feeder",
|
// "group": "feeder",
|
||||||
// "title": "歪斜容忍度",
|
// "title": "æªæ–œå®¹å¿<EFBFBD>åº?,
|
||||||
// "desc": "值越小,能容忍得送入文稿歪斜角度越小",
|
// "desc": "值越小,能容忍得送入文稿歪斜角度越小",
|
||||||
// "type": "int",
|
// "type": "int",
|
||||||
// "fix-id": 34869,
|
// "fix-id": 34869,
|
||||||
|
@ -566,8 +567,8 @@ public:
|
||||||
// "cis-len": {
|
// "cis-len": {
|
||||||
// "cat": "base",
|
// "cat": "base",
|
||||||
// "group": "关于",
|
// "group": "关于",
|
||||||
// "title": "镜头长",
|
// "title": "镜头�,
|
||||||
// "desc": "图像采集镜头的长度,单位为毫米(mm)",
|
// "desc": "图åƒ<EFBFBD>采集镜头的长度,å<EFBFBD>•ä½<EFBFBD>为毫米(mmï¼?,
|
||||||
// "type": "int",
|
// "type": "int",
|
||||||
// "ui-pos": 30,
|
// "ui-pos": 30,
|
||||||
// "auth": 0,
|
// "auth": 0,
|
||||||
|
@ -596,8 +597,8 @@ public:
|
||||||
// "fpga-ver": {
|
// "fpga-ver": {
|
||||||
// "cat": "none",
|
// "cat": "none",
|
||||||
// "group": "关于",
|
// "group": "关于",
|
||||||
// "title": "CIS控制器版本",
|
// "title": "CIS控制器版�,
|
||||||
// "desc": "镜头参数控制驱动程序版本号",
|
// "desc": "镜头å<EFBFBD>‚数控制驱动程åº<EFBFBD>版本å<EFBFBD>?,
|
||||||
// "type": "string",
|
// "type": "string",
|
||||||
// "ui-pos": 17,
|
// "ui-pos": 17,
|
||||||
// "auth": 0,
|
// "auth": 0,
|
||||||
|
|
|
@ -81,25 +81,25 @@ bool MotorBoard::en_lifter()
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
SMBCONFIG *smbc = (SMBCONFIG *)(&val);
|
SMBCONFIG *smbc = (SMBCONFIG *)(&val);
|
||||||
read(0x00, val);
|
read(MB_PORT_CONFIG, val);
|
||||||
smbc->lifter_en = 1;
|
smbc->lifter_en = 1;
|
||||||
write(0x00, val);
|
write(MB_PORT_CONFIG, val);
|
||||||
smbc->lifter_en = 0;
|
smbc->lifter_en = 0;
|
||||||
return write(0x00, val);
|
return write(MB_PORT_CONFIG, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotorBoard::pick_paper(void)
|
void MotorBoard::pick_paper(void)
|
||||||
{
|
{
|
||||||
unsigned int val,pick_en;
|
unsigned int val,pick_en;
|
||||||
SMBCONFIG *smbc = (SMBCONFIG *)(&val);
|
SMBCONFIG *smbc = (SMBCONFIG *)(&val);
|
||||||
read(0x00, val);
|
read(MB_PORT_CONFIG, val);
|
||||||
smbc->pick_paper = 0;
|
smbc->pick_paper = 0;
|
||||||
write(0x00, val);
|
write(MB_PORT_CONFIG, val);
|
||||||
std::this_thread::sleep_for(std::chrono::microseconds(400));
|
std::this_thread::sleep_for(std::chrono::microseconds(400));
|
||||||
smbc->pick_paper = 1;
|
smbc->pick_paper = 1;
|
||||||
write(0x00, val);
|
write(MB_PORT_CONFIG, val);
|
||||||
std::string v_str = std::to_string(m_version);
|
std::string v_str = std::to_string(m_version);
|
||||||
if(v_str.size()<8)
|
// if(v_str.size()<8)
|
||||||
return;
|
return;
|
||||||
uint32_t date = atoi(v_str.substr(2,6).c_str());
|
uint32_t date = atoi(v_str.substr(2,6).c_str());
|
||||||
#ifdef G100
|
#ifdef G100
|
||||||
|
@ -114,13 +114,13 @@ void MotorBoard::pick_paper(void)
|
||||||
if(!(pick_en&0xffff))
|
if(!(pick_en&0xffff))
|
||||||
{
|
{
|
||||||
smbc->pick_paper = 0;
|
smbc->pick_paper = 0;
|
||||||
write(0x00, val);
|
write(MB_PORT_CONFIG, val);
|
||||||
std::this_thread::sleep_for(std::chrono::microseconds(400));
|
std::this_thread::sleep_for(std::chrono::microseconds(400));
|
||||||
smbc->pick_paper = 1;
|
smbc->pick_paper = 1;
|
||||||
write(0x00, val);
|
write(MB_PORT_CONFIG, val);
|
||||||
}
|
}
|
||||||
// smbc->pick_paper = 0;
|
// smbc->pick_paper = 0;
|
||||||
// write(0x00, val);
|
// write(MB_PORT_CONFIG, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotorBoard::clean_paper_road(){
|
void MotorBoard::clean_paper_road(){
|
||||||
|
@ -191,11 +191,11 @@ bool MotorBoard::wait_done(int timeout_ms)
|
||||||
int MotorBoard::os_mode()
|
int MotorBoard::os_mode()
|
||||||
{
|
{
|
||||||
// unsigned int val;
|
// unsigned int val;
|
||||||
// read(0x02, val);
|
// read(MB_PORT_MODE, val);
|
||||||
// SMB_MODE *smb_mode = (SMB_MODE *)&val;
|
// SMB_MODE *smb_mode = (SMB_MODE *)&val;
|
||||||
// return smb_mode->scan_mode;
|
// return smb_mode->scan_mode;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
read(0x06,val);
|
read(MB_PORT_FUNCTION,val);
|
||||||
SMB_FUNC smb_func = *(SMB_FUNC*)&val;
|
SMB_FUNC smb_func = *(SMB_FUNC*)&val;
|
||||||
return smb_func.param.work_mode == 1;
|
return smb_func.param.work_mode == 1;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ int MotorBoard::os_mode()
|
||||||
bool MotorBoard::paper_ready()
|
bool MotorBoard::paper_ready()
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
read(0x02, val);
|
read(MB_PORT_MODE, val);
|
||||||
SMB_MODE *smb_mode = (SMB_MODE *)&val;
|
SMB_MODE *smb_mode = (SMB_MODE *)&val;
|
||||||
return smb_mode->feeding_paper_ready;
|
return smb_mode->feeding_paper_ready;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ bool MotorBoard::paper_ready()
|
||||||
bool MotorBoard::is_scanning()
|
bool MotorBoard::is_scanning()
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
read(0x02, val);
|
read(MB_PORT_MODE, val);
|
||||||
SMB_MODE *smb_mode = (SMB_MODE *)&val;
|
SMB_MODE *smb_mode = (SMB_MODE *)&val;
|
||||||
return smb_mode->work_status;
|
return smb_mode->work_status;
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ bool MotorBoard::is_scanning()
|
||||||
int MotorBoard::paper_counter()
|
int MotorBoard::paper_counter()
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
read(0x02, val);
|
read(MB_PORT_MODE, val);
|
||||||
SMBMODE *smb_mode = (SMBMODE *)&val;
|
SMBMODE *smb_mode = (SMBMODE *)&val;
|
||||||
return smb_mode->scan_num;
|
return smb_mode->scan_num;
|
||||||
}
|
}
|
||||||
|
@ -227,11 +227,11 @@ int MotorBoard::paper_counter()
|
||||||
bool MotorBoard::set_paper_inspect_param(unsigned int value /* = 1000 */)
|
bool MotorBoard::set_paper_inspect_param(unsigned int value /* = 1000 */)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x04, val))
|
if (!read(MB_PORT_CONFIG_EX, val))
|
||||||
return false;
|
return false;
|
||||||
SMBCONFIGEXT *smb_config_ext = (SMBCONFIGEXT *)&val;
|
SMBCONFIGEXT *smb_config_ext = (SMBCONFIGEXT *)&val;
|
||||||
smb_config_ext->error_range_set = value;
|
smb_config_ext->error_range_set = value;
|
||||||
return write(0x04, val);
|
return write(MB_PORT_CONFIG_EX, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotorBoard::get_keeplastpaper(){
|
bool MotorBoard::get_keeplastpaper(){
|
||||||
|
@ -241,32 +241,32 @@ bool MotorBoard::get_keeplastpaper(){
|
||||||
bool MotorBoard::set_paper_inpect_info(unsigned int value)
|
bool MotorBoard::set_paper_inpect_info(unsigned int value)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x04, val))
|
if (!read(MB_PORT_CONFIG_EX, val))
|
||||||
return false;
|
return false;
|
||||||
SMBCONFIGEXT *smb_config_ext = (SMBCONFIGEXT *)&val;
|
SMBCONFIGEXT *smb_config_ext = (SMBCONFIGEXT *)&val;
|
||||||
smb_config_ext->paper_infor = value;
|
smb_config_ext->paper_infor = value;
|
||||||
return write(0x04, val);
|
return write(MB_PORT_CONFIG_EX, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotorBoard::set_paper_inspect(bool enable /* = true */)
|
bool MotorBoard::set_paper_inspect(bool enable /* = true */)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x04, val))
|
if (!read(MB_PORT_CONFIG_EX, val))
|
||||||
return false;
|
return false;
|
||||||
SMBCONFIGEXT *smb_config_ext = (SMBCONFIGEXT *)&val;
|
SMBCONFIGEXT *smb_config_ext = (SMBCONFIGEXT *)&val;
|
||||||
smb_config_ext->paper_size_check_en = enable;
|
smb_config_ext->paper_size_check_en = enable;
|
||||||
return write(0x04, val);
|
return write(MB_PORT_CONFIG_EX, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotorBoard::set_double_inpect(bool enable)
|
bool MotorBoard::set_double_inpect(bool enable)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x00, val))
|
if (!read(MB_PORT_CONFIG, val))
|
||||||
return false;
|
return false;
|
||||||
// enable?m_statecontrol->lcdcontrol(4):m_statecontrol->lcdcontrol(5);
|
// enable?m_statecontrol->lcdcontrol(4):m_statecontrol->lcdcontrol(5);
|
||||||
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
||||||
smb_config->double_paper = enable;
|
smb_config->double_paper = enable;
|
||||||
return write(0x00, val);
|
return write(MB_PORT_CONFIG, val);
|
||||||
}
|
}
|
||||||
bool MotorBoard::get_doublle_inpect()
|
bool MotorBoard::get_doublle_inpect()
|
||||||
{
|
{
|
||||||
|
@ -275,16 +275,16 @@ bool MotorBoard::get_doublle_inpect()
|
||||||
bool MotorBoard::set_double_out_en(bool enable)
|
bool MotorBoard::set_double_out_en(bool enable)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x00, val))
|
if (!read(MB_PORT_CONFIG, val))
|
||||||
return false;
|
return false;
|
||||||
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
||||||
smb_config->double_out_en = enable;
|
smb_config->double_out_en = enable;
|
||||||
return write(0x00, val);
|
return write(MB_PORT_CONFIG, val);
|
||||||
}
|
}
|
||||||
bool MotorBoard::get_double_out_en()
|
bool MotorBoard::get_double_out_en()
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x00, val))
|
if (!read(MB_PORT_CONFIG, val))
|
||||||
return false;
|
return false;
|
||||||
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
||||||
return smb_config->double_out_en;
|
return smb_config->double_out_en;
|
||||||
|
@ -292,11 +292,11 @@ bool MotorBoard::get_double_out_en()
|
||||||
bool MotorBoard::set_staple_inpect(bool enable)
|
bool MotorBoard::set_staple_inpect(bool enable)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x00, val))
|
if (!read(MB_PORT_CONFIG, val))
|
||||||
return false;
|
return false;
|
||||||
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
||||||
smb_config->staple_enable = enable;
|
smb_config->staple_enable = enable;
|
||||||
return write(0x00, val);
|
return write(MB_PORT_CONFIG, val);
|
||||||
}
|
}
|
||||||
bool MotorBoard::get_staple_inpect()
|
bool MotorBoard::get_staple_inpect()
|
||||||
{
|
{
|
||||||
|
@ -310,35 +310,35 @@ bool MotorBoard::set_cuospeed(int value)
|
||||||
return false;
|
return false;
|
||||||
SMBCONFIGEXT *smb_config = (SMBCONFIGEXT *)&val;
|
SMBCONFIGEXT *smb_config = (SMBCONFIGEXT *)&val;
|
||||||
smb_config->cuo_speed = value;
|
smb_config->cuo_speed = value;
|
||||||
return write(0x04, val);
|
return write(MB_PORT_CONFIG_EX, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
// bool MotorBoard::set_en600DPI(bool en)
|
// bool MotorBoard::set_en600DPI(bool en)
|
||||||
// {
|
// {
|
||||||
// unsigned int val;
|
// unsigned int val;
|
||||||
// if (!read(0x00, val))
|
// if (!read(MB_PORT_CONFIG, val))
|
||||||
// return false;
|
// return false;
|
||||||
// SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
// SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
||||||
// smb_config->dpi600 = en?1:0;
|
// smb_config->dpi600 = en?1:0;
|
||||||
// return write(0x00, val);
|
// return write(MB_PORT_CONFIG, val);
|
||||||
// }
|
// }
|
||||||
bool MotorBoard::set_color_mode(int mode)
|
bool MotorBoard::set_color_mode(int mode)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x00, val))
|
if (!read(MB_PORT_CONFIG, val))
|
||||||
return false;
|
return false;
|
||||||
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
||||||
smb_config->color_mode = mode;
|
smb_config->color_mode = mode;
|
||||||
return write(0x00, val);
|
return write(MB_PORT_CONFIG, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotorBoard::set_slowmoire(bool en){
|
bool MotorBoard::set_slowmoire(bool en){
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x00, val))
|
if (!read(MB_PORT_CONFIG, val))
|
||||||
return false;
|
return false;
|
||||||
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
||||||
smb_config->slow_moire = en;
|
smb_config->slow_moire = en;
|
||||||
return write(0x00, val);
|
return write(MB_PORT_CONFIG, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -350,35 +350,35 @@ int MotorBoard::get_color_mode()
|
||||||
bool MotorBoard::set_speed_mode(int mode)
|
bool MotorBoard::set_speed_mode(int mode)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x00, val))
|
if (!read(MB_PORT_CONFIG, val))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
||||||
smb_config->speed_set_enable = 1;
|
smb_config->speed_set_enable = 1;
|
||||||
smb_config->v_setting = mode;
|
smb_config->v_setting = mode;
|
||||||
write(0x00, val);
|
write(MB_PORT_CONFIG, val);
|
||||||
smb_config->speed_set_enable = 0;
|
smb_config->speed_set_enable = 0;
|
||||||
return write(0x00, val);
|
return write(MB_PORT_CONFIG, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotorBoard::set_speed_mode_v_temp(int mode)
|
bool MotorBoard::set_speed_mode_v_temp(int mode)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x00, val))
|
if (!read(MB_PORT_CONFIG, val))
|
||||||
return false;
|
return false;
|
||||||
printf(" set v_tmp = %d \n",mode);
|
printf(" set v_tmp = %d \n",mode);
|
||||||
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
||||||
smb_config->speed_set_enable = 1;
|
smb_config->speed_set_enable = 1;
|
||||||
smb_config->v_temp = mode;
|
smb_config->v_temp = mode;
|
||||||
write(0x00, val);
|
write(MB_PORT_CONFIG, val);
|
||||||
smb_config->speed_set_enable = 0;
|
smb_config->speed_set_enable = 0;
|
||||||
return write(0x00, val);
|
return write(MB_PORT_CONFIG, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int MotorBoard::get_speed_mode()
|
int MotorBoard::get_speed_mode()
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x00, val))
|
if (!read(MB_PORT_CONFIG, val))
|
||||||
return -1;
|
return -1;
|
||||||
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
||||||
return smb_config->v_setting;
|
return smb_config->v_setting;
|
||||||
|
@ -411,8 +411,6 @@ void MotorBoard::pin_call(unsigned int pinNum)
|
||||||
SMBSTATUS *s = (SMBSTATUS *)&val;
|
SMBSTATUS *s = (SMBSTATUS *)&val;
|
||||||
if (!read(MB_PORT_STATUS, val))
|
if (!read(MB_PORT_STATUS, val))
|
||||||
utils::to_log(LOG_LEVEL_FATAL, "read motorboard status failed.\n");
|
utils::to_log(LOG_LEVEL_FATAL, "read motorboard status failed.\n");
|
||||||
else
|
|
||||||
utils::to_log(LOG_LEVEL_DEBUG, "motorboard status = 0x%08x\n", val);
|
|
||||||
if(s->keep_last_paper) // (val & 0x800)
|
if(s->keep_last_paper) // (val & 0x800)
|
||||||
{
|
{
|
||||||
//printf("\n keep_last_paper ");
|
//printf("\n keep_last_paper ");
|
||||||
|
@ -467,7 +465,7 @@ void MotorBoard::pin_call(unsigned int pinNum)
|
||||||
{
|
{
|
||||||
cv_paper_in.notify_all();
|
cv_paper_in.notify_all();
|
||||||
unsigned int papercount = 0;
|
unsigned int papercount = 0;
|
||||||
read(0x02,papercount);
|
read(MB_PORT_MODE,papercount);
|
||||||
SMBMODE smbmode = *(SMBMODE*)&papercount;
|
SMBMODE smbmode = *(SMBMODE*)&papercount;
|
||||||
printf("paper in arm count = %d ,motorcount = %d\n",++countindex,smbmode.scan_num);
|
printf("paper in arm count = %d ,motorcount = %d\n",++countindex,smbmode.scan_num);
|
||||||
startcapimage(true);
|
startcapimage(true);
|
||||||
|
@ -505,26 +503,26 @@ bool MotorBoard::read(unsigned int addr, unsigned int &val)
|
||||||
|
|
||||||
bool MotorBoard::set_time_error(int value){
|
bool MotorBoard::set_time_error(int value){
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x05, val))
|
if (!read(MB_PORT_TIME, val))
|
||||||
return false;
|
return false;
|
||||||
SMBCONFIGTIME *smb_config = (SMBCONFIGTIME *)&val;
|
SMBCONFIGTIME *smb_config = (SMBCONFIGTIME *)&val;
|
||||||
smb_config->error_time_set = value;
|
smb_config->error_time_set = value;
|
||||||
return write(0x05, val);
|
return write(MB_PORT_TIME, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotorBoard::set_screw_inpect(bool enable)
|
bool MotorBoard::set_screw_inpect(bool enable)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x00, val))
|
if (!read(MB_PORT_CONFIG, val))
|
||||||
return false;
|
return false;
|
||||||
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
||||||
smb_config->skew_enable = enable;
|
smb_config->skew_enable = enable;
|
||||||
return write(0x00, val);
|
return write(MB_PORT_CONFIG, val);
|
||||||
}
|
}
|
||||||
bool MotorBoard::get_screw_inpect()
|
bool MotorBoard::get_screw_inpect()
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
read(0x00, val);
|
read(MB_PORT_CONFIG, val);
|
||||||
SMBCONFIG *smb_mode = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_mode = (SMBCONFIG *)&val;
|
||||||
return smb_mode->skew_enable;
|
return smb_mode->skew_enable;
|
||||||
}
|
}
|
||||||
|
@ -532,37 +530,37 @@ bool MotorBoard::get_screw_inpect()
|
||||||
bool MotorBoard::set_screw_level(int level)
|
bool MotorBoard::set_screw_level(int level)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x00, val))
|
if (!read(MB_PORT_CONFIG, val))
|
||||||
return false;
|
return false;
|
||||||
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
||||||
smb_config->skew_parameter = level;
|
smb_config->skew_parameter = level;
|
||||||
return write(0x00, val);
|
return write(MB_PORT_CONFIG, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotorBoard::set_auto_paper(bool enable,bool enkey){
|
bool MotorBoard::set_auto_paper(bool enable,bool enkey){
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x00, val))
|
if (!read(MB_PORT_CONFIG, val))
|
||||||
return false;
|
return false;
|
||||||
// m_statecontrol?m_statecontrol->setautopaperflag(enable,enkey):void(0);
|
// m_statecontrol?m_statecontrol->setautopaperflag(enable,enkey):void(0);
|
||||||
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
||||||
smb_config->autofeed_mode = enable;
|
smb_config->autofeed_mode = enable;
|
||||||
return write(0x00, val);
|
return write(MB_PORT_CONFIG, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotorBoard::set_long_paper(bool enable)
|
bool MotorBoard::set_long_paper(bool enable)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x00, val))
|
if (!read(MB_PORT_CONFIG, val))
|
||||||
return false;
|
return false;
|
||||||
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_config = (SMBCONFIG *)&val;
|
||||||
smb_config->paper = enable;
|
smb_config->paper = enable;
|
||||||
return write(0x00, val);
|
return write(MB_PORT_CONFIG, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int MotorBoard::get_screw_level()
|
int MotorBoard::get_screw_level()
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
auto ret= read(0x00, val);
|
auto ret= read(MB_PORT_CONFIG, val);
|
||||||
if(!ret)
|
if(!ret)
|
||||||
return -1;
|
return -1;
|
||||||
SMBCONFIG *smb_mode = (SMBCONFIG *)&val;
|
SMBCONFIG *smb_mode = (SMBCONFIG *)&val;
|
||||||
|
@ -573,23 +571,23 @@ void MotorBoard::start_countmode()
|
||||||
{
|
{
|
||||||
unsigned int regval=0;
|
unsigned int regval=0;
|
||||||
|
|
||||||
read(0x06,regval);
|
read(MB_PORT_FUNCTION,regval);
|
||||||
utils::to_log(LOG_LEVEL_DEBUG, "func6 regval = 0x%08x\n", regval);
|
utils::to_log(LOG_LEVEL_DEBUG, "func6 regval = 0x%08x\n", regval);
|
||||||
SMBFUNC func = *(SMBFUNC*)®val;
|
SMBFUNC func = *(SMBFUNC*)®val;
|
||||||
func.param.work_mode =1;
|
func.param.work_mode =1;
|
||||||
func.param.func_feed_mid = 1;
|
func.param.func_feed_mid = 1;
|
||||||
func.param.func_clear_count = 1;
|
func.param.func_clear_count = 1;
|
||||||
utils::to_log(LOG_LEVEL_DEBUG, "func6 value = 0x%08x\n", func.value);
|
utils::to_log(LOG_LEVEL_DEBUG, "func6 value = 0x%08x\n", func.value);
|
||||||
write(0x06,func.value);
|
write(MB_PORT_FUNCTION,func.value);
|
||||||
func.param.func_encount = 1;
|
func.param.func_encount = 1;
|
||||||
func.param.key_sound = 1;
|
func.param.key_sound = 1;
|
||||||
func.param.func_clear_count = 0;
|
func.param.func_clear_count = 0;
|
||||||
utils::to_log(LOG_LEVEL_DEBUG, "func6 value = 0x%08x\n", func.value);
|
utils::to_log(LOG_LEVEL_DEBUG, "func6 value = 0x%08x\n", func.value);
|
||||||
write(0x06,func.value);
|
write(MB_PORT_FUNCTION,func.value);
|
||||||
func.param.func_encount = 0;
|
func.param.func_encount = 0;
|
||||||
func.param.key_sound = 0;
|
func.param.key_sound = 0;
|
||||||
utils::to_log(LOG_LEVEL_DEBUG, "func6 value = 0x%08x\n",func.value);
|
utils::to_log(LOG_LEVEL_DEBUG, "func6 value = 0x%08x\n",func.value);
|
||||||
write(0x06,func.value);
|
write(MB_PORT_FUNCTION,func.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -602,28 +600,28 @@ void MotorBoard::PutMsg(int type, int value, int clearscreen)
|
||||||
|
|
||||||
void MotorBoard::errormsg(uint value)
|
void MotorBoard::errormsg(uint value)
|
||||||
{
|
{
|
||||||
// if(value & 0x4)
|
if(value & 0x4)
|
||||||
// PutMsg((int)DisType::Dis_Err_CoverOpen,0,(int)ClearScreen::All);
|
PutMsg((int)DisType::Dis_Err_CoverOpen,0,(int)ClearScreen::All);
|
||||||
// else if (value & 0x2)
|
else if (value & 0x2)
|
||||||
// PutMsg((int)DisType::Dis_Err_NoPaper,0,(int)ClearScreen::All);
|
PutMsg((int)DisType::Dis_Err_NoPaper,0,(int)ClearScreen::All);
|
||||||
// else if (value & 0x8)
|
else if (value & 0x8)
|
||||||
// PutMsg((int)DisType::Dis_Err_FeedError,0,(int)ClearScreen::All);
|
PutMsg((int)DisType::Dis_Err_FeedError,0,(int)ClearScreen::All);
|
||||||
// // else if (value & 0x10)
|
// else if (value & 0x10)
|
||||||
// // PutMsg((int)DisType::Dis_Err_JamIn,0,(int)ClearScreen::All);
|
// PutMsg((int)DisType::Dis_Err_JamIn,0,(int)ClearScreen::All);
|
||||||
// else if (value & 0x20)
|
else if (value & 0x20)
|
||||||
// PutMsg((int)DisType::Dis_Err_DoubleFeed,0,(int)ClearScreen::All);
|
PutMsg((int)DisType::Dis_Err_DoubleFeed,0,(int)ClearScreen::All);
|
||||||
// else if (value & 0x40)
|
else if (value & 0x40)
|
||||||
// PutMsg((int)DisType::Dis_Err_Stable,0,(int)ClearScreen::All);
|
PutMsg((int)DisType::Dis_Err_Stable,0,(int)ClearScreen::All);
|
||||||
// else if (value & 0x80)
|
else if (value & 0x80)
|
||||||
// PutMsg((int)DisType::Dis_Err_PaperScrew,0,(int)ClearScreen::All);
|
PutMsg((int)DisType::Dis_Err_PaperScrew,0,(int)ClearScreen::All);
|
||||||
// else if (value & 0x00010000)
|
else if (value & 0x00010000)
|
||||||
// PutMsg((int)DisType::Dis_Err_AqrImgTimeout,0,(int)ClearScreen::All);
|
PutMsg((int)DisType::Dis_Err_AqrImgTimeout,0,(int)ClearScreen::All);
|
||||||
// else if((value & 0x1000010) == 0x1000010)
|
else if((value & 0x1000010) == 0x1000010)
|
||||||
// PutMsg((int)DisType::Dis_Err_JamIn,3,(int)ClearScreen::All);
|
PutMsg((int)DisType::Dis_Err_JamIn,3,(int)ClearScreen::All);
|
||||||
// else if((value & 0x800010) == 0x800010)
|
else if((value & 0x800010) == 0x800010)
|
||||||
// PutMsg((int)DisType::Dis_Err_JamIn,2,(int)ClearScreen::All);
|
PutMsg((int)DisType::Dis_Err_JamIn,2,(int)ClearScreen::All);
|
||||||
// else if((value & 0x400010) == 0x400010)
|
else if((value & 0x400010) == 0x400010)
|
||||||
// PutMsg((int)DisType::Dis_Err_JamIn,1,(int)ClearScreen::All);
|
PutMsg((int)DisType::Dis_Err_JamIn,1,(int)ClearScreen::All);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotorBoard::SetKeyState(bool value)
|
void MotorBoard::SetKeyState(bool value)
|
||||||
|
@ -635,11 +633,11 @@ void MotorBoard::SetKeyState(bool value)
|
||||||
|
|
||||||
void MotorBoard::set_keystopenable(bool value){
|
void MotorBoard::set_keystopenable(bool value){
|
||||||
unsigned int regval=0;
|
unsigned int regval=0;
|
||||||
read(0x06,regval);
|
read(MB_PORT_FUNCTION,regval);
|
||||||
utils::to_log(LOG_LEVEL_DEBUG, "func6 regval = 0x%08x\n", regval);
|
utils::to_log(LOG_LEVEL_DEBUG, "func6 regval = 0x%08x\n", regval);
|
||||||
SMBFUNC func = *(SMBFUNC*)®val;
|
SMBFUNC func = *(SMBFUNC*)®val;
|
||||||
func.param.key_stop_enable = value;
|
func.param.key_stop_enable = value;
|
||||||
write(0x06, regval);
|
write(MB_PORT_FUNCTION, regval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -663,14 +661,14 @@ void MotorBoard::set_freq(int motor_choose,int speedmode,int colormode,int dpi)
|
||||||
// {
|
// {
|
||||||
// int x = 0; // (dpi == 1?(Get_static_jsonconfig().getscannerinfo().chu_motor_speed_200):(dpi == 2?Get_static_jsonconfig().getscannerinfo().chu_motor_speed_300 : Get_static_jsonconfig().getscannerinfo().chu_motor_speed_600));
|
// int x = 0; // (dpi == 1?(Get_static_jsonconfig().getscannerinfo().chu_motor_speed_200):(dpi == 2?Get_static_jsonconfig().getscannerinfo().chu_motor_speed_300 : Get_static_jsonconfig().getscannerinfo().chu_motor_speed_600));
|
||||||
// unsigned int regval=0;
|
// unsigned int regval=0;
|
||||||
// read(0x06,regval);
|
// read(MB_PORT_FUNCTION,regval);
|
||||||
// SMBFUNC func = *(SMBFUNC*)®val;
|
// SMBFUNC func = *(SMBFUNC*)®val;
|
||||||
// func.param.motor_choose = motor_choose;
|
// func.param.motor_choose = motor_choose;
|
||||||
// func.param.wr_en = 1;
|
// func.param.wr_en = 1;
|
||||||
// write(0x06,func.value);
|
// write(MB_PORT_FUNCTION,func.value);
|
||||||
// write(0x04,x);
|
// write(MB_PORT_CONFIG_EX,x);
|
||||||
// //func.param.wr_en = 0;
|
// //func.param.wr_en = 0;
|
||||||
// //write(0x06,func.value);
|
// //write(MB_PORT_FUNCTION,func.value);
|
||||||
// return ;
|
// return ;
|
||||||
// }
|
// }
|
||||||
// if(motor_choose == 1)
|
// if(motor_choose == 1)
|
||||||
|
@ -680,7 +678,7 @@ void MotorBoard::set_freq(int motor_choose,int speedmode,int colormode,int dpi)
|
||||||
// if(motor_choose == 3)
|
// if(motor_choose == 3)
|
||||||
// table = frep_cfg(param.finalPeriod,param.Fmin,param.stepnum,param.a,param.offset,param.finalDelay,param.acceleration_time);
|
// table = frep_cfg(param.finalPeriod,param.Fmin,param.stepnum,param.a,param.offset,param.finalDelay,param.acceleration_time);
|
||||||
// unsigned int regval=0;
|
// unsigned int regval=0;
|
||||||
// read(0x06,regval);
|
// read(MB_PORT_FUNCTION,regval);
|
||||||
// SMBFUNC func = *(SMBFUNC*)®val;
|
// SMBFUNC func = *(SMBFUNC*)®val;
|
||||||
// int start_addr_cuo = 0;
|
// int start_addr_cuo = 0;
|
||||||
// #ifdef G200
|
// #ifdef G200
|
||||||
|
@ -695,12 +693,12 @@ void MotorBoard::set_freq(int motor_choose,int speedmode,int colormode,int dpi)
|
||||||
// func.param.motor_choose = motor_choose;
|
// func.param.motor_choose = motor_choose;
|
||||||
// func.param.wr_en = 1;
|
// func.param.wr_en = 1;
|
||||||
// func.param.motor_addr =i;
|
// func.param.motor_addr =i;
|
||||||
// write(0x06,func.value);
|
// write(MB_PORT_FUNCTION,func.value);
|
||||||
// write(0x04,i<start_addr_cuo?0:table[i-start_addr_cuo]);
|
// write(MB_PORT_CONFIG_EX,i<start_addr_cuo?0:table[i-start_addr_cuo]);
|
||||||
// //printf("\nfreq= %x addr =%d ",table[i-start_addr_cuo],i);
|
// //printf("\nfreq= %x addr =%d ",table[i-start_addr_cuo],i);
|
||||||
// }
|
// }
|
||||||
// func.param.wr_en = 0;
|
// func.param.wr_en = 0;
|
||||||
// write(0x06,func.value);
|
// write(MB_PORT_FUNCTION,func.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotorBoard::init_statecontrol()
|
void MotorBoard::init_statecontrol()
|
||||||
|
@ -743,13 +741,13 @@ void MotorBoard::startcapimage(bool value)
|
||||||
{
|
{
|
||||||
// if(m_config.g200params.is_fixedpaper)
|
// if(m_config.g200params.is_fixedpaper)
|
||||||
// return;
|
// return;
|
||||||
// FILE *fp = fopen("/sys/class/tty/ttyUSB0/device/huagao_scanner", "w");
|
FILE *fp = fopen("/sys/class/tty/ttyUSB0/device/huagao_scanner", "w");
|
||||||
// if (fp == NULL)
|
if (fp == NULL)
|
||||||
// perror("startcapimage open filed");
|
perror("startcapimage open filed");
|
||||||
// else{
|
else{
|
||||||
// fprintf(fp, "%d", value ? 1 : 0);
|
fprintf(fp, "%d", value ? 1 : 0);
|
||||||
// fclose(fp);
|
fclose(fp);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotorBoard::set_sensor_pwm_duty(int sensorid,int duty)
|
bool MotorBoard::set_sensor_pwm_duty(int sensorid,int duty)
|
||||||
|
@ -757,7 +755,7 @@ bool MotorBoard::set_sensor_pwm_duty(int sensorid,int duty)
|
||||||
//1:扫描;2:开盖;3:歪斜—1;4:歪斜-2;5:出纸口;6:有无纸
|
//1:扫描;2:开盖;3:歪斜—1;4:歪斜-2;5:出纸口;6:有无纸
|
||||||
printf("set_sensor_pwm_duty type = %d duty = %d \n",sensorid,duty);
|
printf("set_sensor_pwm_duty type = %d duty = %d \n",sensorid,duty);
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x05, val))
|
if (!read(MB_PORT_TIME, val))
|
||||||
return false;
|
return false;
|
||||||
if(sensorid< 1 || sensorid >6)
|
if(sensorid< 1 || sensorid >6)
|
||||||
return false;
|
return false;
|
||||||
|
@ -766,15 +764,15 @@ bool MotorBoard::set_sensor_pwm_duty(int sensorid,int duty)
|
||||||
SMBCONFIGTIME *smb_config_time = (SMBCONFIGTIME *)&val;
|
SMBCONFIGTIME *smb_config_time = (SMBCONFIGTIME *)&val;
|
||||||
smb_config_time->sen_duty_set_sel = sensorid;
|
smb_config_time->sen_duty_set_sel = sensorid;
|
||||||
smb_config_time->duty_set = duty*8+50;
|
smb_config_time->duty_set = duty*8+50;
|
||||||
write(0x05, val);
|
write(MB_PORT_TIME, val);
|
||||||
smb_config_time->sen_duty_set_sel = 0;
|
smb_config_time->sen_duty_set_sel = 0;
|
||||||
return write(0x05, val);
|
return write(MB_PORT_TIME, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotorBoard::enable_sensor_pwm(int sensorid,bool en)
|
bool MotorBoard::enable_sensor_pwm(int sensorid,bool en)
|
||||||
{
|
{
|
||||||
std::uint32_t val;
|
std::uint32_t val;
|
||||||
if (!read(0x05, val))
|
if (!read(MB_PORT_TIME, val))
|
||||||
return false;
|
return false;
|
||||||
if(sensorid< 1 || sensorid >6)
|
if(sensorid< 1 || sensorid >6)
|
||||||
return false;
|
return false;
|
||||||
|
@ -782,13 +780,13 @@ bool MotorBoard::enable_sensor_pwm(int sensorid,bool en)
|
||||||
bit.set(sensorid+6,en);
|
bit.set(sensorid+6,en);
|
||||||
val = bit.to_ulong();
|
val = bit.to_ulong();
|
||||||
printf("enable_sensor_pwm = %d \n",val);
|
printf("enable_sensor_pwm = %d \n",val);
|
||||||
return write(0x05, val);
|
return write(MB_PORT_TIME, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotorBoard::set_ultrasonic_param(int type,int value){
|
bool MotorBoard::set_ultrasonic_param(int type,int value){
|
||||||
//1:双张检测周期;2:有无纸检测周期;3:双张阈值;4:单张阈值;
|
//1:双张检测周期;2:有无纸检测周期;3:双张阈值;4:单张阈值;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x07, val))
|
if (!read(MB_PORT_ULTROSONIC, val))
|
||||||
return false;
|
return false;
|
||||||
if(type< 1 || type >4)
|
if(type< 1 || type >4)
|
||||||
return false;
|
return false;
|
||||||
|
@ -813,9 +811,9 @@ bool MotorBoard::set_ultrasonic_param(int type,int value){
|
||||||
}
|
}
|
||||||
printf("val = %d \n",val);
|
printf("val = %d \n",val);
|
||||||
tmp->param.send_cyc_en = 1;
|
tmp->param.send_cyc_en = 1;
|
||||||
write(0x07,val);
|
write(MB_PORT_ULTROSONIC,val);
|
||||||
tmp->param.send_cyc_en = 0;
|
tmp->param.send_cyc_en = 0;
|
||||||
return write(0x07,val);
|
return write(MB_PORT_ULTROSONIC,val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotorBoard::init_sensor_duty()
|
void MotorBoard::init_sensor_duty()
|
||||||
|
@ -837,13 +835,13 @@ void MotorBoard::init_sensor_duty()
|
||||||
|
|
||||||
std::uint32_t MotorBoard::get_ultrasonic_version(){
|
std::uint32_t MotorBoard::get_ultrasonic_version(){
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (!read(0x07, val))
|
if (!read(MB_PORT_ULTROSONIC, val))
|
||||||
return 0;
|
return 0;
|
||||||
SMB_Ultrasonic_Config *tmp = (SMB_Ultrasonic_Config *)&val;
|
SMB_Ultrasonic_Config *tmp = (SMB_Ultrasonic_Config *)&val;
|
||||||
tmp->param.rd_ver_en = 1;
|
tmp->param.rd_ver_en = 1;
|
||||||
write(0x07,val);
|
write(MB_PORT_ULTROSONIC,val);
|
||||||
tmp->param.rd_ver_en = 0;
|
tmp->param.rd_ver_en = 0;
|
||||||
write(0x07,val);
|
write(MB_PORT_ULTROSONIC,val);
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
read(0x08,val);
|
read(0x08,val);
|
||||||
return val;
|
return val;
|
||||||
|
@ -851,7 +849,7 @@ std::uint32_t MotorBoard::get_ultrasonic_version(){
|
||||||
|
|
||||||
std::string MotorBoard::getmbversion(){
|
std::string MotorBoard::getmbversion(){
|
||||||
uint32_t value = 0;
|
uint32_t value = 0;
|
||||||
read(0x03, value);
|
read(MB_PORT_VERSION, value);
|
||||||
m_version = value;
|
m_version = value;
|
||||||
printf("mb version: = %s \n", std::to_string(value).c_str());
|
printf("mb version: = %s \n", std::to_string(value).c_str());
|
||||||
return std::to_string(value);
|
return std::to_string(value);
|
||||||
|
|
|
@ -71,9 +71,9 @@ void PinMonitor::monitor()
|
||||||
//LOG_TRACE("poll call");
|
//LOG_TRACE("poll call");
|
||||||
if (call_back)
|
if (call_back)
|
||||||
{
|
{
|
||||||
sw.reset();
|
// sw.reset();
|
||||||
call_back(pin.getPort());
|
call_back(pin.getPort());
|
||||||
utils::to_log(LOG_LEVEL_DEBUG, utils::format_string("poll call times = %.2f \n",sw.elapse_ms()).c_str());
|
// utils::to_log(LOG_LEVEL_DEBUG, utils::format_string("= %.2f \n",sw.elapse_ms()).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -457,7 +457,7 @@ dyn_mem_ptr async_scanner::handle_scan_start(LPPACK_BASE pack, uint32_t* used, p
|
||||||
FILE* dst = fopen(("/tmp/scan_" + std::to_string(lpinfo->pos.paper_ind) + ".bmp").c_str(), "wb");
|
FILE* dst = fopen(("/tmp/scan_" + std::to_string(lpinfo->pos.paper_ind) + ".bmp").c_str(), "wb");
|
||||||
if(dst)
|
if(dst)
|
||||||
{
|
{
|
||||||
std::string bih(utils::bitmap_info_header(lpinfo->width, lpinfo->height, lpinfo->bpp, lpinfo->resolution_x, lpinfo->resolution_y)),
|
std::string bih(utils::bitmap_info_header(lpinfo->width, lpinfo->height, lpinfo->bpp * lpinfo->channels, lpinfo->resolution_x, lpinfo->resolution_y)),
|
||||||
bfh(utils::bitmap_file_header((BITMAPINFOHEADER*)&bih[0]));
|
bfh(utils::bitmap_file_header((BITMAPINFOHEADER*)&bih[0]));
|
||||||
fwrite(bfh.c_str(), 1, bfh.length(), dst);
|
fwrite(bfh.c_str(), 1, bfh.length(), dst);
|
||||||
fwrite(bih.c_str(), 1, bih.length(), dst);
|
fwrite(bih.c_str(), 1, bih.length(), dst);
|
||||||
|
|
|
@ -60,7 +60,7 @@ add_packagedirs("sdk")
|
||||||
add_defines("BUILD_AS_DEVICE")
|
add_defines("BUILD_AS_DEVICE")
|
||||||
add_defines("VER_MAIN=2")
|
add_defines("VER_MAIN=2")
|
||||||
add_defines("VER_FAMILY=300")
|
add_defines("VER_FAMILY=300")
|
||||||
add_defines("VER_DATE=20240109")
|
add_defines("VER_DATE=20240111")
|
||||||
add_defines("VER_BUILD=14")
|
add_defines("VER_BUILD=14")
|
||||||
|
|
||||||
target("conf")
|
target("conf")
|
||||||
|
|
Loading…
Reference in New Issue