Browse Source

V17| 更新协议

master
zhaohe 4 months ago
parent
commit
857637fcdc
  1. 2
      .gitignore
  2. 7
      CMakeLists.txt
  3. 2
      a8000_protocol
  4. 10
      iflytop_canbus/iflytop_canbus_master.cpp
  5. 7
      iflytop_canbus/iflytop_canbus_master.hpp
  6. BIN
      release/A8K上位机V17.exe
  7. 4
      src/mainwindow.cpp
  8. 2
      src/mainwindow.h
  9. 2
      src/tab/module_opera_tab.cpp
  10. 7
      src/tab/step_motor_ctrl_tab.cpp
  11. 2
      src/version.h
  12. BIN
      tools/makesfx.exe
  13. 1
      tools/run.bat

2
.gitignore

@ -69,6 +69,8 @@ Thumbs.db
# Binaries # Binaries
# -------- # --------
*.exe *.exe
!makesfx.exe
!release/*.exe
build build
CMakeLists.txt.user CMakeLists.txt.user

7
CMakeLists.txt

@ -45,9 +45,9 @@ set(PROJECT_SOURCES
iflytop_canbus/iflytop_canbus_master.cpp iflytop_canbus/iflytop_canbus_master.cpp
iflytop_canbus/waveshare_can.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/z_function_list_box.cpp
libzqt/zui/zq_vtab_page.cpp libzqt/zui/zq_vtab_page.cpp
@ -64,7 +64,6 @@ set(PROJECT_SOURCES
src/tab/fan_ctrl_tab.cpp src/tab/fan_ctrl_tab.cpp
src/tab/water_cooling_temperature_tab.cpp src/tab/water_cooling_temperature_tab.cpp
a8000_protocol/api/apibasic/errorcode.cpp
src/tab/pipette_ctrl_tab.cpp src/tab/pipette_ctrl_tab.cpp
src/basic/stm32_pin.cpp src/basic/stm32_pin.cpp

2
a8000_protocol

@ -1 +1 @@
Subproject commit baa52b8e1db1da6eb1ba4a5bbcb55dc49d22c795
Subproject commit 5fb4985d0c6cae59ab4f00a1de65910938bca096

10
iflytop_canbus/iflytop_canbus_master.cpp

@ -112,7 +112,7 @@ void IflytopCanbusMaster::processRxPacket(zcr_cmd_header_t *frame, size_t len) {
} }
void IflytopCanbusMaster::updateChannelConfig() { // 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) { void IflytopCanbusMaster::ping(int32_t device_id) {
int32_t param[4]; 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]; } int32_t IflytopCanbusMaster::getAck(int32_t index) { return ((int32_t *)(m_receipt_frame->data))[index]; }
uint8_t *IflytopCanbusMaster::getAckBuf() { return m_receipt_frame->data; } 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); } 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; zcr_cmd_header_t *frame = (zcr_cmd_header_t *)m_txbuf;
int32_t frameLen = paramLen + sizeof(zcr_cmd_header_t) + 1; int32_t frameLen = paramLen + sizeof(zcr_cmd_header_t) + 1;
frame->cmdid = cmdid; frame->cmdid = cmdid;
if (m_txindex < 60000) {
m_txindex = 60000;
if (m_txindex > 100) {
m_txindex = 0;
} }
frame->index = m_txindex; 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) { 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)); throw zexception(ecode, err::error2str(ecode));
} }
return; return;

7
iflytop_canbus/iflytop_canbus_master.hpp

@ -12,7 +12,8 @@
#include <thread> #include <thread>
#include <vector> #include <vector>
#include "a8000_protocol\protocol.hpp"
#include "a8000_protocol/protocol.hpp"
#include "idatachannel.hpp" #include "idatachannel.hpp"
#include "waveshare_can.hpp" #include "waveshare_can.hpp"
@ -125,6 +126,10 @@ class IflytopCanbusMaster {
callcmd0(device_id, kstep_motor_read_pos); callcmd0(device_id, kstep_motor_read_pos);
*pos = *(int32_t *)m_receipt_frame->data; *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); } void step_motor_stop(int32_t device_id, int32_t breakstop) { callcmd1(device_id, kstep_motor_stop, breakstop); }
private: private:

BIN
release/A8K上位机V17.exe

4
src/mainwindow.cpp

@ -327,7 +327,7 @@ map<int, int> moduleTypes;
void MainWindow::constructAppUI() { void MainWindow::constructAppUI() {
ModuleOperaTab::inst()->construct(ui->moduleOpera); ModuleOperaTab::inst()->construct(ui->moduleOpera);
// khbot_module // khbot_module
// ktemperature_ctrl_module
// kwater_cooling_temperature_ctrl_module
// kfan_ctrl_module // kfan_ctrl_module
// kcode_scaner // kcode_scaner
// kpipette_ctrl_module // kpipette_ctrl_module
@ -350,7 +350,7 @@ void MainWindow::constructAppUI() {
PipetteCtrlTab::inst()->construct(ui->buttonTabWidget); PipetteCtrlTab::inst()->construct(ui->buttonTabWidget);
moduleTypes[kpipette_ctrl_module] = tabindex++; moduleTypes[kpipette_ctrl_module] = tabindex++;
WaterCoolingTemperatureControlerTab::inst()->construct(ui->buttonTabWidget); WaterCoolingTemperatureControlerTab::inst()->construct(ui->buttonTabWidget);
moduleTypes[ktemperature_ctrl_module] = tabindex++;
moduleTypes[kwater_cooling_temperature_ctrl_module] = tabindex++;
FanCtrlTab::inst()->construct(ui->buttonTabWidget); FanCtrlTab::inst()->construct(ui->buttonTabWidget);
moduleTypes[kfan_ctrl_module] = tabindex++; moduleTypes[kfan_ctrl_module] = tabindex++;
XYRobotTab::inst()->construct(ui->buttonTabWidget); XYRobotTab::inst()->construct(ui->buttonTabWidget);

2
src/mainwindow.h

@ -39,7 +39,7 @@
#include "qfunction.hpp" #include "qfunction.hpp"
#include "zexception.hpp" #include "zexception.hpp"
#include "zqthread.hpp" #include "zqthread.hpp"
#include "a8000_protocol\api\apibasic\packet_interface.hpp"
#include "a8000_protocol/protocol.hpp"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;

2
src/tab/module_opera_tab.cpp

@ -21,7 +21,7 @@ static const char *module_type2_str(int id) {
switch (id) { switch (id) {
case khbot_module: case khbot_module:
return "hbot模块"; return "hbot模块";
case ktemperature_ctrl_module:
case kwater_cooling_temperature_ctrl_module:
return "温度控制"; return "温度控制";
case kfan_ctrl_module: case kfan_ctrl_module:
return "风扇控制"; return "风扇控制";

7
src/tab/step_motor_ctrl_tab.cpp

@ -43,7 +43,11 @@ void StepMotorCtrlTab::construct(QTabWidget *fathertab) {
ICM->step_motor_read_pos(getDeviceId(), &pos); ICM->step_motor_read_pos(getDeviceId(), &pos);
ZQUI::ins()->ishow("Pos:%d", 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) { box->newSubButton("读取IO状态", [this](int argn, const char **args) {
int32_t portState = 0; int32_t portState = 0;
int32_t indexInStm32 = 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("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("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); tableBox->addReg("io_trigger_append_distance", kreg_step_motor_io_trigger_append_distance, ZRegItem::krw | ZRegItem::kdec);
} }
tab->addSpacer(); tab->addSpacer();

2
src/version.h

@ -1,4 +1,4 @@
#pragma once #pragma once
#define VERSION "VERSION_16"
#define VERSION "V17"
#define MAUFACTURER "iflytop" #define MAUFACTURER "iflytop"

BIN
tools/makesfx.exe

1
tools/run.bat

@ -0,0 +1 @@
appenv\app.exe
Loading…
Cancel
Save