Mercurial > public > ostc4
comparison Small_CPU/Src/GNSS.c @ 955:9b29995d6619 Evo_2_23 tip
GNSS backup position:
In the previous implementation a position had to be provided by the module in order to be stored in the log. This may cause a wrong position entry (default) in the log, for example if signal is lost while preparing for the dive in the water. To avoid this the last received position will be used for ~2 hours => Diver may take the dive side position before starting with the dive preparation. The last known position will be display in the GNSS position search window as well.
author | Ideenmodellierer |
---|---|
date | Wed, 01 Jan 2025 20:37:17 +0100 |
parents | 96cf6c53c934 |
children |
comparison
equal
deleted
inserted
replaced
954:4e4fbd73e329 | 955:9b29995d6619 |
---|---|
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 |
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. |