releasev1.2

This commit is contained in:
kirl committed 2026-08-03 04:09:26 +08:00
1 parent 74010ef611
commit c296caa328
10 files changed
+693 -267

No files matched your search

+6 -27
View File
@@ -22,7 +22,6 @@
* WiFi: 连接 ICE (密码 12345678), 获取 IP 后用浏览器打开控制页面
*/
#include "emm_v5.h"
#include "magnet.h"
#include "servo.h"
#include "web_ctrl.h"
@@ -47,35 +46,15 @@ static void button_recognize_task(void *pvParam)
{
while (1) {
if (key_is_pressed()) {
ESP_LOGI(TAG, "按钮按下, 归零后再发送 RECOGNIZE ...");
ESP_LOGI(TAG, "按钮按下, 先发 TASK_START (MPU 开始计时) ...");
buzzer_beep(2000, 100); /* 短音: 识别开始 */
/* 按下按钮即通知 MPU 任务开始计时 (与 RECOGNIZE 区分, 不触发识别) */
edc_proto_send_task_start();
/* ---- 归零: 舵机抬起 + Z/X/Y 三轴并行回零 ----
Z 旋转与 X/Y 平移互不干扰 (Fragment 里也是三轴并行),
无需等 Z 到位再动 X/Y —— 三轴同时下发、一次到位等待 */
actuator_servo_up();
uint32_t z_motion = actuator_angle_motion_time_ms(ACTUATOR_ANGLE_LIMIT_DEG,
ACTUATOR_EXEC_Z_VEL,
ACTUATOR_EXEC_Z_ACC);
uint32_t xy_motion = actuator_mm_motion_time_ms(ACTUATOR_LIMIT_X_MAX,
ACTUATOR_EXEC_VEL,
ACTUATOR_EXEC_ACC);
uint32_t y_motion = actuator_mm_motion_time_ms(ACTUATOR_LIMIT_Y_MAX,
ACTUATOR_EXEC_VEL,
ACTUATOR_EXEC_ACC);
uint32_t home_motion = z_motion;
if (xy_motion > home_motion) home_motion = xy_motion;
if (y_motion > home_motion) home_motion = y_motion;
actuator_motor_angle(ACTUATOR_ADDR_ANGLE, 0.0f,
ACTUATOR_EXEC_Z_VEL, ACTUATOR_EXEC_Z_ACC, true);
actuator_motor_mm(ACTUATOR_ADDR_X, 0.0f,
ACTUATOR_EXEC_VEL, ACTUATOR_EXEC_ACC, true);
actuator_motor_mm(ACTUATOR_ADDR_Y1, 330.0f,
ACTUATOR_EXEC_VEL, ACTUATOR_EXEC_ACC, true);
actuator_wait_arrival(home_motion,
(1u << 0) | (1u << 1) | (1u << 2) | (1u << 3));
Cycle 执行完成后也会调用 actuator_home_all() 置零 */
actuator_home_all();
ESP_LOGI(TAG, "归零完成, 发送 RECOGNIZE ...");