|
|
@@ -1335,14 +1335,14 @@ void WorkTask_XYV3(void)
|
|
|
device_status.photo_ws = 2;
|
|
|
cal_n = device_status.cul_time * 60;
|
|
|
}
|
|
|
- if(cal_n>1000&&cal_n%1200==0) //每隔20分钟高压通电30S
|
|
|
+ if(cal_n>1000&&cal_n%1200==0) //每隔20分钟高压通电5S
|
|
|
{
|
|
|
ctr_lamp(ON, 1);
|
|
|
gaoya_on = 1;
|
|
|
}
|
|
|
if(gaoya_on){
|
|
|
gaoya_on_sec++;
|
|
|
- if(gaoya_on_sec>30){
|
|
|
+ if(gaoya_on_sec>5){
|
|
|
gaoya_on=0;
|
|
|
gaoya_on_sec = 0;
|
|
|
ctr_lamp(OFF, 1);
|
|
|
@@ -1426,131 +1426,131 @@ static void Control_Clear_thread_entry(void *parameter)
|
|
|
}
|
|
|
|
|
|
/*入口函数加热*/
|
|
|
-//static void Control_Heat_thread_entry(void *parameter)
|
|
|
-//{
|
|
|
-// rt_pin_mode(SIGNAL_GaoYa, PIN_MODE_INPUT);
|
|
|
-// rt_pin_mode(SIGNAL_GuangShan, PIN_MODE_INPUT);
|
|
|
-// static int GaoyYa_cnt,GuangShan_cnt = 500; //10s
|
|
|
-// bool GaoYa = false;
|
|
|
-// bool GuangShan = false;
|
|
|
-// while(1)
|
|
|
-// {
|
|
|
-//
|
|
|
-// if(rt_pin_read(SIGNAL_GaoYa)==0)
|
|
|
-// {
|
|
|
-// LOG_I("检测到高压计数!");
|
|
|
-// GaoYa = true;
|
|
|
-// }
|
|
|
-//
|
|
|
-// if(rt_pin_read(SIGNAL_GuangShan)==0)
|
|
|
-// {
|
|
|
-// LOG_I("检测到光栅计数!");
|
|
|
-// GuangShan = true;
|
|
|
-// }
|
|
|
-//
|
|
|
-// if(GaoYa)
|
|
|
-// {
|
|
|
-// GaoyYa_cnt --;
|
|
|
-// if(GaoyYa_cnt==0)
|
|
|
-// {
|
|
|
-// GaoyYa_cnt = 500;
|
|
|
-// GaoYa = false;
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// if(GuangShan)
|
|
|
-// {
|
|
|
-// GuangShan_cnt--;
|
|
|
-// if(GuangShan_cnt==0)
|
|
|
-// {
|
|
|
-// GuangShan_cnt = 500;
|
|
|
-// GuangShan = false;
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// if(GaoYa&&GuangShan)
|
|
|
-// {
|
|
|
-// device_status.all_ycct += 1; //计数值增加
|
|
|
-// //拍照
|
|
|
-// if(device_status.all_ycct>=1){
|
|
|
-// //device_status.photo_ws = 1;
|
|
|
-// }
|
|
|
-// GaoYa = false;
|
|
|
-// GuangShan = false;
|
|
|
-// GaoyYa_cnt = 500;
|
|
|
-// GuangShan_cnt = 500;
|
|
|
-// rt_thread_delay(1000);
|
|
|
-// }
|
|
|
-// rt_thread_delay(20);
|
|
|
-// }
|
|
|
-//}
|
|
|
-
|
|
|
-static void Control_Heat_thread_entry(void *parameter) {
|
|
|
+static void Control_Heat_thread_entry(void *parameter)
|
|
|
+{
|
|
|
rt_pin_mode(SIGNAL_GaoYa, PIN_MODE_INPUT);
|
|
|
rt_pin_mode(SIGNAL_GuangShan, PIN_MODE_INPUT);
|
|
|
+ static int GaoyYa_cnt,GuangShan_cnt = 500; //10s
|
|
|
+ bool GaoYa = false;
|
|
|
+ bool GuangShan = false;
|
|
|
+ while(1)
|
|
|
+ {
|
|
|
|
|
|
- // 修正变量名和初始化
|
|
|
- static int GaoYa_cnt = 500, GuangShan_cnt = 500;
|
|
|
- static bool GaoYa = false, GuangShan = false;
|
|
|
- static int highPressureDuration = 0;
|
|
|
-
|
|
|
-
|
|
|
- while (1) {
|
|
|
- // 高压信号去抖动
|
|
|
- if (rt_pin_read(SIGNAL_GaoYa) == 0) {
|
|
|
- LOG_I("高压信号稳定触发");
|
|
|
+ if(rt_pin_read(SIGNAL_GaoYa)==0)
|
|
|
+ {
|
|
|
+ LOG_I("检测到高压计数!");
|
|
|
GaoYa = true;
|
|
|
- highPressureDuration ++;
|
|
|
- }else{
|
|
|
- highPressureDuration = 0;
|
|
|
}
|
|
|
|
|
|
- // 光栅信号去抖动(类似逻辑)
|
|
|
if(rt_pin_read(SIGNAL_GuangShan)==0)
|
|
|
{
|
|
|
LOG_I("检测到光栅计数!");
|
|
|
GuangShan = true;
|
|
|
}
|
|
|
- /* 高压持续时间监测 */
|
|
|
+
|
|
|
if(GaoYa)
|
|
|
{
|
|
|
- // 持续时间累计(每次循环+1,20ms/次)
|
|
|
- if(highPressureDuration >= 50)
|
|
|
+ GaoyYa_cnt --;
|
|
|
+ if(GaoyYa_cnt==0)
|
|
|
{
|
|
|
- LOG_E("高压持续超过5秒!");
|
|
|
- // 执行关闭高压操作(示例函数)
|
|
|
- //ctr_lamp(OFF, 1);
|
|
|
- // 可选:自动复位保护
|
|
|
-// rt_thread_mdelay(10000); // 等待10秒
|
|
|
-// ctr_lamp(ON, 1);
|
|
|
- highPressureDuration = 0;
|
|
|
- }
|
|
|
- }
|
|
|
- // 计数器逻辑
|
|
|
- if (GaoYa) {
|
|
|
- if (--GaoYa_cnt <= 0) {
|
|
|
+ GaoyYa_cnt = 500;
|
|
|
GaoYa = false;
|
|
|
- GaoYa_cnt = 500;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (GuangShan) {
|
|
|
- if (--GuangShan_cnt <= 0) {
|
|
|
- GuangShan = false;
|
|
|
+ if(GuangShan)
|
|
|
+ {
|
|
|
+ GuangShan_cnt--;
|
|
|
+ if(GuangShan_cnt==0)
|
|
|
+ {
|
|
|
GuangShan_cnt = 500;
|
|
|
+ GuangShan = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 触发拍照逻辑
|
|
|
- if (GaoYa && GuangShan) {
|
|
|
- device_status.all_ycct++;
|
|
|
- GaoYa = GuangShan = false;
|
|
|
- GaoYa_cnt = GuangShan_cnt = 500;
|
|
|
+ if(GaoYa&&GuangShan)
|
|
|
+ {
|
|
|
+ device_status.all_ycct += 1; //计数值增加
|
|
|
+ //拍照
|
|
|
+ if(device_status.all_ycct>=1){
|
|
|
+ //device_status.photo_ws = 1;
|
|
|
+ }
|
|
|
+ GaoYa = false;
|
|
|
+ GuangShan = false;
|
|
|
+ GaoyYa_cnt = 500;
|
|
|
+ GuangShan_cnt = 500;
|
|
|
+ rt_thread_delay(1000);
|
|
|
}
|
|
|
- rt_thread_delay(20); // 保持20ms周期
|
|
|
+ rt_thread_delay(20);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//static void Control_Heat_thread_entry(void *parameter) {
|
|
|
+// rt_pin_mode(SIGNAL_GaoYa, PIN_MODE_INPUT);
|
|
|
+// rt_pin_mode(SIGNAL_GuangShan, PIN_MODE_INPUT);
|
|
|
+//
|
|
|
+// // 修正变量名和初始化
|
|
|
+// static int GaoYa_cnt = 500, GuangShan_cnt = 500;
|
|
|
+// static bool GaoYa = false, GuangShan = false;
|
|
|
+// static int highPressureDuration = 0;
|
|
|
+//
|
|
|
+//
|
|
|
+// while (1) {
|
|
|
+// // 高压信号去抖动
|
|
|
+// if (rt_pin_read(SIGNAL_GaoYa) == 0) {
|
|
|
+// LOG_I("高压信号稳定触发");
|
|
|
+// GaoYa = true;
|
|
|
+// highPressureDuration ++;
|
|
|
+// }else{
|
|
|
+// highPressureDuration = 0;
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 光栅信号去抖动(类似逻辑)
|
|
|
+// if(rt_pin_read(SIGNAL_GuangShan)==0)
|
|
|
+// {
|
|
|
+// LOG_I("检测到光栅计数!");
|
|
|
+// GuangShan = true;
|
|
|
+// }
|
|
|
+// /* 高压持续时间监测 */
|
|
|
+// if(GaoYa)
|
|
|
+// {
|
|
|
+// // 持续时间累计(每次循环+1,20ms/次)
|
|
|
+// if(highPressureDuration >= 50)
|
|
|
+// {
|
|
|
+// LOG_E("高压持续超过5秒!");
|
|
|
+// // 执行关闭高压操作(示例函数)
|
|
|
+// //ctr_lamp(OFF, 1);
|
|
|
+// // 可选:自动复位保护
|
|
|
+//// rt_thread_mdelay(10000); // 等待10秒
|
|
|
+//// ctr_lamp(ON, 1);
|
|
|
+// highPressureDuration = 0;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 计数器逻辑
|
|
|
+// if (GaoYa) {
|
|
|
+// if (--GaoYa_cnt <= 0) {
|
|
|
+// GaoYa = false;
|
|
|
+// GaoYa_cnt = 500;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (GuangShan) {
|
|
|
+// if (--GuangShan_cnt <= 0) {
|
|
|
+// GuangShan = false;
|
|
|
+// GuangShan_cnt = 500;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 触发拍照逻辑
|
|
|
+// if (GaoYa && GuangShan) {
|
|
|
+// device_status.all_ycct++;
|
|
|
+// GaoYa = GuangShan = false;
|
|
|
+// GaoYa_cnt = GuangShan_cnt = 500;
|
|
|
+// }
|
|
|
+// rt_thread_delay(20); // 保持20ms周期
|
|
|
+// }
|
|
|
+//}
|
|
|
+
|
|
|
/*清扫线程*/
|
|
|
int Control_clear(void)
|
|
|
{
|