From 8ab6208ff1fa775408f0284b992a8551f8c08d41 Mon Sep 17 00:00:00 2001 From: xxxxm <2389287465@qq.com> Date: Mon, 16 Mar 2026 11:36:31 +0800 Subject: [PATCH] =?UTF-8?q?fix-module/shoot-heatControl,,,=E7=83=AD?= =?UTF-8?q?=E9=87=8F=E5=8F=82=E6=95=B0=E5=BE=85=E8=AE=BEconfig.c-129-134?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- User/module/config.c | 1 + User/module/shoot.c | 5 +++++ User/module/shoot.h | 1 + 3 files changed, 7 insertions(+) diff --git a/User/module/config.c b/User/module/config.c index 2bc1baa..5a58db8 100644 --- a/User/module/config.c +++ b/User/module/config.c @@ -127,6 +127,7 @@ Config_RobotParam_t robot_config = { }, .heatControl={ .enable=true, + .safe_shots=5, // 安全出弹余量 .nmax=18.0f, // 最大射频 Hz .Hwarn=200.0f, // 热量预警值 .Hsatu=100.0f, // 热量饱和值 diff --git a/User/module/shoot.c b/User/module/shoot.c index 847efa6..c9bdee0 100644 --- a/User/module/shoot.c +++ b/User/module/shoot.c @@ -512,6 +512,11 @@ int8_t Shoot_CaluTargetAngle(Shoot_t *s, Shoot_CMD_t *cmd) /* 根据热量控制计算实际射频 */ float actual_freq = Shoot_CaluFreqByHeat(s); + /* 检查可发射弹丸数是否满足安全余量 */ + if (s->param->heatControl.enable && s->heatcontrol.shots_available <= s->param->heatControl.safe_shots) { + actual_freq = 0.0f; /* 禁止发弹 */ + } + float dt = s->timer.now - s->var_trig.time_lastShoot; float dpos; dpos = CircleError(s->target_variable.trig_angle, s->var_trig.trig_agl, M_2PI); diff --git a/User/module/shoot.h b/User/module/shoot.h index 0f14916..13972ed 100644 --- a/User/module/shoot.h +++ b/User/module/shoot.h @@ -164,6 +164,7 @@ typedef struct { }jamDetection;/* 卡弹检测参数 */ struct { bool enable; /* 是否启用热量控制 */ + uint16_t safe_shots;/* 安全余量,当shots_available小于等于该值时禁止发弹 */ float nmax;//最大射频 float Hwarn;//热量预警值 float Hsatu;//热量饱和值