From a179e099b932b9526fe14aecd93c7030d14b00dd Mon Sep 17 00:00:00 2001 From: "REASEARCHER\\18383" <1633026436@qq.com> Date: Wed, 3 Sep 2025 11:25:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E5=9E=8B=E6=97=A0=E5=88=B7=EF=BC=8C?= =?UTF-8?q?=E6=A0=87=E5=87=86=E7=89=88=E6=9C=AC=E5=B8=A6=E4=BC=A0=E5=8A=A8?= =?UTF-8?q?=EF=BC=8C=E8=9C=97=E8=BD=AE=E8=9C=97=E6=9D=86=E4=BC=A0=E5=8A=A8?= =?UTF-8?q?=E6=AF=9480=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=B0=B4=E5=B9=B3?= =?UTF-8?q?=E8=A7=92=E5=BA=A6=E5=BC=82=E5=B8=B8=E5=A4=84=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 | 29 ++++++++++++++++-------- 1 file changed, 19 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..098fa06 100644 --- a/Hyt2/APP/Device/Device_angle/get_angle.c +++ b/Hyt2/APP/Device/Device_angle/get_angle.c @@ -2882,18 +2882,27 @@ 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;