diff --git a/.gitignore b/.gitignore index dd320fe..1f5e4be 100644 --- a/.gitignore +++ b/.gitignore @@ -69,6 +69,8 @@ Thumbs.db # Binaries # -------- *.exe +!makesfx.exe +!release/*.exe build CMakeLists.txt.user \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index fd06a37..b3377db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,9 +45,9 @@ set(PROJECT_SOURCES iflytop_canbus/iflytop_canbus_master.cpp iflytop_canbus/waveshare_can.cpp - a8000_protocol/api/apibasic/errorcode.cpp - a8000_protocol/api/apibasic/cmdid.cpp - a8000_protocol/api/apibasic/reg_index.cpp + a8000_protocol/protocol/errorcode.cpp + a8000_protocol/protocol/cmdid.cpp + a8000_protocol/protocol/reg_index.cpp libzqt/zui/z_function_list_box.cpp libzqt/zui/zq_vtab_page.cpp @@ -64,7 +64,6 @@ set(PROJECT_SOURCES src/tab/fan_ctrl_tab.cpp src/tab/water_cooling_temperature_tab.cpp - a8000_protocol/api/apibasic/errorcode.cpp src/tab/pipette_ctrl_tab.cpp src/basic/stm32_pin.cpp diff --git a/a8000_protocol b/a8000_protocol index baa52b8..5fb4985 160000 --- a/a8000_protocol +++ b/a8000_protocol @@ -1 +1 @@ -Subproject commit baa52b8e1db1da6eb1ba4a5bbcb55dc49d22c795 +Subproject commit 5fb4985d0c6cae59ab4f00a1de65910938bca096 diff --git a/iflytop_canbus/iflytop_canbus_master.cpp b/iflytop_canbus/iflytop_canbus_master.cpp index 2829cf9..4c70d77 100644 --- a/iflytop_canbus/iflytop_canbus_master.cpp +++ b/iflytop_canbus/iflytop_canbus_master.cpp @@ -112,7 +112,7 @@ void IflytopCanbusMaster::processRxPacket(zcr_cmd_header_t *frame, size_t len) { } void IflytopCanbusMaster::updateChannelConfig() { // - m_waveCan.setCanpPrameter(CANUSB_SPEED_500000, CANUSB_MODE_NORMAL, CANUSB_FRAME_STANDARD); + m_waveCan.setCanpPrameter(CANUSB_SPEED_1000000, CANUSB_MODE_NORMAL, CANUSB_FRAME_STANDARD); } void IflytopCanbusMaster::ping(int32_t device_id) { int32_t param[4]; @@ -129,7 +129,7 @@ void IflytopCanbusMaster::readreg(int32_t device_id, int32_t regaddr, int32_t *v int32_t IflytopCanbusMaster::getAck(int32_t index) { return ((int32_t *)(m_receipt_frame->data))[index]; } uint8_t *IflytopCanbusMaster::getAckBuf() { return m_receipt_frame->data; } -int32_t IflytopCanbusMaster::getAckBufLen() { return m_receipt_len - sizeof(zcr_cmd_header_t); } +int32_t IflytopCanbusMaster::getAckBufLen() { return m_receipt_frame->datalen; } void IflytopCanbusMaster::writereg(int32_t device_id, int32_t regaddr, int32_t val) { callcmd2(device_id, kmodule_set_reg, regaddr, val); } @@ -165,8 +165,8 @@ void IflytopCanbusMaster::callcmd(int32_t device_id, int32_t cmdid, uint8_t *par zcr_cmd_header_t *frame = (zcr_cmd_header_t *)m_txbuf; int32_t frameLen = paramLen + sizeof(zcr_cmd_header_t) + 1; frame->cmdid = cmdid; - if (m_txindex < 60000) { - m_txindex = 60000; + if (m_txindex > 100) { + m_txindex = 0; } frame->index = m_txindex; @@ -216,7 +216,7 @@ void IflytopCanbusMaster::callcmd(int32_t device_id, int32_t cmdid, uint8_t *par } if (m_receipt_frame->packetType == kptv2_error_ack) { - int32_t ecode = m_receipt_frame->data[0]; + int32_t ecode = *(int32_t *)m_receipt_frame->data; throw zexception(ecode, err::error2str(ecode)); } return; diff --git a/iflytop_canbus/iflytop_canbus_master.hpp b/iflytop_canbus/iflytop_canbus_master.hpp index 29b0dba..221d4bc 100644 --- a/iflytop_canbus/iflytop_canbus_master.hpp +++ b/iflytop_canbus/iflytop_canbus_master.hpp @@ -12,7 +12,8 @@ #include #include -#include "a8000_protocol\protocol.hpp" +#include "a8000_protocol/protocol.hpp" + #include "idatachannel.hpp" #include "waveshare_can.hpp" @@ -125,6 +126,10 @@ class IflytopCanbusMaster { callcmd0(device_id, kstep_motor_read_pos); *pos = *(int32_t *)m_receipt_frame->data; } + void step_motor_read_enc_pos(int32_t device_id, int32_t *pos) { + callcmd0(device_id, kstep_motor_read_enc_pos); + *pos = *(int32_t *)m_receipt_frame->data; + } void step_motor_stop(int32_t device_id, int32_t breakstop) { callcmd1(device_id, kstep_motor_stop, breakstop); } private: diff --git a/release/A8K上位机V17.exe b/release/A8K上位机V17.exe new file mode 100644 index 0000000..3c0d1dc Binary files /dev/null and b/release/A8K上位机V17.exe differ diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 30bf839..95cf714 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -327,7 +327,7 @@ map moduleTypes; void MainWindow::constructAppUI() { ModuleOperaTab::inst()->construct(ui->moduleOpera); // khbot_module - // ktemperature_ctrl_module + // kwater_cooling_temperature_ctrl_module // kfan_ctrl_module // kcode_scaner // kpipette_ctrl_module @@ -350,7 +350,7 @@ void MainWindow::constructAppUI() { PipetteCtrlTab::inst()->construct(ui->buttonTabWidget); moduleTypes[kpipette_ctrl_module] = tabindex++; WaterCoolingTemperatureControlerTab::inst()->construct(ui->buttonTabWidget); - moduleTypes[ktemperature_ctrl_module] = tabindex++; + moduleTypes[kwater_cooling_temperature_ctrl_module] = tabindex++; FanCtrlTab::inst()->construct(ui->buttonTabWidget); moduleTypes[kfan_ctrl_module] = tabindex++; XYRobotTab::inst()->construct(ui->buttonTabWidget); diff --git a/src/mainwindow.h b/src/mainwindow.h index 6f91347..907f897 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -39,7 +39,7 @@ #include "qfunction.hpp" #include "zexception.hpp" #include "zqthread.hpp" -#include "a8000_protocol\api\apibasic\packet_interface.hpp" +#include "a8000_protocol/protocol.hpp" QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; diff --git a/src/tab/module_opera_tab.cpp b/src/tab/module_opera_tab.cpp index c651002..bcb6e07 100644 --- a/src/tab/module_opera_tab.cpp +++ b/src/tab/module_opera_tab.cpp @@ -21,7 +21,7 @@ static const char *module_type2_str(int id) { switch (id) { case khbot_module: return "hbot模块"; - case ktemperature_ctrl_module: + case kwater_cooling_temperature_ctrl_module: return "温度控制"; case kfan_ctrl_module: return "风扇控制"; diff --git a/src/tab/step_motor_ctrl_tab.cpp b/src/tab/step_motor_ctrl_tab.cpp index 15f6442..84a2823 100644 --- a/src/tab/step_motor_ctrl_tab.cpp +++ b/src/tab/step_motor_ctrl_tab.cpp @@ -43,7 +43,11 @@ void StepMotorCtrlTab::construct(QTabWidget *fathertab) { ICM->step_motor_read_pos(getDeviceId(), &pos); ZQUI::ins()->ishow("Pos:%d", pos); }); - + box->newSubButton("读取编码器位置", [this](int argn, const char **args) { + int32_t pos = 0; + ICM->step_motor_read_enc_pos(getDeviceId(), &pos); + ZQUI::ins()->ishow("Pos:%d", pos); + }); box->newSubButton("读取IO状态", [this](int argn, const char **args) { int32_t portState = 0; int32_t indexInStm32 = 0; @@ -140,7 +144,6 @@ void StepMotorCtrlTab::construct(QTabWidget *fathertab) { 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(); diff --git a/src/version.h b/src/version.h index 84963d3..652332c 100644 --- a/src/version.h +++ b/src/version.h @@ -1,4 +1,4 @@ #pragma once -#define VERSION "VERSION_16" +#define VERSION "V17" #define MAUFACTURER "iflytop" diff --git a/tools/makesfx.exe b/tools/makesfx.exe new file mode 100644 index 0000000..d5d6cb1 Binary files /dev/null and b/tools/makesfx.exe differ diff --git a/tools/run.bat b/tools/run.bat new file mode 100644 index 0000000..f21a682 --- /dev/null +++ b/tools/run.bat @@ -0,0 +1 @@ +appenv\app.exe \ No newline at end of file