|
|
@ -226,6 +226,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi |
|
|
|
} else if (type == kreport) { |
|
|
|
ZQUI::ins()->rawDataPreviewShow("[REPORT ] [%d->%d],%s", from, to, zhex2str(hex, hexlen).c_str()); //
|
|
|
|
} |
|
|
|
processReportPacket(type, from, to, hex, hexlen); |
|
|
|
}); |
|
|
|
} |
|
|
|
MainWindow::~MainWindow() { delete ui; } |
|
|
@ -234,79 +235,146 @@ void MainWindow::processException(const zexception &e) { // |
|
|
|
ZQUI::ins()->ishow("%s", e.what()); |
|
|
|
} |
|
|
|
int32_t MainWindow::getDeviceId() { return PublicState_DeviceIDVal; } |
|
|
|
void MainWindow::constructAppUI() { |
|
|
|
|
|
|
|
void MainWindow::constructPumpControlUI(ZQFunctionListBox *box, int targetDeviceId) { |
|
|
|
// ZQFunctionListBox *box = new ZQFunctionListBox(tab, "泵机指令", 4);
|
|
|
|
|
|
|
|
box->newFunc("pump_rotate", {"subid", "rpm"}, [this, targetDeviceId](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->pump_rotate(targetDeviceId, atoi(args[0]), atoi(args[1])); |
|
|
|
}); |
|
|
|
|
|
|
|
box->newFunc("pump_stop", {"subid"}, [this, targetDeviceId](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->pump_stop(targetDeviceId, atoi(args[0])); |
|
|
|
}); |
|
|
|
|
|
|
|
box->newFunc("pump_set_ihold_irun_idelay", {"subid", "ihold", "irun", "idelay"}, [this, targetDeviceId](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->pump_set_ihold_irun_idelay(targetDeviceId, atoi(args[0]), atoi(args[1]), atoi(args[2]), atoi(args[3])); |
|
|
|
}); |
|
|
|
|
|
|
|
box->newFunc("pump_set_acc", {"subid", "acc"}, [this, targetDeviceId](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->pump_set_acc(targetDeviceId, atoi(args[0]), atoi(args[1])); |
|
|
|
}); |
|
|
|
|
|
|
|
box->newFunc("pump_set_subic_reg", {"subid", "regadd", "val"}, [this, targetDeviceId](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->pump_set_subic_reg(targetDeviceId, atoi(args[0]), atoi(args[1]), atoi(args[2])); |
|
|
|
}); |
|
|
|
|
|
|
|
box->newFunc("pump_get_subic_reg", {"subid", "regadd"}, [this, targetDeviceId](int argn, const char **args) { //
|
|
|
|
int val = IflytopCanbusMaster::ins()->pump_get_subic_reg(targetDeviceId, atoi(args[0]), atoi(args[1])); |
|
|
|
ZQUI::ins()->ishow("val:%x", val); |
|
|
|
}); |
|
|
|
|
|
|
|
box->newFunc("pump_get_subic_reg", {"subid", "regadd"}, [this, targetDeviceId](int argn, const char **args) { //
|
|
|
|
int val = IflytopCanbusMaster::ins()->pump_get_subic_reg(targetDeviceId, atoi(args[0]), atoi(args[1])); |
|
|
|
ZQUI::ins()->ishow("val:%x", val); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
void MainWindow::constructCommonOperationTab() { |
|
|
|
/***********************************************************************************************************************
|
|
|
|
* 模块操作 * |
|
|
|
***********************************************************************************************************************/ |
|
|
|
|
|
|
|
ZQVTabPage *tab = new ZQVTabPage(ui->buttonTabWidget, "通用接口"); |
|
|
|
// static
|
|
|
|
{ |
|
|
|
ZQVTabPage *tab = new ZQVTabPage(ui->buttonTabWidget, "基础方法"); |
|
|
|
// static
|
|
|
|
|
|
|
|
// ack_read_board_info_data_t readboardinfo(int to);
|
|
|
|
// ack_sysinfo_t readsysinfo(int to);
|
|
|
|
// ask_taskinfo_t readtaskinfo(int to,int32_t taskoff);
|
|
|
|
|
|
|
|
{ |
|
|
|
ZQFunctionListBox *box = new ZQFunctionListBox(tab, "通用方法", 4); |
|
|
|
box->newFunc("读板卡信息", {}, [this](int argn, const char **args) { //
|
|
|
|
ack_read_board_info_data_t ack = IflytopCanbusMaster::ins()->readboardinfo(getDeviceId()); |
|
|
|
ZQUI::ins()->ishow("boardType :%s(%d)", BoardTypeToString(ack.boardType), ack.boardType); |
|
|
|
ZQUI::ins()->ishow("projectId :%s(%d)", ProjectIDToString(ack.projectId), ack.projectId); |
|
|
|
ZQUI::ins()->ishow("protcol_version :%d", ack.protcol_version); |
|
|
|
ZQUI::ins()->ishow("software_version :%d", ack.software_version); |
|
|
|
ZQUI::ins()->ishow("hardware_version :%d", ack.hardware_version); |
|
|
|
}); |
|
|
|
|
|
|
|
box->newFunc("读内存信息", {}, [this](int argn, const char **args) { //
|
|
|
|
ack_sysinfo_t ack = IflytopCanbusMaster::ins()->readsysinfo(getDeviceId()); |
|
|
|
ask_taskinfo_t task[20]; |
|
|
|
for (int i = 0; i < ack.taskNum; i++) { |
|
|
|
task[i] = IflytopCanbusMaster::ins()->readtaskinfo(getDeviceId(), i); |
|
|
|
} |
|
|
|
ZQUI::ins()->ishow("=========================== sys info ==========================="); |
|
|
|
ZQUI::ins()->ishow("total_heap_size :%d", ack.total_heap_size); |
|
|
|
ZQUI::ins()->ishow("free_heap_size :%d", ack.free_heap_size); |
|
|
|
ZQUI::ins()->ishow("sysHasRun :%d", ack.sysHasRun); |
|
|
|
ZQUI::ins()->ishow("="); |
|
|
|
|
|
|
|
ZQUI::ins()->ishow("=========================== task info ==========================="); |
|
|
|
ZQUI::ins()->ishow("taskoff name state stackRemainSize priority"); |
|
|
|
for (int i = 0; i < ack.taskNum; i++) { |
|
|
|
ZQUI::ins()->ishow("%d %10s %c %d %d", i, task[i].taskName, task[i].state, task[i].stackRemindSize, task[i].priority); |
|
|
|
} |
|
|
|
ZQUI::ins()->ishow("="); |
|
|
|
}); |
|
|
|
} |
|
|
|
ZQFunctionListBox *box = new ZQFunctionListBox(tab, "通用方法", 4); |
|
|
|
box->newFunc("读板卡信息", {"id"}, [this](int argn, const char **args) { //
|
|
|
|
ack_read_board_info_data_t ack = IflytopCanbusMaster::ins()->readboardinfo(atoi(args[0])); |
|
|
|
ZQUI::ins()->ishow("boardType :%s(%d)", BoardTypeToString(ack.boardType), ack.boardType); |
|
|
|
ZQUI::ins()->ishow("projectId :%s(%d)", ProjectIDToString(ack.projectId), ack.projectId); |
|
|
|
ZQUI::ins()->ishow("protcol_version :%d", ack.protcol_version); |
|
|
|
ZQUI::ins()->ishow("software_version :%d", ack.software_version); |
|
|
|
ZQUI::ins()->ishow("hardware_version :%d", ack.hardware_version); |
|
|
|
}); |
|
|
|
|
|
|
|
box->newFunc("读内存信息", {"id"}, [this](int argn, const char **args) { //
|
|
|
|
ack_sysinfo_t ack = IflytopCanbusMaster::ins()->readsysinfo(atoi(args[0])); |
|
|
|
ask_taskinfo_t task[20]; |
|
|
|
for (int i = 0; i < ack.taskNum; i++) { |
|
|
|
task[i] = IflytopCanbusMaster::ins()->readtaskinfo(atoi(args[0]), i); |
|
|
|
} |
|
|
|
ZQUI::ins()->ishow("=========================== sys info ==========================="); |
|
|
|
ZQUI::ins()->ishow("total_heap_size :%d", ack.total_heap_size); |
|
|
|
ZQUI::ins()->ishow("free_heap_size :%d", ack.free_heap_size); |
|
|
|
ZQUI::ins()->ishow("sysHasRun :%d", ack.sysHasRun); |
|
|
|
ZQUI::ins()->ishow("="); |
|
|
|
|
|
|
|
ZQUI::ins()->ishow("=========================== task info ==========================="); |
|
|
|
ZQUI::ins()->ishow("taskoff name state stackRemainSize priority"); |
|
|
|
for (int i = 0; i < ack.taskNum; i++) { |
|
|
|
ZQUI::ins()->ishow("%d %10s %c %d %d", i, task[i].taskName, task[i].state, task[i].stackRemindSize, task[i].priority); |
|
|
|
} |
|
|
|
ZQUI::ins()->ishow("="); |
|
|
|
}); |
|
|
|
|
|
|
|
{ |
|
|
|
ZQFunctionListBox *box = new ZQFunctionListBox(tab, "泵机指令", 4); |
|
|
|
box->newFunc("PingAllBoard", {}, [this](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->pingAllBoard(); |
|
|
|
}); |
|
|
|
|
|
|
|
box->newFunc("pump_rotate", {"subid", "rpm"}, [this](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->pump_rotate(getDeviceId(), atoi(args[0]), atoi(args[1])); |
|
|
|
}); |
|
|
|
box->newFunc("clear_reset_flag", {"id"}, [this](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->clear_reset_flag(atoi(args[0])); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
box->newFunc("pump_stop", {"subid"}, [this](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->pump_stop(getDeviceId(), atoi(args[0])); |
|
|
|
}); |
|
|
|
void MainWindow::constructDrawBarDisinfectionBoxTab() { //
|
|
|
|
|
|
|
|
box->newFunc("pump_set_ihold_irun_idelay", {"subid", "ihold", "irun", "idelay"}, [this](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->pump_set_ihold_irun_idelay(getDeviceId(), atoi(args[0]), atoi(args[1]), atoi(args[2]), atoi(args[3])); |
|
|
|
}); |
|
|
|
ZQVTabPage *tab = new ZQVTabPage(ui->buttonTabWidget, "消毒拉杆箱"); |
|
|
|
|
|
|
|
box->newFunc("pump_set_acc", {"subid", "acc"}, [this](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->pump_set_acc(getDeviceId(), atoi(args[0]), atoi(args[1])); |
|
|
|
}); |
|
|
|
{ |
|
|
|
ZQFunctionListBox *box = new ZQFunctionListBox(tab, "MINI功率控制板", 4); |
|
|
|
constructPumpControlUI(box, kFixBoardId_LiquidCtrl); |
|
|
|
// 喷液MINI真空泵
|
|
|
|
box->newFunc("喷液MINI真空泵控制", {"onoff"}, [this](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->sl_mini_ac_ctrl(kFixBoardId_LiquidCtrl, atoi(args[0])); |
|
|
|
}); |
|
|
|
// 气密性测试MINI真空泵
|
|
|
|
box->newFunc("气密性测试MINI真空泵", {"onoff"}, [this](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->atta_mini_air_compressor_ctrl(kFixBoardId_LiquidCtrl, atoi(args[0])); |
|
|
|
}); |
|
|
|
// 压力传感器总线
|
|
|
|
box->newFunc("压力传感器总线-读数据", {"subid"}, [this](int argn, const char **args) { //
|
|
|
|
int32_t val = IflytopCanbusMaster::ins()->pressure_sensor_bus_read_data( //
|
|
|
|
kFixBoardId_LiquidCtrl, atoi(args[0])); |
|
|
|
ZQUI::ins()->ishow("val:%d", val); |
|
|
|
}); |
|
|
|
box->newFunc("压力传感器总线-设置上报周期", {"periodms"}, [this](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->pressure_sensor_bus_set_report_period_ms( //
|
|
|
|
kFixBoardId_LiquidCtrl, atoi(args[0])); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
box->newFunc("pump_set_subic_reg", {"subid", "regadd", "val"}, [this](int argn, const char **args) { //
|
|
|
|
IflytopCanbusMaster::ins()->pump_set_subic_reg(getDeviceId(), atoi(args[0]), atoi(args[1]), atoi(args[2])); |
|
|
|
}); |
|
|
|
void MainWindow::constructAppUI() { |
|
|
|
//
|
|
|
|
constructCommonOperationTab(); |
|
|
|
constructDrawBarDisinfectionBoxTab(); |
|
|
|
} |
|
|
|
|
|
|
|
box->newFunc("pump_get_subic_reg", {"subid", "regadd"}, [this](int argn, const char **args) { //
|
|
|
|
int val = IflytopCanbusMaster::ins()->pump_get_subic_reg(getDeviceId(), atoi(args[0]), atoi(args[1])); |
|
|
|
ZQUI::ins()->ishow("val:%d", val); |
|
|
|
}); |
|
|
|
void MainWindow::processReportPacket(packet_type_t type, uint8_t from, uint8_t to, uint8_t *hex, uint32_t hexlen) { |
|
|
|
if (type != kreport) { |
|
|
|
return; |
|
|
|
} |
|
|
|
zcanbus_packet_t *frame = (zcanbus_packet_t *)hex; |
|
|
|
|
|
|
|
if (frame->function_id == kreport_heatpacket_pong) { |
|
|
|
report_heatpacket_data_t *ack = (report_heatpacket_data_t *)frame->params; |
|
|
|
ZQUI::ins()->rshow("[Heat ][FROM:%03d] HeatIndex:%x ToardType:%s flag:%x", //
|
|
|
|
from, ack->heartIndex, BoardTypeToString(ack->boardType), ack->flag); |
|
|
|
|
|
|
|
} else if (frame->function_id == kreport_exception_error) { |
|
|
|
report_exeception_data_t *ack = (report_exeception_data_t *)frame->params; |
|
|
|
ZQUI::ins()->rshow("[Exception][FROM:%03d] subid:%x ecode:%s", //
|
|
|
|
from, ack->subid, ErrorCodeToString(ack->ecode)); |
|
|
|
} else if (frame->function_id == kreport_pressure_data) { |
|
|
|
report_pressure_data_t *ack = (report_pressure_data_t *)frame->params; |
|
|
|
QString info; |
|
|
|
info.append(fmt("[Pressure][FROM:%03d](%d)", from, ack->sensorDataNum)); |
|
|
|
for (int i = 0; i < ack->sensorDataNum; i++) { |
|
|
|
info.append(fmt(" %d:%d,", ack->data[i].subid, ack->data[i].pressureVal)); |
|
|
|
} |
|
|
|
ZQUI::ins()->rshow(info.toStdString().c_str()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|