From 72c45e43d80fa985dbd248a06b01437dba8c5249 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sat, 8 Jun 2024 16:29:05 +0800 Subject: [PATCH] update --- CMakeLists.txt | 2 + a8000_protocol | 2 +- src/tab/fan_ctrl_tab.cpp | 60 +++++++++++++++++++++++++++ src/tab/fan_ctrl_tab.hpp | 43 +++++++++++++++++++ src/tab/module_opera_tab.cpp | 19 +-------- src/tab/water_cooling_temperature_tab.cpp | 69 +++++++++++++++++++++++++++++++ src/tab/water_cooling_temperature_tab.hpp | 43 +++++++++++++++++++ 7 files changed, 220 insertions(+), 18 deletions(-) create mode 100644 src/tab/fan_ctrl_tab.cpp create mode 100644 src/tab/fan_ctrl_tab.hpp create mode 100644 src/tab/water_cooling_temperature_tab.cpp create mode 100644 src/tab/water_cooling_temperature_tab.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index a6db071..d4c8aae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,8 @@ set(PROJECT_SOURCES src/tab/mini_servo_tab.cpp src/tab/code_scaner_tab.cpp + 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 diff --git a/a8000_protocol b/a8000_protocol index 8268827..8fa3934 160000 --- a/a8000_protocol +++ b/a8000_protocol @@ -1 +1 @@ -Subproject commit 82688278acc674cf0ad6a3a5f9017b93cc45a670 +Subproject commit 8fa3934e833a116d68d4c32ebba8352ce1b8746f diff --git a/src/tab/fan_ctrl_tab.cpp b/src/tab/fan_ctrl_tab.cpp new file mode 100644 index 0000000..2464c10 --- /dev/null +++ b/src/tab/fan_ctrl_tab.cpp @@ -0,0 +1,60 @@ +#include "fan_ctrl_tab.hpp" + +#include "iflytop_canbus/iflytop_canbus_master.hpp" +#include "logger.hpp" +#include "qt_serial_datachannel.hpp" +#include "zexception.hpp" +#include "zui/z_function_list_box.hpp" +#include "zui/z_reg_table_list_box.hpp" +#include "zui/zq_vtab_page.hpp" +// +#include "./mainwindow.h" +#include "zui\zqui.hpp" +// +using namespace iflytop; +using namespace std; + +extern Ui::MainWindow *main_ui; + +extern int getDeviceId(); + +FanCtrlTab *FanCtrlTab::inst() { + static FanCtrlTab *ins = new FanCtrlTab(); + return ins; +} + +void FanCtrlTab::construct(QTabWidget *fathertab) { + /*********************************************************************************************************************** + * 模块操作 * + ***********************************************************************************************************************/ + // kpipette_ctrl_init_device + // kpipette_ctrl_put_tip + // kpipette_ctrl_move_to_ul + + ZQVTabPage *tab = new ZQVTabPage(fathertab, "风扇控制"); + + { + ZQFunctionListBox *box = new ZQFunctionListBox(tab, "风扇控制", 4); + box->newFunc("控制风扇转速", {"speed"}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), kfan_controler_set_speed, atoi(args[0])); }); + } + + tab->addSpacer(); + + { + 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("reg_pipette_pos_ul", kreg_pipette_pos_ul, ZRegItem::krw | ZRegItem::kdec); + + tableBox->addSpacer(); + tab->addSpacer(); + } +} diff --git a/src/tab/fan_ctrl_tab.hpp b/src/tab/fan_ctrl_tab.hpp new file mode 100644 index 0000000..9887d14 --- /dev/null +++ b/src/tab/fan_ctrl_tab.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +#include + +namespace iflytop { +using namespace std; + +class FanCtrlTab { + public: + static FanCtrlTab *inst(); + + void construct(QTabWidget *fathertab); +}; +} // namespace iflytop diff --git a/src/tab/module_opera_tab.cpp b/src/tab/module_opera_tab.cpp index bfc8da2..89d1ba5 100644 --- a/src/tab/module_opera_tab.cpp +++ b/src/tab/module_opera_tab.cpp @@ -17,21 +17,6 @@ extern Ui::MainWindow *main_ui; extern int getDeviceId(); -// typedef enum { -// kuniversal_module = 0, // 通用模块 -// khbot_module = 1, // hbot模块 -// kmotor_module = 2, // 电机控制 -// ktemperature_ctrl_module = 3, // 温度控制 -// kfan_ctrl_module = 5, // 风扇控制 -// kcode_scaner = 6, // 风扇控制 -// kpipette_ctrl_module = 7, // 移液体枪控制 -// ka8000_optical_module = 8, // a8000光学模组 -// klaster_scaner_module = 9, // a8000光学模组 - -// ktmc_step_motor = 10, // 步进电机 -// kmini_servo_motor_module = 11, // 舵机 -// kboard = 12, // 舵机 -// } module_type_t; static const char *module_type2_str(int id) { switch (id) { @@ -42,7 +27,7 @@ static const char *module_type2_str(int id) { case kmotor_module: return "电机控制"; case ktemperature_ctrl_module: - return "温度控制"; + return "水冷温度控制"; case kfan_ctrl_module: return "风扇控制"; case kcode_scaner: @@ -92,7 +77,7 @@ void ModuleOperaTab::construct(QWidget *parent) { if (i % 10 == 0) { ZQUI::ins()->ishow(""); } - ZQUI::ins()->ishow("module :%d isOnline type:%10s v(%d)", i, module_type2_str(moduleType),moduleVersion); + ZQUI::ins()->ishow("module :%d isOnline type:%10s v(%d)", i, module_type2_str(moduleType), moduleVersion); } catch (const zexception &e) { if (e.ecode() != ke_overtime) { ZQUI::ins()->ishow("%s", e.what()); diff --git a/src/tab/water_cooling_temperature_tab.cpp b/src/tab/water_cooling_temperature_tab.cpp new file mode 100644 index 0000000..dd83ec5 --- /dev/null +++ b/src/tab/water_cooling_temperature_tab.cpp @@ -0,0 +1,69 @@ +#include "water_cooling_temperature_tab.hpp" + +#include "iflytop_canbus/iflytop_canbus_master.hpp" +#include "logger.hpp" +#include "qt_serial_datachannel.hpp" +#include "zexception.hpp" +#include "zui/z_function_list_box.hpp" +#include "zui/z_reg_table_list_box.hpp" +#include "zui/zq_vtab_page.hpp" +// +#include "./mainwindow.h" +#include "zui\zqui.hpp" +// +using namespace iflytop; +using namespace std; + +extern Ui::MainWindow *main_ui; + +extern int getDeviceId(); + +WaterCoolingTemperatureControlerTab *WaterCoolingTemperatureControlerTab::inst() { + static WaterCoolingTemperatureControlerTab *ins = new WaterCoolingTemperatureControlerTab(); + return ins; +} + +void WaterCoolingTemperatureControlerTab::construct(QTabWidget *fathertab) { + /*********************************************************************************************************************** + * 模块操作 * + ***********************************************************************************************************************/ + // kpipette_ctrl_init_device + // kpipette_ctrl_put_tip + // kpipette_ctrl_move_to_ul + + ZQVTabPage *tab = new ZQVTabPage(fathertab, "水冷温度控制器"); + + { + ZQFunctionListBox *box = new ZQFunctionListBox(tab, "水冷温度控制器", 4); + + box->newFunc("开始控温", {"temperature"}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), ktemp_controler_start_hearting, atoi(args[0])); }); + box->newFunc("停止控温", {}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), ktemp_controler_stop_hearting); }); + box->newFunc("测试-帕尔贴-控制功率", {"level[-100,100]"}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), ktemp_controler_set_peltier_power_level, atoi(args[0])); }); + box->newFunc("测试-水泵-控制转速", {"speed[0,100]"}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), ktemp_controler_set_pump_level, atoi(args[0])); }); + box->newFunc("测试-风扇-控制转速", {"speed[0,100]"}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), ktemp_controler_set_fan_level, atoi(args[0])); }); + box->newFunc("测试-日志-开关", {"enable[0,1]"}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), ktemp_controler_enable_log, atoi(args[0])); }); + } + + tab->addSpacer(); + + { + 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("reg_pipette_pos_ul", kreg_pipette_pos_ul, ZRegItem::krw | ZRegItem::kdec); + tableBox->addReg("reg_pipette_capactitance_val", kreg_pipette_capactitance_val, ZRegItem::krw | ZRegItem::kdec); + tableBox->addReg("reg_pipette_tip_state", kreg_pipette_tip_state, ZRegItem::krw | ZRegItem::kdec); + tableBox->addReg("reg_pipette_limit_ul", kreg_pipette_limit_ul, ZRegItem::krw | ZRegItem::kdec); + + tableBox->addSpacer(); + tab->addSpacer(); + } +} diff --git a/src/tab/water_cooling_temperature_tab.hpp b/src/tab/water_cooling_temperature_tab.hpp new file mode 100644 index 0000000..c695c9d --- /dev/null +++ b/src/tab/water_cooling_temperature_tab.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +#include + +namespace iflytop { +using namespace std; + +class WaterCoolingTemperatureControlerTab { + public: + static WaterCoolingTemperatureControlerTab *inst(); + + void construct(QTabWidget *fathertab); +}; +} // namespace iflytop