下班备份
This commit is contained in:
@@ -9,10 +9,10 @@
|
||||
|
||||
|
||||
#define OSC_CNT 40
|
||||
#define SLOPE_CNT 40
|
||||
#define SLOPE_CNT 20
|
||||
|
||||
#define STOP_TIME_MS 500
|
||||
#define RUN_TIME_MS 0
|
||||
#define RUN_TIME_MS 200
|
||||
|
||||
#define BDC_STOP() Motor_Control(MOTOR_CMD_STOP)
|
||||
#define BDC_UP() Motor_Control(MOTOR_CMD_FORWARD)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#define MAIN_DBG_LOG(...) DBG_LOG(__VA_ARGS__)
|
||||
#define MAIN_DBG_ARRAY(ARRAY, SIZE) DBG_ARRAY(ARRAY,SIZE)
|
||||
|
||||
#define SOFTWARE_VERSION 10 //软件版本
|
||||
#define SOFTWARE_VERSION 11 //软件版本
|
||||
#define HARDWARE_VERSION 20 //硬件版本
|
||||
|
||||
AppDetect_t App;
|
||||
@@ -78,31 +78,63 @@ void GradeControl(ControlLevel_m level)
|
||||
{
|
||||
switch(level){
|
||||
case LEVEL_1:{
|
||||
|
||||
App.ADTrack.Slope_VPT = 500;
|
||||
App.ADTrack.LeftUpVPT = 10000;
|
||||
App.ADTrack.LeftLowVPT = 10000;
|
||||
App.ADTrack.RightUpVPT = 10000;
|
||||
App.ADTrack.RightLowVPT = 10000;
|
||||
App.ADTrack.LeftUpShieldVPT = 4000;
|
||||
App.ADTrack.LeftLowShieldVPT = 4000;
|
||||
App.ADTrack.RightUpShieldVPT = 4000;
|
||||
App.ADTrack.RightLowShieldVPT = 4000;
|
||||
break;}
|
||||
|
||||
case LEVEL_2:{
|
||||
|
||||
App.ADTrack.Slope_VPT = 500;
|
||||
App.ADTrack.LeftUpVPT = 20000;
|
||||
App.ADTrack.LeftLowVPT = 20000;
|
||||
App.ADTrack.RightUpVPT = 20000;
|
||||
App.ADTrack.RightLowVPT = 20000;
|
||||
App.ADTrack.LeftUpShieldVPT = 4000;
|
||||
App.ADTrack.LeftLowShieldVPT = 4000;
|
||||
App.ADTrack.RightUpShieldVPT = 4000;
|
||||
App.ADTrack.RightLowShieldVPT = 4000;
|
||||
break;}
|
||||
|
||||
case LEVEL_3:{
|
||||
App.ADTrack.Slope_VPT = 2000;
|
||||
App.ADTrack.Slope_VPT = 500;
|
||||
App.ADTrack.LeftUpVPT = 30000;
|
||||
App.ADTrack.LeftLowVPT = 30000;
|
||||
App.ADTrack.RightUpVPT = 30000;
|
||||
App.ADTrack.RightLowVPT = 30000;
|
||||
App.ADTrack.LeftUpShieldVPT = 4000;
|
||||
App.ADTrack.LeftLowShieldVPT = 4000;
|
||||
App.ADTrack.RightUpShieldVPT = 4000;
|
||||
App.ADTrack.RightLowShieldVPT = 4000;
|
||||
break;}
|
||||
|
||||
case LEVEL_4:{
|
||||
App.ADTrack.Slope_VPT = 500;
|
||||
App.ADTrack.LeftUpVPT = 40000;
|
||||
App.ADTrack.LeftLowVPT = 40000;
|
||||
App.ADTrack.RightUpVPT = 40000;
|
||||
App.ADTrack.RightLowVPT = 40000;
|
||||
App.ADTrack.LeftUpShieldVPT = 10000;
|
||||
App.ADTrack.LeftLowShieldVPT = 10000;
|
||||
App.ADTrack.RightUpShieldVPT = 10000;
|
||||
App.ADTrack.RightLowShieldVPT = 10000;
|
||||
break;}
|
||||
|
||||
case LEVEL_4:{
|
||||
|
||||
App.ADTrack.LeftUpShieldVPT = 4000;
|
||||
App.ADTrack.LeftLowShieldVPT = 4000;
|
||||
App.ADTrack.RightUpShieldVPT = 4000;
|
||||
App.ADTrack.RightLowShieldVPT = 4000;
|
||||
break;}
|
||||
|
||||
case LEVEL_5:{
|
||||
|
||||
App.ADTrack.Slope_VPT = 500;
|
||||
App.ADTrack.LeftUpVPT = 50000;
|
||||
App.ADTrack.LeftLowVPT = 50000;
|
||||
App.ADTrack.RightUpVPT = 50000;
|
||||
App.ADTrack.RightLowVPT = 50000;
|
||||
App.ADTrack.LeftUpShieldVPT = 4000;
|
||||
App.ADTrack.LeftLowShieldVPT = 4000;
|
||||
App.ADTrack.RightUpShieldVPT = 4000;
|
||||
App.ADTrack.RightLowShieldVPT = 4000;
|
||||
break;}
|
||||
}
|
||||
}
|
||||
@@ -143,7 +175,11 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
int32_t ll_slope = result_ll.slope;
|
||||
int32_t ru_slope = result_ru.slope;
|
||||
int32_t rl_slope = result_rl.slope;
|
||||
//show(A2_slope);
|
||||
// show(1, lu_slope);
|
||||
// show(2, ll_slope);
|
||||
// show(3, ru_slope);
|
||||
// show(4, rl_slope);
|
||||
|
||||
|
||||
for(int i = SLOPE_CNT-1; i > 0; i--)
|
||||
{
|
||||
@@ -278,12 +314,11 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
}
|
||||
else if(App.DownFlag == true)
|
||||
{
|
||||
if(App.RunCollDelay1mSCnt <= 0)
|
||||
{
|
||||
if(App.LeftRunFalg == true)
|
||||
{
|
||||
if(lu_slope < -App.ADTrack.Slope_VPT
|
||||
&& ll_slope > App.ADTrack.Slope_VPT)
|
||||
&& ll_slope > App.ADTrack.Slope_VPT
|
||||
&& App.RunCollDelay1mSCnt <= 0)
|
||||
{
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
@@ -305,7 +340,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
{
|
||||
if(ru_slope < -App.ADTrack.Slope_VPT
|
||||
&& rl_slope > App.ADTrack.Slope_VPT
|
||||
)
|
||||
&& App.RunCollDelay1mSCnt <= 0)
|
||||
{
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
@@ -324,54 +359,51 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(App.UpFlag == true)
|
||||
{
|
||||
if(App.RunCollDelay1mSCnt <= 0)
|
||||
if(App.LeftRunFalg == true)
|
||||
{
|
||||
if(App.LeftRunFalg == true)
|
||||
if(lu_slope > App.ADTrack.Slope_VPT
|
||||
&& ll_slope < -App.ADTrack.Slope_VPT
|
||||
&& App.RunCollDelay1mSCnt <= 0)
|
||||
{
|
||||
if(lu_slope > App.ADTrack.Slope_VPT
|
||||
&& ll_slope < -App.ADTrack.Slope_VPT)
|
||||
{
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
App.DownFlag = false;
|
||||
App.UpFlag = false;
|
||||
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||
}
|
||||
else if(Olu_diff1 < (App.ADTrack.LeftUpVPT / 2)
|
||||
&& Oll_diff1 > -(App.ADTrack.LeftLowVPT / 2))
|
||||
{
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
App.DownFlag = false;
|
||||
App.UpFlag = false;
|
||||
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||
}
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
App.DownFlag = false;
|
||||
App.UpFlag = false;
|
||||
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||
}
|
||||
else if(App.RightRunFalg == true)
|
||||
else if(Olu_diff1 < (App.ADTrack.LeftUpVPT / 2)
|
||||
&& Oll_diff1 > -(App.ADTrack.LeftLowVPT / 2))
|
||||
{
|
||||
if(ru_slope > App.ADTrack.Slope_VPT
|
||||
&& rl_slope < -App.ADTrack.Slope_VPT
|
||||
)
|
||||
{
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
App.DownFlag = false;
|
||||
App.UpFlag = false;
|
||||
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||
}
|
||||
else if(Oru_diff1 < (App.ADTrack.RightUpVPT / 2)
|
||||
&& Orl_diff1 > -(App.ADTrack.RightLowVPT / 2)
|
||||
)
|
||||
{
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
App.DownFlag = false;
|
||||
App.UpFlag = false;
|
||||
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||
}
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
App.DownFlag = false;
|
||||
App.UpFlag = false;
|
||||
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||
}
|
||||
}
|
||||
else if(App.RightRunFalg == true)
|
||||
{
|
||||
if(ru_slope > App.ADTrack.Slope_VPT
|
||||
&& rl_slope < -App.ADTrack.Slope_VPT
|
||||
&& App.RunCollDelay1mSCnt <= 0)
|
||||
{
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
App.DownFlag = false;
|
||||
App.UpFlag = false;
|
||||
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||
}
|
||||
else if(Oru_diff1 < (App.ADTrack.RightUpVPT / 2)
|
||||
&& Orl_diff1 > -(App.ADTrack.RightLowVPT / 2)
|
||||
)
|
||||
{
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
App.DownFlag = false;
|
||||
App.UpFlag = false;
|
||||
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -644,9 +676,7 @@ int main(void)
|
||||
#if(USE_WDT == 1)
|
||||
FeedDogHandler();
|
||||
#endif
|
||||
#if(USE_DEBUG == 1)
|
||||
DebugLoopHandler();
|
||||
#endif
|
||||
#if(USE_CS1237_LEFTUP == 1)
|
||||
LEFTUP_CS1237DataLoopCollect();
|
||||
#endif
|
||||
@@ -676,20 +706,10 @@ void SysTick_IrqHandler(void)
|
||||
SysTick_IncTick();
|
||||
App1mSRoutine();
|
||||
Dbg1msRoutine();
|
||||
|
||||
#if(USE_CS1237_LEFTUP == 1)
|
||||
LEFTUP_CS12371mSRoutine();
|
||||
#endif
|
||||
#if(USE_CS1237_LEFTLOW == 1)
|
||||
LEFTLOW_CS12371mSRoutine();
|
||||
#endif
|
||||
#if(USE_CS1237_RIGHTUP == 1)
|
||||
RIGHTUP_CS12371mSRoutine();
|
||||
#endif
|
||||
#if(USE_CS1237_RIGHTLOW == 1)
|
||||
RIGHTLOW_CS12371mSRoutine();
|
||||
#endif
|
||||
|
||||
Dcmotor1msRoutine();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user