diff --git a/Hyt2/APP/Device/device_Other/device_heat.c b/Hyt2/APP/Device/device_Other/device_heat.c index 4e275ba..e2bed31 100644 --- a/Hyt2/APP/Device/device_Other/device_heat.c +++ b/Hyt2/APP/Device/device_Other/device_heat.c @@ -465,6 +465,10 @@ static char ptz_heat_data_collect_task() { static uint16_t ntc_num = 0; + static uint16_t overCurrTime; + static uint16_t currTime; + static uint8_t heatFlag = 0; //加热标志位,1-禁止加热,0-允许加热 + while (1) { adc_software_trigger_enable(ADC1, ADC_INSERTED_CHANNEL); // OSTimeDlyHMSM(0u, 0u, 0u, 1u); @@ -476,7 +480,45 @@ static char ptz_heat_data_collect_task() ptz_Voltage_collect_adc1_task(); ptz_Current_collect_adc1_task(); ptz_temperature_collect_tmp75_task(); - ptz_heat_collect_adc1_task(); + /*未禁止加热后检测电流,查看是否过流*/ + if ( !heatFlag ) + { + ptz_heat_collect_adc1_task(); + + if ( g_ptz.electric_current > 6 ) //过流 + { + overCurrTime++; + } + else + { + currTime = 0; + } + //长时间过流 + if ( overCurrTime >= 20 ) //20*100ms=2s + { + heatFlag = 1; //禁止加热 + closeHeat(); + overCurrTime = 0; + } + } + else + { + if ( g_ptz.electric_current < 3.5 ) //电流恢复正常 + { + currTime++; + } + else + { + currTime = 0; + } + //长时间电流正常 + if ( currTime >= 20 ) //20*100ms=2s + { + heatFlag = 0; //允许加热 + currTime = 0; + } + } + // ptz_heat_collect_adc1_task(); OSTimeDlyHMSM(0u, 0u, 0u, 100u); } diff --git a/Hyt2/APP/Service/service_statusmonitor.c b/Hyt2/APP/Service/service_statusmonitor.c index 4450bf9..69ee057 100644 --- a/Hyt2/APP/Service/service_statusmonitor.c +++ b/Hyt2/APP/Service/service_statusmonitor.c @@ -85,7 +85,7 @@ static char ptz_temp_volt_current_fault_detect_task() g_ptz.fault_detect.temperature_fault = NO_FAULT; } //¶ȹϣ̨ܿƣ¶ֵ10Чʱ̨ - if(g_ptz.temperature > (PTZ_TEMP_DETECT_MAX + 10.0) || g_ptz.temperature < (PTZ_TEMP_DETECT_MIN - 9.0) ) + if(g_ptz.temperature > (PTZ_TEMP_DETECT_MAX + 10.0) || g_ptz.temperature < (PTZ_TEMP_DETECT_MIN - 4.0) ) { max_temperature_fault = FAULT; ptz_hori_stop(PTZ_HORI_STOP_TIME); diff --git a/Hyt2/APP/Service/service_statusmonitor.h b/Hyt2/APP/Service/service_statusmonitor.h index 339dd42..6e3d153 100644 --- a/Hyt2/APP/Service/service_statusmonitor.h +++ b/Hyt2/APP/Service/service_statusmonitor.h @@ -100,14 +100,14 @@ #ifdef PTZ_MEDIUM_WORM_L6235D_AS5047D //¶ֵ #define PTZ_TEMP_DETECT_MAX 65.0 //70.0 - #define PTZ_TEMP_DETECT_MIN -30.0//70.0 + #define PTZ_TEMP_DETECT_MIN -35.0//70.0 //ѹֵ #define PTZ_VOLT_DETECT_MAX 30.0//30.0 #define PTZ_VOLT_DETECT_MIN 18.0//30.0 //ֵ - #define PTZ_CURRENT_DETECT 6.0//5.0 + #define PTZ_CURRENT_DETECT 7.5//5.0 //ֵ #define PTZ_HALL_DETECT 30//30