diff --git a/dap/dap.cfg b/dap/dap.cfg new file mode 100644 index 0000000..ba46fe8 --- /dev/null +++ b/dap/dap.cfg @@ -0,0 +1,3 @@ +adapter driver cmsis-dap +transport select swd +source [find target/stm32f4x.cfg] \ No newline at end of file diff --git a/doc/DAP烧录.md b/doc/DAP烧录.md new file mode 100644 index 0000000..89f74fc --- /dev/null +++ b/doc/DAP烧录.md @@ -0,0 +1 @@ +https://cloud.tencent.com/developer/article/1840792 \ No newline at end of file diff --git a/flush_bydap.bat b/flush_bydap.bat new file mode 100644 index 0000000..521387c --- /dev/null +++ b/flush_bydap.bat @@ -0,0 +1 @@ +openocd.exe -f ./dap/dap.cfg -c "init; reset halt; wait_halt; flash write_image erase ./Debug/a8000_subboard.hex" -c reset -c shutdown \ No newline at end of file diff --git a/rst_bydap.bat b/rst_bydap.bat new file mode 100644 index 0000000..d3333c0 --- /dev/null +++ b/rst_bydap.bat @@ -0,0 +1 @@ +openocd.exe -f ./dap/dap.cfg -c "init;reset;shutdown" \ No newline at end of file diff --git a/sdk/components/api/zi_module.hpp b/sdk/components/api/zi_module.hpp index f30b3b6..f749bcd 100644 --- a/sdk/components/api/zi_module.hpp +++ b/sdk/components/api/zi_module.hpp @@ -1,5 +1,6 @@ #pragma once #include +#include "version.h" #include diff --git a/sdk/components/pipette_module/base/pipette_cfg.hpp b/sdk/components/pipette_module/base/pipette_cfg.hpp index afbc2eb..c0e9e55 100644 --- a/sdk/components/pipette_module/base/pipette_cfg.hpp +++ b/sdk/components/pipette_module/base/pipette_cfg.hpp @@ -19,6 +19,7 @@ typedef struct { int32_t platform_info_cpyid; // 平台信息的副本ID int32_t each_action_delay_time; // 每个动作之间的延时,单位ms (动作调试使用) int32_t aspirate_pressure_report_extend_time; // 吸取时,额外压力上报时长 + int32_t lld_enable_protect; // 是否使能lld保护 int32_t max; } common_cfg_t; @@ -27,15 +28,17 @@ typedef enum { kpipette_common_cfg_platform_info_cpyid, // 平台信息的副本ID kpipette_common_cfg_each_action_delay_time, // 每个动作之间的延时,单位ms (动作调试使用) kpipette_common_cfg_aspirate_pressure_report_extend_time, // 吸取时,额外压力上报时长 + kpipette_common_cfg_lld_enable_protect, // 是否使能lld保护 kpipette_common_cfg_max, } pipette_common_cfg_index_t; static inline const char *common_cfg_index_to_string(pipette_common_cfg_index_t index) { switch (index) { CASE_ENUM_TO_STRING(kpipette_common_cfg_pressure_record_enable) - CASE_ENUM_TO_STRING(kpipette_common_cfg_platform_info_cpyid) // 平台信息的副本ID - CASE_ENUM_TO_STRING(kpipette_common_cfg_each_action_delay_time) // 每个动作之间的延时,单位ms (动作调试使用) + CASE_ENUM_TO_STRING(kpipette_common_cfg_platform_info_cpyid) // 平台信息的副本ID + CASE_ENUM_TO_STRING(kpipette_common_cfg_each_action_delay_time) // 每个动作之间的延时,单位ms (动作调试使用) CASE_ENUM_TO_STRING(kpipette_common_cfg_aspirate_pressure_report_extend_time) // 吸取时,额外压力上报时长 + CASE_ENUM_TO_STRING(kpipette_common_cfg_lld_enable_protect) // 是否使能lld保护 CASE_ENUM_TO_STRING(kpipette_common_cfg_max) } return "unknown"; @@ -447,6 +450,7 @@ static inline const char *liquid_info_index_to_string(liquid_info_index_t index) CASE_ENUM_TO_STRING(kliquid_info_plld_pm_vcpyid); CASE_ENUM_TO_STRING(kliquid_info_plld_threshold); CASE_ENUM_TO_STRING(kliquid_info_plld_zm_vel); + CASE_ENUM_TO_STRING(kliquid_info_plld_invasion_depth); CASE_ENUM_TO_STRING(kliquid_info_empty_tip_pm_vcpyid); CASE_ENUM_TO_STRING(kliquid_info_blowout_air_volume); CASE_ENUM_TO_STRING(kliquid_info_blowout_air_pm_vcpyid); @@ -464,9 +468,8 @@ static inline const char *liquid_info_index_to_string(liquid_info_index_t index) CASE_ENUM_TO_STRING(kliquid_info_jet_pm_vcpyid); CASE_ENUM_TO_STRING(kliquid_info_distribu_pm_vpyid); CASE_ENUM_TO_STRING(kliquid_info_mark); - default: - return "unknown liquid info index"; } + return "unkown_index"; } #undef CASE_ENUM_TO_STRING diff --git a/sdk/components/pipette_module/pipette_ctrl_module.cpp b/sdk/components/pipette_module/pipette_ctrl_module.cpp index a6d451d..40d2726 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module.cpp +++ b/sdk/components/pipette_module/pipette_ctrl_module.cpp @@ -408,7 +408,13 @@ int32_t PipetteModule::pipette_pump_aspirate() { adjust_container_pos(&acfg->container_pos, m_common_cfg.platform_info_cpyid); if (acfg->lld_enable) { - _do_lld(acfg->container_pos, platform_info, container_cfg, liquidinfo); // 液面探测 + bool lld_enable_protect = false; + if (acfg->lld_enable_protect < 0) { + lld_enable_protect = acfg->lld_enable_protect; + } else { + lld_enable_protect = m_common_cfg.lld_enable_protect; // 使用全局配置 + } + _do_lld(acfg->container_pos, platform_info, container_cfg, liquidinfo, m_common_cfg.lld_enable_protect); // 液面探测 } else { m_state.water_level = acfg->container_pos + container_cfg->fix_water_level_depth; // 没有使用lld,使用固定深度 } @@ -432,10 +438,19 @@ int32_t PipetteModule::pipette_pump_aspirate() { return 0; } -void PipetteModule::_do_lld(int32_t container_pos, platinfo_t *platform_info, container_info_t *container_cfg, liquid_info_t *liquidinfo) { +void PipetteModule::_do_lld(int32_t container_pos, platinfo_t *platform_info, container_info_t *container_cfg, liquid_info_t *liquidinfo, int32_t enable_lld_project) { int32_t ecode = 0; int32_t start_pressure = 0; + int32_t lld_end_pos = container_pos + container_cfg->container_depth - container_cfg->lld_end_pos_margin; + if (enable_lld_project) { + int32_t lld_limit_end_pos = container_pos + platform_info->tip_length - container_cfg->immersion_depth; + if (lld_end_pos > lld_limit_end_pos) { + lld_end_pos = lld_limit_end_pos; // 限制lld_end_pos不能超过瓶口 + ZLOGW(TAG, "lld_end_pos %d is larger than lld_limit_end_pos %d, set lld_end_pos to lld_limit_end_pos", lld_end_pos, lld_limit_end_pos); + } + } + // 移动到转移位置 ZLOGI(TAG, "-->zm move to transform pos"); zm_move_to_block(get_zmotor_standby_pos(), kzm_v_default, 0); @@ -445,11 +460,6 @@ void PipetteModule::_do_lld(int32_t container_pos, platinfo_t *platform_info, co pump_move_to_x100nl_block(300 /*30ul*/, kpm_v_max); // 为lld清空tip,提供一定空气柱 action_delay(); - // 移动到瓶口 - ZLOGI(TAG, "-->zm move to container neck pos"); - zm_move_to_block(container_pos - 50 /*5mm*/, kzm_v_default, 0); - action_delay(); - // 启动lld ZLOGI(TAG, "-->start lld, lld_pm_vindex %d plld_threshold %d", liquidinfo->plld_pm_vcpyid, liquidinfo->plld_threshold); DO_IN_THREAD(m_smtp2.pump_set_io1_mode(1)); // lld输入高 @@ -459,13 +469,6 @@ void PipetteModule::_do_lld(int32_t container_pos, platinfo_t *platform_info, co m_smtp2.pump_get_pressure(&start_pressure); ZLOGI(TAG, "-->start lld , start_pressure is %d", start_pressure); - if (m_common_cfg.pressure_record_enable) { - int32_t nopos = zm_get_now_pos(); - int32_t pressure = 0; - m_smtp2.pump_get_pressure(&pressure); - push_pressure_sample_data(nopos, pressure); - } - #if 1 pump_do_lld(liquidinfo->plld_threshold, 200, liquidinfo->plld_pm_vcpyid); // lld延时200ms,速度为plld_zm_vel osDelay(110); // 等待lld启动 @@ -473,12 +476,18 @@ void PipetteModule::_do_lld(int32_t container_pos, platinfo_t *platform_info, co pump_start_lld(2400, liquidinfo->plld_pm_vcpyid); #endif + if (m_common_cfg.pressure_record_enable) { + int32_t nopos = zm_get_now_pos(); + int32_t pressure = 0; + m_smtp2.pump_get_pressure(&pressure); + push_pressure_sample_data(nopos, pressure); + } + // 快速移动到瓶口 ZLOGI(TAG, "-->zm move quick to lld search start pos"); zm_move_to_lld_start_search_pos_block(container_pos, container_cfg, kzm_v_default, 0); // lld,zm移动到瓶底 - ZLOGI(TAG, "-->zm move slow to container bottom pos"); - int32_t lld_end_pos = container_pos + container_cfg->container_depth - container_cfg->lld_end_pos_margin; + ZLOGI(TAG, "-->zm move slow to lld end pos"); zm_move_to(lld_end_pos, kzm_v_lld, liquidinfo->plld_zm_vel); /** @@ -498,7 +507,7 @@ void PipetteModule::_do_lld(int32_t container_pos, platinfo_t *platform_info, co water_level = zm_get_now_pos() - liquidinfo->plld_invasion_depth; detect_liquid = true; m_zm->stop(); - ZLOGI(TAG, "-->detect liquid, water_level %d", water_level); + ZLOGI(TAG, "-->detect liquid, plld_invasion_depth:%d water_level %d", liquidinfo->plld_invasion_depth, water_level); break; } if (!m_common_cfg.pressure_record_enable) { diff --git a/sdk/components/pipette_module/pipette_ctrl_module.hpp b/sdk/components/pipette_module/pipette_ctrl_module.hpp index c91c052..c307d0d 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module.hpp +++ b/sdk/components/pipette_module/pipette_ctrl_module.hpp @@ -306,7 +306,7 @@ class PipetteModule : public ZIModule { virtual int32_t pipette_pump_aspirate_set_param(aspiration_paramid_t param, int32_t val); virtual int32_t pipette_pump_aspirate(); - void _do_lld(int32_t container_pos, platinfo_t *platform_info, container_info_t *container_cfg, liquid_info_t *liquidinfo); + void _do_lld(int32_t container_pos, platinfo_t *platform_info, container_info_t *container_cfg, liquid_info_t *liquidinfo, int32_t enable_lld_project); void _do_sapirate(platinfo_t *platform_info, container_info_t *container_cfg, liquid_info_t *liquidinfo, aspiration_param_t *acfg); virtual int32_t pipette_pump_distribu_all_set_param(distribu_all_paramid_t param, int32_t val); diff --git a/sdk/components/pipette_module/pipette_ctrl_module_test.cpp b/sdk/components/pipette_module/pipette_ctrl_module_test.cpp index 0f6458e..3dcfb39 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module_test.cpp +++ b/sdk/components/pipette_module/pipette_ctrl_module_test.cpp @@ -31,7 +31,7 @@ int32_t PipetteModule::pipette_test_pump_move_to_x100nl(int32_t x100nl, int32_t int32_t PipetteModule::pipette_test_lld(int32_t container_pos, int32_t container_cpyid, int32_t liquid_cpyid) { adjust_container_pos(&container_pos, m_common_cfg.platform_info_cpyid); thread_start_work(__FUNCTION__, [this, container_pos, container_cpyid, liquid_cpyid]() { - ZLOGI(TAG, "pipette_pump_aspirate"); + ZLOGI(TAG, "pipette_test_lld container_pos:%d container_cpyid:%d liquid_cpyid:%d", container_pos, container_cpyid, liquid_cpyid); if (pump_read_tip_state() == 0) { throw zapp_exception(err::kpipette_error_TipDrop); } @@ -42,10 +42,10 @@ int32_t PipetteModule::pipette_test_lld(int32_t container_pos, int32_t container DO_IN_THREAD(m_smtp2.pump_set_io1_mode(0)); // lld输入高 platinfo_t *platform_info = get_platinfo_smart(m_common_cfg.platform_info_cpyid, &m_now_platinfo); - liquid_info_t *liquidinfo = get_liquid_info_smart(container_cpyid, &m_now_liquid_info); - container_info_t *container_cfg = get_container_info_smart(liquid_cpyid, &m_now_container_info); + liquid_info_t *liquidinfo = get_liquid_info_smart(liquid_cpyid, &m_now_liquid_info); + container_info_t *container_cfg = get_container_info_smart(container_cpyid, &m_now_container_info); - _do_lld(container_pos, platform_info, container_cfg, liquidinfo); + _do_lld(container_pos, platform_info, container_cfg, liquidinfo, true); }); return 0; } diff --git a/usrc/main.cpp b/usrc/main.cpp index 8d3766a..a062490 100644 --- a/usrc/main.cpp +++ b/usrc/main.cpp @@ -1,6 +1,6 @@ #include #include - +#include "version.h" #include "configs/device_id_mgr.hpp" #include "public_service/public_service.hpp" #include "sdk/chip/chip.hpp" diff --git a/usrc/project_configs.h b/usrc/project_configs.h index ac69691..e34e39d 100644 --- a/usrc/project_configs.h +++ b/usrc/project_configs.h @@ -1,5 +1,4 @@ #pragma once -#include "version.h" #define PC_MANUFACTURER "http://www.iflytop.com/" #define PC_PROJECT_NAME "a8000_subboard" #define PC_IFLYTOP_ENABLE_OS 1 diff --git a/usrc/version.h b/usrc/version.h index 422691a..29843a0 100644 --- a/usrc/version.h +++ b/usrc/version.h @@ -1,2 +1,2 @@ #pragma once -#define APP_VERSION 1206 +#define APP_VERSION 1208