From e4fccac36eca3eed1d4bde75ef9c87746dad23e8 Mon Sep 17 00:00:00 2001 From: "REASEARCHER\\18383" <1633026436@qq.com> Date: Wed, 3 Sep 2025 11:51:23 +0800 Subject: [PATCH] =?UTF-8?q?heat80Gear(=E5=8D=AB=E5=AF=BC=E4=BD=8E=E6=B8=A9?= =?UTF-8?q?)=20=E5=A2=9E=E5=8A=A0=E6=B0=B4=E5=B9=B3=E5=9B=9E=E9=9B=B6?= =?UTF-8?q?=E8=A7=92=E5=BA=A6=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Hyt2/APP/Device/Device_angle/get_angle.c | 28 +++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Hyt2/APP/Device/Device_angle/get_angle.c b/Hyt2/APP/Device/Device_angle/get_angle.c index fa1bc50..cf77ded 100644 --- a/Hyt2/APP/Device/Device_angle/get_angle.c +++ b/Hyt2/APP/Device/Device_angle/get_angle.c @@ -2882,17 +2882,25 @@ static char ptz_hori_get_angle_a() // tem4 = tem4 + 360.0; // } } - if(tem4 == 360.0)///////解决既显示360又显示角度0的问题 + //避免出现异常 + for(uint8_t i = 0; i < 3; i++) { - tem4 = 0; - } - if(tem4 < 0) - { - tem4 = tem4 + 360.0; - } - if(tem4>360.0) - { - tem4 = tem4 - 360.0; + if(tem4 == 360.0)///////解决既显示360又显示角度0的问题 + { + tem4 = 0; + } + else if( tem4 < 0 ) + { + tem4 = tem4 + 360.0; + } + else if( tem4 > 360.0 ) + { + tem4 = tem4 - 360.0; + } + if (tem4 >=0 && tem4 <= 360.0) + { + break; + } } g_ptz.hori_angle_actual = tem4;