调试
This commit is contained in:
@@ -118,7 +118,7 @@
|
|||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Key>CMSIS_AGDI</Key>
|
<Key>CMSIS_AGDI</Key>
|
||||||
<Name>-X"" -O206 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD1FFF8000 -FC1000 -FN2 -FF0HC32F460_512K.FLM -FS00 -FL080000 -FP0($$Device:HC32F460JEUA$FlashARM\HC32F460_512K.FLM) -FF1HC32F460_otp.FLM -FS13000C00 -FL13FC -FP1($$Device:HC32F460JEUA$FlashARM\HC32F460_otp.FLM)</Name>
|
<Name>-X"Any" -UAny -O206 -S9 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD1FFF8000 -FC1000 -FN2 -FF0HC32F460_512K.FLM -FS00 -FL080000 -FP0($$Device:HC32F460JEUA$FlashARM\HC32F460_512K.FLM) -FF1HC32F460_otp.FLM -FS13000C00 -FL13FC -FP1($$Device:HC32F460JEUA$FlashARM\HC32F460_otp.FLM)</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
@@ -228,6 +228,16 @@
|
|||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>RightDiffSum,0x0A</ItemText>
|
<ItemText>RightDiffSum,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>15</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>KeyASta</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>16</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>KeyBSta</ItemText>
|
||||||
|
</Ww>
|
||||||
</WatchWindow1>
|
</WatchWindow1>
|
||||||
<Tracepoint>
|
<Tracepoint>
|
||||||
<THDelay>0</THDelay>
|
<THDelay>0</THDelay>
|
||||||
@@ -275,7 +285,7 @@
|
|||||||
<Enable>1</Enable>
|
<Enable>1</Enable>
|
||||||
<EnableLog>0</EnableLog>
|
<EnableLog>0</EnableLog>
|
||||||
<Protocol>2</Protocol>
|
<Protocol>2</Protocol>
|
||||||
<DbgClock>1000000</DbgClock>
|
<DbgClock>5000000</DbgClock>
|
||||||
</DebugDescription>
|
</DebugDescription>
|
||||||
</TargetOption>
|
</TargetOption>
|
||||||
</Target>
|
</Target>
|
||||||
@@ -441,7 +451,7 @@
|
|||||||
<GroupNumber>1</GroupNumber>
|
<GroupNumber>1</GroupNumber>
|
||||||
<FileNumber>2</FileNumber>
|
<FileNumber>2</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>..\..\..\mcu\common\system_hc32f460.c</PathWithFileName>
|
<PathWithFileName>..\..\..\mcu\common\system_hc32f460.c</PathWithFileName>
|
||||||
@@ -453,7 +463,7 @@
|
|||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>driver</GroupName>
|
<GroupName>driver</GroupName>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<cbSel>0</cbSel>
|
<cbSel>0</cbSel>
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
|
|||||||
@@ -320,13 +320,13 @@
|
|||||||
<PlainCh>0</PlainCh>
|
<PlainCh>0</PlainCh>
|
||||||
<Ropi>0</Ropi>
|
<Ropi>0</Ropi>
|
||||||
<Rwpi>0</Rwpi>
|
<Rwpi>0</Rwpi>
|
||||||
<wLevel>0</wLevel>
|
<wLevel>2</wLevel>
|
||||||
<uThumb>0</uThumb>
|
<uThumb>0</uThumb>
|
||||||
<uSurpInc>0</uSurpInc>
|
<uSurpInc>0</uSurpInc>
|
||||||
<uC99>1</uC99>
|
<uC99>1</uC99>
|
||||||
<useXO>0</useXO>
|
<useXO>0</useXO>
|
||||||
<v6Lang>3</v6Lang>
|
<v6Lang>3</v6Lang>
|
||||||
<v6LangP>5</v6LangP>
|
<v6LangP>3</v6LangP>
|
||||||
<vShortEn>1</vShortEn>
|
<vShortEn>1</vShortEn>
|
||||||
<vShortWch>1</vShortWch>
|
<vShortWch>1</vShortWch>
|
||||||
<v6Lto>0</v6Lto>
|
<v6Lto>0</v6Lto>
|
||||||
@@ -1359,8 +1359,8 @@
|
|||||||
<RTE>
|
<RTE>
|
||||||
<apis/>
|
<apis/>
|
||||||
<components>
|
<components>
|
||||||
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.5.0" condition="ARMv6_7_8-M Device">
|
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.0.1" condition="ARMv6_7_8-M Device">
|
||||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.8.0"/>
|
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.0.1"/>
|
||||||
<targetInfos>
|
<targetInfos>
|
||||||
<targetInfo name="Debug"/>
|
<targetInfo name="Debug"/>
|
||||||
<targetInfo name="Release"/>
|
<targetInfo name="Release"/>
|
||||||
|
|||||||
@@ -335,10 +335,21 @@ void Motor_SetDirection(uint8_t dir) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t KeyASta;
|
||||||
|
uint8_t KeyBSta;
|
||||||
|
uint8_t RunSta;
|
||||||
// 电机控制接口
|
// 电机控制接口
|
||||||
void Motor_Control(MotorCommand cmd) {
|
void Motor_Control(MotorCommand cmd) {
|
||||||
g_motorCmd = cmd;
|
g_motorCmd = cmd;
|
||||||
|
if(cmd == MOTOR_CMD_REVERSE)
|
||||||
|
KeyASta =true;
|
||||||
|
else if(cmd == MOTOR_CMD_FORWARD)
|
||||||
|
KeyBSta = true;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KeyASta = false;
|
||||||
|
KeyBSta = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取电机当前方向
|
// 获取电机当前方向
|
||||||
@@ -388,9 +399,7 @@ void Dcmotor1msRoutine(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t KeyASta;
|
|
||||||
uint8_t KeyBSta;
|
|
||||||
uint8_t RunSta;
|
|
||||||
void DcmotorLoopHandler(void)
|
void DcmotorLoopHandler(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -418,7 +427,7 @@ void DcmotorLoopHandler(void)
|
|||||||
{
|
{
|
||||||
RunSta = true;
|
RunSta = true;
|
||||||
Timer61B_Init();
|
Timer61B_Init();
|
||||||
g_motorSpeed = 8000;
|
g_motorSpeed = 9500;
|
||||||
Timer6_SetGeneralCmpValue(M4_TMR61, Timer6GenCompareA, g_motorSpeed);
|
Timer6_SetGeneralCmpValue(M4_TMR61, Timer6GenCompareA, g_motorSpeed);
|
||||||
Timer6_SetGeneralCmpValue(M4_TMR61, Timer6GenCompareC, g_motorSpeed);
|
Timer6_SetGeneralCmpValue(M4_TMR61, Timer6GenCompareC, g_motorSpeed);
|
||||||
Timer6_StartCount(M4_TMR61);
|
Timer6_StartCount(M4_TMR61);
|
||||||
@@ -430,7 +439,7 @@ void DcmotorLoopHandler(void)
|
|||||||
{
|
{
|
||||||
RunSta = true;
|
RunSta = true;
|
||||||
Timer61A_Init();
|
Timer61A_Init();
|
||||||
g_motorSpeed = 8000;
|
g_motorSpeed = 9500;
|
||||||
Timer6_SetGeneralCmpValue(M4_TMR61, Timer6GenCompareA, g_motorSpeed);
|
Timer6_SetGeneralCmpValue(M4_TMR61, Timer6GenCompareA, g_motorSpeed);
|
||||||
Timer6_SetGeneralCmpValue(M4_TMR61, Timer6GenCompareC, g_motorSpeed);
|
Timer6_SetGeneralCmpValue(M4_TMR61, Timer6GenCompareC, g_motorSpeed);
|
||||||
Timer6_StartCount(M4_TMR61);
|
Timer6_StartCount(M4_TMR61);
|
||||||
|
|||||||
@@ -9,7 +9,14 @@
|
|||||||
|
|
||||||
|
|
||||||
#define OSC_CNT 40
|
#define OSC_CNT 40
|
||||||
#define SLOPE_CNT 30
|
#define SLOPE_CNT 20
|
||||||
|
|
||||||
|
#define STOP_TIME_MS 500
|
||||||
|
#define RUN_TIME_MS 10
|
||||||
|
|
||||||
|
#define BDC_STOP() Motor_Control(MOTOR_CMD_STOP)
|
||||||
|
#define BDC_UP() Motor_Control(MOTOR_CMD_FORWARD)
|
||||||
|
#define BDC_DOWN() Motor_Control(MOTOR_CMD_REVERSE)
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
int32_t Slope_VPT;
|
int32_t Slope_VPT;
|
||||||
@@ -66,6 +73,7 @@ typedef struct {
|
|||||||
uint32_t Read1mSDelayCnt;
|
uint32_t Read1mSDelayCnt;
|
||||||
uint32_t Uart1Delay1mSCnt;
|
uint32_t Uart1Delay1mSCnt;
|
||||||
uint32_t StopCollDelay1mSCnt;
|
uint32_t StopCollDelay1mSCnt;
|
||||||
|
uint32_t RunCollDelay1mSCnt;
|
||||||
uint32_t EvenRunDelay1mSCnt;
|
uint32_t EvenRunDelay1mSCnt;
|
||||||
uint8_t FeedDogDlyCnt;
|
uint8_t FeedDogDlyCnt;
|
||||||
|
|
||||||
|
|||||||
@@ -147,18 +147,19 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
|||||||
&& (App.LeftLowCS1237_SlopeArray[0] >= App.ADTrack.Slope_VPT)
|
&& (App.LeftLowCS1237_SlopeArray[0] >= App.ADTrack.Slope_VPT)
|
||||||
&& (App.LeftLowCS1237_SlopeArray[1] >= App.ADTrack.Slope_VPT)
|
&& (App.LeftLowCS1237_SlopeArray[1] >= App.ADTrack.Slope_VPT)
|
||||||
&& (App.LeftLowCS1237_SlopeArray[2] >= App.ADTrack.Slope_VPT))
|
&& (App.LeftLowCS1237_SlopeArray[2] >= App.ADTrack.Slope_VPT))
|
||||||
|| ((Olu_diff1 >= App.ADTrack.LeftUpVPT)
|
// || ((Olu_diff1 >= App.ADTrack.LeftUpVPT)
|
||||||
&& (Olu_diff2 >= App.ADTrack.LeftUpVPT)
|
// && (Olu_diff2 >= App.ADTrack.LeftUpVPT)
|
||||||
&& (Olu_diff3 >= App.ADTrack.LeftUpVPT)
|
// && (Olu_diff3 >= App.ADTrack.LeftUpVPT)
|
||||||
&& (Oll_diff1 <= -App.ADTrack.LeftLowVPT)
|
// && (Oll_diff1 <= -App.ADTrack.LeftLowVPT)
|
||||||
&& (Oll_diff2 <= -App.ADTrack.LeftLowVPT)
|
// && (Oll_diff2 <= -App.ADTrack.LeftLowVPT)
|
||||||
&& (Oll_diff3 <= -App.ADTrack.LeftLowVPT)))
|
// && (Oll_diff3 <= -App.ADTrack.LeftLowVPT))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
//BDC_UP();
|
BDC_UP();
|
||||||
Motor_Control(MOTOR_CMD_FORWARD);
|
|
||||||
App.UpFlag = true;
|
App.UpFlag = true;
|
||||||
App.StopFlag = false;
|
App.StopFlag = false;
|
||||||
App.DownFlag = false;
|
App.DownFlag = false;
|
||||||
|
App.RunCollDelay1mSCnt = RUN_TIME_MS;
|
||||||
}
|
}
|
||||||
else if(((App.LeftUpCS1237_SlopeArray[0] >= App.ADTrack.Slope_VPT)
|
else if(((App.LeftUpCS1237_SlopeArray[0] >= App.ADTrack.Slope_VPT)
|
||||||
&& (App.LeftUpCS1237_SlopeArray[1] >= App.ADTrack.Slope_VPT)
|
&& (App.LeftUpCS1237_SlopeArray[1] >= App.ADTrack.Slope_VPT)
|
||||||
@@ -166,18 +167,19 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
|||||||
&& (App.LeftLowCS1237_SlopeArray[0] <= -App.ADTrack.Slope_VPT)
|
&& (App.LeftLowCS1237_SlopeArray[0] <= -App.ADTrack.Slope_VPT)
|
||||||
&& (App.LeftLowCS1237_SlopeArray[1] <= -App.ADTrack.Slope_VPT)
|
&& (App.LeftLowCS1237_SlopeArray[1] <= -App.ADTrack.Slope_VPT)
|
||||||
&& (App.LeftLowCS1237_SlopeArray[2] <= -App.ADTrack.Slope_VPT))
|
&& (App.LeftLowCS1237_SlopeArray[2] <= -App.ADTrack.Slope_VPT))
|
||||||
|| ((Olu_diff1 <= -App.ADTrack.LeftUpVPT)
|
// || ((Olu_diff1 <= -App.ADTrack.LeftUpVPT)
|
||||||
&& (Olu_diff1 <= -App.ADTrack.LeftUpVPT)
|
// && (Olu_diff1 <= -App.ADTrack.LeftUpVPT)
|
||||||
&& (Olu_diff1 <= -App.ADTrack.LeftUpVPT)
|
// && (Olu_diff1 <= -App.ADTrack.LeftUpVPT)
|
||||||
&& (Oll_diff1 >= App.ADTrack.LeftLowVPT)
|
// && (Oll_diff1 >= App.ADTrack.LeftLowVPT)
|
||||||
&& (Oll_diff1 >= App.ADTrack.LeftLowVPT)
|
// && (Oll_diff1 >= App.ADTrack.LeftLowVPT)
|
||||||
&& (Oll_diff1 >= App.ADTrack.LeftLowVPT)))
|
// && (Oll_diff1 >= App.ADTrack.LeftLowVPT))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
//BDC_DOWN();
|
BDC_DOWN();
|
||||||
Motor_Control(MOTOR_CMD_REVERSE);
|
|
||||||
App.DownFlag = true;
|
App.DownFlag = true;
|
||||||
App.StopFlag = false;
|
App.StopFlag = false;
|
||||||
App.UpFlag = false;
|
App.UpFlag = false;
|
||||||
|
App.RunCollDelay1mSCnt = RUN_TIME_MS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(LeftSlopeSum < RightSlopeSum && LeftDiffSum < RightDiffSum)
|
else if(LeftSlopeSum < RightSlopeSum && LeftDiffSum < RightDiffSum)
|
||||||
@@ -189,18 +191,19 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
|||||||
&& (App.RightLowCS1237_SlopeArray[0] >= App.ADTrack.Slope_VPT)
|
&& (App.RightLowCS1237_SlopeArray[0] >= App.ADTrack.Slope_VPT)
|
||||||
&& (App.RightLowCS1237_SlopeArray[1] >= App.ADTrack.Slope_VPT)
|
&& (App.RightLowCS1237_SlopeArray[1] >= App.ADTrack.Slope_VPT)
|
||||||
&& (App.RightLowCS1237_SlopeArray[2] >= App.ADTrack.Slope_VPT))
|
&& (App.RightLowCS1237_SlopeArray[2] >= App.ADTrack.Slope_VPT))
|
||||||
|| ((Oru_diff1 >= App.ADTrack.RightUpVPT)
|
// || ((Oru_diff1 >= App.ADTrack.RightUpVPT)
|
||||||
&& (Oru_diff2 >= App.ADTrack.RightUpVPT)
|
// && (Oru_diff2 >= App.ADTrack.RightUpVPT)
|
||||||
&& (Oru_diff3 >= App.ADTrack.RightUpVPT)
|
// && (Oru_diff3 >= App.ADTrack.RightUpVPT)
|
||||||
&& (Orl_diff1 <= -App.ADTrack.RightLowVPT)
|
// && (Orl_diff1 <= -App.ADTrack.RightLowVPT)
|
||||||
&& (Orl_diff2 <= -App.ADTrack.RightLowVPT)
|
// && (Orl_diff2 <= -App.ADTrack.RightLowVPT)
|
||||||
&& (Orl_diff3 <= -App.ADTrack.RightLowVPT)))
|
// && (Orl_diff3 <= -App.ADTrack.RightLowVPT))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
//BDC_UP();
|
BDC_UP();
|
||||||
Motor_Control(MOTOR_CMD_FORWARD);
|
|
||||||
App.UpFlag = true;
|
App.UpFlag = true;
|
||||||
App.StopFlag = false;
|
App.StopFlag = false;
|
||||||
App.DownFlag = false;
|
App.DownFlag = false;
|
||||||
|
App.RunCollDelay1mSCnt = RUN_TIME_MS;
|
||||||
}
|
}
|
||||||
else if(((App.RightUpCS1237_SlopeArray[0] >= App.ADTrack.Slope_VPT)
|
else if(((App.RightUpCS1237_SlopeArray[0] >= App.ADTrack.Slope_VPT)
|
||||||
&& (App.RightUpCS1237_SlopeArray[1] >= App.ADTrack.Slope_VPT)
|
&& (App.RightUpCS1237_SlopeArray[1] >= App.ADTrack.Slope_VPT)
|
||||||
@@ -208,117 +211,120 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
|||||||
&& (App.RightLowCS1237_SlopeArray[0] <= -App.ADTrack.Slope_VPT)
|
&& (App.RightLowCS1237_SlopeArray[0] <= -App.ADTrack.Slope_VPT)
|
||||||
&& (App.RightLowCS1237_SlopeArray[1] <= -App.ADTrack.Slope_VPT)
|
&& (App.RightLowCS1237_SlopeArray[1] <= -App.ADTrack.Slope_VPT)
|
||||||
&& (App.RightLowCS1237_SlopeArray[2] <= -App.ADTrack.Slope_VPT))
|
&& (App.RightLowCS1237_SlopeArray[2] <= -App.ADTrack.Slope_VPT))
|
||||||
|| ((Oru_diff1 <= -App.ADTrack.RightUpVPT)
|
// || ((Oru_diff1 <= -App.ADTrack.RightUpVPT)
|
||||||
&& (Oru_diff2 <= -App.ADTrack.RightUpVPT)
|
// && (Oru_diff2 <= -App.ADTrack.RightUpVPT)
|
||||||
&& (Oru_diff3 <= -App.ADTrack.RightUpVPT)
|
// && (Oru_diff3 <= -App.ADTrack.RightUpVPT)
|
||||||
&& (Orl_diff1 >= App.ADTrack.RightLowVPT)
|
// && (Orl_diff1 >= App.ADTrack.RightLowVPT)
|
||||||
&& (Orl_diff2 >= App.ADTrack.RightLowVPT)
|
// && (Orl_diff2 >= App.ADTrack.RightLowVPT)
|
||||||
&& (Orl_diff3 >= App.ADTrack.RightLowVPT)))
|
// && (Orl_diff3 >= App.ADTrack.RightLowVPT))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
//BDC_DOWN();
|
BDC_DOWN();
|
||||||
Motor_Control(MOTOR_CMD_REVERSE);
|
|
||||||
App.DownFlag = true;
|
App.DownFlag = true;
|
||||||
App.StopFlag = false;
|
App.StopFlag = false;
|
||||||
App.UpFlag = false;
|
App.UpFlag = false;
|
||||||
|
App.RunCollDelay1mSCnt = RUN_TIME_MS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(App.DownFlag == true)
|
else if(App.DownFlag == true)
|
||||||
|
{
|
||||||
|
if(App.RunCollDelay1mSCnt <= 0)
|
||||||
{
|
{
|
||||||
if(App.LeftRunFalg == true)
|
if(App.LeftRunFalg == true)
|
||||||
{
|
{
|
||||||
if(lu_slope < -App.ADTrack.Slope_VPT
|
if(lu_slope < -App.ADTrack.Slope_VPT
|
||||||
&& ll_slope > App.ADTrack.Slope_VPT)
|
&& ll_slope > App.ADTrack.Slope_VPT)
|
||||||
{
|
{
|
||||||
//BDC_STOP();
|
BDC_STOP();
|
||||||
Motor_Control(MOTOR_CMD_STOP);
|
|
||||||
App.StopFlag = true;
|
App.StopFlag = true;
|
||||||
App.DownFlag = false;
|
App.DownFlag = false;
|
||||||
App.UpFlag = false;
|
App.UpFlag = false;
|
||||||
App.StopCollDelay1mSCnt = 1000;
|
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||||
}
|
}
|
||||||
else if(Olu_diff1 > -(App.ADTrack.LeftUpVPT / 2)
|
else if(Olu_diff1 > -(App.ADTrack.LeftUpVPT / 2)
|
||||||
&& Oll_diff1 < (App.ADTrack.LeftLowVPT / 2))
|
&& Oll_diff1 < (App.ADTrack.LeftLowVPT / 2))
|
||||||
{
|
{
|
||||||
//BDC_STOP();
|
BDC_STOP();
|
||||||
Motor_Control(MOTOR_CMD_STOP);
|
|
||||||
App.StopFlag = true;
|
App.StopFlag = true;
|
||||||
App.DownFlag = false;
|
App.DownFlag = false;
|
||||||
App.UpFlag = false;
|
App.UpFlag = false;
|
||||||
App.StopCollDelay1mSCnt = 1000;
|
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(App.RightRunFalg == true)
|
else if(App.RightRunFalg == true)
|
||||||
{
|
{
|
||||||
if(ru_slope < -App.ADTrack.Slope_VPT
|
if(ru_slope < -App.ADTrack.Slope_VPT
|
||||||
&& rl_slope > App.ADTrack.Slope_VPT)
|
//&& rl_slope > App.ADTrack.Slope_VPT
|
||||||
|
)
|
||||||
{
|
{
|
||||||
//BDC_STOP();
|
BDC_STOP();
|
||||||
Motor_Control(MOTOR_CMD_STOP);
|
|
||||||
App.StopFlag = true;
|
App.StopFlag = true;
|
||||||
App.DownFlag = false;
|
App.DownFlag = false;
|
||||||
App.UpFlag = false;
|
App.UpFlag = false;
|
||||||
App.StopCollDelay1mSCnt = 1000;
|
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||||
}
|
}
|
||||||
else if(Oru_diff1 > -(App.ADTrack.RightUpVPT / 2)
|
// else if(Oru_diff1 > -(App.ADTrack.RightUpVPT / 2)
|
||||||
&& Orl_diff1 < (App.ADTrack.RightLowVPT / 2))
|
// //&& Orl_diff1 < (App.ADTrack.RightLowVPT / 2)
|
||||||
{
|
// )
|
||||||
//BDC_STOP();
|
// {
|
||||||
Motor_Control(MOTOR_CMD_STOP);
|
// BDC_STOP();
|
||||||
App.StopFlag = true;
|
// App.StopFlag = true;
|
||||||
App.DownFlag = false;
|
// App.DownFlag = false;
|
||||||
App.UpFlag = false;
|
// App.UpFlag = false;
|
||||||
App.StopCollDelay1mSCnt = 1000;
|
// App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(App.UpFlag == true)
|
else if(App.UpFlag == true)
|
||||||
|
{
|
||||||
|
if(App.RunCollDelay1mSCnt <= 0)
|
||||||
{
|
{
|
||||||
if(App.LeftRunFalg == true)
|
if(App.LeftRunFalg == true)
|
||||||
{
|
{
|
||||||
if(lu_slope > App.ADTrack.Slope_VPT
|
if(lu_slope > App.ADTrack.Slope_VPT
|
||||||
&& ll_slope < -App.ADTrack.Slope_VPT)
|
&& ll_slope < -App.ADTrack.Slope_VPT)
|
||||||
{
|
{
|
||||||
//BDC_STOP();
|
BDC_STOP();
|
||||||
Motor_Control(MOTOR_CMD_STOP);
|
|
||||||
App.StopFlag = true;
|
App.StopFlag = true;
|
||||||
App.DownFlag = false;
|
App.DownFlag = false;
|
||||||
App.UpFlag = false;
|
App.UpFlag = false;
|
||||||
App.StopCollDelay1mSCnt = 1000;
|
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||||
}
|
}
|
||||||
else if(Olu_diff1 < (App.ADTrack.LeftUpVPT / 2)
|
else if(Olu_diff1 < (App.ADTrack.LeftUpVPT / 2)
|
||||||
&& Oll_diff1 > -(App.ADTrack.LeftLowVPT / 2))
|
&& Oll_diff1 > -(App.ADTrack.LeftLowVPT / 2))
|
||||||
{
|
{
|
||||||
//BDC_STOP();
|
BDC_STOP();
|
||||||
Motor_Control(MOTOR_CMD_STOP);
|
|
||||||
App.StopFlag = true;
|
App.StopFlag = true;
|
||||||
App.DownFlag = false;
|
App.DownFlag = false;
|
||||||
App.UpFlag = false;
|
App.UpFlag = false;
|
||||||
App.StopCollDelay1mSCnt = 1000;
|
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(App.RightRunFalg == true)
|
else if(App.RightRunFalg == true)
|
||||||
{
|
{
|
||||||
if(ru_slope > App.ADTrack.Slope_VPT
|
if(ru_slope > App.ADTrack.Slope_VPT
|
||||||
&& rl_slope < -App.ADTrack.Slope_VPT)
|
//&& rl_slope < -App.ADTrack.Slope_VPT
|
||||||
|
)
|
||||||
{
|
{
|
||||||
//BDC_STOP();
|
BDC_STOP();
|
||||||
Motor_Control(MOTOR_CMD_STOP);
|
|
||||||
App.StopFlag = true;
|
App.StopFlag = true;
|
||||||
App.DownFlag = false;
|
App.DownFlag = false;
|
||||||
App.UpFlag = false;
|
App.UpFlag = false;
|
||||||
App.StopCollDelay1mSCnt = 1000;
|
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||||
}
|
}
|
||||||
else if(Oru_diff1 < (App.ADTrack.RightUpVPT / 2)
|
// else if(Oru_diff1 < (App.ADTrack.RightUpVPT / 2)
|
||||||
&& Orl_diff1 > -(App.ADTrack.RightLowVPT / 2))
|
// && Orl_diff1 > -(App.ADTrack.RightLowVPT / 2)
|
||||||
{
|
// )
|
||||||
//BDC_STOP();
|
// {
|
||||||
Motor_Control(MOTOR_CMD_STOP);
|
// BDC_STOP();
|
||||||
App.StopFlag = true;
|
// App.StopFlag = true;
|
||||||
App.DownFlag = false;
|
// App.DownFlag = false;
|
||||||
App.UpFlag = false;
|
// App.UpFlag = false;
|
||||||
App.StopCollDelay1mSCnt = 1000;
|
// App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -528,11 +534,11 @@ static void AppLoopHandler(void)
|
|||||||
App.StopFlag = true;
|
App.StopFlag = true;
|
||||||
App.EvenRunning = false;
|
App.EvenRunning = false;
|
||||||
|
|
||||||
App.ADTrack.Slope_VPT = 1000;
|
App.ADTrack.Slope_VPT = 1500;
|
||||||
App.ADTrack.LeftUpVPT = 20000;
|
App.ADTrack.LeftUpVPT = 10000;
|
||||||
App.ADTrack.LeftLowVPT = 20000;
|
App.ADTrack.LeftLowVPT = 10000;
|
||||||
App.ADTrack.RightUpVPT = 20000;
|
App.ADTrack.RightUpVPT = 10000;
|
||||||
App.ADTrack.RightLowVPT = 20000;
|
App.ADTrack.RightLowVPT = 10000;
|
||||||
|
|
||||||
App.ADTrack.LeftUp_Org_AdZero = App.LeftUpCS1237_TrendArray[0];
|
App.ADTrack.LeftUp_Org_AdZero = App.LeftUpCS1237_TrendArray[0];
|
||||||
App.ADTrack.LeftLow_Org_AdZero = App.LeftLowCS1237_TrendArray[0];
|
App.ADTrack.LeftLow_Org_AdZero = App.LeftLowCS1237_TrendArray[0];
|
||||||
@@ -558,6 +564,8 @@ static void App1mSRoutine(void)
|
|||||||
App.Uart1Delay1mSCnt--;
|
App.Uart1Delay1mSCnt--;
|
||||||
if(App.StopCollDelay1mSCnt > 0)
|
if(App.StopCollDelay1mSCnt > 0)
|
||||||
App.StopCollDelay1mSCnt--;
|
App.StopCollDelay1mSCnt--;
|
||||||
|
if(App.RunCollDelay1mSCnt > 0)
|
||||||
|
App.RunCollDelay1mSCnt--;
|
||||||
|
|
||||||
if(App.EvenRunning == true)
|
if(App.EvenRunning == true)
|
||||||
App.EvenRunDelay1mSCnt++;
|
App.EvenRunDelay1mSCnt++;
|
||||||
|
|||||||
Reference in New Issue
Block a user