refactor: 对齐 DLD154V4B 规格和 M1H 参考
- 灵敏度表改为 M1H 值: {216,108,36,10} / {108,72,18,9}
- 时序参数对齐: OUT_DELAY 39→38, PULSE_DELAY 10→19
- LED 宏命名对齐 154V4B: LEDA=红(PB1), LEDB=绿(PA9), LEDC=黄(PA10)
- RLY1/RLY2 引脚交换: PA6=RLY1, PA5=RLY2
This commit is contained in:
@@ -16,11 +16,12 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define HOLD_TIME 5*1200
|
||||
#define LC_HOLD_TIME 4*1200 //时间4分钟
|
||||
#define IN_DELAY 10
|
||||
#define OUT_DELAY 39
|
||||
#define PLUSE_DELAY 10
|
||||
// 时序参数(每 tick ≈50ms),对齐 M1H 参考实现
|
||||
#define HOLD_TIME (5 * 1200) // 有限存在保持(约5分钟)
|
||||
#define LC_HOLD_TIME (4 * 1200) // 安全复位时间(约4分钟)
|
||||
#define IN_DELAY 10 // 进入防抖 500ms
|
||||
#define OUT_DELAY 38 // 离开防抖 1.9s
|
||||
#define PULSE_DELAY 19 // 脉冲宽度 950ms
|
||||
|
||||
|
||||
#define MAX_CMP_LOOP_UNIT 4 // 5 组
|
||||
|
||||
@@ -9,8 +9,11 @@
|
||||
|
||||
|
||||
|
||||
const uint16_t SensTable[4] = {300, 60, 32, 21 };
|
||||
const uint16_t SensTable_1[4] = {60, 32, 21, 14 }; //释放灵敏度
|
||||
// 灵敏度表(对齐 M1H 参考实现)
|
||||
// 进入阈值 = Origin × SensTable[SENS] / 65536
|
||||
// 离开阈值(滞回)= Origin × SensTable_1[SENS] / 65536,约为进入的一半
|
||||
const uint16_t SensTable[4] = {216, 108, 36, 10}; // 0=低灵敏, 3=高灵敏
|
||||
const uint16_t SensTable_1[4] = {108, 72, 18, 9}; // 释放灵敏度(滞回)
|
||||
|
||||
const uint16_t DELAY_TIME[4] = {0, 10}; //0、0.6秒、1.6秒、3秒 {0,12,32,60}; //0、0.6秒、1.6秒、3秒
|
||||
|
||||
@@ -345,7 +348,7 @@ void update_flt_history(uint32_t new_flt, int32_t firstOrder, int32_t secondOrde
|
||||
if (flt_mgr.init_samples >= INIT_SAMPLE_COUNT) {
|
||||
flt_mgr.stable_init_value = flt_mgr.init_sum / INIT_SAMPLE_COUNT;
|
||||
flt_mgr.is_initialized = 1;
|
||||
LEDA_OFF;
|
||||
LEDB_OFF;
|
||||
stage_config[0].base_value = flt_mgr.stable_init_value;
|
||||
update_lower_upper(&stage_config[0]);
|
||||
flt_mgr.init_freq = (float)(g_sys_freq )/((float)(flt_mgr.stable_init_value << XNSUM_FOR_ORIGIN_FACTOR)/((float)(loop1_LPCNT))) * g_input_div;
|
||||
@@ -727,7 +730,7 @@ void TMR15_GLOBAL_IRQHandler(void)
|
||||
loop1_FLAG_PLUSE_IN_F = 1;
|
||||
}
|
||||
loop1_INCNT = 0;
|
||||
LEDA_ON;
|
||||
LEDB_ON;
|
||||
}
|
||||
|
||||
if(loop1_FLAG_PLUSE_IN_F)
|
||||
@@ -760,14 +763,14 @@ void TMR15_GLOBAL_IRQHandler(void)
|
||||
loop1_FLAG_OUT = 0;
|
||||
loop1_FLAG_PLUSE = 1;
|
||||
loop1_OUTCNT = 0;
|
||||
LEDA_OFF;
|
||||
LEDB_OFF;
|
||||
}
|
||||
}
|
||||
|
||||
if(loop1_FLAG_PLUSE) // Give 500ms
|
||||
{
|
||||
loop1_OUTCNT++;
|
||||
if(loop1_OUTCNT > PLUSE_DELAY)
|
||||
if(loop1_OUTCNT > PULSE_DELAY)
|
||||
{
|
||||
loop1_FLAG_PLUSE = 0;
|
||||
loop1_OUTCNT = 0;
|
||||
@@ -971,7 +974,7 @@ void vd1_task(void){
|
||||
loop1_VD_FLAG = 1; //???????1
|
||||
loop1_FLAG_IN = 1; //??????
|
||||
|
||||
LEDA_ON;
|
||||
LEDB_ON;
|
||||
|
||||
|
||||
if(!SET_SAFE)
|
||||
@@ -1026,7 +1029,7 @@ void vd1_task(void){
|
||||
g_loop_acs_info.flag_event = 1;
|
||||
g_loop_acs_info.car_state = 0;
|
||||
// g_led_A_state = 0;
|
||||
LEDA_OFF;
|
||||
LEDB_OFF;
|
||||
loop1_ORG_CNT = 0;
|
||||
loop1_ORG_SUM = 0;
|
||||
Hold_CNT = 0;
|
||||
@@ -1085,16 +1088,16 @@ void loop_task_function(void *pvParameters)
|
||||
if(!loop1_LOOP_OK0){
|
||||
for(swcnt = 0; swcnt < 6; swcnt++){
|
||||
if(gpio_output_data_bit_read(LED_GREEN_GPIO, LED_GREEN_PIN)){
|
||||
LEDA_ON;
|
||||
LEDB_ON;
|
||||
}
|
||||
else{
|
||||
LEDA_OFF;
|
||||
LEDB_OFF;
|
||||
}
|
||||
vTaskDelay(200);
|
||||
// TODO: 添加看门狗
|
||||
}
|
||||
loop1_LOOP_OK0= 1;
|
||||
LEDA_OFF;
|
||||
LEDB_OFF;
|
||||
}
|
||||
|
||||
if(loop1_CAP_OK){
|
||||
@@ -1132,7 +1135,7 @@ void loop_task_function(void *pvParameters)
|
||||
// loop1_FLAG_PLUSE = 0;
|
||||
|
||||
// 线圈断开,继电器释放,状态为0,车辆状态也为0
|
||||
RLY1_OFF; RLY2_OFF; LEDA_OFF;
|
||||
RLY1_OFF; RLY2_OFF; LEDB_OFF;
|
||||
|
||||
if(gpio_output_data_bit_read(LED_YELLOW_GPIO, LED_YELLOW_PIN)){
|
||||
LED_YELLOW_ON;
|
||||
@@ -1152,10 +1155,10 @@ void loop_task_function(void *pvParameters)
|
||||
g_xn_counter = 0;
|
||||
|
||||
// if(gpio_output_data_bit_read(LED_GREEN_GPIO, LED_GREEN_PIN)){
|
||||
// LEDA_ON;
|
||||
// LEDB_ON;
|
||||
// }
|
||||
// else{
|
||||
// LEDA_OFF;
|
||||
// LEDB_OFF;
|
||||
// }
|
||||
//
|
||||
// if(gpio_output_data_bit_read(LED_YELLOW_GPIO, LED_YELLOW_PIN)){
|
||||
|
||||
Reference in New Issue
Block a user