From ece6d88be97dd975cfe6ab1ab9d4eab9d9856962 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sat, 29 Mar 2025 10:06:09 +0800 Subject: [PATCH] v1003 | change can baudrate to 1M --- a8000_protocol | 2 +- sdk/components/pipette_module/pipette_ctrl_module_v2.cpp | 13 ++++++++----- sdk/components/pipette_module/pipette_ctrl_module_v2.hpp | 3 ++- usrc/project_configs.h | 2 +- usrc/public_service/common_hardware_init.c | 2 +- usrc/version.h | 2 ++ 6 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 usrc/version.h diff --git a/a8000_protocol b/a8000_protocol index 74042ce..de705d4 160000 --- a/a8000_protocol +++ b/a8000_protocol @@ -1 +1 @@ -Subproject commit 74042ce3f342868ca2bfdb51a09fddd68ab396c1 +Subproject commit de705d4df1deff279fa9547365f34f22a65c2904 diff --git a/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp b/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp index ca4d489..fb600a1 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp +++ b/sdk/components/pipette_module/pipette_ctrl_module_v2.cpp @@ -153,6 +153,8 @@ int32_t PipetteModuleV2::module_xxx_reg_impl(int32_t param_id, bool read, int32_ XXX_STATE_REG(kreg_pipette_zm_pos, assign_int32(&val, zm_get_now_pos())); XXX_STATE_REG(kreg_pipette_zm_is_enable, REG_GET(m_state.enable)); XXX_STATE_REG(kreg_pipette_zm_dpos, REG_GET(m_state.dpos)); + XXX_STATE_REG(kreg_pipette_zm_has_move_zero, REG_GET(m_state.zm_has_move_zero)); + /*********************************************************************************************************************** * CFG * @@ -184,6 +186,7 @@ int32_t PipetteModuleV2::module_xxx_reg_impl(int32_t param_id, bool read, int32_ XXX_CFG_REG(zm_pos_devi_tolerance); XXX_CFG_REG(zm_io_trigger_append_distance); + default: return err::kmodule_not_find_reg; break; @@ -210,7 +213,7 @@ int32_t PipetteModuleV2::pipette_zmotor_enable(int32_t enable) { m_zm->enable(enable); m_state.enable = enable; if (enable == 0 && m_cfg.zm_enable_enc == 0) { - m_state.has_move_to_zero = 0; + m_state.zm_has_move_zero = 0; } return 0; } @@ -224,7 +227,7 @@ int32_t PipetteModuleV2::pipette_zmotor_move_zero() { // thread_start_work(__FUNCTION__, [this]() { do_zm_move_0p(); // 移动到零点 zm_set_now_pos(0 + m_cfg.zm_dzero - m_cfg.zm_io_trigger_append_distance); - m_state.has_move_to_zero = 1; + m_state.zm_has_move_zero = 1; }); return 0; } @@ -241,7 +244,7 @@ int32_t PipetteModuleV2::pipette_zmotor_measure_distance() { int32_t dpos = zm_get_now_pos() - startpos; zm_set_now_pos(0 + m_cfg.zm_dzero - m_cfg.zm_io_trigger_append_distance); - m_state.has_move_to_zero = 1; + m_state.zm_has_move_zero = 1; m_asynchronous_result.result0 = 0 + m_cfg.zm_dzero - m_cfg.zm_io_trigger_append_distance - dpos; }); @@ -635,7 +638,7 @@ void PipetteModuleV2::do_pipette_zmotor_move_to_zero_point_quick() { int32_t dpos = zm_get_now_pos() - startpos; // 设置零点 zm_set_now_pos(0 + m_cfg.zm_dzero - m_cfg.zm_io_trigger_append_distance); - m_state.has_move_to_zero = 1; + m_state.zm_has_move_zero = 1; if (m_cfg.zm_pos_devi_tolerance != 0 && (abs(expectation_dpos - dpos) > m_cfg.zm_pos_devi_tolerance)) { throw zapp_exception(err::kstep_motor_lost_step); @@ -837,7 +840,7 @@ check_motor_is_enable: check_motor_has_moveto_zero: if (m_state.enable == 0) return err::kstep_motor_not_enable; - if (m_state.has_move_to_zero == 0) return err::kstep_motor_not_move_to_zero; + if (m_state.zm_has_move_zero == 0) return err::kstep_motor_not_move_to_zero; goto check; check: diff --git a/sdk/components/pipette_module/pipette_ctrl_module_v2.hpp b/sdk/components/pipette_module/pipette_ctrl_module_v2.hpp index 8917164..3953e5a 100644 --- a/sdk/components/pipette_module/pipette_ctrl_module_v2.hpp +++ b/sdk/components/pipette_module/pipette_ctrl_module_v2.hpp @@ -79,6 +79,7 @@ class PipetteModuleV2 : public ZIModule { int32_t zm_dzero; // 零点偏移 int32_t zm_io_trigger_append_distance; int32_t zm_pos_devi_tolerance; + } config_t; typedef struct { @@ -106,7 +107,7 @@ class PipetteModuleV2 : public ZIModule { int32_t aspirate_cfg_eigen_time; // 吸液操作验证,特征时间,用来检测气泡,吸空检测 int32_t aspirate_cfg_tolerance; // 容差 - int32_t has_move_to_zero; + int32_t zm_has_move_zero; } state_t; struct { diff --git a/usrc/project_configs.h b/usrc/project_configs.h index 89ebc8a..ac69691 100644 --- a/usrc/project_configs.h +++ b/usrc/project_configs.h @@ -1,5 +1,5 @@ #pragma once -#define PC_VERSION 1002 +#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/public_service/common_hardware_init.c b/usrc/public_service/common_hardware_init.c index b2ccd37..69ba747 100644 --- a/usrc/public_service/common_hardware_init.c +++ b/usrc/public_service/common_hardware_init.c @@ -140,7 +140,7 @@ static void can1_init() { HAL_NVIC_EnableIRQ(CAN1_SCE_IRQn); hcan1.Instance = CAN1; - hcan1.Init.Prescaler = 4; + hcan1.Init.Prescaler = 2; hcan1.Init.Mode = CAN_MODE_NORMAL; hcan1.Init.SyncJumpWidth = CAN_SJW_3TQ; hcan1.Init.TimeSeg1 = CAN_BS1_14TQ; diff --git a/usrc/version.h b/usrc/version.h new file mode 100644 index 0000000..1cb0f84 --- /dev/null +++ b/usrc/version.h @@ -0,0 +1,2 @@ +#pragma once +#define PC_VERSION 1003