@@ -2217,137 +2217,3 @@ bool lg290pMessageEnabled(char *nmeaSentence, int sentenceLength)
2217
2217
// If we can't ID this message, allow it by default. The device configuration should control most message flow.
2218
2218
return (true );
2219
2219
}
2220
-
2221
- // Re-create the GST sentence to increase the horizontal and vertical precision number of decimals
2222
- // ie, 0.0 becomes 0.009
2223
- // See issue: https://github.com/sparkfun/SparkFun_RTK_Everywhere_Firmware/issues/513
2224
- // $GNGST,223954.500,1.7,1.5,1.0,109.3,1.412,1.055,2.4*7E
2225
- // Modifies the sentence length with new length
2226
- void lg290pModifyGst (char *nmeaSentence, uint16_t *sentenceLength)
2227
- {
2228
- // This issue currently only applies to LG290P firmware version 4
2229
- // Version 3 does not support GST messages. Version 5 should fix the issue.
2230
- if (lg290pFirmwareVersion != 4 )
2231
- return ;
2232
-
2233
- if (online.gnss == false )
2234
- return ;
2235
-
2236
- // Only apply the GST patch if our HPA is very small (<0.1m), ie RTK Float or Fix.
2237
- if (gnss->isRTKFix () == false && gnss->isRTKFloat () == false )
2238
- return ;
2239
-
2240
- GNSS_LG290P *lg290p = (GNSS_LG290P *)gnss;
2241
-
2242
- // Identify sentence type
2243
- char sentenceType[strlen (" GST" ) + 1 ] = {0 };
2244
- strncpy (sentenceType, &nmeaSentence[3 ],
2245
- 3 ); // Copy three letters, starting in spot 3. Null terminated from array initializer.
2246
-
2247
- // We only care about GST sentences
2248
- if (strncmp (sentenceType, " GST" , sizeof (sentenceType)) != 0 )
2249
- return ;
2250
-
2251
- const int latitudeErrorComma = 6 ;
2252
- const int longitudeErrorComma = 7 ;
2253
- const int altitudeErrorComma = 8 ;
2254
-
2255
- uint8_t latitudeStart = 0 ;
2256
- uint8_t latitudeStop = 0 ;
2257
- uint8_t longitudeStart = 0 ;
2258
- uint8_t longitudeStop = 0 ;
2259
- uint8_t altitudeStart = 0 ;
2260
- uint8_t checksumStart = 0 ;
2261
-
2262
- if (settings.enableImuCompensationDebug == true && !inMainMenu)
2263
- systemPrintf (" Original GNGST:\r\n %s\r\n " , nmeaSentence);
2264
-
2265
- int commaCount = 0 ;
2266
- for (int x = 0 ; x < strnlen (nmeaSentence, *sentenceLength); x++) // Assumes sentence is null terminated
2267
- {
2268
- if (nmeaSentence[x] == ' ,' )
2269
- {
2270
- commaCount++;
2271
- if (commaCount == latitudeErrorComma)
2272
- latitudeStart = x + 1 ;
2273
- if (commaCount == latitudeErrorComma + 1 )
2274
- latitudeStop = x;
2275
- if (commaCount == longitudeErrorComma)
2276
- longitudeStart = x + 1 ;
2277
- if (commaCount == longitudeErrorComma + 1 )
2278
- longitudeStop = x;
2279
- if (commaCount == altitudeErrorComma)
2280
- altitudeStart = x + 1 ;
2281
- }
2282
- if (nmeaSentence[x] == ' *' )
2283
- {
2284
- checksumStart = x;
2285
- break ;
2286
- }
2287
- }
2288
-
2289
- if (latitudeStart == 0 || latitudeStop == 0 || longitudeStart == 0 || longitudeStop == 0 || altitudeStart == 0 ||
2290
- checksumStart == 0 )
2291
- {
2292
- systemPrintln (" Delineator not found" );
2293
- return ;
2294
- }
2295
-
2296
- char newSentence[150 ] = {0 };
2297
-
2298
- if (sizeof (newSentence) < *sentenceLength)
2299
- {
2300
- systemPrintln (" newSentence not big enough!" );
2301
- return ;
2302
- }
2303
-
2304
- char errorString[strlen (" 0.000" ) + 1 ] = {0 };
2305
-
2306
- // strncat terminates
2307
-
2308
- // Add start of message up to latitude
2309
- strncat (newSentence, nmeaSentence, latitudeStart);
2310
-
2311
- // Convert error from EPE message to string. We don't have pure lat error, only 2D and 3D.
2312
- snprintf (errorString, sizeof (errorString), " %0.3f" , lg290p->getHorizontalAccuracy ());
2313
-
2314
- // Add latitude error
2315
- strncat (newSentence, errorString, sizeof (newSentence) - 1 );
2316
-
2317
- // Add interstitial between end of lat and beginning of lon
2318
- strncat (newSentence, nmeaSentence + latitudeStop, longitudeStart - latitudeStop);
2319
-
2320
- // Add same error for longitude error
2321
- strncat (newSentence, errorString, sizeof (newSentence) - 1 );
2322
-
2323
- // Add interstitial between end of lon and beginning of alt
2324
- strncat (newSentence, nmeaSentence + longitudeStop, altitudeStart - longitudeStop);
2325
-
2326
- // Convert error from EPE message to string. We don't have pure altitude error, use double 2D error as stand-in.
2327
- snprintf (errorString, sizeof (errorString), " %0.3f" , lg290p->getHorizontalAccuracy () * 2 );
2328
-
2329
- // Add altitude error. We don't really have altitude so use 3D error in its place.
2330
- strncat (newSentence, errorString, sizeof (newSentence) - 1 );
2331
-
2332
- // From: http://engineeringnotes.blogspot.com/2015/02/generate-crc-for-nmea-strings-arduino.html
2333
- byte CRC = 0 ; // XOR chars between '$' and '*'
2334
- for (byte x = 1 ; x < strlen (newSentence); x++)
2335
- CRC = CRC ^ newSentence[x];
2336
-
2337
- // Convert CRC to string, add * and CR LF
2338
- snprintf (errorString, sizeof (errorString), " *%02X\r\n " , CRC);
2339
-
2340
- // Add CRC
2341
- strncat (newSentence, errorString, sizeof (newSentence) - 1 );
2342
-
2343
- // Increase length of sentence
2344
- *sentenceLength = strlen (newSentence);
2345
-
2346
- // Overwrite the original NMEA
2347
- strncpy (nmeaSentence, newSentence, *sentenceLength);
2348
-
2349
- nmeaSentence[*sentenceLength] = ' \0 ' ; // Terminate string
2350
-
2351
- if (settings.enableImuCompensationDebug == true && !inMainMenu)
2352
- systemPrintf (" Corrected GNGST:\r\n %s\r\n " , nmeaSentence);
2353
- }
0 commit comments