Browse Source

update

master
zhaohe 10 months ago
parent
commit
57bd8a7c03
  1. 2
      a8000_protocol
  2. 11
      src/tab/id_card_read_tab.cpp
  3. 2
      src/tab/mini_servo_tab.cpp
  4. 11
      src/tab/step_motor_ctrl_tab.cpp
  5. 7
      src/tab/xyrobot_tab.cpp

2
a8000_protocol

@ -1 +1 @@
Subproject commit 8f3e18d35b26becec3236055a1324e31e8d0f40c
Subproject commit 40ada078fcd4420b6779ba894c5756acf0a071de

11
src/tab/id_card_read_tab.cpp

@ -156,7 +156,16 @@ void IDCardReaderTab::construct(QTabWidget *fathertab) {
for (int i = 0; i < EEPROM_MAX_ADD; i += 4) {
uint32_t writeval = A8kIdCardWriter::instance()->readEepromWriteData(i);
ZQUI::ins()->ishow("write 0x%04x 0x%02x 0x%02x 0x%02x 0x%02x", i, (writeval >> 0) & 0xff, (writeval >> 8) & 0xff, (writeval >> 16) & 0xff, (writeval >> 24) & 0xff);
ICM->callcmd2(getDeviceId(), ka8000_idcard_write_raw, i, writeval);
for (size_t j = 0; j < 3; j++) {
if (j != 0) Sleep(100);
try {
ICM->callcmd2(getDeviceId(), ka8000_idcard_write_raw, i, writeval);
} catch (const std::exception &e) {
std::cerr << e.what() << '\n';
}
break;
}
}
ZQUI::ins()->ishow("write all done.");
});

2
src/tab/mini_servo_tab.cpp

@ -44,6 +44,7 @@ void MiniServoTab::construct(QTabWidget *fathertab) {
box->newFunc("扭矩模式-旋转", {"torque"}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kmini_servo_rotate_with_torque, atoi(args[0])); });
box->newFunc("设置中点", {}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), kmini_servo_set_mid_point); });
box->newFunc("设置当前位置(1->3599)", {"pos"}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kmini_servo_set_cur_pos,atoi(args[0])); });
box->newFunc("读取IO状态", {"ioindex"}, [this](int argn, const char **args) {
ICM->callcmd1(getDeviceId(), kmini_servo_read_io_state, atoi(args[0]));
ZQUI::ins()->ishow("IO:%d", ICM->getAck(0));
@ -65,7 +66,6 @@ void MiniServoTab::construct(QTabWidget *fathertab) {
return true;
});
tableBox->addReg("pos", kreg_mini_servo_pos, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("limit-torque(位置模式,速度模式有效)", kreg_mini_servo_limit_torque, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("limit-velocity(位置模式有效)", kreg_mini_servo_limit_velocity, ZRegItem::krw | ZRegItem::kdec);

11
src/tab/step_motor_ctrl_tab.cpp

@ -95,11 +95,8 @@ void StepMotorCtrlTab::construct(QTabWidget *fathertab) {
box->newFunc("相对移动", {"distance"}, [this](int argn, const char **args) { ICM->step_motor_easy_move_by(getDeviceId(), atoi(args[0])); });
box->newFunc("移动到", {"position"}, [this](int argn, const char **args) { ICM->step_motor_easy_move_to(getDeviceId(), atoi(args[0])); });
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])); });
box->newFunc("往复运动", {"startPos", "endPos","times"}, [this](int argn, const char **args) {
ICM->callcmd3(getDeviceId(), kstep_motor_easy_reciprocating_motion, atoi(args[0]), atoi(args[1]), atoi(args[2]));
});
box->newFunc("往复运动", {"startPos", "endPos", "times"}, [this](int argn, const char **args) { ICM->callcmd3(getDeviceId(), kstep_motor_easy_reciprocating_motion, atoi(args[0]), atoi(args[1]), atoi(args[2])); });
box->newFunc("快速归零", {}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), kstep_motor_easy_move_to_zero_point_quick); });
}
{
@ -140,6 +137,10 @@ void StepMotorCtrlTab::construct(QTabWidget *fathertab) {
tableBox->addReg("tzerowait", kreg_step_motor_tzerowait, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("enc_resolution", kreg_step_motor_enc_resolution, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("enable_enc", kreg_step_motor_enable_enc, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("dzero_pos", kreg_step_motor_dzero_pos, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("pos_devi_toleranc", kreg_step_motor_pos_devi_tolerance, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("io_trigger_append_distance", kreg_step_motor_io_trigger_append_distance, ZRegItem::krw | ZRegItem::kdec);
}
tab->addSpacer();

7
src/tab/xyrobot_tab.cpp

@ -59,8 +59,8 @@ void XYRobotTab::construct(QTabWidget *fathertab) {
});
box->newFunc("设置位置", {"x", "y"}, [this](int argn, const char **args) { ICM->callcmd2(getDeviceId(), kxymotor_set_pos, atoi(args[0]), atoi(args[1])); });
box->newFunc("相对移动", {"dx", "dy", "velocity"}, [this](int argn, const char **args) { ICM->callcmd3(getDeviceId(), kxymotor_move_by, atoi(args[0]), atoi(args[1]), atoi(args[2])); });
box->newFunc("绝对移动", {"x", "y", "velocity"}, [this](int argn, const char **args) { ICM->callcmd3(getDeviceId(), kxymotor_move_to, atoi(args[0]), atoi(args[1]), atoi(args[2])); });
box->newFunc("相对移动", {"dx", "dy"}, [this](int argn, const char **args) { ICM->callcmd2(getDeviceId(), kxymotor_move_by, atoi(args[0]), atoi(args[1])); });
box->newFunc("绝对移动", {"x", "y"}, [this](int argn, const char **args) { ICM->callcmd2(getDeviceId(), kxymotor_move_to, atoi(args[0]), atoi(args[1])); });
box->newFunc("直接控制电机相对移动", {"motor1_dpos", "motor2_dpos"}, [this](int argn, const char **args) { ICM->callcmd2(getDeviceId(), kxymotor_motor_move_by_direct, atoi(args[0]), atoi(args[1])); });
box->newFunc("读取全部输入IO", {}, [this](int argn, const char **args) {
@ -135,6 +135,9 @@ void XYRobotTab::construct(QTabWidget *fathertab) {
tableBox->addReg("look_zero_edge_speed", kreg_xyrobot_look_zero_edge_speed, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("shift_x", kreg_xyrobot_shift_x, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("shift_y", kreg_xyrobot_shift_y, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("pos_devi_tolerance", kreg_xyrobot_pos_devi_tolerance, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("io_trigger_append_distance", kreg_xyrobot_io_trigger_append_distance, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("default_velocity", kreg_xyrobot_default_velocity, ZRegItem::krw | ZRegItem::kdec);
tableBox->addSpacer();

Loading…
Cancel
Save