Mercurial > public > ostc4
comparison Small_CPU/Src/GNSS.c @ 969:81049905d829 Evo_2_23
Zusammenf?hren
author | heinrichsweikamp |
---|---|
date | Sun, 19 Jan 2025 12:02:59 +0100 (2 months ago) |
parents | 3420e3ba698d |
children |
comparison
equal
deleted
inserted
replaced
968:b9a1710522b1 | 969:81049905d829 |
---|---|
27 */ | 27 */ |
28 | 28 |
29 #include <string.h> | 29 #include <string.h> |
30 #include "GNSS.h" | 30 #include "GNSS.h" |
31 #include "data_exchange.h" | 31 #include "data_exchange.h" |
32 #include "rtc.h" | |
32 | 33 |
33 union u_Short uShort; | 34 union u_Short uShort; |
34 union i_Short iShort; | 35 union i_Short iShort; |
35 union u_Long uLong; | 36 union u_Long uLong; |
36 union i_Long iLong; | 37 union i_Long iLong; |
55 GNSS->hMSL = 0; | 56 GNSS->hMSL = 0; |
56 GNSS->hAcc = 0; | 57 GNSS->hAcc = 0; |
57 GNSS->vAcc = 0; | 58 GNSS->vAcc = 0; |
58 GNSS->gSpeed = 0; | 59 GNSS->gSpeed = 0; |
59 GNSS->headMot = 0; | 60 GNSS->headMot = 0; |
60 GNSS->alive = 0; | |
61 } | 61 } |
62 | 62 |
63 /*! | 63 /*! |
64 * Parse data to unique chip ID standard. | 64 * Parse data to unique chip ID standard. |
65 * Look at: 32.19.1.1 u-blox 8 Receiver description | 65 * Look at: 32.19.1.1 u-blox 8 Receiver description |
66 * @param GNSS Pointer to main GNSS structure. | 66 * @param GNSS Pointer to main GNSS structure. |
67 */ | 67 */ |
68 void GNSS_ParseUniqID(GNSS_StateHandle *GNSS) { | 68 void GNSS_ParseUniqID(GNSS_StateHandle *GNSS) { |
69 for (int var = 0; var < 5; var++) { | 69 for (int var = 0; var < 4; var++) { |
70 GNSS->uniqueID[var] = GNSS_Handle.uartWorkingBuffer[10 + var]; | 70 GNSS->uniqueID[var] = GNSS_Handle.uartWorkingBuffer[10 + var]; |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 /*! | 74 /*! |
77 * @param GNSS Pointer to main GNSS structure. | 77 * @param GNSS Pointer to main GNSS structure. |
78 */ | 78 */ |
79 void GNSS_ParsePVTData(GNSS_StateHandle *GNSS) { | 79 void GNSS_ParsePVTData(GNSS_StateHandle *GNSS) { |
80 | 80 |
81 static float searchCnt = 1.0; | 81 static float searchCnt = 1.0; |
82 | |
83 RTC_TimeTypeDef sTimeNow; | |
82 | 84 |
83 uShort.bytes[0] = GNSS_Handle.uartWorkingBuffer[10]; | 85 uShort.bytes[0] = GNSS_Handle.uartWorkingBuffer[10]; |
84 GNSS->yearBytes[0]=GNSS_Handle.uartWorkingBuffer[10]; | 86 GNSS->yearBytes[0]=GNSS_Handle.uartWorkingBuffer[10]; |
85 uShort.bytes[1] = GNSS_Handle.uartWorkingBuffer[11]; | 87 uShort.bytes[1] = GNSS_Handle.uartWorkingBuffer[11]; |
86 GNSS->yearBytes[1]=GNSS_Handle.uartWorkingBuffer[11]; | 88 GNSS->yearBytes[1]=GNSS_Handle.uartWorkingBuffer[11]; |
141 GNSS->fLat = searchCnt++; | 143 GNSS->fLat = searchCnt++; |
142 } | 144 } |
143 | 145 |
144 if(GNSS->alive & GNSS_ALIVE_STATE_ALIVE) /* alive */ | 146 if(GNSS->alive & GNSS_ALIVE_STATE_ALIVE) /* alive */ |
145 { | 147 { |
146 GNSS->alive &= !GNSS_ALIVE_STATE_ALIVE; | 148 GNSS->alive &= ~GNSS_ALIVE_STATE_ALIVE; |
147 } | 149 } |
148 else | 150 else |
149 { | 151 { |
150 GNSS->alive |= GNSS_ALIVE_STATE_ALIVE; | 152 GNSS->alive |= GNSS_ALIVE_STATE_ALIVE; |
151 } | 153 } |
153 { | 155 { |
154 GNSS->alive |= GNSS_ALIVE_STATE_TIME; | 156 GNSS->alive |= GNSS_ALIVE_STATE_TIME; |
155 } | 157 } |
156 else | 158 else |
157 { | 159 { |
158 GNSS->alive &= !GNSS_ALIVE_STATE_TIME; | 160 GNSS->alive &= ~GNSS_ALIVE_STATE_TIME; |
161 } | |
162 | |
163 if(GNSS->fixType >= 2) | |
164 { | |
165 RTC_GetTime(&sTimeNow); | |
166 GNSS->alive |= GNSS_ALIVE_BACKUP_POS; | |
167 GNSS->last_fLat = GNSS->fLat; | |
168 GNSS->last_fLon = GNSS->fLon; | |
169 GNSS->last_hour = sTimeNow.Hours; | |
159 } | 170 } |
160 } | 171 } |
161 | 172 |
162 /*! | 173 /*! |
163 * Parse data to UTC time solution standard. | 174 * Parse data to UTC time solution standard. |