添加本地晶振钟差补偿系数time_scale
This commit is contained in:
parent
aff61940e0
commit
68939ce315
@ -19,4 +19,5 @@ uint8_t U1_TX_buf[UART_BF_SIZE]={0};
|
|||||||
/* define var */
|
/* define var */
|
||||||
uint8_t ST_IMU_INT = 0, TDK_IMU_INT = 0; // IMU INT flag
|
uint8_t ST_IMU_INT = 0, TDK_IMU_INT = 0; // IMU INT flag
|
||||||
uint8_t U1_DMA_BUSY = 0;
|
uint8_t U1_DMA_BUSY = 0;
|
||||||
|
double time_scale=1;
|
||||||
int GPS_week;
|
int GPS_week;
|
||||||
|
@ -67,6 +67,7 @@ extern UART_HandleTypeDef huart1;
|
|||||||
extern UART_HandleTypeDef huart2;
|
extern UART_HandleTypeDef huart2;
|
||||||
/* USER CODE BEGIN EV */
|
/* USER CODE BEGIN EV */
|
||||||
extern TIM_HandleTypeDef htim3;
|
extern TIM_HandleTypeDef htim3;
|
||||||
|
extern double time_scale;
|
||||||
|
|
||||||
/* USER CODE END EV */
|
/* USER CODE END EV */
|
||||||
|
|
||||||
@ -371,7 +372,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
|||||||
IMU_mng_ST.ready = 1;
|
IMU_mng_ST.ready = 1;
|
||||||
IMU_mng_ST.gpstime = SYS_TIME.SYS_GPST_TIME;
|
IMU_mng_ST.gpstime = SYS_TIME.SYS_GPST_TIME;
|
||||||
IMU_mng_ST.utctime = SYS_TIME.SYS_UTC_TIME;
|
IMU_mng_ST.utctime = SYS_TIME.SYS_UTC_TIME;
|
||||||
IMU_mng_ST.gpstime.sec = IMU_mng_ST.utctime.sec = __HAL_TIM_GET_COUNTER(&htim3) / 10000.0;
|
IMU_mng_ST.gpstime.sec = IMU_mng_ST.utctime.sec = __HAL_TIM_GET_COUNTER(&htim3) / 10000.0*time_scale;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -387,6 +388,9 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
|||||||
else if (GPIO_Pin == PPS_INT_Pin)
|
else if (GPIO_Pin == PPS_INT_Pin)
|
||||||
{
|
{
|
||||||
/* Neet to add sec and clean Tim CNT */
|
/* Neet to add sec and clean Tim CNT */
|
||||||
|
int timer_count =__HAL_TIM_GET_COUNTER(&htim3);
|
||||||
|
if (timer_count<12000 && timer_count > 8000)
|
||||||
|
time_scale=10000.0/timer_count;
|
||||||
__HAL_TIM_SET_COUNTER(&htim3, 0); // clean TIM3 CNT
|
__HAL_TIM_SET_COUNTER(&htim3, 0); // clean TIM3 CNT
|
||||||
if (SYS_TIME.NMEA_GET == 1)
|
if (SYS_TIME.NMEA_GET == 1)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user