下半区传感器接线方式修改,屏幕安装点过低或过高,按压上半区或下半区屏幕会造成误触发,未能得到解决

This commit is contained in:
2026-07-09 18:52:49 +08:00
parent 7f68ef4677
commit 59d5c62b12
11 changed files with 910 additions and 353 deletions
+2 -3
View File
@@ -51,9 +51,8 @@ uint8_t CRC_Sum(uint8_t *_pbuff, uint16_t _cmdLen);
bool isAllZero(uint8_t *arr, int size);
int fixWithMedianIterative(int arr[], int size, int windowSize, int threshold, int maxIterations, int verbose);
int finalCheck(int arr[], int size, int threshold, int verbose);
int weightedMovingAverageWithEnhance(int32_t arr[], int size, int windowSize,
int enhanceStart, int enhanceEnd,
double enhanceFactor, int verbose);
int weightedMovingAverageWithEnhance(int32_t arr[], int size, int windowSize,int enhanceStart, int enhanceEnd, double enhanceFactor, int verbose);
int CompareAndCountAbs(const int32_t *arr1, const int32_t *arr2, uint16_t length,int32_t zero1, int32_t zero2, int32_t offset);
#endif
+20
View File
@@ -213,6 +213,24 @@
#define CLR_TWIN_BIT1() PORT_ResetBits(TWIN_BIT1_PORTx, TWIN_BIT1_PINx)//拉低
#define GET_BIT1_DOUT() PORT_GetBit(TWIN_BIT1_PORTx, TWIN_BIT1_PINx)
//< BUZZER
#define BUZZER_PORTx (PortB)
#define BUZZER_PINx (Pin15)
#define BUZZER_ON() PORT_SetBits(BUZZER_PORTx, BUZZER_PINx)//拉高
#define BUZZER_OFF() PORT_ResetBits(BUZZER_PORTx, BUZZER_PINx)//拉低
//< LED
#define LED_GREEN_PORTx (PortA)
#define LED_GREEN_PINx (Pin08)
#define LED_GREEN_ON() PORT_SetBits(LED_GREEN_PORTx, LED_GREEN_PINx)//拉高
#define LED_GREEN_OFF() PORT_ResetBits(LED_GREEN_PORTx, LED_GREEN_PINx)//拉低
#define LED_RED_PORTx (PortA)
#define LED_RED_PINx (Pin09)
#define LED_RED_ON() PORT_SetBits(LED_RED_PORTx, LED_RED_PINx)//拉高
#define LED_RED_OFF() PORT_ResetBits(LED_RED_PORTx, LED_RED_PINx)//拉低
typedef struct {
int32_t ControlLevel;//控制等级
int32_t DBGWaveOut;//调试波形输出
@@ -289,6 +307,8 @@ void ExtInt04IntEnable(void);
void ExtInt04IntDisable(void);
void ExtInt06IntEnable(void);
void ExtInt06IntDisable(void);
void Bit0AndBit1_OUT(void);
void Bit0AndBit1_IN(void);
#endif
+17 -11
View File
@@ -11,26 +11,31 @@
#define SLOPE_CNT 20
#define SLOPE_VPT 1000
#define PRESS_VPT 3
#define PRESS_VPT 10
#define FOLLOW_VPT 10
#define SHIELD_VPT 5000
#define SHIELD_VPT 2
#define EME_STOP_VPT 4000
#define CENTRE_VPT 2000
#define CENTRE_FRONT_CNT 0
#define CENTRE_FRONT_SUM 0
#define CENTRE_FRONT_VPT 0
#define CENTRE_VPT 0
#define STOP_TIME_MS 500
#define CENT_TIME_MS 200
#define RUN_TIME_MS 0
#define EME_START_MS 0
#define EME_STOP_MS 2000
#define SLOPE_START_MS 3000
#define TRAVEL_TIME_MS 30000
#define TRAVEL_TIME_MS 50000
#define PEAK 1200 //1200mm
#define VALLEY 720 //720mm
#define BDC_STOP() (SET_TWIN_BIT0(),SET_TWIN_BIT1())
#define BDC_UP() (SET_TWIN_BIT0(),CLR_TWIN_BIT1())
#define BDC_DOWN() (SET_TWIN_BIT1(),CLR_TWIN_BIT0())
#define BDC_DOWN() (SET_TWIN_BIT0(),CLR_TWIN_BIT1())
#define BDC_UP() (SET_TWIN_BIT1(),CLR_TWIN_BIT0())
//#define BDC_STOP() Motor_Control(MOTOR_CMD_STOP)
//#define BDC_UP() Motor_Control(MOTOR_CMD_FORWARD)
@@ -55,11 +60,6 @@ typedef struct{
int32_t RightUpVPT;//右上设备阈值
int32_t RightLowVPT;//右下设备阈值
int32_t LeftUpShieldVPT; //左上屏蔽阈值
int32_t LeftLowShieldVPT; //左下屏蔽阈值
int32_t RightUpShieldVPT; //右上屏蔽阈值
int32_t RightLowShieldVPT; //右下屏蔽阈值
int32_t LeftUp_Org_AdZero;//左上设备原始AD零点
int32_t LeftLow_Org_AdZero;//左下设备原始AD零点
int32_t RightUp_Org_AdZero;//右上设备原始AD零点
@@ -135,6 +135,7 @@ typedef struct {
uint32_t Uart3RxTimeOut1mSCnt;
uint32_t StopCollDelay1mSCnt;
uint32_t RunCollDelay1mSCnt;
uint32_t CentCollDelay1mSCnt;
uint32_t EmergencyDelay1mSCnt;
uint32_t SlopeCollDelay1mSCnt;
uint32_t CailUp1mSCnt;
@@ -166,6 +167,11 @@ typedef struct {
int32_t RightUpCS1237_SlopeArray[SLOPE_CNT];
int32_t RightLowCS1237_SlopeArray[SLOPE_CNT];
int32_t aaa;
int32_t bbb;
int32_t ccc;
int32_t ddd;
bool WaitFlag;
}AppDetect_t;
extern AppDetect_t App;