|
@@ -54,12 +54,14 @@ void lct_coordcal_init(LCT_COORDCAL_PARAM_T stLctCoordcalParam)
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-void lct_coordcal_main(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T *pstFirstPathList, uint8 *pbyPredictionFlag, COORD_T *pstPredictionCoord, LCT_MINIMUM_VALUE_GROUP_T *pstMinimumValueGroup, uint16 *pwMinmumValueNum)
|
|
|
+void lct_coordcal_main(PUB_LCT_BTS_LIST_T *pstLctBtsList, PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T *pstFirstPathList, uint8 *pbyPredictionFlag, COORD_T *pstPredictionCoord, LCT_MINIMUM_VALUE_GROUP_T *pstMinimumValueGroup, uint16 *pwMinmumValueNum)
|
|
|
{
|
|
|
LCT_FIRSTPATH_T *pstFirstPathDataList = pstFirstPathList->astFirstPath;
|
|
|
uint8 byFirstPathDataListLen = pstFirstPathList->byBtsNum;
|
|
@@ -76,18 +78,19 @@ void lct_coordcal_main(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T
|
|
|
uint8 byPredictionFlag = 0;
|
|
|
COORD_T stPredictionCoord = {0};
|
|
|
COORD_T stAheadPointCoord = {0};
|
|
|
+ uint8 byChangeXY = 0;
|
|
|
|
|
|
LCT_MINIMUM_VALUE_GROUP_T stMinmumValueGroup = {0};
|
|
|
uint16 wMinmumValueNum = 0;
|
|
|
|
|
|
-
|
|
|
- lct_coordcal_sel_valid_bts(pstLctDataList, pstFirstPathDataList, byFirstPathDataListLen, astValidCalPathBtsList, &byValidCalPathBtsListLen, astValidTrackPathBtsList, &byValidTrackPathBtsListLen, &dwBuildId, &dwLayerId);
|
|
|
+
|
|
|
+ lct_coordcal_select_valid_bts_by_fp_and_ampl(pstLctDataList, pstFirstPathDataList, byFirstPathDataListLen, astValidCalPathBtsList, &byValidCalPathBtsListLen, astValidTrackPathBtsList, &byValidTrackPathBtsListLen, &dwBuildId, &dwLayerId);
|
|
|
|
|
|
|
|
|
gLct_dwSpeedX = 0;
|
|
|
gLct_dwSpeedY = 0;
|
|
|
|
|
|
- lct_prediction_current_coord_by_history(dwBuildId, dwLayerId, &stPredictionCoord, &byPredictionFlag, &stAheadPointCoord, &gLct_dwSpeedX, &gLct_dwSpeedY);
|
|
|
+ lct_prediction_current_coord_by_history(dwBuildId, dwLayerId, &stPredictionCoord, &byPredictionFlag, &stAheadPointCoord, &gLct_dwSpeedX, &gLct_dwSpeedY, &byChangeXY);
|
|
|
|
|
|
|
|
|
|
|
@@ -97,8 +100,8 @@ void lct_coordcal_main(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ lct_prediction_prediction_phone_move_tendency(gLct_astPredictionDirectionDataList);
|
|
|
|
|
|
|
|
|
if (!byPredictionFlag)
|
|
@@ -111,9 +114,9 @@ void lct_coordcal_main(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T
|
|
|
|
|
|
|
|
|
|
|
|
- lct_coordcal_two_dimension_location(astValidCalPathBtsList, byValidCalPathBtsListLen, byPredictionFlag, stPredictionCoord, CAL_PATH, &stMinmumValueGroup);
|
|
|
+ lct_coordcal_two_dimension_location(pstLctBtsList, astValidCalPathBtsList, byValidCalPathBtsListLen, byPredictionFlag, stPredictionCoord, CAL_PATH, &stMinmumValueGroup);
|
|
|
|
|
|
- lct_coordcal_two_dimension_location(astValidTrackPathBtsList, byValidTrackPathBtsListLen, byPredictionFlag, stPredictionCoord, TRACK_PATH, &stMinmumValueGroup);
|
|
|
+ lct_coordcal_two_dimension_location(pstLctBtsList, astValidTrackPathBtsList, byValidTrackPathBtsListLen, byPredictionFlag, stPredictionCoord, TRACK_PATH, &stMinmumValueGroup);
|
|
|
}
|
|
|
|
|
|
else
|
|
@@ -127,7 +130,7 @@ void lct_coordcal_main(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T
|
|
|
|
|
|
gLct_byDirectionX = 0;
|
|
|
gLct_byDirectionY = 0;
|
|
|
- lct_coordcal_prediction_x_y_move_direction(pstFirstPathDataList, byFirstPathDataListLen, gLct_astPredictionDirectionDataList, &gLct_byDirectionX, &gLct_byDirectionY);
|
|
|
+ lct_coordcal_prediction_x_y_move_direction(pstFirstPathDataList, byFirstPathDataListLen, gLct_astPredictionDirectionDataList, &stAheadPointCoord, byChangeXY, &gLct_byDirectionX, &gLct_byDirectionY);
|
|
|
|
|
|
|
|
|
|
|
@@ -141,12 +144,14 @@ void lct_coordcal_main(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T
|
|
|
|
|
|
|
|
|
|
|
|
- lct_coordcal_two_dimension_location(astValidCalPathBtsList, byValidCalPathBtsListLen, byPredictionFlag, stPredictionCoord, 0, &stMinmumValueGroup);
|
|
|
+ lct_coordcal_check_valid_bts_by_move_direction(CAL_PATH, astValidCalPathBtsList, byValidCalPathBtsListLen, pstLctDataList, &stAheadPointCoord, byChangeXY, gLct_byDirectionX, gLct_byDirectionY, &byValidCalPathBtsListLen);
|
|
|
+ lct_coordcal_two_dimension_location(pstLctBtsList, astValidCalPathBtsList, byValidCalPathBtsListLen, byPredictionFlag, stPredictionCoord, 0, &stMinmumValueGroup);
|
|
|
|
|
|
- lct_coordcal_two_dimension_location(astValidTrackPathBtsList, byValidTrackPathBtsListLen, byPredictionFlag, stPredictionCoord, 1, &stMinmumValueGroup);
|
|
|
+ lct_coordcal_check_valid_bts_by_move_direction(TRACK_PATH, astValidTrackPathBtsList, byValidTrackPathBtsListLen, pstLctDataList, &stAheadPointCoord, byChangeXY, gLct_byDirectionX, gLct_byDirectionY, &byValidTrackPathBtsListLen);
|
|
|
+ lct_coordcal_two_dimension_location(pstLctBtsList, astValidTrackPathBtsList, byValidTrackPathBtsListLen, byPredictionFlag, stPredictionCoord, 1, &stMinmumValueGroup);
|
|
|
|
|
|
-
|
|
|
- lct_coordcal_two_dimension_check(&stMinmumValueGroup, &stPredictionCoord, &stAheadPointCoord, gLct_byDirectionX, gLct_byDirectionY);
|
|
|
+
|
|
|
+ lct_coordcal_two_dimension_check(&stMinmumValueGroup, &stPredictionCoord, &stAheadPointCoord, byChangeXY, gLct_byDirectionX, gLct_byDirectionY);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -167,13 +172,13 @@ void lct_coordcal_main(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-void lct_coordcal_sel_valid_bts(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_T *pstFirstPathList, uint8 byFirstPathListLen, LCT_FIRSTPATH_T *pstValidCalBtsList, uint8 *pbyValidCalBtsListLen, LCT_FIRSTPATH_T *pstValidTrackBtsList, uint8 *pbyValidTrackBtsListLen, int32 *pdwBulidId, int32 *pdwLayerId)
|
|
|
+void lct_coordcal_select_valid_bts_by_fp_and_ampl(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_T *pstFirstPathList, uint8 byFirstPathListLen, LCT_FIRSTPATH_T *pstValidCalBtsList, uint8 *pbyValidCalBtsListLen, LCT_FIRSTPATH_T *pstValidTrackBtsList, uint8 *pbyValidTrackBtsListLen, int32 *pdwBulidId, int32 *pdwLayerId)
|
|
|
{
|
|
|
LCT_FIRSTPATH_T stBtsFirstPath = {0};
|
|
|
LCT_FIRSTPATH_T *pststBtsFirstPath = NULL;
|
|
@@ -357,6 +362,311 @@ void lct_coordcal_sel_valid_bts(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPA
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+void lct_coordcal_check_valid_bts_by_move_direction(uint8 byFirstPathType, LCT_FIRSTPATH_T *pstValidBtsList, uint8 byValidBtsListLen, PUB_LOCATION_DATA_T *pstLctDataList, COORD_T *pstAheadCoord, uint8 byChangeXY, int8 byDirectionX, int8 byDirectionY, uint8 *pbyValidBtsListLen)
|
|
|
+{
|
|
|
+ LCT_FIRSTPATH_T *pstBtsFirstPath = NULL;
|
|
|
+ uint8 byFreqIndex = 0;
|
|
|
+ PUB_LOCATION_DATA_T *pstBtsLctData = NULL;
|
|
|
+ int32 dwGap = 0;
|
|
|
+
|
|
|
+ if (byDirectionX != 0 || byDirectionY != 0)
|
|
|
+ {
|
|
|
+ for (uint8 i = 0; i < byValidBtsListLen; i++)
|
|
|
+ {
|
|
|
+ pstBtsFirstPath = &pstValidBtsList[i];
|
|
|
+ byFreqIndex = pstBtsFirstPath->byFreqIndex;
|
|
|
+ pstBtsLctData = &pstLctDataList[byFreqIndex];
|
|
|
+
|
|
|
+
|
|
|
+ if (byChangeXY == 1)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (pstAheadCoord->dwX > pstBtsFirstPath->dwCoordX)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (byDirectionX == 1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (byDirectionX == -1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ if (byDirectionX == 1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (byDirectionX == -1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (byChangeXY == 2)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (pstAheadCoord->dwY > pstBtsFirstPath->dwCoordY)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (byDirectionY == 1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (byDirectionY == -1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ if (byDirectionY == 1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (byDirectionY == -1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ *pbyValidBtsListLen = byValidBtsListLen;
|
|
|
+
|
|
|
+ return;
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -458,7 +768,7 @@ void lct_coordcal_check_move_tendency(LCT_FIRSTPATH_T *pstFirstPathList, uint8 b
|
|
|
fDistancP = util_distance_cal_p2p_distance(pstFirstPathData->dwCoordX, pstFirstPathData->dwCoordY, pstPredictionCoord->dwX, pstPredictionCoord->dwY);
|
|
|
fDistancA = util_distance_cal_p2p_distance(pstFirstPathData->dwCoordX, pstFirstPathData->dwCoordY, pstAheadCoord->dwX, pstAheadCoord->dwY);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
if (fDistancP < fDistancA)
|
|
|
{
|
|
|
if (pstBtsDirectionData->byDirectionTendency != 1)
|
|
@@ -481,18 +791,363 @@ void lct_coordcal_check_move_tendency(LCT_FIRSTPATH_T *pstFirstPathList, uint8 b
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
-void lct_coordcal_prediction_x_y_move_direction(LCT_FIRSTPATH_T *pstFirstPathList, uint8 byFirstPathListLen, LCT_FIRSTPATH_PREDICTION_DIRECTION_DATA_T *pstPredictionDirectionDataList, int8 *pbyDirectionX, int8 *pbyDirectionY)
|
|
|
+void lct_coordcal_prediction_x_y_move_direction(LCT_FIRSTPATH_T *pstFirstPathList, uint8 byFirstPathListLen, LCT_FIRSTPATH_PREDICTION_DIRECTION_DATA_T *pstPredictionDirectionDataList, COORD_T *pstAheadCoord, uint8 byChangeXY, int8 *pbyDirectionX, int8 *pbyDirectionY)
|
|
|
{
|
|
|
- LCT_COORDSEL_MEAN_COORD_T *pstMeanLctCoordList = &gLct_stMeanLctCoordList;
|
|
|
- uint8 byListLen = pstMeanLctCoordList->byListLen;
|
|
|
- COORD_T stAheadCoord = {0};
|
|
|
-
|
|
|
LCT_FIRSTPATH_T *pstFirstPathData = NULL;
|
|
|
uint8 byFreqIndex = 0;
|
|
|
LCT_FIRSTPATH_PREDICTION_DIRECTION_DATA_T *pstCurrentBtsDirectionData = NULL;
|
|
@@ -501,306 +1156,297 @@ void lct_coordcal_prediction_x_y_move_direction(LCT_FIRSTPATH_T *pstFirstPathLis
|
|
|
uint8 byOtherFreqIndex = 0;
|
|
|
LCT_FIRSTPATH_PREDICTION_DIRECTION_DATA_T *pstOtherBtstDirectionData = NULL;
|
|
|
|
|
|
+
|
|
|
int32 dwCurrentX = 0;
|
|
|
int32 dwCurrentY = 0;
|
|
|
- uint32 dwCurrentIndex = 0;
|
|
|
-
|
|
|
+ int8 byMainDirectionX = 0;
|
|
|
+ int8 byMainDirectionY = 0;
|
|
|
+ uint8 byMainDirectionXCounter = 0;
|
|
|
+ uint8 byMainDirectionYCounter = 0;
|
|
|
+ uint8 byFirstPathIndexX = 0;
|
|
|
+ uint8 byFirstPathIndexY = 0;
|
|
|
+
|
|
|
+
|
|
|
int32 dwOtherX = 0;
|
|
|
int32 dwOtherY = 0;
|
|
|
- uint32 dwOtherIndex = 0;
|
|
|
-
|
|
|
- int8 byDirectionX = 0;
|
|
|
- int8 byDirectionY = 0;
|
|
|
-
|
|
|
-
|
|
|
- uint8 byCounterPlusX = 0;
|
|
|
- uint8 byCounterMinusX = 0;
|
|
|
- uint8 byCounterPlusY = 0;
|
|
|
- uint8 byCounterMinusY = 0;
|
|
|
-
|
|
|
-
|
|
|
- if (byListLen < 1)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- stAheadCoord = pstMeanLctCoordList->astCoordList[byListLen - 1];
|
|
|
|
|
|
|
|
|
for (uint8 i = 0; i < byFirstPathListLen; i++)
|
|
|
{
|
|
|
- pstFirstPathData = &pstFirstPathList[i];
|
|
|
+ pstFirstPathData = &pstFirstPathList[i];
|
|
|
byFreqIndex = pstFirstPathData->byFreqIndex;
|
|
|
|
|
|
|
|
|
pstCurrentBtsDirectionData = &pstPredictionDirectionDataList[byFreqIndex];
|
|
|
+ pstCurrentBtsDirectionData->byDirectionX = 0;
|
|
|
+ pstCurrentBtsDirectionData->byDirectionY = 0;
|
|
|
+ pstCurrentBtsDirectionData->byDirectionXCounter = 0;
|
|
|
+ pstCurrentBtsDirectionData->byDirectionYCounter = 0;
|
|
|
dwCurrentX = pstCurrentBtsDirectionData->dwCoordX;
|
|
|
dwCurrentY = pstCurrentBtsDirectionData->dwCoordY;
|
|
|
- dwCurrentIndex = pstCurrentBtsDirectionData->dwCalPathIndex;
|
|
|
|
|
|
|
|
|
if (pstCurrentBtsDirectionData->byValidFlag == 1)
|
|
|
{
|
|
|
- for (uint8 j = i + 1; j < byFirstPathListLen; j++)
|
|
|
- {
|
|
|
-
|
|
|
- pstOtherFirstPathData = &pstFirstPathList[j];
|
|
|
- byOtherFreqIndex = pstOtherFirstPathData->byFreqIndex;
|
|
|
- pstOtherBtstDirectionData = &pstPredictionDirectionDataList[byOtherFreqIndex];
|
|
|
+
|
|
|
+ lct_coordcal_cal_bts_move_direction(pstCurrentBtsDirectionData->byDirectionTendency, dwCurrentX, dwCurrentY, pstAheadCoord, &byMainDirectionX, &byMainDirectionY);
|
|
|
|
|
|
-
|
|
|
- if (pstOtherBtstDirectionData->byValidFlag == 1)
|
|
|
+
|
|
|
+ for (uint8 j = 0; j < byFirstPathListLen; j++)
|
|
|
+ {
|
|
|
+ if (i != j)
|
|
|
{
|
|
|
- dwOtherX = pstOtherBtstDirectionData->dwCoordX;
|
|
|
- dwOtherY = pstOtherBtstDirectionData->dwCoordY;
|
|
|
- dwOtherIndex = pstOtherBtstDirectionData->dwCalPathIndex;
|
|
|
+
|
|
|
+ pstOtherFirstPathData = &pstFirstPathList[j];
|
|
|
+ byOtherFreqIndex = pstOtherFirstPathData->byFreqIndex;
|
|
|
+ pstOtherBtstDirectionData = &pstPredictionDirectionDataList[byOtherFreqIndex];
|
|
|
|
|
|
-
|
|
|
- if (pstCurrentBtsDirectionData->byDirectionTendency == 1)
|
|
|
+
|
|
|
+ if (pstOtherBtstDirectionData->byValidFlag == 1)
|
|
|
{
|
|
|
-
|
|
|
- if (pstOtherBtstDirectionData->byDirectionTendency == 1)
|
|
|
+ dwOtherX = pstOtherBtstDirectionData->dwCoordX;
|
|
|
+ dwOtherY = pstOtherBtstDirectionData->dwCoordY;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (byMainDirectionX == 1)
|
|
|
{
|
|
|
-
|
|
|
- if (dwOtherX > dwCurrentX)
|
|
|
+
|
|
|
+ if (pstOtherBtstDirectionData->byDirectionTendency == 1)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
- {
|
|
|
- byCounterPlusX++;
|
|
|
- }
|
|
|
- else
|
|
|
+
|
|
|
+ if ((dwOtherX > dwCurrentX && pstAheadCoord->dwX < dwOtherX) || (dwOtherX <= dwCurrentX && pstAheadCoord->dwX < dwOtherX))
|
|
|
{
|
|
|
- byCounterMinusX++;
|
|
|
+ byMainDirectionXCounter++;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- else if (dwOtherX < dwCurrentX)
|
|
|
+
|
|
|
+ else if (pstOtherBtstDirectionData->byDirectionTendency == 2)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
- {
|
|
|
- byCounterMinusX++;
|
|
|
- }
|
|
|
- else
|
|
|
+
|
|
|
+ if ((dwOtherX < dwCurrentX && pstAheadCoord->dwX >= dwOtherX) || (dwOtherX >= dwCurrentX && pstAheadCoord->dwX >= dwOtherX))
|
|
|
{
|
|
|
- byCounterPlusX++;
|
|
|
+ byMainDirectionXCounter++;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- if (dwOtherY > dwCurrentY)
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (byMainDirectionX == -1)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (pstOtherBtstDirectionData->byDirectionTendency == 1)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
- {
|
|
|
- byCounterPlusY++;
|
|
|
- }
|
|
|
- else
|
|
|
+
|
|
|
+ if ((dwOtherX < dwCurrentX && pstAheadCoord->dwX > dwOtherX) || (dwOtherX >= dwCurrentX && pstAheadCoord->dwX > dwOtherX))
|
|
|
{
|
|
|
- byCounterMinusY++;
|
|
|
+ byMainDirectionXCounter++;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- else if (dwOtherY < dwCurrentY)
|
|
|
+
|
|
|
+ else if (pstOtherBtstDirectionData->byDirectionTendency == 2)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
+
|
|
|
+ if ((dwOtherX >= dwCurrentX && pstAheadCoord->dwX <= dwOtherX) || (dwOtherX <= dwCurrentX && pstAheadCoord->dwX <= dwOtherX))
|
|
|
{
|
|
|
- byCounterMinusY++;
|
|
|
+ byMainDirectionXCounter++;
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- byCounterPlusY++;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- else
|
|
|
- {
|
|
|
- byDirectionY = 0;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- else if (pstOtherBtstDirectionData->byDirectionTendency == 2)
|
|
|
- {
|
|
|
-
|
|
|
- if (dwOtherX > dwCurrentX)
|
|
|
- {
|
|
|
- byCounterMinusX++;
|
|
|
- }
|
|
|
-
|
|
|
- else if (dwOtherX < dwCurrentX)
|
|
|
- {
|
|
|
- byDirectionX = 1;
|
|
|
- }
|
|
|
-
|
|
|
- else
|
|
|
- {
|
|
|
- byDirectionX = 0;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if (dwOtherY > dwCurrentY)
|
|
|
- {
|
|
|
- byCounterMinusY++;
|
|
|
- }
|
|
|
-
|
|
|
- else if (dwOtherY < dwCurrentY)
|
|
|
- {
|
|
|
- byCounterPlusY++;
|
|
|
- }
|
|
|
-
|
|
|
- else
|
|
|
- {
|
|
|
- byDirectionY = 0;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- else if (pstCurrentBtsDirectionData->byDirectionTendency == 2)
|
|
|
- {
|
|
|
-
|
|
|
- if (pstOtherBtstDirectionData->byDirectionTendency == 1)
|
|
|
- {
|
|
|
-
|
|
|
- if (dwOtherX > dwCurrentX)
|
|
|
- {
|
|
|
- byCounterPlusX++;
|
|
|
- }
|
|
|
-
|
|
|
- else if (dwOtherX < dwCurrentX)
|
|
|
- {
|
|
|
- byCounterMinusX++;
|
|
|
- }
|
|
|
-
|
|
|
- else
|
|
|
- {
|
|
|
- byDirectionX = 0;
|
|
|
- }
|
|
|
|
|
|
-
|
|
|
- if (dwOtherY > dwCurrentY)
|
|
|
- {
|
|
|
- byCounterPlusY++;
|
|
|
- }
|
|
|
-
|
|
|
- else if (dwOtherY < dwCurrentY)
|
|
|
- {
|
|
|
- byCounterMinusY++;
|
|
|
- }
|
|
|
-
|
|
|
- else
|
|
|
- {
|
|
|
- byDirectionY = 0;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- else if (pstOtherBtstDirectionData->byDirectionTendency == 2)
|
|
|
+
|
|
|
+ if (byMainDirectionY == 1)
|
|
|
{
|
|
|
-
|
|
|
- if (dwOtherX > dwCurrentX)
|
|
|
+
|
|
|
+ if (pstOtherBtstDirectionData->byDirectionTendency == 1)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
- {
|
|
|
- byCounterMinusX++;
|
|
|
- }
|
|
|
- else
|
|
|
+
|
|
|
+ if ((dwOtherY > dwCurrentY && pstAheadCoord->dwY < dwOtherY) || (dwOtherY <= dwCurrentY && pstAheadCoord->dwY < dwOtherY))
|
|
|
{
|
|
|
- byCounterPlusX++;
|
|
|
+ byMainDirectionYCounter++;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- else if (dwOtherX < dwCurrentX)
|
|
|
+
|
|
|
+ else if (pstOtherBtstDirectionData->byDirectionTendency == 2)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
- {
|
|
|
- byCounterPlusX++;
|
|
|
- }
|
|
|
- else
|
|
|
+
|
|
|
+ if ((dwOtherY <= dwCurrentY && pstAheadCoord->dwY >= dwOtherY) || (dwOtherY >= dwCurrentY && pstAheadCoord->dwY >= dwOtherY))
|
|
|
{
|
|
|
- byCounterMinusX++;
|
|
|
+ byMainDirectionYCounter++;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- else
|
|
|
- {
|
|
|
- byDirectionX = 0;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if (dwOtherY > dwCurrentY)
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (byMainDirectionY == -1)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (pstOtherBtstDirectionData->byDirectionTendency == 1)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
+
|
|
|
+ if ((dwOtherY >= dwCurrentY && pstAheadCoord->dwY > dwOtherY) || (dwOtherY < dwCurrentY && pstAheadCoord->dwY > dwOtherY))
|
|
|
{
|
|
|
- byCounterMinusY++;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- byCounterPlusY++;
|
|
|
+ byMainDirectionYCounter++;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- else if (dwOtherY < dwCurrentY)
|
|
|
+
|
|
|
+ else if (pstOtherBtstDirectionData->byDirectionTendency == 2)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
- {
|
|
|
- byCounterPlusY++;
|
|
|
- }
|
|
|
- else
|
|
|
+
|
|
|
+ if ((dwOtherY > dwCurrentY && pstAheadCoord->dwY <= dwOtherY) || (dwOtherY <= dwCurrentY && pstAheadCoord->dwY <= dwOtherY))
|
|
|
{
|
|
|
- byCounterMinusY++;
|
|
|
+ byMainDirectionYCounter++;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- else
|
|
|
- {
|
|
|
- byDirectionY = 0;
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (byCounterPlusX != 0 || byCounterMinusX != 0 || byCounterPlusY != 0 || byCounterMinusY != 0)
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
+
|
|
|
+ pstCurrentBtsDirectionData->byDirectionX = byMainDirectionX;
|
|
|
+ pstCurrentBtsDirectionData->byDirectionY = byMainDirectionY;
|
|
|
+ pstCurrentBtsDirectionData->byDirectionXCounter = byMainDirectionXCounter;
|
|
|
+ pstCurrentBtsDirectionData->byDirectionYCounter = byMainDirectionYCounter;
|
|
|
+
|
|
|
+
|
|
|
+ byMainDirectionX = 0;
|
|
|
+ byMainDirectionY = 0;
|
|
|
+ byMainDirectionXCounter = 0;
|
|
|
+ byMainDirectionYCounter = 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if (byCounterPlusX == 0 && byCounterMinusX == 0 && byCounterPlusY == 0 && byCounterMinusY == 0)
|
|
|
+
|
|
|
+ for (uint8 i = 0; i < byFirstPathListLen; i++)
|
|
|
+ {
|
|
|
+ pstFirstPathData = &pstFirstPathList[i];
|
|
|
+ byFreqIndex = pstFirstPathData->byFreqIndex;
|
|
|
+ pstCurrentBtsDirectionData = &pstPredictionDirectionDataList[byFreqIndex];
|
|
|
+ if (pstCurrentBtsDirectionData->byDirectionXCounter > byMainDirectionXCounter)
|
|
|
+ {
|
|
|
+ byMainDirectionXCounter = pstCurrentBtsDirectionData->byDirectionXCounter;
|
|
|
+ byFirstPathIndexX = i;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (pstCurrentBtsDirectionData->byDirectionYCounter > byMainDirectionYCounter)
|
|
|
+ {
|
|
|
+ byMainDirectionYCounter = pstCurrentBtsDirectionData->byDirectionYCounter;
|
|
|
+ byFirstPathIndexY = i;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (byMainDirectionXCounter > byMainDirectionYCounter)
|
|
|
+ {
|
|
|
+
|
|
|
+ pstFirstPathData = &pstFirstPathList[byFirstPathIndexX];
|
|
|
+ byFreqIndex = pstFirstPathData->byFreqIndex;
|
|
|
+ pstCurrentBtsDirectionData = &pstPredictionDirectionDataList[byFreqIndex];
|
|
|
+ byMainDirectionX = pstCurrentBtsDirectionData->byDirectionX;
|
|
|
+ }
|
|
|
+ else if (byMainDirectionXCounter < byMainDirectionYCounter)
|
|
|
{
|
|
|
- *pbyDirectionX = 0;
|
|
|
- *pbyDirectionY = 0;
|
|
|
+
|
|
|
+ pstFirstPathData = &pstFirstPathList[byFirstPathIndexY];
|
|
|
+ byFreqIndex = pstFirstPathData->byFreqIndex;
|
|
|
+ pstCurrentBtsDirectionData = &pstPredictionDirectionDataList[byFreqIndex];
|
|
|
+ byMainDirectionY = pstCurrentBtsDirectionData->byDirectionY;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (byCounterPlusX > byCounterMinusX)
|
|
|
+
|
|
|
+ if (byChangeXY == 1)
|
|
|
{
|
|
|
- byDirectionX = 1;
|
|
|
+
|
|
|
+ pstFirstPathData = &pstFirstPathList[byFirstPathIndexX];
|
|
|
+ byFreqIndex = pstFirstPathData->byFreqIndex;
|
|
|
+ pstCurrentBtsDirectionData = &pstPredictionDirectionDataList[byFreqIndex];
|
|
|
+ byMainDirectionX = pstCurrentBtsDirectionData->byDirectionX;
|
|
|
}
|
|
|
- else if (byCounterPlusX < byCounterMinusX)
|
|
|
+
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ pstFirstPathData = &pstFirstPathList[byFirstPathIndexY];
|
|
|
+ byFreqIndex = pstFirstPathData->byFreqIndex;
|
|
|
+ pstCurrentBtsDirectionData = &pstPredictionDirectionDataList[byFreqIndex];
|
|
|
+ byMainDirectionY = pstCurrentBtsDirectionData->byDirectionY;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ *pbyDirectionX = byMainDirectionX;
|
|
|
+ *pbyDirectionY = byMainDirectionY;
|
|
|
+
|
|
|
+ return;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+void lct_coordcal_cal_bts_move_direction(uint8 byDirectionTendency, int32 dwBtsCoordX, int32 dwBtsCoordY, COORD_T *pstAheadCoord, int8 *pbyDirectionX, int8 *pbyDirectionY)
|
|
|
+{
|
|
|
+ int8 byDirectionX = 0;
|
|
|
+ int8 byDirectionY = 0;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (byDirectionTendency == 1)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (pstAheadCoord->dwX > dwBtsCoordX)
|
|
|
{
|
|
|
byDirectionX = -1;
|
|
|
}
|
|
|
- else
|
|
|
+
|
|
|
+ else if (pstAheadCoord->dwX < dwBtsCoordX)
|
|
|
{
|
|
|
- byDirectionX = 0;
|
|
|
+ byDirectionX = 1;
|
|
|
}
|
|
|
|
|
|
- if (byCounterPlusY > byCounterMinusY)
|
|
|
+
|
|
|
+ if (pstAheadCoord->dwY > dwBtsCoordY)
|
|
|
+ {
|
|
|
+ byDirectionY = -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (pstAheadCoord->dwY < dwBtsCoordY)
|
|
|
{
|
|
|
byDirectionY = 1;
|
|
|
}
|
|
|
- else if (byCounterPlusY < byCounterMinusY)
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (byDirectionTendency == 2)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (pstAheadCoord->dwX > dwBtsCoordX)
|
|
|
{
|
|
|
- byDirectionY = -1;
|
|
|
+ byDirectionX = 1;
|
|
|
}
|
|
|
- else
|
|
|
+
|
|
|
+ else if (pstAheadCoord->dwX < dwBtsCoordX)
|
|
|
{
|
|
|
- byDirectionY = 0;
|
|
|
+ byDirectionX = -1;
|
|
|
}
|
|
|
|
|
|
- *pbyDirectionX = byDirectionX;
|
|
|
- *pbyDirectionY = byDirectionY;
|
|
|
+
|
|
|
+ if (pstAheadCoord->dwY > dwBtsCoordY)
|
|
|
+ {
|
|
|
+ byDirectionY = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (pstAheadCoord->dwY < dwBtsCoordY)
|
|
|
+ {
|
|
|
+ byDirectionY = -1;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ *pbyDirectionX = byDirectionX;
|
|
|
+ *pbyDirectionY = byDirectionY;
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|