1522 lines
58 KiB
C
1522 lines
58 KiB
C
|
///Copyright (c) 2022, <20>Ĵ<EFBFBD><C4B4><EFBFBD>Դ<EFBFBD><D4B4>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾
|
|||
|
///All rights reserved.
|
|||
|
///@file service_selfcheck.C
|
|||
|
///@brief <20><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><F2A3ACB0><EFBFBD>ˮƽȫ<C6BD><C8AB>Χ<EFBFBD>Լ졢<D4BC><ECA1A2><EFBFBD><EFBFBD><EFBFBD>Լ죬<D4BC><ECA3AC>ֱȫ<D6B1><C8AB>Χ<EFBFBD><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/// <20>Լ<EFBFBD>
|
|||
|
///
|
|||
|
///@details
|
|||
|
///@note
|
|||
|
///@author ypc
|
|||
|
///@date 2019/05/23
|
|||
|
///
|
|||
|
///@version v1.0 2019/05/23 <20><>ʼ<EFBFBD>汾
|
|||
|
/// Hyt2.1.0 2022/06/02 <20><><EFBFBD><EFBFBD>GD32<33><32>Ƭ<EFBFBD><C6AC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ֲ
|
|||
|
|
|||
|
#include "service_selfcheck.h"
|
|||
|
#include "bsp_os.h"
|
|||
|
#include "ptz_global_variable.h"
|
|||
|
#include "angle_poweroffsave.h"
|
|||
|
#include "comm_cfginfo.h"
|
|||
|
#include "tmc2160.h"
|
|||
|
#include "service_error_count.h"
|
|||
|
|
|||
|
#ifdef PTZ_BLDC_MOTOR
|
|||
|
/// <20><>̨ȫ<CCA8><C8AB>Χ<EFBFBD>Լ<EFBFBD>
|
|||
|
static unsigned char ptz_hori_complete_self_check_task()
|
|||
|
{
|
|||
|
switch(g_ptz.hori_self_check)
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
|||
|
case PTZ_HORI_SELF_CHECK_COMPLETE_STEP:
|
|||
|
if(g_ptz.hori_ps_sw3_state == PS_COVER)//<2F><><EFBFBD><EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD>翪<EFBFBD>ر<EFBFBD><D8B1><EFBFBD>ס
|
|||
|
{
|
|||
|
ptz_hori_start(PTZ_HORI_DIR_LEFT, PTZ_HORI_SELF_CHECK_SPEED);
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_COMPLETE_STEP + 1;
|
|||
|
}
|
|||
|
else//û<>б<EFBFBD><D0B1><EFBFBD>ס
|
|||
|
{
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_right_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_fall = 0;
|
|||
|
ptz_hori_start(PTZ_HORI_DIR_RIGHT, PTZ_HORI_SELF_CHECK_SPEED);
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_COMPLETE_STEP + 2;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case PTZ_HORI_SELF_CHECK_COMPLETE_STEP + 1:
|
|||
|
if(g_ptz.hori_ps_sw3_state == PS_NO_COVER)
|
|||
|
{
|
|||
|
OSTimeDlyHMSM(0u, 0u, 3u, 0u);//<2F><>ʱת<CAB1><D7AA>
|
|||
|
ptz_hori_stop(PTZ_HORI_STOP_TIME);
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_right_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_fall = 0;
|
|||
|
ptz_hori_start(PTZ_HORI_DIR_RIGHT, PTZ_HORI_SELF_CHECK_SPEED);
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_COMPLETE_STEP + 2;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
//<2F>ȴ<EFBFBD><C8B4><EFBFBD>һ<EFBFBD><D2BB>ˮƽ<CBAE><C6BD><EFBFBD>翪<EFBFBD><E7BFAA><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
case (PTZ_HORI_SELF_CHECK_COMPLETE_STEP + 2):
|
|||
|
if(g_ptz.hori_ps_sw3_right_fall >= PS_FALL_ON)
|
|||
|
{
|
|||
|
g_ptz.hori_as5047d.as5047d_data_reset = 1;
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
g_ptz.hori_self_check++;
|
|||
|
|
|||
|
OSTimeDlyHMSM(0u, 0u, 5u, 0u);
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
//<2F>ȴ<EFBFBD><C8B4>ڶ<EFBFBD><DAB6><EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD>翪<EFBFBD><E7BFAA><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
case (PTZ_HORI_SELF_CHECK_COMPLETE_STEP + 3):
|
|||
|
if(g_ptz.hori_ps_sw3_right_fall >= PS_FALL_ON)
|
|||
|
{
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_num = g_ptz.hori_as5047d.as5047d_cycle_count;
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_angle_max = g_ptz.hori_as5047d.as5047d_ptz_angle_actual;
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_angle_K = 360.0 / g_ptz.hori_as5047d.as5047d_ptz_angle_max;
|
|||
|
|
|||
|
g_ptz.hori_as5047d.as5047d_remain_angle = g_ptz.hori_as5047d.as5047d_ptz_angle_max -
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_num * 360.0;
|
|||
|
g_ptz.hori_angleP.angle_allow_max = 360.0;
|
|||
|
g_ptz.hori_angleP.angle_allow_min = 0.0;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 1;
|
|||
|
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_right_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_fall = 0;
|
|||
|
ptz_hori_stop(PTZ_HORI_STOP_TIME);
|
|||
|
g_ptz.hori_angle_state = 1;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_DATA_SAVE;
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
return g_ptz.hori_self_check;
|
|||
|
}
|
|||
|
|
|||
|
/// <20><>̨ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
static unsigned char ptz_hori_simplify_self_check_task()
|
|||
|
{
|
|||
|
switch(g_ptz.hori_self_check)
|
|||
|
{
|
|||
|
case PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP:
|
|||
|
if(g_ptz.hori_ps_sw3_state == PS_COVER)//<2F><><EFBFBD><EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD>翪<EFBFBD>ر<EFBFBD><D8B1><EFBFBD>ס
|
|||
|
{
|
|||
|
ptz_hori_start(PTZ_HORI_DIR_LEFT, PTZ_HORI_SELF_CHECK_SPEED);
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP + 1;
|
|||
|
}
|
|||
|
else//û<>е<EFBFBD>ס
|
|||
|
{
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_right_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_fall = 0;
|
|||
|
ptz_hori_start(PTZ_HORI_DIR_RIGHT, PTZ_HORI_SELF_CHECK_SPEED);
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP + 2;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP + 1://<2F><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>翪<EFBFBD><E7BFAA><EFBFBD><EFBFBD><EFBFBD>뵲Ƭ<EBB5B2>ڵ<EFBFBD>
|
|||
|
if(g_ptz.hori_ps_sw3_state == PS_NO_COVER)
|
|||
|
{
|
|||
|
OSTimeDlyHMSM(0u, 0u, 3u, 0u);//<2F><>ʱת<CAB1><D7AA>
|
|||
|
ptz_hori_stop(PTZ_HORI_STOP_TIME);
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_right_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_fall = 0;
|
|||
|
ptz_hori_start(PTZ_HORI_DIR_RIGHT, PTZ_HORI_SELF_CHECK_SPEED);
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP + 2;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP + 2:
|
|||
|
//<2F>ȴ<EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD>翪<EFBFBD><E7BFAA><EFBFBD><EFBFBD>ת<EFBFBD>½<EFBFBD><C2BD><EFBFBD>
|
|||
|
if(g_ptz.hori_ps_sw3_right_fall >= PS_FALL_ON)
|
|||
|
{
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_count = 0;
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_angle_actual = 0;
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_angle_wf_last = 0;
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_init_angle = g_ptz.hori_as5047d.as5047d_angle_actual;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 1;
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_right_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_fall = 0;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP + 3;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP + 3://ת<><D7AA><EFBFBD><EFBFBD>0λ
|
|||
|
OSTimeDlyHMSM(0u, 0u, 1u, 0u);//<2F><>ʱת<CAB1><D7AA>
|
|||
|
g_ptz.hori_angle_control = 0.0;
|
|||
|
g_ptz.hori_speed_control = PTZ_HORI_BEST_SPEED;
|
|||
|
ptz_hori_rotate_plan(PTZ_HORI_MIN_DISTANCE);
|
|||
|
g_ptz.hori_rotate_monitor_switch = PTZ_HORI_GO_TO_ANGLE_A;
|
|||
|
g_ptz.hori_angle_state = 1;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
break;
|
|||
|
}
|
|||
|
return g_ptz.hori_self_check;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <20><>̨<EFBFBD><CCA8>ֱȫ<D6B1><C8AB>Χ<EFBFBD>Լ<EFBFBD>
|
|||
|
static unsigned char ptz_vert_complete_self_check_task()
|
|||
|
{
|
|||
|
switch(g_ptz.vert_self_check)
|
|||
|
{
|
|||
|
///<2F><><EFBFBD>ȶ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>翪<EFBFBD>ص<EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϴ<D0B6>ֱ״̬
|
|||
|
case PTZ_VERT_SELF_CHECK_COMPLETE_STEP:
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
if(g_ptz.vert_ps_sw1_state == PS_COVER)//<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
{
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_UP, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 1;
|
|||
|
}
|
|||
|
if(g_ptz.vert_ps_sw2_state == PS_COVER)//<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
{
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 2;
|
|||
|
}
|
|||
|
if(g_ptz.vert_ps_sw1_state == PS_NO_COVER && g_ptz.vert_ps_sw2_state == PS_NO_COVER)
|
|||
|
//<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
{
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 2;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case (PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 1):
|
|||
|
if(g_ptz.vert_ps_sw1_state == PS_NO_COVER)
|
|||
|
{
|
|||
|
OSTimeDlyHMSM(0u, 0u, 3u, 0u);//<2F><>ʱת<CAB1><D7AA>
|
|||
|
ptz_vert_stop(PTZ_VERT_STOP_TIME);
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
g_ptz.vert_self_check ++;
|
|||
|
}
|
|||
|
break;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
case (PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 2):
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_DOWN, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check ++;
|
|||
|
break;
|
|||
|
|
|||
|
#ifdef PTZ_SW1_DOWN_FALL_UPDATE
|
|||
|
//<2F>ж<EFBFBD><D0B6>Ƿ<C7B7><F1B5BDB4>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>,Ȼ<><C8BB><EFBFBD><EFBFBD>̨<EFBFBD><CCA8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
|||
|
case (PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 3):
|
|||
|
if(g_ptz.vert_ps_sw1_down_fall >= 1 ||
|
|||
|
g_ptz.vert_ps_sw1_state == PS_COVER)
|
|||
|
{
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_data_reset = 1;
|
|||
|
ptz_vert_stop(PTZ_VERT_STOP_TIME);
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_UP, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 10;
|
|||
|
}
|
|||
|
break;
|
|||
|
#endif
|
|||
|
|
|||
|
#ifdef PTZ_SW1_UP_RISE_UPDATE
|
|||
|
//<2F>ж<EFBFBD><D0B6>Ƿ<C7B7><F1B5BDB4>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>,Ȼ<><C8BB><EFBFBD><EFBFBD>̨<EFBFBD><CCA8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
|||
|
case (PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 3):
|
|||
|
if(g_ptz.vert_ps_sw1_down_fall >= 1 ||
|
|||
|
g_ptz.vert_ps_sw1_state == PS_COVER)
|
|||
|
{
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 300u);
|
|||
|
ptz_vert_stop(PTZ_VERT_STOP_TIME);
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_UP, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check++;
|
|||
|
}
|
|||
|
break;
|
|||
|
//<2F>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case (PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 4):
|
|||
|
if(g_ptz.vert_ps_sw1_up_rise >= 1 ||
|
|||
|
g_ptz.vert_ps_sw1_state == PS_NO_COVER)
|
|||
|
{
|
|||
|
g_ptz.vert_as5047d.as5047d_data_reset = 1;
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 10;
|
|||
|
}
|
|||
|
break;
|
|||
|
#endif
|
|||
|
|
|||
|
//<2F>ȴ<EFBFBD>SW2<57>½<EFBFBD><C2BD><EFBFBD>,<2C><><EFBFBD>㴹ֱת<D6B1><D7AA><EFBFBD><EFBFBD>Χ
|
|||
|
case (PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 10):
|
|||
|
if(g_ptz.vert_ps_sw2_up_fall >= 1 ||
|
|||
|
g_ptz.vert_ps_sw2_state == PS_COVER)
|
|||
|
{
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_num = g_ptz.vert_as5047d.as5047d_cycle_count;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_max = g_ptz.vert_as5047d.as5047d_ptz_angle_actual;
|
|||
|
|
|||
|
g_ptz.vert_angleP.angle_range =
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_max / PTZ_VERT_BIG_GEAR_RATIO;
|
|||
|
|
|||
|
g_ptz.vert_angleP.angle_allow_min = g_ptz.vert_angleP.angle_range / 2.0 * (-1);
|
|||
|
g_ptz.vert_angleP.angle_allow_max = g_ptz.vert_angleP.angle_range / 2.0;
|
|||
|
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_K = 1 / PTZ_VERT_BIG_GEAR_RATIO;
|
|||
|
|
|||
|
|
|||
|
g_ptz.vert_as5047d.as5047d_remain_angle = g_ptz.vert_as5047d.as5047d_ptz_angle_max -
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_num * 360.0;
|
|||
|
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
|
|||
|
ptz_vert_stop(PTZ_VERT_STOP_TIME);
|
|||
|
g_ptz.vert_angle_state = 1;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_DATA_SAVE;
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
return g_ptz.vert_self_check;
|
|||
|
}
|
|||
|
|
|||
|
/// <20><>̨<EFBFBD><CCA8>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
static unsigned char ptz_vert_simplify_self_check_task()
|
|||
|
{
|
|||
|
switch(g_ptz.vert_self_check)
|
|||
|
{
|
|||
|
case PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP:
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
if(g_ptz.vert_ps_sw1_state == PS_COVER)//<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
{
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_UP, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 1;
|
|||
|
}
|
|||
|
if(g_ptz.vert_ps_sw2_state == PS_COVER)//<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
{
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_DOWN, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 2;
|
|||
|
}
|
|||
|
if(g_ptz.vert_ps_sw1_state == PS_NO_COVER && g_ptz.vert_ps_sw2_state == PS_NO_COVER)
|
|||
|
//<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
{
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_DOWN, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 2;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 1:
|
|||
|
if(g_ptz.vert_ps_sw1_state == PS_NO_COVER)
|
|||
|
{
|
|||
|
OSTimeDlyHMSM(0u, 0u, 3u, 0u);//<2F><>ʱת<CAB1><D7AA>
|
|||
|
ptz_vert_stop(PTZ_VERT_STOP_TIME);
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_DOWN, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 2;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
#ifdef PTZ_SW1_DOWN_FALL_UPDATE
|
|||
|
case PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 2:
|
|||
|
if(g_ptz.vert_ps_sw1_down_fall >= 1 ||
|
|||
|
g_ptz.vert_ps_sw1_state == PS_COVER)
|
|||
|
{//<2F>ȴ<EFBFBD>SW1<57><31><EFBFBD>翪<EFBFBD>ر<EFBFBD><D8B1>ڵ<EFBFBD><DAB5><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD>µ<EFBFBD>ǰλ<C7B0><CEBB>
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_count = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_actual = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_wf_last = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_init_angle = g_ptz.vert_as5047d.as5047d_angle_actual;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
ptz_vert_stop(PTZ_VERT_STOP_TIME);
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 10;
|
|||
|
}
|
|||
|
break;
|
|||
|
#endif
|
|||
|
|
|||
|
#ifdef PTZ_SW1_UP_RISE_UPDATE
|
|||
|
//<2F>ж<EFBFBD><D0B6>Ƿ<C7B7><F1B5BDB4>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>,Ȼ<><C8BB><EFBFBD><EFBFBD>̨<EFBFBD><CCA8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
|||
|
case (PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 2):
|
|||
|
if(g_ptz.vert_ps_sw1_down_fall >= 1 ||
|
|||
|
g_ptz.vert_ps_sw1_state == PS_COVER)
|
|||
|
{
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 300u);
|
|||
|
ptz_vert_stop(PTZ_VERT_STOP_TIME);
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_UP, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check++;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
//<2F>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case (PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 3):
|
|||
|
if(g_ptz.vert_ps_sw1_up_rise >= 1 ||
|
|||
|
g_ptz.vert_ps_sw1_state == PS_NO_COVER)
|
|||
|
{
|
|||
|
//<2F>ȴ<EFBFBD>SW1<57><31><EFBFBD>翪<EFBFBD>ر<EFBFBD><D8B1>ڵ<EFBFBD><DAB5><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD>µ<EFBFBD>ǰλ<C7B0><CEBB>
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_count = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_actual = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_wf_last = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_init_angle = g_ptz.vert_as5047d.as5047d_angle_actual;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 10;
|
|||
|
}
|
|||
|
break;
|
|||
|
#endif
|
|||
|
|
|||
|
case PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 10:
|
|||
|
OSTimeDlyHMSM(0u, 0u, 1u, 0u);
|
|||
|
g_ptz.vert_angle_control = 0.0;
|
|||
|
g_ptz.vert_speed_control = PTZ_VERT_BEST_SPEED;
|
|||
|
ptz_vert_rotate_plan(PTZ_VERT_ANGLE);
|
|||
|
g_ptz.vert_rotate_monitor_switch = PTZ_VERT_GO_TO_ANGLE_A;
|
|||
|
g_ptz.vert_angle_state = 1;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
break;
|
|||
|
}
|
|||
|
return g_ptz.vert_self_check;
|
|||
|
}
|
|||
|
|
|||
|
#endif
|
|||
|
|
|||
|
#ifdef PTZ_STEP_MOTOR
|
|||
|
/// <20><>̨ȫ<CCA8><C8AB>Χ<EFBFBD>Լ<EFBFBD>
|
|||
|
static unsigned char ptz_hori_complete_self_check_task()
|
|||
|
{
|
|||
|
TMC2160Control data;
|
|||
|
switch(g_ptz.hori_self_check)
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
|||
|
case PTZ_HORI_SELF_CHECK_COMPLETE_STEP:
|
|||
|
data = ptz_hori_choice_microstep(PTZ_HORI_SELF_CHECK_SPEED);
|
|||
|
g_ptz.hori_tmc2160 = data;
|
|||
|
if(g_ptz.hori_ps_sw3_state == PS_COVER)//<2F><><EFBFBD><EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD>翪<EFBFBD>ر<EFBFBD><D8B1><EFBFBD>ס
|
|||
|
{
|
|||
|
ptz_hori_start(PTZ_HORI_DIR_LEFT, PTZ_HORI_SELF_CHECK_SPEED);
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_COMPLETE_STEP + 1;
|
|||
|
}
|
|||
|
else//û<>б<EFBFBD><D0B1><EFBFBD>ס
|
|||
|
{
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_right_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_fall = 0;
|
|||
|
ptz_hori_start(PTZ_HORI_DIR_RIGHT, PTZ_HORI_SELF_CHECK_SPEED);
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_COMPLETE_STEP + 2;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case PTZ_HORI_SELF_CHECK_COMPLETE_STEP + 1:
|
|||
|
if(g_ptz.hori_ps_sw3_state == PS_NO_COVER)
|
|||
|
{
|
|||
|
OSTimeDlyHMSM(0u, 0u, 3u, 0u);//<2F><>ʱת<CAB1><D7AA>
|
|||
|
ptz_hori_stop(PTZ_HORI_STOP_TIME);
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_right_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_fall = 0;
|
|||
|
ptz_hori_start(PTZ_HORI_DIR_RIGHT, PTZ_HORI_SELF_CHECK_SPEED);
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_COMPLETE_STEP + 2;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
//<2F>ȴ<EFBFBD><C8B4><EFBFBD>һ<EFBFBD><D2BB>ˮƽ<CBAE><C6BD><EFBFBD>翪<EFBFBD><E7BFAA><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
case (PTZ_HORI_SELF_CHECK_COMPLETE_STEP + 2):
|
|||
|
if(g_ptz.hori_ps_sw3_right_fall >= PS_FALL_ON)
|
|||
|
{
|
|||
|
g_ptz.hori_as5047d.as5047d_data_reset = 1;
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
g_ptz.hori_self_check++;
|
|||
|
|
|||
|
OSTimeDlyHMSM(0u, 0u, 5u, 0u);
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
//<2F>ȴ<EFBFBD><C8B4>ڶ<EFBFBD><DAB6><EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD>翪<EFBFBD><E7BFAA><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
case (PTZ_HORI_SELF_CHECK_COMPLETE_STEP + 3):
|
|||
|
if(g_ptz.hori_ps_sw3_right_fall >= PS_FALL_ON)
|
|||
|
{
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_num = g_ptz.hori_as5047d.as5047d_cycle_count;
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_angle_max = g_ptz.hori_as5047d.as5047d_ptz_angle_actual;
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_angle_K = 360.0 / g_ptz.hori_as5047d.as5047d_ptz_angle_max;
|
|||
|
|
|||
|
g_ptz.hori_as5047d.as5047d_remain_angle = g_ptz.hori_as5047d.as5047d_ptz_angle_max -
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_num * 360.0;
|
|||
|
g_ptz.hori_angleP.angle_allow_max = 360.0;
|
|||
|
g_ptz.hori_angleP.angle_allow_min = 0.0;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 1;
|
|||
|
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_right_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_fall = 0;
|
|||
|
ptz_hori_stop(PTZ_HORI_STOP_TIME);
|
|||
|
g_ptz.hori_angle_state = 1;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_DATA_SAVE;
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
return g_ptz.hori_self_check;
|
|||
|
}
|
|||
|
|
|||
|
/// <20><>̨ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
static unsigned char ptz_hori_simplify_self_check_task()
|
|||
|
{
|
|||
|
TMC2160Control data;
|
|||
|
switch(g_ptz.hori_self_check)
|
|||
|
{
|
|||
|
case PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP:
|
|||
|
data = ptz_hori_choice_microstep(PTZ_HORI_SELF_CHECK_SPEED);
|
|||
|
g_ptz.hori_tmc2160 = data;
|
|||
|
if(g_ptz.hori_ps_sw3_state == PS_COVER)//<2F><><EFBFBD><EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD>翪<EFBFBD>ر<EFBFBD><D8B1><EFBFBD>ס
|
|||
|
{
|
|||
|
ptz_hori_start(PTZ_HORI_DIR_LEFT, PTZ_HORI_SELF_CHECK_SPEED);
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP + 1;
|
|||
|
}
|
|||
|
else//û<>е<EFBFBD>ס
|
|||
|
{
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_right_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_fall = 0;
|
|||
|
ptz_hori_start(PTZ_HORI_DIR_RIGHT, PTZ_HORI_SELF_CHECK_SPEED);
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP + 2;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP + 1://<2F><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>翪<EFBFBD><E7BFAA><EFBFBD><EFBFBD><EFBFBD>뵲Ƭ<EBB5B2>ڵ<EFBFBD>
|
|||
|
if(g_ptz.hori_ps_sw3_state == PS_NO_COVER)
|
|||
|
{
|
|||
|
OSTimeDlyHMSM(0u, 0u, 3u, 0u);//<2F><>ʱת<CAB1><D7AA>
|
|||
|
ptz_hori_stop(PTZ_HORI_STOP_TIME);
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_right_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_fall = 0;
|
|||
|
ptz_hori_start(PTZ_HORI_DIR_RIGHT, PTZ_HORI_SELF_CHECK_SPEED);
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP + 2;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP + 2:
|
|||
|
//<2F>ȴ<EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD>翪<EFBFBD><E7BFAA><EFBFBD><EFBFBD>ת<EFBFBD>½<EFBFBD><C2BD><EFBFBD>
|
|||
|
if(g_ptz.hori_ps_sw3_right_fall >= PS_FALL_ON)
|
|||
|
{
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_count = 0;
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_angle_actual = 0;
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_angle_wf_last = 0;
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_init_angle = g_ptz.hori_as5047d.as5047d_angle_actual;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 1;
|
|||
|
g_ptz.hori_ps_sw3_right_fall = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_right_rise = 0;
|
|||
|
g_ptz.hori_ps_sw3_left_fall = 0;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP + 3;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP + 3://ת<><D7AA><EFBFBD><EFBFBD>0λ
|
|||
|
OSTimeDlyHMSM(0u, 0u, 1u, 0u);//<2F><>ʱת<CAB1><D7AA>
|
|||
|
g_ptz.hori_angle_control = 0.0;
|
|||
|
g_ptz.hori_speed_control = PTZ_HORI_BEST_SPEED;
|
|||
|
ptz_hori_rotate_plan(PTZ_HORI_MIN_DISTANCE);
|
|||
|
g_ptz.hori_rotate_monitor_switch = PTZ_HORI_GO_TO_ANGLE_A;
|
|||
|
g_ptz.hori_angle_state = 1;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
break;
|
|||
|
}
|
|||
|
return g_ptz.hori_self_check;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <20><>̨<EFBFBD><CCA8>ֱȫ<D6B1><C8AB>Χ<EFBFBD>Լ<EFBFBD>
|
|||
|
static unsigned char ptz_vert_complete_self_check_task()
|
|||
|
{
|
|||
|
TMC2160Control data;
|
|||
|
switch(g_ptz.vert_self_check)
|
|||
|
{
|
|||
|
///<2F><><EFBFBD>ȶ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>翪<EFBFBD>ص<EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϴ<D0B6>ֱ״̬
|
|||
|
case PTZ_VERT_SELF_CHECK_COMPLETE_STEP:
|
|||
|
data = ptz_vert_choice_microstep(PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_tmc2160 = data;
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
if(g_ptz.vert_ps_sw1_state == PS_COVER)//<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
{
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_UP, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 1;
|
|||
|
}
|
|||
|
if(g_ptz.vert_ps_sw2_state == PS_COVER)//<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
{
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 2;
|
|||
|
}
|
|||
|
if(g_ptz.vert_ps_sw1_state == PS_NO_COVER && g_ptz.vert_ps_sw2_state == PS_NO_COVER)
|
|||
|
//<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
{
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 2;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case (PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 1):
|
|||
|
if(g_ptz.vert_ps_sw1_state == PS_NO_COVER)
|
|||
|
{
|
|||
|
OSTimeDlyHMSM(0u, 0u, 3u, 0u);//<2F><>ʱת<CAB1><D7AA>
|
|||
|
ptz_vert_stop(PTZ_VERT_STOP_TIME);
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
g_ptz.vert_self_check ++;
|
|||
|
}
|
|||
|
break;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
case (PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 2):
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_DOWN, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check ++;
|
|||
|
break;
|
|||
|
|
|||
|
#ifdef PTZ_SW1_DOWN_FALL_UPDATE
|
|||
|
//<2F>ж<EFBFBD><D0B6>Ƿ<C7B7><F1B5BDB4>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>,Ȼ<><C8BB><EFBFBD><EFBFBD>̨<EFBFBD><CCA8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
|||
|
case (PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 3):
|
|||
|
if(g_ptz.vert_ps_sw1_down_fall >= 1 ||
|
|||
|
g_ptz.vert_ps_sw1_state == PS_COVER)
|
|||
|
{
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_data_reset = 1;
|
|||
|
ptz_vert_stop(PTZ_VERT_STOP_TIME);
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_UP, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 10;
|
|||
|
}
|
|||
|
break;
|
|||
|
#endif
|
|||
|
|
|||
|
#ifdef PTZ_SW1_UP_RISE_UPDATE
|
|||
|
//<2F>ж<EFBFBD><D0B6>Ƿ<C7B7><F1B5BDB4>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>,Ȼ<><C8BB><EFBFBD><EFBFBD>̨<EFBFBD><CCA8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
|||
|
case (PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 3):
|
|||
|
if(g_ptz.vert_ps_sw1_down_fall >= 1 ||
|
|||
|
g_ptz.vert_ps_sw1_state == PS_COVER)
|
|||
|
{
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 300u);
|
|||
|
ptz_vert_stop(PTZ_VERT_STOP_TIME);
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_UP, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check++;
|
|||
|
}
|
|||
|
break;
|
|||
|
//<2F>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case (PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 4):
|
|||
|
if(g_ptz.vert_ps_sw1_up_rise >= 1 ||
|
|||
|
g_ptz.vert_ps_sw1_state == PS_NO_COVER)
|
|||
|
{
|
|||
|
g_ptz.vert_as5047d.as5047d_data_reset = 1;
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 10;
|
|||
|
}
|
|||
|
break;
|
|||
|
#endif
|
|||
|
|
|||
|
//<2F>ȴ<EFBFBD>SW2<57>½<EFBFBD><C2BD><EFBFBD>,<2C><><EFBFBD>㴹ֱת<D6B1><D7AA><EFBFBD><EFBFBD>Χ
|
|||
|
case (PTZ_VERT_SELF_CHECK_COMPLETE_STEP + 10):
|
|||
|
if(g_ptz.vert_ps_sw2_up_fall >= 1 ||
|
|||
|
g_ptz.vert_ps_sw2_state == PS_COVER)
|
|||
|
{
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_num = g_ptz.vert_as5047d.as5047d_cycle_count;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_max = g_ptz.vert_as5047d.as5047d_ptz_angle_actual;
|
|||
|
|
|||
|
g_ptz.vert_angleP.angle_range =
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_max / PTZ_VERT_BIG_GEAR_RATIO;
|
|||
|
|
|||
|
g_ptz.vert_angleP.angle_allow_min = g_ptz.vert_angleP.angle_range / 2.0 * (-1);
|
|||
|
g_ptz.vert_angleP.angle_allow_max = g_ptz.vert_angleP.angle_range / 2.0;
|
|||
|
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_K = 1 / PTZ_VERT_BIG_GEAR_RATIO;
|
|||
|
|
|||
|
|
|||
|
g_ptz.vert_as5047d.as5047d_remain_angle = g_ptz.vert_as5047d.as5047d_ptz_angle_max -
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_num * 360.0;
|
|||
|
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
|
|||
|
ptz_vert_stop(PTZ_VERT_STOP_TIME);
|
|||
|
g_ptz.vert_angle_state = 1;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_DATA_SAVE;
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
return g_ptz.vert_self_check;
|
|||
|
}
|
|||
|
|
|||
|
/// <20><>̨<EFBFBD><CCA8>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
static unsigned char ptz_vert_simplify_self_check_task()
|
|||
|
{
|
|||
|
TMC2160Control data;
|
|||
|
switch(g_ptz.vert_self_check)
|
|||
|
{
|
|||
|
case PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP:
|
|||
|
data = ptz_vert_choice_microstep(PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_tmc2160 = data;
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
if(g_ptz.vert_ps_sw1_state == PS_COVER)//<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
{
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_UP, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 1;
|
|||
|
}
|
|||
|
if(g_ptz.vert_ps_sw2_state == PS_COVER)//<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
{
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_DOWN, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 2;
|
|||
|
}
|
|||
|
if(g_ptz.vert_ps_sw1_state == PS_NO_COVER && g_ptz.vert_ps_sw2_state == PS_NO_COVER)
|
|||
|
//<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
{
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_DOWN, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 2;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 1:
|
|||
|
if(g_ptz.vert_ps_sw1_state == PS_NO_COVER)
|
|||
|
{
|
|||
|
OSTimeDlyHMSM(0u, 0u, 3u, 0u);//<2F><>ʱת<CAB1><D7AA>
|
|||
|
ptz_vert_stop(PTZ_VERT_STOP_TIME);
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_DOWN, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 2;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
#ifdef PTZ_SW1_DOWN_FALL_UPDATE
|
|||
|
case PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 2:
|
|||
|
if(g_ptz.vert_ps_sw1_down_fall >= 1 ||
|
|||
|
g_ptz.vert_ps_sw1_state == PS_COVER)
|
|||
|
{//<2F>ȴ<EFBFBD>SW1<57><31><EFBFBD>翪<EFBFBD>ر<EFBFBD><D8B1>ڵ<EFBFBD><DAB5><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD>µ<EFBFBD>ǰλ<C7B0><CEBB>
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_count = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_actual = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_wf_last = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_init_angle = g_ptz.vert_as5047d.as5047d_angle_actual;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
ptz_vert_stop(PTZ_VERT_STOP_TIME);
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 10;
|
|||
|
}
|
|||
|
break;
|
|||
|
#endif
|
|||
|
|
|||
|
#ifdef PTZ_SW1_UP_RISE_UPDATE
|
|||
|
//<2F>ж<EFBFBD><D0B6>Ƿ<C7B7><F1B5BDB4>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>,Ȼ<><C8BB><EFBFBD><EFBFBD>̨<EFBFBD><CCA8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
|||
|
case (PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 2):
|
|||
|
if(g_ptz.vert_ps_sw1_down_fall >= 1 ||
|
|||
|
g_ptz.vert_ps_sw1_state == PS_COVER)
|
|||
|
{
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 300u);
|
|||
|
ptz_vert_stop(PTZ_VERT_STOP_TIME);
|
|||
|
ptz_vert_start(PTZ_VERT_DIR_UP, PTZ_VERT_SELF_CHECK_SPEED);
|
|||
|
g_ptz.vert_self_check++;
|
|||
|
}
|
|||
|
break;
|
|||
|
//<2F>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case (PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 3):
|
|||
|
if(g_ptz.vert_ps_sw1_up_rise >= 1 ||
|
|||
|
g_ptz.vert_ps_sw1_state == PS_NO_COVER)
|
|||
|
{
|
|||
|
//<2F>ȴ<EFBFBD>SW1<57><31><EFBFBD>翪<EFBFBD>ر<EFBFBD><D8B1>ڵ<EFBFBD><DAB5><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD>µ<EFBFBD>ǰλ<C7B0><CEBB>
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_count = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_actual = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_wf_last = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_init_angle = g_ptz.vert_as5047d.as5047d_angle_actual;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
g_ptz.vert_ps_sw1_down_fall = 0;
|
|||
|
g_ptz.vert_ps_sw1_up_rise = 0;
|
|||
|
g_ptz.vert_ps_sw2_up_fall = 0;
|
|||
|
g_ptz.vert_ps_sw2_down_rise = 0;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 10;
|
|||
|
}
|
|||
|
break;
|
|||
|
#endif
|
|||
|
|
|||
|
case PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP + 10:
|
|||
|
OSTimeDlyHMSM(0u, 0u, 1u, 0u);
|
|||
|
data = ptz_vert_choice_microstep(PTZ_VERT_BEST_SPEED);
|
|||
|
g_ptz.vert_tmc2160 = data;
|
|||
|
g_ptz.vert_angle_control = 0.0;
|
|||
|
g_ptz.vert_speed_control = PTZ_VERT_BEST_SPEED;
|
|||
|
ptz_vert_rotate_plan(PTZ_VERT_ANGLE);
|
|||
|
g_ptz.vert_rotate_monitor_switch = PTZ_VERT_GO_TO_ANGLE_A;
|
|||
|
g_ptz.vert_angle_state = 1;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
break;
|
|||
|
}
|
|||
|
return g_ptz.vert_self_check;
|
|||
|
}
|
|||
|
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
|
|||
|
static void ptz_hori_self_check_task()
|
|||
|
{
|
|||
|
while(1)
|
|||
|
{
|
|||
|
if(error_conut_state == 0)
|
|||
|
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>Լ<EFBFBD>
|
|||
|
ptz_hori_complete_self_check_task();
|
|||
|
ptz_hori_simplify_self_check_task();
|
|||
|
}
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if(g_ptz.vert_self_check == PTZ_VERT_SELF_CHECK_DATA_SAVE &&
|
|||
|
g_ptz.hori_self_check == PTZ_HORI_SELF_CHECK_DATA_SAVE)
|
|||
|
{
|
|||
|
ptz_self_check_data_save();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//ת<><D7AA><EFBFBD><EFBFBD>ֱ0λ
|
|||
|
g_ptz.vert_angle_control = 0.0;
|
|||
|
g_ptz.vert_speed_control = PTZ_VERT_BEST_SPEED;
|
|||
|
ptz_vert_rotate_plan(PTZ_VERT_ANGLE);
|
|||
|
g_ptz.vert_rotate_monitor_switch = PTZ_VERT_GO_TO_ANGLE_A;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
//ת<><D7AA>ˮƽ0λ
|
|||
|
g_ptz.hori_angle_control = 0.0;
|
|||
|
g_ptz.hori_speed_control = PTZ_HORI_BEST_SPEED;
|
|||
|
ptz_hori_rotate_plan(PTZ_HORI_MIN_DISTANCE);
|
|||
|
g_ptz.hori_rotate_monitor_switch = PTZ_HORI_GO_TO_ANGLE_A;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
}
|
|||
|
|
|||
|
if(g_ptz.hori_self_check == PTZ_HORI_SELF_CHECK_END &&
|
|||
|
g_ptz.vert_self_check == PTZ_VERT_SELF_CHECK_END)
|
|||
|
{
|
|||
|
|
|||
|
#ifdef PTZ_CMD_SAVE_BEFORE
|
|||
|
ptz_cmd_before_start();//<2F>鿴<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>
|
|||
|
#endif
|
|||
|
OSTaskDel(OS_PRIO_SELF);//<2F>رո<D8B1><D5B8><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 1u);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void ptz_vert_self_check_task()
|
|||
|
{
|
|||
|
while(1)
|
|||
|
{
|
|||
|
if(error_conut_state == 0)
|
|||
|
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>Լ<EFBFBD>
|
|||
|
ptz_vert_complete_self_check_task();
|
|||
|
ptz_vert_simplify_self_check_task();
|
|||
|
}
|
|||
|
if(g_ptz.vert_self_check == PTZ_VERT_SELF_CHECK_END)
|
|||
|
{
|
|||
|
if(g_ptz.offset_angle.vert_offset_switch == 2)
|
|||
|
{
|
|||
|
g_ptz.vert_angleP.angle_allow_min = g_ptz.vert_angleP.angle_range / 2.0 * (-1);
|
|||
|
g_ptz.vert_angleP.angle_allow_max = g_ptz.vert_angleP.angle_range / 2.0;
|
|||
|
g_ptz.vert_angleP.angle_allow_min =
|
|||
|
g_ptz.vert_angleP.angle_allow_min - g_ptz.offset_angle.vert_zero_offset_angle;
|
|||
|
g_ptz.vert_angleP.angle_allow_max =
|
|||
|
g_ptz.vert_angleP.angle_allow_max - g_ptz.offset_angle.vert_zero_offset_angle;
|
|||
|
}
|
|||
|
OSTaskDel(OS_PRIO_SELF);//<2F>رո<D8B1><D5B8><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 1u);
|
|||
|
}
|
|||
|
}
|
|||
|
//ˮƽ<CBAE>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
static OS_STK task_hori_self_check_stk[TASK_HORI_SELF_CHECK_STK_SIZE];
|
|||
|
static void creat_task_hori_self_check(void)
|
|||
|
{
|
|||
|
CPU_INT08U task_err;
|
|||
|
CPU_INT08U name_err;
|
|||
|
|
|||
|
task_err = OSTaskCreateExt((void (*)(void *)) ptz_hori_self_check_task,
|
|||
|
(void *) 0,
|
|||
|
(OS_STK *)&task_hori_self_check_stk[TASK_HORI_SELF_CHECK_STK_SIZE - 1],
|
|||
|
(INT8U ) TASK_HORI_SELF_CHECK_PRIO,
|
|||
|
(INT16U ) TASK_HORI_SELF_CHECK_PRIO,
|
|||
|
(OS_STK *)&task_hori_self_check_stk[0],
|
|||
|
(INT32U ) TASK_HORI_SELF_CHECK_STK_SIZE,
|
|||
|
(void *) 0,
|
|||
|
(INT16U )(OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR));
|
|||
|
#if (OS_TASK_NAME_EN > 0)
|
|||
|
OSTaskNameSet(TASK_HORI_SELF_CHECK_PRIO, "ptz_hori_self_check_task", &name_err);
|
|||
|
#endif
|
|||
|
if ((task_err == OS_ERR_NONE) && (name_err == OS_ERR_NONE)) {
|
|||
|
pdebug(DEBUG_LEVEL_INFO,"create ptz_hori_self_check_task success...\n\r");
|
|||
|
} else {
|
|||
|
pdebug(DEBUG_LEVEL_FATAL,"create ptz_hori_self_check_task failed...\n\r");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//<2F><>ֱ<EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
static OS_STK task_vert_self_check_stk[TASK_VERT_SELF_CHECK_STK_SIZE];
|
|||
|
static void creat_task_vert_self_check(void)
|
|||
|
{
|
|||
|
CPU_INT08U task_err;
|
|||
|
CPU_INT08U name_err;
|
|||
|
|
|||
|
task_err = OSTaskCreateExt((void (*)(void *)) ptz_vert_self_check_task,
|
|||
|
(void *) 0,
|
|||
|
(OS_STK *)&task_vert_self_check_stk[TASK_VERT_SELF_CHECK_STK_SIZE - 1],
|
|||
|
(INT8U ) TASK_VERT_SELF_CHECK_PRIO,
|
|||
|
(INT16U ) TASK_VERT_SELF_CHECK_PRIO,
|
|||
|
(OS_STK *)&task_vert_self_check_stk[0],
|
|||
|
(INT32U ) TASK_VERT_SELF_CHECK_STK_SIZE,
|
|||
|
(void *) 0,
|
|||
|
(INT16U )(OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR));
|
|||
|
#if (OS_TASK_NAME_EN > 0)
|
|||
|
OSTaskNameSet(TASK_VERT_SELF_CHECK_PRIO, "ptz_vert_self_check_task", &name_err);
|
|||
|
#endif
|
|||
|
if ((task_err == OS_ERR_NONE) && (name_err == OS_ERR_NONE)) {
|
|||
|
pdebug(DEBUG_LEVEL_INFO,"create ptz_vert_self_check_task success...\n\r");
|
|||
|
} else {
|
|||
|
pdebug(DEBUG_LEVEL_FATAL,"create ptz_vert_self_check_task failed...\n\r");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@brief <EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ췽ʽѡ<EFBFBD><EFBFBD>
|
|||
|
@param
|
|||
|
@return
|
|||
|
@note 20180903 v1.0
|
|||
|
20220602 v2.0 lqc
|
|||
|
*/
|
|||
|
/*
|
|||
|
static void ptz_self_check_data_init()
|
|||
|
{
|
|||
|
if(ptz_self_check_data_read() == 1)//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
{
|
|||
|
#ifdef PTZ_NO_SELF_CHECK
|
|||
|
if(ptz_power_off_data_read() == 1)
|
|||
|
{
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
g_ptz.hori_angle_state = 1;
|
|||
|
g_ptz.vert_angle_state = 1;
|
|||
|
g_ptz.no_self_check_state = 1;//<2F><>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
return;
|
|||
|
}
|
|||
|
g_ptz.no_self_check_state = 0;//<2F><>ȡʧ<C8A1><CAA7>
|
|||
|
#endif
|
|||
|
|
|||
|
g_ptz.hori_angle_state = 0;
|
|||
|
g_ptz.vert_angle_state = 0;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP;
|
|||
|
|
|||
|
|
|||
|
#ifdef PTZ_VERT_SIMPLIFY_CHECK_OFF//<2F><>Ҫ<EFBFBD><D2AA>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_count = g_ptz.vert_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
#endif
|
|||
|
|
|||
|
#ifdef PTZ_HORI_SIMPLIFY_CHECK_OFF//<2F><>Ҫˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_count = g_ptz.hori_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 1;
|
|||
|
#endif
|
|||
|
}
|
|||
|
else//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܽ<EFBFBD><DCBD><EFBFBD>ȫ<EFBFBD><C8AB>Χ<EFBFBD>Լ<EFBFBD>
|
|||
|
{
|
|||
|
g_ptz.hori_angle_state = 0;
|
|||
|
g_ptz.vert_angle_state = 0;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_COMPLETE_STEP;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_COMPLETE_STEP;
|
|||
|
|
|||
|
|
|||
|
#ifdef PTZ_VERT_COMPLETE_CHECK_OFF//<2F><>Ҫ<EFBFBD><D2AA>ֱȫ<D6B1><C8AB>Χ<EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_DATA_SAVE;
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_count = g_ptz.vert_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
#endif
|
|||
|
|
|||
|
#ifdef PTZ_HORI_COMPLETE_CHECK_OFF//<2F><>Ҫˮƽȫ<C6BD><C8AB>Χ<EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_DATA_SAVE;
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_count = g_ptz.hori_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 1;
|
|||
|
#endif
|
|||
|
}
|
|||
|
}
|
|||
|
*/
|
|||
|
|
|||
|
/************ͨ<><CDA8><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>Լ췽ʽ***********/
|
|||
|
|
|||
|
#ifdef ONE
|
|||
|
//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>Լ췽ʽѡ<CABD><D1A1>
|
|||
|
static void ptz_self_check_data_init()
|
|||
|
{
|
|||
|
if(strstr((const char*)system_info.complete_self_check, "enable"))
|
|||
|
{//ȫ<>Լ<EFBFBD>ʹ<EFBFBD><CAB9>
|
|||
|
if(ptz_self_check_data_read() == 1)//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
{//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
|
|||
|
if(strstr((const char*)system_info.simplify_self_check, "both_enable"))
|
|||
|
{//˫<><CBAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.no_self_check_state = 0;//<2F><>ȡʧ<C8A1><CAA7>
|
|||
|
g_ptz.hori_angle_state = 0;
|
|||
|
g_ptz.vert_angle_state = 0;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 0;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 0;
|
|||
|
return;
|
|||
|
}
|
|||
|
if(strstr((const char*)system_info.simplify_self_check, "hori_enable"))
|
|||
|
{//ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD>Լ졢<D4BC><ECA1A2>ֱ<EFBFBD><D6B1><EFBFBD>Լ<EFBFBD>
|
|||
|
if(ptz_power_off_data_read() == 1)
|
|||
|
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
g_ptz.hori_angle_state = 0;
|
|||
|
g_ptz.vert_angle_state = 1;
|
|||
|
g_ptz.no_self_check_state = 1;//<2F><>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 0;
|
|||
|
|
|||
|
}else{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD>ֱ<EFBFBD><D6B1>Ĭ<EFBFBD><C4AC>ֵ<EFBFBD><D6B5>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.no_self_check_state = 0;//<2F><>ȡʧ<C8A1><CAA7>
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_count = g_ptz.vert_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 0;
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
if(strstr((const char*)system_info.simplify_self_check, "vert_enable"))
|
|||
|
{//<2F><>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>Լ졢ˮƽ<CBAE><C6BD><EFBFBD>Լ<EFBFBD>
|
|||
|
if(ptz_power_off_data_read() == 1)
|
|||
|
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP;
|
|||
|
g_ptz.hori_angle_state = 1;
|
|||
|
g_ptz.vert_angle_state = 0;
|
|||
|
g_ptz.no_self_check_state = 1;//<2F><>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 0;
|
|||
|
|
|||
|
}else{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD>ֱ<EFBFBD><D6B1>Ĭ<EFBFBD><C4AC>ֵ<EFBFBD><D6B5>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.no_self_check_state = 0;//<2F><>ȡʧ<C8A1><CAA7>
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 0;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_count = g_ptz.hori_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 1;
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
if(strstr((const char*)system_info.simplify_self_check, "both_disable"))
|
|||
|
{//˫<><EFBFBD><E1B2BB><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
if(ptz_power_off_data_read() == 1)
|
|||
|
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
g_ptz.hori_angle_state = 1;
|
|||
|
g_ptz.vert_angle_state = 1;
|
|||
|
g_ptz.no_self_check_state = 1;//<2F><>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
|
|||
|
}else{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.no_self_check_state = 0;//<2F><>ȡʧ<C8A1><CAA7>
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_count = g_ptz.vert_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_count = g_ptz.hori_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 1;
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
}else{
|
|||
|
//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܽ<EFBFBD><DCBD><EFBFBD>ȫ<EFBFBD><C8AB>Χ<EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.hori_angle_state = 0;
|
|||
|
g_ptz.vert_angle_state = 0;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_COMPLETE_STEP;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_COMPLETE_STEP;
|
|||
|
return;
|
|||
|
}
|
|||
|
}else{//<2F>κ<EFBFBD><CEBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD><C2B6><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
if((ptz_self_check_data_read() == 1) && (ptz_power_off_data_read() == 1))
|
|||
|
{//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
g_ptz.hori_angle_state = 1;
|
|||
|
g_ptz.vert_angle_state = 1;
|
|||
|
g_ptz.no_self_check_state = 1;//<2F><>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
return;
|
|||
|
}else{
|
|||
|
g_ptz.no_self_check_state = 0;//<2F><>ȡʧ<C8A1><CAA7>
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_DATA_SAVE;
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_count = g_ptz.vert_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_DATA_SAVE;
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_count = g_ptz.hori_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 1;
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
#endif
|
|||
|
|
|||
|
//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>Լ췽ʽѡ<CABD><D1A1>
|
|||
|
static void ptz_self_check_data_init()
|
|||
|
{
|
|||
|
if(strstr((const char*)system_info.complete_self_check, "enable"))
|
|||
|
{//ȫ<>Լ<EFBFBD>ʹ<EFBFBD><CAB9>
|
|||
|
if(ptz_self_check_data_read() == 1)//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
{//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
error_conut_state = 0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if(strstr((const char*)system_info.simplify_self_check, "both_enabled"))
|
|||
|
{//˫<><CBAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.no_self_check_state = 0;//<2F><>ȡʧ<C8A1><CAA7>
|
|||
|
g_ptz.hori_angle_state = 0;
|
|||
|
g_ptz.vert_angle_state = 0;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬Ϊ0ʱ<30><CAB1><EFBFBD>Ƕȼ<C7B6><C8BC>㲻<EFBFBD><E3B2BB><EFBFBD>ã<EFBFBD><C3A3><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>籣<EFBFBD><E7B1A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD>1<EFBFBD><31>
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 0;
|
|||
|
return;
|
|||
|
}
|
|||
|
if(strstr((const char*)system_info.simplify_self_check, "hori_enabled"))
|
|||
|
{//ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD>Լ졢<D4BC><ECA1A2>ֱ<EFBFBD><D6B1><EFBFBD>Լ<EFBFBD>
|
|||
|
if(ptz_power_off_data_read() == 1)
|
|||
|
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
g_ptz.hori_angle_state = 0;
|
|||
|
g_ptz.vert_angle_state = 1;
|
|||
|
g_ptz.no_self_check_state = 1;//<2F><>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 0;
|
|||
|
|
|||
|
}else{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD>ֱ<EFBFBD><D6B1>Ĭ<EFBFBD><C4AC>ֵ<EFBFBD><D6B5>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.no_self_check_state = 0;//<2F><>ȡʧ<C8A1><CAA7>
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_count = g_ptz.vert_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_SIMPLIFY_STEP;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 0;
|
|||
|
g_ptz.hori_angle_state = 0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3>Ƕ<EFBFBD>״̬<D7B4><CCAC><EFBFBD>ù<EFBFBD><C3B9><EFBFBD>
|
|||
|
g_ptz.vert_angle_state = 0;
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
if(strstr((const char*)system_info.simplify_self_check, "vert_enabled"))
|
|||
|
{//<2F><>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>Լ졢ˮƽ<CBAE><C6BD><EFBFBD>Լ<EFBFBD>
|
|||
|
if(ptz_power_off_data_read() == 1)
|
|||
|
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP;
|
|||
|
g_ptz.hori_angle_state = 1;
|
|||
|
g_ptz.vert_angle_state = 0;
|
|||
|
g_ptz.no_self_check_state = 1;//<2F><>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 0;
|
|||
|
|
|||
|
}else{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD>ˮƽ<CBAE><C6BD>Ĭ<EFBFBD><C4AC>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.no_self_check_state = 0;//<2F><>ȡʧ<C8A1><CAA7>
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_SIMPLIFY_STEP;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 0;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_count = g_ptz.hori_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 1;
|
|||
|
g_ptz.hori_angle_state = 0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3>Ƕ<EFBFBD>״̬<D7B4><CCAC><EFBFBD>ù<EFBFBD><C3B9><EFBFBD>
|
|||
|
g_ptz.vert_angle_state = 0;
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
if(strstr((const char*)system_info.simplify_self_check, "both_disabled"))
|
|||
|
{//˫<><EFBFBD><E1B2BB><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
if(ptz_power_off_data_read() == 1)
|
|||
|
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
g_ptz.hori_angle_state = 1;
|
|||
|
g_ptz.vert_angle_state = 1;
|
|||
|
g_ptz.no_self_check_state = 1;//<2F><>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
|
|||
|
}else{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.no_self_check_state = 0;//<2F><>ȡʧ<C8A1><CAA7>
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_count = g_ptz.vert_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_count = g_ptz.hori_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 1;
|
|||
|
g_ptz.hori_angle_state = 0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3>Ƕ<EFBFBD>״̬<D7B4><CCAC><EFBFBD>ù<EFBFBD><C3B9><EFBFBD>
|
|||
|
g_ptz.vert_angle_state = 0;
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
}else{
|
|||
|
error_conut_state = 1;//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܽ<EFBFBD><DCBD><EFBFBD>ȫ<EFBFBD><C8AB>Χ<EFBFBD>Լ<EFBFBD>
|
|||
|
g_ptz.hori_angle_state = 0;
|
|||
|
g_ptz.vert_angle_state = 0;
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_COMPLETE_STEP;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_COMPLETE_STEP;
|
|||
|
return;
|
|||
|
}
|
|||
|
}else{//<2F>κ<EFBFBD><CEBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD><C2B6><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
error_conut_state = 0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if(ptz_self_check_data_read() == 1)
|
|||
|
{//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
if(ptz_power_off_data_read() == 1)
|
|||
|
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
g_ptz.hori_angle_state = 1;
|
|||
|
g_ptz.vert_angle_state = 1;
|
|||
|
g_ptz.no_self_check_state = 1;//<2F><>ȡ<EFBFBD>ɹ<EFBFBD>
|
|||
|
return;
|
|||
|
}else{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡʧ<C8A1><CAA7>
|
|||
|
g_ptz.no_self_check_state = 0;//<2F><>ȡʧ<C8A1><CAA7>
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_END;
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_count = g_ptz.vert_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_END;
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_count = g_ptz.hori_as5047d.as5047d_cycle_num / 2;
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 1;
|
|||
|
|
|||
|
g_ptz.hori_angle_state = 0;//<2F>Ƕ<EFBFBD>״̬<D7B4><CCAC><EFBFBD>ù<EFBFBD><C3B9><EFBFBD>
|
|||
|
g_ptz.vert_angle_state = 0;
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
}else{//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1><CAA7>
|
|||
|
g_ptz.no_self_check_state = 0;//<2F><>ȡʧ<C8A1><CAA7>
|
|||
|
g_ptz.vert_self_check = PTZ_VERT_SELF_CHECK_DATA_SAVE;
|
|||
|
/* <20>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>¸<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>б<EFBFBD><D0B1><EFBFBD> */
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ˲<CFB8><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_max = 9600.0;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_K = 1.0/80;
|
|||
|
g_ptz.vert_as5047d.as5047d_remain_angle = 230.0;
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_num = 26;
|
|||
|
|
|||
|
g_ptz.vert_angleP.angle_min = -60.0;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>Сֵ
|
|||
|
g_ptz.vert_angleP.angle_max = 60.0;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
g_ptz.vert_angleP.angle_allow_min = -60.0;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD>Сֵ
|
|||
|
g_ptz.vert_angleP.angle_allow_max = 60.0;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
g_ptz.vert_angleP.angle_range = 120.0;//<2F><>̨<EFBFBD>Ƕȷ<C7B6>Χ
|
|||
|
|
|||
|
g_ptz.vert_as5047d.as5047d_state = 1;
|
|||
|
|
|||
|
g_ptz.hori_self_check = PTZ_HORI_SELF_CHECK_DATA_SAVE;
|
|||
|
/* <20>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>¸<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>б<EFBFBD><D0B1><EFBFBD> */
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_angle_max = 28800.0;
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_angle_K = 1.0/80;
|
|||
|
g_ptz.hori_as5047d.as5047d_remain_angle = 0.0;
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_num = 80;
|
|||
|
|
|||
|
g_ptz.hori_angleP.angle_min = 0.0;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>Сֵ
|
|||
|
g_ptz.hori_angleP.angle_max = 360.0;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
g_ptz.hori_angleP.angle_allow_min = 0.0;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD>Сֵ
|
|||
|
g_ptz.hori_angleP.angle_allow_max = 360.0;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
g_ptz.hori_angleP.angle_range = 360.0;//<2F><>̨<EFBFBD>Ƕȷ<C7B6>Χ
|
|||
|
|
|||
|
g_ptz.hori_as5047d.as5047d_state = 1;
|
|||
|
|
|||
|
g_ptz.hori_angle_state = 0;//<2F>Ƕ<EFBFBD>״̬<D7B4><CCAC><EFBFBD>ù<EFBFBD><C3B9><EFBFBD>
|
|||
|
g_ptz.vert_angle_state = 0;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
void init_self_check_module(void)
|
|||
|
{
|
|||
|
// g_ptz.hori_self_check = 255;
|
|||
|
// g_ptz.vert_self_check = 255;
|
|||
|
|
|||
|
ptz_self_check_data_init();
|
|||
|
// init_error_count_task();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
creat_task_hori_self_check();
|
|||
|
creat_task_vert_self_check();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
|
|||
|
unsigned int ptz_self_check_data_crc(PtzSelfCheckData data)
|
|||
|
{
|
|||
|
float crc = 0;
|
|||
|
unsigned int crc1 = 0;
|
|||
|
crc = crc + data.hori_as5047d.as5047d_ptz_angle_max;
|
|||
|
crc = crc + data.hori_as5047d.as5047d_ptz_angle_K;
|
|||
|
crc = crc + data.hori_as5047d.as5047d_remain_angle;
|
|||
|
crc = crc + data.hori_as5047d.as5047d_cycle_num;
|
|||
|
|
|||
|
crc = crc + data.vert_as5047d.as5047d_ptz_angle_max;
|
|||
|
crc = crc + data.vert_as5047d.as5047d_ptz_angle_K;
|
|||
|
crc = crc + data.vert_as5047d.as5047d_remain_angle;
|
|||
|
crc = crc + data.vert_as5047d.as5047d_cycle_num;
|
|||
|
|
|||
|
crc = crc + data.hori_angleP.angle_min;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>Сֵ
|
|||
|
crc = crc + data.hori_angleP.angle_max;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
crc = crc + data.hori_angleP.angle_allow_min;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD>Сֵ
|
|||
|
crc = crc + data.hori_angleP.angle_allow_max;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
crc = crc + data.hori_angleP.angle_range;//<2F><>̨<EFBFBD>Ƕȷ<C7B6>Χ
|
|||
|
|
|||
|
crc = crc + data.vert_angleP.angle_min;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>Сֵ
|
|||
|
crc = crc + data.vert_angleP.angle_max;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
crc = crc + data.vert_angleP.angle_allow_min;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD>Сֵ
|
|||
|
crc = crc + data.vert_angleP.angle_allow_max;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
crc = crc + data.vert_angleP.angle_range;//<2F><>̨<EFBFBD>Ƕȷ<C7B6>Χ
|
|||
|
|
|||
|
crc = crc + data.hori_angle_error;//ˮƽ<CBAE>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD>
|
|||
|
crc1 = (unsigned int)crc;
|
|||
|
return crc1;
|
|||
|
}
|
|||
|
|
|||
|
static PtzSelfCheckData self_check_data;
|
|||
|
static PtzSelfCheckData self_check_data_a;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
char ptz_self_check_data_save()
|
|||
|
{
|
|||
|
char i,j;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
memcpy(&self_check_data.hori_as5047d, &g_ptz.hori_as5047d, sizeof(g_ptz.hori_as5047d));
|
|||
|
memcpy(&self_check_data.hori_angleP, &g_ptz.hori_angleP, sizeof(g_ptz.hori_angleP));
|
|||
|
memcpy(&self_check_data.vert_as5047d, &g_ptz.vert_as5047d, sizeof(g_ptz.vert_as5047d));
|
|||
|
memcpy(&self_check_data.vert_angleP, &g_ptz.vert_angleP, sizeof(g_ptz.vert_angleP));
|
|||
|
|
|||
|
self_check_data.hori_angle_error = g_ptz.hori_angle_error;//<2F>洢ˮƽ<CBAE>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
|
|||
|
self_check_data.crc = ptz_self_check_data_crc(self_check_data);
|
|||
|
|
|||
|
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD><E6B4A2>
|
|||
|
for(i = 0; i < SELF_CHECK_DATA_SAVE_FLASH_NUM; i++)
|
|||
|
{
|
|||
|
memset(&self_check_data_a, 0, sizeof(self_check_data_a));
|
|||
|
write_many_data(sizeof(self_check_data),(unsigned char *)(&self_check_data),SELF_CHECK_DATA_FLASH_ADD);
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 5u);
|
|||
|
Flash_Read((unsigned char *)(&self_check_data_a),SELF_CHECK_DATA_FLASH_ADD,sizeof(self_check_data_a));
|
|||
|
if(memcmp(&self_check_data, &self_check_data_a, sizeof(self_check_data)) == 0)//<2F>ж<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ȷ
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 5u);
|
|||
|
}
|
|||
|
//д<>뱸<EFBFBD>ݴ洢<DDB4><E6B4A2>
|
|||
|
for(j = 0; j < SELF_CHECK_DATA_SAVE_FLASH_NUM; j++)
|
|||
|
{
|
|||
|
memset(&self_check_data_a, 0, sizeof(self_check_data_a));
|
|||
|
write_many_data(sizeof(self_check_data),(unsigned char *)(&self_check_data),SELF_CHECK_DATA_BACKUP_FLASH_ADD);
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 5u);
|
|||
|
Flash_Read((unsigned char *)(&self_check_data_a),SELF_CHECK_DATA_BACKUP_FLASH_ADD,sizeof(self_check_data_a));
|
|||
|
if(memcmp(&self_check_data, &self_check_data_a, sizeof(self_check_data)) == 0)//<2F>ж<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ȷ
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 5u);
|
|||
|
}
|
|||
|
|
|||
|
if(i < SELF_CHECK_DATA_SAVE_FLASH_NUM || j < SELF_CHECK_DATA_SAVE_FLASH_NUM)//<2F>ж<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD>
|
|||
|
{
|
|||
|
//д<><D0B4><EFBFBD>ɹ<EFBFBD>
|
|||
|
return 1;
|
|||
|
}
|
|||
|
//д<><D0B4>ʧ<EFBFBD><CAA7>
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ
|
|||
|
char ptz_self_check_data_read()
|
|||
|
{
|
|||
|
char i,j;
|
|||
|
//<2F><><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
for(i = 0; i < SELF_CHECK_DATA_READ_FLASH_NUM; i++)
|
|||
|
{
|
|||
|
memset(&self_check_data, 0, sizeof(self_check_data));
|
|||
|
Flash_Read((unsigned char *)(&self_check_data),SELF_CHECK_DATA_FLASH_ADD,sizeof(self_check_data));
|
|||
|
if(self_check_data.crc == ptz_self_check_data_crc(self_check_data)
|
|||
|
&& self_check_data.crc > 0)
|
|||
|
{
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_angle_max = self_check_data.hori_as5047d.as5047d_ptz_angle_max;
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_angle_K = self_check_data.hori_as5047d.as5047d_ptz_angle_K;
|
|||
|
g_ptz.hori_as5047d.as5047d_remain_angle = self_check_data.hori_as5047d.as5047d_remain_angle;
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_num = self_check_data.hori_as5047d.as5047d_cycle_num;
|
|||
|
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_max = self_check_data.vert_as5047d.as5047d_ptz_angle_max;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_K = self_check_data.vert_as5047d.as5047d_ptz_angle_K;
|
|||
|
g_ptz.vert_as5047d.as5047d_remain_angle = self_check_data.vert_as5047d.as5047d_remain_angle;
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_num = self_check_data.vert_as5047d.as5047d_cycle_num;
|
|||
|
|
|||
|
g_ptz.hori_angleP.angle_min = self_check_data.hori_angleP.angle_min;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>Сֵ
|
|||
|
g_ptz.hori_angleP.angle_max = self_check_data.hori_angleP.angle_max;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
g_ptz.hori_angleP.angle_allow_min = self_check_data.hori_angleP.angle_allow_min;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD>Сֵ
|
|||
|
g_ptz.hori_angleP.angle_allow_max = self_check_data.hori_angleP.angle_allow_max;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
g_ptz.hori_angleP.angle_range = self_check_data.hori_angleP.angle_range;//<2F><>̨<EFBFBD>Ƕȷ<C7B6>Χ
|
|||
|
|
|||
|
g_ptz.vert_angleP.angle_min = self_check_data.vert_angleP.angle_min;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>Сֵ
|
|||
|
g_ptz.vert_angleP.angle_max = self_check_data.vert_angleP.angle_max;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
g_ptz.vert_angleP.angle_allow_min = self_check_data.vert_angleP.angle_allow_min;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD>Сֵ
|
|||
|
g_ptz.vert_angleP.angle_allow_max = self_check_data.vert_angleP.angle_allow_max;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
g_ptz.vert_angleP.angle_range = self_check_data.vert_angleP.angle_range;//<2F><>̨<EFBFBD>Ƕȷ<C7B6>Χ
|
|||
|
|
|||
|
g_ptz.hori_angle_error = self_check_data.hori_angle_error;//<2F><>ֵˮƽ<CBAE>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD>
|
|||
|
return 1;
|
|||
|
}
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 2u);
|
|||
|
}
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ӱ<EFBFBD><D3B1>ݴ洢<DDB4><E6B4A2><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
for(j = 0; j < SELF_CHECK_DATA_READ_FLASH_NUM; j++)
|
|||
|
{
|
|||
|
memset(&self_check_data, 0, sizeof(self_check_data));
|
|||
|
Flash_Read((unsigned char *)(&self_check_data),SELF_CHECK_DATA_BACKUP_FLASH_ADD,sizeof(self_check_data));
|
|||
|
if(self_check_data.crc == ptz_self_check_data_crc(self_check_data)
|
|||
|
&& self_check_data.crc > 0)
|
|||
|
{
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_angle_max = self_check_data.hori_as5047d.as5047d_ptz_angle_max;
|
|||
|
g_ptz.hori_as5047d.as5047d_ptz_angle_K = self_check_data.hori_as5047d.as5047d_ptz_angle_K;
|
|||
|
g_ptz.hori_as5047d.as5047d_remain_angle = self_check_data.hori_as5047d.as5047d_remain_angle;
|
|||
|
g_ptz.hori_as5047d.as5047d_cycle_num = self_check_data.hori_as5047d.as5047d_cycle_num;
|
|||
|
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_max = self_check_data.vert_as5047d.as5047d_ptz_angle_max;
|
|||
|
g_ptz.vert_as5047d.as5047d_ptz_angle_K = self_check_data.vert_as5047d.as5047d_ptz_angle_K;
|
|||
|
g_ptz.vert_as5047d.as5047d_remain_angle = self_check_data.vert_as5047d.as5047d_remain_angle;
|
|||
|
g_ptz.vert_as5047d.as5047d_cycle_num = self_check_data.vert_as5047d.as5047d_cycle_num;
|
|||
|
|
|||
|
g_ptz.hori_angleP.angle_min = self_check_data.hori_angleP.angle_min;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>Сֵ
|
|||
|
g_ptz.hori_angleP.angle_max = self_check_data.hori_angleP.angle_max;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
g_ptz.hori_angleP.angle_allow_min = self_check_data.hori_angleP.angle_allow_min;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD>Сֵ
|
|||
|
g_ptz.hori_angleP.angle_allow_max = self_check_data.hori_angleP.angle_allow_max;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
g_ptz.hori_angleP.angle_range = self_check_data.hori_angleP.angle_range;//<2F><>̨<EFBFBD>Ƕȷ<C7B6>Χ
|
|||
|
|
|||
|
g_ptz.vert_angleP.angle_min = self_check_data.vert_angleP.angle_min;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>Сֵ
|
|||
|
g_ptz.vert_angleP.angle_max = self_check_data.vert_angleP.angle_max;//<2F><>̨<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
g_ptz.vert_angleP.angle_allow_min = self_check_data.vert_angleP.angle_allow_min;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD>Сֵ
|
|||
|
g_ptz.vert_angleP.angle_allow_max = self_check_data.vert_angleP.angle_allow_max;//<2F><>̨<EFBFBD><CCA8><EFBFBD>ýǶ<C3BD><C7B6><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
g_ptz.vert_angleP.angle_range = self_check_data.vert_angleP.angle_range;//<2F><>̨<EFBFBD>Ƕȷ<C7B6>Χ
|
|||
|
|
|||
|
g_ptz.hori_angle_error = self_check_data.hori_angle_error;//<2F><>ֵˮƽ<CBAE>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD>
|
|||
|
return 1;
|
|||
|
}
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 2u);
|
|||
|
}
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
char ptz_self_check_data_erase()
|
|||
|
{
|
|||
|
char i, j;
|
|||
|
memset(&self_check_data_a, 0, sizeof(self_check_data_a));
|
|||
|
memset(&self_check_data, 0, sizeof(self_check_data));
|
|||
|
|
|||
|
#ifdef PTZ_NO_SELF_CHECK
|
|||
|
ptz_power_off_data_erase(PTZ_MB85RC64_ADD_A);
|
|||
|
ptz_power_off_data_erase(PTZ_MB85RC64_ADD_B);
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 5u);
|
|||
|
#endif
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD><E6B4A2>
|
|||
|
for(i = 0; i < SELF_CHECK_DATA_SAVE_FLASH_NUM; i++)
|
|||
|
{
|
|||
|
memset(&self_check_data_a, 0, sizeof(self_check_data_a));
|
|||
|
write_many_data(sizeof(self_check_data),(unsigned char *)(&self_check_data),SELF_CHECK_DATA_FLASH_ADD);
|
|||
|
asm("nop");
|
|||
|
asm("nop");
|
|||
|
Flash_Read((unsigned char *)(&self_check_data_a),SELF_CHECK_DATA_FLASH_ADD,sizeof(self_check_data_a));
|
|||
|
if(memcmp(&self_check_data, &self_check_data_a, sizeof(self_check_data)) == 0)//<2F>жϲ<D0B6><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ȷ
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 5u);
|
|||
|
}
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ洢<DDB4><E6B4A2>
|
|||
|
for(j = 0; j < SELF_CHECK_DATA_SAVE_FLASH_NUM; j++)
|
|||
|
{
|
|||
|
memset(&self_check_data_a, 0, sizeof(self_check_data_a));
|
|||
|
write_many_data(sizeof(self_check_data),(unsigned char *)(&self_check_data),SELF_CHECK_DATA_BACKUP_FLASH_ADD);
|
|||
|
asm("nop");
|
|||
|
asm("nop");
|
|||
|
Flash_Read((unsigned char *)(&self_check_data_a),SELF_CHECK_DATA_BACKUP_FLASH_ADD,sizeof(self_check_data_a));
|
|||
|
if(memcmp(&self_check_data, &self_check_data_a, sizeof(self_check_data)) == 0)//<2F>жϲ<D0B6><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ȷ
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
OSTimeDlyHMSM(0u, 0u, 0u, 5u);
|
|||
|
}
|
|||
|
|
|||
|
if(i < SELF_CHECK_DATA_SAVE_FLASH_NUM || j < SELF_CHECK_DATA_SAVE_FLASH_NUM)//<2F>жϲ<D0B6><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD>
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
|||
|
return 1;
|
|||
|
}
|
|||
|
//<2F><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|