双柱双电机S型传感器独立分支初始版本
This commit is contained in:
@@ -167,6 +167,18 @@
|
||||
#define CLR_RIGHTLOW_CS1237_SCLK() PORT_ResetBits(RIGHTLOW_CS1237_SCLK_PORTx, RIGHTLOW_CS1237_SCLK_PINx)//拉低
|
||||
#endif
|
||||
|
||||
//< BIT0
|
||||
#define TWIN_BIT0_PORTx (PortB)
|
||||
#define TWIN_BIT0_PINx (Pin12)
|
||||
#define SET_TWIN_BIT0() PORT_SetBits(TWIN_BIT0_PORTx, TWIN_BIT0_PINx)//拉高
|
||||
#define CLR_TWIN_BIT0() PORT_ResetBits(TWIN_BIT0_PORTx, TWIN_BIT0_PINx)//拉低
|
||||
|
||||
//< BIT1
|
||||
#define TWIN_BIT1_PORTx (PortB)
|
||||
#define TWIN_BIT1_PINx (Pin13)
|
||||
#define SET_TWIN_BIT1() PORT_SetBits(TWIN_BIT1_PORTx, TWIN_BIT1_PINx)//拉高
|
||||
#define CLR_TWIN_BIT1() PORT_ResetBits(TWIN_BIT1_PORTx, TWIN_BIT1_PINx)//拉低
|
||||
|
||||
typedef struct {
|
||||
uint32_t ControlLevel;//控制等级
|
||||
uint32_t DBGWaveOut;//调试波形输出
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
#define STOP_TIME_MS 500
|
||||
#define RUN_TIME_MS 0
|
||||
|
||||
#define BDC_STOP() Motor_Control(MOTOR_CMD_STOP)
|
||||
#define BDC_UP() Motor_Control(MOTOR_CMD_FORWARD)
|
||||
#define BDC_DOWN() Motor_Control(MOTOR_CMD_REVERSE)
|
||||
#define BDC_STOP() (SET_TWIN_BIT0(),SET_TWIN_BIT1())
|
||||
#define BDC_UP() (CLR_TWIN_BIT0(),SET_TWIN_BIT1())
|
||||
#define BDC_DOWN() (SET_TWIN_BIT0(),CLR_TWIN_BIT1())
|
||||
|
||||
/*控制等级*/
|
||||
typedef enum {
|
||||
|
||||
@@ -445,6 +445,9 @@ static void GPIO_Config(void)
|
||||
PORT_Init(RIGHTUP_CS1237_SCLK_PORTx, RIGHTUP_CS1237_SCLK_PINx, &stcPortInit);
|
||||
PORT_Init(RIGHTLOW_CS1237_SCLK_PORTx, RIGHTLOW_CS1237_SCLK_PINx, &stcPortInit);
|
||||
|
||||
stcPortInit.enPullUp = Enable;//上拉
|
||||
PORT_Init(TWIN_BIT0_PORTx, TWIN_BIT0_PINx, &stcPortInit);
|
||||
PORT_Init(TWIN_BIT1_PORTx, TWIN_BIT1_PINx, &stcPortInit);
|
||||
}
|
||||
/*********************************左上传感器
|
||||
*******************************************************************************
|
||||
|
||||
@@ -410,36 +410,36 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
|
||||
if (lu_K.peaks_positive
|
||||
&& lu_K.valleys_negative
|
||||
&& lu_diff[0] < App.ADTrack.Slope_VPT / 2
|
||||
&& lu_diff[0] > -App.ADTrack.Slope_VPT / 2
|
||||
&& lu_diff[1] < App.ADTrack.Slope_VPT / 2
|
||||
&& lu_diff[1] > -App.ADTrack.Slope_VPT / 2
|
||||
&& lu_diff[2] < App.ADTrack.Slope_VPT / 2
|
||||
&& lu_diff[2] > -App.ADTrack.Slope_VPT / 2
|
||||
&& App.LeftUpCS1237_SlopeArray[0] < App.ADTrack.Slope_VPT / 2
|
||||
&& App.LeftUpCS1237_SlopeArray[0] > -App.ADTrack.Slope_VPT / 2
|
||||
&& App.LeftUpCS1237_SlopeArray[1] < App.ADTrack.Slope_VPT / 2
|
||||
&& App.LeftUpCS1237_SlopeArray[1] > -App.ADTrack.Slope_VPT / 2
|
||||
&& App.LeftUpCS1237_SlopeArray[2] < App.ADTrack.Slope_VPT / 2
|
||||
&& App.LeftUpCS1237_SlopeArray[2] > -App.ADTrack.Slope_VPT / 2
|
||||
&& ll_K.peaks_positive
|
||||
&& ll_K.valleys_negative
|
||||
&& ll_diff[0] < App.ADTrack.Slope_VPT / 2
|
||||
&& ll_diff[0] > -App.ADTrack.Slope_VPT / 2
|
||||
&& ll_diff[1] < App.ADTrack.Slope_VPT / 2
|
||||
&& ll_diff[1] > -App.ADTrack.Slope_VPT / 2
|
||||
&& ll_diff[2] < App.ADTrack.Slope_VPT / 2
|
||||
&& ll_diff[2] > -App.ADTrack.Slope_VPT / 2
|
||||
&& App.LeftLowCS1237_SlopeArray[0] < App.ADTrack.Slope_VPT / 2
|
||||
&& App.LeftLowCS1237_SlopeArray[0] > -App.ADTrack.Slope_VPT / 2
|
||||
&& App.LeftLowCS1237_SlopeArray[1] < App.ADTrack.Slope_VPT / 2
|
||||
&& App.LeftLowCS1237_SlopeArray[1] > -App.ADTrack.Slope_VPT / 2
|
||||
&& App.LeftLowCS1237_SlopeArray[2] < App.ADTrack.Slope_VPT / 2
|
||||
&& App.LeftLowCS1237_SlopeArray[2] > -App.ADTrack.Slope_VPT / 2
|
||||
&& ru_K.peaks_positive
|
||||
&& ru_K.valleys_negative
|
||||
&& ru_diff[0] < App.ADTrack.Slope_VPT / 2
|
||||
&& ru_diff[0] > -App.ADTrack.Slope_VPT / 2
|
||||
&& ru_diff[1] < App.ADTrack.Slope_VPT / 2
|
||||
&& ru_diff[1] > -App.ADTrack.Slope_VPT / 2
|
||||
&& ru_diff[2] < App.ADTrack.Slope_VPT / 2
|
||||
&& ru_diff[2] > -App.ADTrack.Slope_VPT / 2
|
||||
&& App.RightUpCS1237_SlopeArray[0] < App.ADTrack.Slope_VPT / 2
|
||||
&& App.RightUpCS1237_SlopeArray[0] > -App.ADTrack.Slope_VPT / 2
|
||||
&& App.RightUpCS1237_SlopeArray[1] < App.ADTrack.Slope_VPT / 2
|
||||
&& App.RightUpCS1237_SlopeArray[1] > -App.ADTrack.Slope_VPT / 2
|
||||
&& App.RightUpCS1237_SlopeArray[2] < App.ADTrack.Slope_VPT / 2
|
||||
&& App.RightUpCS1237_SlopeArray[2] > -App.ADTrack.Slope_VPT / 2
|
||||
&& rl_K.peaks_positive
|
||||
&& rl_K.valleys_negative
|
||||
&& rl_diff[0] < App.ADTrack.Slope_VPT / 2
|
||||
&& rl_diff[0] > -App.ADTrack.Slope_VPT / 2
|
||||
&& rl_diff[1] < App.ADTrack.Slope_VPT / 2
|
||||
&& rl_diff[1] > -App.ADTrack.Slope_VPT / 2
|
||||
&& rl_diff[2] < App.ADTrack.Slope_VPT / 2
|
||||
&& rl_diff[2] > -App.ADTrack.Slope_VPT / 2)
|
||||
&& App.RightLowCS1237_SlopeArray[0] < App.ADTrack.Slope_VPT / 2
|
||||
&& App.RightLowCS1237_SlopeArray[0] > -App.ADTrack.Slope_VPT / 2
|
||||
&& App.RightLowCS1237_SlopeArray[1] < App.ADTrack.Slope_VPT / 2
|
||||
&& App.RightLowCS1237_SlopeArray[1] > -App.ADTrack.Slope_VPT / 2
|
||||
&& App.RightLowCS1237_SlopeArray[2] < App.ADTrack.Slope_VPT / 2
|
||||
&& App.RightLowCS1237_SlopeArray[2] > -App.ADTrack.Slope_VPT / 2)
|
||||
{
|
||||
if(App.StopFlag == true && App.StopCollDelay1mSCnt <= 0){
|
||||
App.ADTrack.LeftUp_Org_AdZero = lu_ad[0];
|
||||
|
||||
Reference in New Issue
Block a user