From 3d977d8af4a5bcdbb4d6df83055ea1e8395fc157 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sat, 6 Jul 2024 14:55:39 +0800 Subject: [PATCH] update --- src/tab/a8k_opt_tab.cpp | 118 ++++++++++++++++++++++++++++------------ src/tab/step_motor_ctrl_tab.cpp | 6 +- 2 files changed, 85 insertions(+), 39 deletions(-) diff --git a/src/tab/a8k_opt_tab.cpp b/src/tab/a8k_opt_tab.cpp index 38f440b..a63434a 100644 --- a/src/tab/a8k_opt_tab.cpp +++ b/src/tab/a8k_opt_tab.cpp @@ -28,41 +28,87 @@ A8kOptTab *A8kOptTab::inst() { return ins; } - -// 巴迪泰复位风险 - // 1.转盘清空板夹。(因为需要拆设备,只能自动化清理) - // 2.板夹仓推杆推到一半,光学模组拉杆拉到一半。(因为需要拆设备,只能自动化清理) - // 3.脱帽盖帽摇匀处理到一半。(只能人工清理) - -//-------------------------------------------------------------------------------------------- - -//++++++++++++++++++++++++++++++++++++++++ - -//硬件测试测试 -//打开t光学激光(激光增益,扫描增益) -//读即时取扫描结果() - -//打开f光学激光(激光增益,扫描增益) -//读即时取扫描结果 - -//++++++++++++++++++++++++++++++++++++++++ - -//单独模块测试 - //钩爪复位,光学模组复位 - //板夹仓-推杆复位,板夹仓-平移复位 - //转盘复位 - -//入板准备 -//T光学开始扫描:(激光增益,扫描增益,扫描启动位置,扫描方向,扫描点数) -//F光学开始扫描:(激光增益,扫描增益,扫描启动位置,扫描方向,扫描点数) -//读取扫描结果 -//分析存储扫描结果 -//丢板 - void A8kOptTab::construct(QTabWidget *fathertab) { - - - - - + /*********************************************************************************************************************** + * 模块操作 * + ***********************************************************************************************************************/ + ZQVTabPage *tab = new ZQVTabPage(fathertab, "光学模组"); + + { + ZQFunctionListBox *box = new ZQFunctionListBox(tab, "光学测试", 4); + // box->newSubButton("停止", [this](int argn, const char **args) { ICM->step_motor_stop(getDeviceId(), 0); }); + + box->newFunc("T光学-开始扫描", {"scanDirection", "lasterGain", "scanGain"}, [this](int argn, const char **args) { + int32_t scanDirection = atoi(args[0]); + int32_t lasterGain = atoi(args[1]); + int32_t scanGain = atoi(args[2]); + ICM->callcmd3(getDeviceId(), ka8k_opt_v2_t_start_scan, scanDirection, lasterGain, scanGain); + }); + + box->newFunc("F光学-开始扫描", {"scanDirection", "lasterGain", "scanGain"}, [this](int argn, const char **args) { + int32_t scanDirection = atoi(args[0]); + int32_t lasterGain = atoi(args[1]); + int32_t scanGain = atoi(args[2]); + ICM->callcmd3(getDeviceId(), ka8k_opt_v2_f_start_scan, scanDirection, lasterGain, scanGain); + }); + } + + { + ZQFunctionListBox *box = new ZQFunctionListBox(tab, "硬件测试", 4); + box->newFunc("T光学-打开激光", {"lasterGain", "scanGain"}, [this](int argn, const char **args) { + int32_t lasterGain = atoi(args[0]); + int32_t scanGain = atoi(args[1]); + ICM->callcmd2(getDeviceId(), ka8k_opt_v2_t_open_laster, lasterGain, scanGain); + }); + + box->newFunc("T光学-关闭激光", {}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), ka8k_opt_v2_t_close_laster); }); + + box->newFunc("T光学-读取值", {"val0", "val1"}, [this](int argn, const char **args) { + int32_t val0 = 0; + int32_t val1 = 0; + ICM->callcmd0(getDeviceId(), ka8k_opt_v2_t_readVal); + val0 = ICM->getAck(0); + val1 = ICM->getAck(1); + + ZQUI::ins()->ishow("val0:%d, val1:%d", val0, val1); + }); + + box->newFunc("F光学-打开激光", {"lasterGain", "scanGain"}, [this](int argn, const char **args) { + int32_t lasterGain = atoi(args[0]); + int32_t scanGain = atoi(args[1]); + ICM->callcmd2(getDeviceId(), ka8k_opt_v2_f_open_laster, lasterGain, scanGain); + }); + + box->newFunc("F光学-关闭激光", {}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), ka8k_opt_v2_f_close_laster); }); + + box->newFunc("F光学-读取值", {"val0", "val1"}, [this](int argn, const char **args) { + int32_t val0 = 0; + int32_t val1 = 0; + ICM->callcmd0(getDeviceId(), ka8k_opt_v2_f_readVal); + val0 = ICM->getAck(0); + val1 = ICM->getAck(1); + + ZQUI::ins()->ishow("val0:%d, val1:%d", val0, val1); + }); + } + + { + ZRegTableList *tableBox = new ZRegTableList(tab, "寄存器操作"); + tableBox->initializeRegOperation( + [this](int32_t add, int32_t val) { // + ICM->writereg(getDeviceId(), add, val); + return true; + }, + [this](int32_t add, int32_t *val) { // + ICM->readreg(getDeviceId(), add, val); + return true; + }); + + tableBox->addReg("T光学正向扫描起点位置", kreg_a8k_opt_t_pos_offset, ZRegItem::krw | ZRegItem::kdec); + tableBox->addReg("F光学正向扫描起点位置", kreg_a8k_opt_f_pos_offset, ZRegItem::krw | ZRegItem::kdec); + tableBox->addReg("扫描间隔", kreg_a8k_opt_scan_step_interval, ZRegItem::krw | ZRegItem::kdec); + tableBox->addReg("扫描点数", kreg_a8k_opt_scan_pointnum, ZRegItem::krw | ZRegItem::kdec); + } + + tab->addSpacer(); } diff --git a/src/tab/step_motor_ctrl_tab.cpp b/src/tab/step_motor_ctrl_tab.cpp index b67a034..be98449 100644 --- a/src/tab/step_motor_ctrl_tab.cpp +++ b/src/tab/step_motor_ctrl_tab.cpp @@ -32,11 +32,12 @@ void StepMotorCtrlTab::construct(QTabWidget *fathertab) { { ZQFunctionListBox *box = new ZQFunctionListBox(tab, "方法组1", 4); + box->newSubButton("停止", [this](int argn, const char **args) { ICM->step_motor_stop(getDeviceId(), 0); }); + box->newSubButtonEnd(); box->newSubButton("使能", [this](int argn, const char **args) { ICM->step_motor_enable(getDeviceId(), 1); }); box->newSubButton("失能", [this](int argn, const char **args) { ICM->step_motor_enable(getDeviceId(), 0); }); - box->newSubButton("停止", [this](int argn, const char **args) { ICM->step_motor_stop(getDeviceId(), 0); }); box->newSubButton("激活配置", [this](int argn, const char **args) { ICM->step_motor_active_cfg(getDeviceId()); }); - + box->newSubButtonEnd(); box->newSubButton("读取位置1", [this](int argn, const char **args) { int32_t pos = 0; ICM->step_motor_read_pos(getDeviceId(), &pos); @@ -96,7 +97,6 @@ void StepMotorCtrlTab::construct(QTabWidget *fathertab) { box->newFunc("移动到IO", {"ioindex", "direction"}, [this](int argn, const char **args) { ICM->step_motor_easy_move_to_io(getDeviceId(), atoi(args[0]), atoi(args[1])); }); } - { ZRegTableList *tableBox = new ZRegTableList(tab, "寄存器操作"); tableBox->initializeRegOperation(