1、修复了小概率采集到错误ad值的bug
2、优化了中间抬升下降的bug
This commit is contained in:
@@ -36,6 +36,10 @@ static void show(uint8_t ch,int32_t ad)
|
||||
}
|
||||
void LEFTUP_CS1237AinADataProcessCallBack(int32_t AD)
|
||||
{
|
||||
if(abs(AD - App.LeftUpCS1237_TrendArray[0]) > 2000000)
|
||||
{
|
||||
AD = App.LeftUpCS1237_TrendArray[0];
|
||||
}
|
||||
show(1,AD);
|
||||
for(int i = OSC_CNT-1; i > 0; i--)
|
||||
{
|
||||
@@ -46,6 +50,11 @@ void LEFTUP_CS1237AinADataProcessCallBack(int32_t AD)
|
||||
}
|
||||
void LEFTLOW_CS1237AinADataProcessCallBack(int32_t AD)
|
||||
{
|
||||
|
||||
if(abs(AD - App.LeftLowCS1237_TrendArray[0]) > 2000000)
|
||||
{
|
||||
AD = App.LeftLowCS1237_TrendArray[0];
|
||||
}
|
||||
show(2,AD);
|
||||
for(int i = OSC_CNT-1; i > 0; i--)
|
||||
{
|
||||
@@ -56,6 +65,10 @@ void LEFTLOW_CS1237AinADataProcessCallBack(int32_t AD)
|
||||
}
|
||||
void RIGHTUP_CS1237AinADataProcessCallBack(int32_t AD)
|
||||
{
|
||||
if(abs(AD - App.RightUpCS1237_TrendArray[0]) > 2000000)
|
||||
{
|
||||
AD = App.RightUpCS1237_TrendArray[0];
|
||||
}
|
||||
show(3,AD);
|
||||
for(int i = OSC_CNT-1; i > 0; i--)
|
||||
{
|
||||
@@ -66,6 +79,10 @@ void RIGHTUP_CS1237AinADataProcessCallBack(int32_t AD)
|
||||
}
|
||||
void RIGHTLOW_CS1237AinADataProcessCallBack(int32_t AD)
|
||||
{
|
||||
if(abs(AD - App.RightLowCS1237_TrendArray[0]) > 2000000)
|
||||
{
|
||||
AD = App.RightLowCS1237_TrendArray[0];
|
||||
}
|
||||
show(4,AD);
|
||||
for(int i = OSC_CNT-1; i > 0; i--)
|
||||
{
|
||||
@@ -250,7 +267,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
App.LeftRunFalg = true;
|
||||
// if((App.LeftLowCS1237_SlopeArray[0] > App.ADTrack.Slope_VPT/3))
|
||||
// {
|
||||
if((Oll_diff1+Orl_diff1) < -App.ADTrack.LeftLowVPT/3)
|
||||
if((Oll_diff1+Orl_diff1) < -(App.ADTrack.LeftLowVPT/(App.Para.Layout.ControlLevel+1)))
|
||||
{
|
||||
BDC_UP();
|
||||
App.UpFlag = true;
|
||||
@@ -263,7 +280,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
// }
|
||||
// else if((App.LeftLowCS1237_SlopeArray[0] < -App.ADTrack.Slope_VPT/3))
|
||||
// {
|
||||
if((Oll_diff1+Orl_diff1) > App.ADTrack.LeftLowVPT/3)
|
||||
if((Oll_diff1+Orl_diff1) > App.ADTrack.LeftLowVPT/(App.Para.Layout.ControlLevel+1))
|
||||
{
|
||||
BDC_DOWN();
|
||||
App.UpFlag = false;
|
||||
@@ -278,9 +295,9 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
else if(abs(Oll_diff1) < abs(Orl_diff1))
|
||||
{
|
||||
App.RightRunFalg = true;
|
||||
if((App.RightLowCS1237_SlopeArray[0] > App.ADTrack.Slope_VPT/3))
|
||||
{
|
||||
if((Oll_diff1+Orl_diff1) < -App.ADTrack.RightLowVPT/3)
|
||||
// if((App.RightLowCS1237_SlopeArray[0] > App.ADTrack.Slope_VPT/3))
|
||||
// {
|
||||
if((Oll_diff1+Orl_diff1) < -(App.ADTrack.RightLowVPT/(App.Para.Layout.ControlLevel+1)))
|
||||
{
|
||||
BDC_UP();
|
||||
App.UpFlag = true;
|
||||
@@ -290,10 +307,10 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
App.RunCollDelay1mSCnt = RUN_TIME_MS;
|
||||
//App.EmergencyDelay1mSCnt = EME_START_MS;
|
||||
}
|
||||
}
|
||||
else if((App.RightLowCS1237_SlopeArray[0] < -App.ADTrack.Slope_VPT/3))
|
||||
{
|
||||
if((Oll_diff1+Orl_diff1) > App.ADTrack.RightLowVPT/3)
|
||||
// }
|
||||
// else if((App.RightLowCS1237_SlopeArray[0] < -App.ADTrack.Slope_VPT/3))
|
||||
// {
|
||||
if((Oll_diff1+Orl_diff1) > App.ADTrack.RightLowVPT/(App.Para.Layout.ControlLevel+1))
|
||||
{
|
||||
BDC_DOWN();
|
||||
App.UpFlag = false;
|
||||
@@ -303,7 +320,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
App.RunCollDelay1mSCnt = RUN_TIME_MS;
|
||||
//App.EmergencyDelay1mSCnt = EME_START_MS;
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
else if((LeftSlopeSum > RightSlopeSum && LeftDiffSum > RightDiffSum))
|
||||
@@ -448,7 +465,10 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||
App.EmergencyDelay1mSCnt = EME_START_MS;
|
||||
}
|
||||
else if((LeftLowDiff + EME_STOP_VPT) < RightLowDiff && App.EmergencyDelay1mSCnt <= 0 && App.CentreRunFalg == false)
|
||||
else if((abs(Oll_diff1) + EME_STOP_VPT) < abs(Orl_diff1)
|
||||
&& (abs(Oll_diff2) + EME_STOP_VPT) < abs(Orl_diff2)
|
||||
&& (abs(Oll_diff3) + EME_STOP_VPT) < abs(Orl_diff3)
|
||||
&& App.EmergencyDelay1mSCnt <= 0 && App.CentreRunFalg == false)
|
||||
{
|
||||
BDC_STOP();
|
||||
App.EmeFlag = true;
|
||||
@@ -469,7 +489,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
App.EmergencyDelay1mSCnt = EME_START_MS;
|
||||
}
|
||||
else if(((App.CentreRunFalg == false ) && (Orl_diff1 < App.ADTrack.Stop_VPT))
|
||||
|| ((App.CentreRunFalg == true) && ((Oll_diff1 + Orl_diff1) < (-App.ADTrack.Stop_VPT))))
|
||||
|| ((App.CentreRunFalg == true) && ((Oll_diff1 + Orl_diff1) < (App.ADTrack.Stop_VPT))))
|
||||
{
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
@@ -479,7 +499,10 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||
App.EmergencyDelay1mSCnt = EME_START_MS;
|
||||
}
|
||||
else if(LeftLowDiff > (RightLowDiff + EME_STOP_VPT) && App.EmergencyDelay1mSCnt <= 0 && App.CentreRunFalg == false)
|
||||
else if(abs(Oll_diff1) > (abs(Orl_diff1) + EME_STOP_VPT)
|
||||
&& abs(Oll_diff2) > (abs(Orl_diff2) + EME_STOP_VPT)
|
||||
&& abs(Oll_diff3) > (abs(Orl_diff3) + EME_STOP_VPT)
|
||||
&& App.EmergencyDelay1mSCnt <= 0 && App.CentreRunFalg == false)
|
||||
{
|
||||
BDC_STOP();
|
||||
App.EmeFlag = true;
|
||||
@@ -492,7 +515,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
if(App.LeftRunFalg == true)
|
||||
{
|
||||
if(((App.CentreRunFalg == false ) && (ll_slope < -App.ADTrack.Slope_VPT))
|
||||
|| ((App.CentreRunFalg == true ) && (App.LeftUpCS1237_SlopeArray[0] + App.RightUpCS1237_SlopeArray[0]) > -App.ADTrack.Slope_VPT))
|
||||
|| ((App.CentreRunFalg == true ) && (App.LeftUpCS1237_SlopeArray[0] + App.RightUpCS1237_SlopeArray[0]) > App.ADTrack.Slope_VPT))
|
||||
{
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
@@ -503,7 +526,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
App.EmergencyDelay1mSCnt = EME_START_MS;
|
||||
}
|
||||
else if(((App.CentreRunFalg == false ) && (Oll_diff1 > -App.ADTrack.Stop_VPT))
|
||||
|| ((App.CentreRunFalg == true) && ((Oll_diff1 + Orl_diff1) > -(App.ADTrack.Stop_VPT))))
|
||||
|| ((App.CentreRunFalg == true) && ((Oll_diff1 + Orl_diff1) > -App.ADTrack.Stop_VPT)))
|
||||
{
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
@@ -513,7 +536,10 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||
App.EmergencyDelay1mSCnt = EME_START_MS;
|
||||
}
|
||||
else if((LeftLowDiff + EME_STOP_VPT) < RightLowDiff && App.EmergencyDelay1mSCnt <= 0 && App.CentreRunFalg == false)
|
||||
else if((abs(Oll_diff1) + EME_STOP_VPT) < abs(Orl_diff1)
|
||||
&& (abs(Oll_diff2) + EME_STOP_VPT) < abs(Orl_diff2)
|
||||
&& (abs(Oll_diff3) + EME_STOP_VPT) < abs(Orl_diff3)
|
||||
&& App.EmergencyDelay1mSCnt <= 0 && App.CentreRunFalg == false)
|
||||
{
|
||||
BDC_STOP();
|
||||
App.EmeFlag = true;
|
||||
@@ -544,7 +570,10 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
App.StopCollDelay1mSCnt = STOP_TIME_MS;
|
||||
App.EmergencyDelay1mSCnt = EME_START_MS;
|
||||
}
|
||||
else if(LeftLowDiff > (RightLowDiff + EME_STOP_VPT) && App.EmergencyDelay1mSCnt <= 0 && App.CentreRunFalg == false)
|
||||
else if(abs(Oll_diff1) > (abs(Orl_diff1) + EME_STOP_VPT)
|
||||
&& abs(Oll_diff2) > (abs(Orl_diff2) + EME_STOP_VPT)
|
||||
&& abs(Oll_diff3) > (abs(Orl_diff3) + EME_STOP_VPT)
|
||||
&& App.EmergencyDelay1mSCnt <= 0 && App.CentreRunFalg == false)
|
||||
{
|
||||
BDC_STOP();
|
||||
App.EmeFlag = true;
|
||||
|
||||
Reference in New Issue
Block a user