@@ -587,6 +587,7 @@ JshI2CInfo i2cHRM;
587
587
#define PRESSURE_I2C &i2cPressure
588
588
#define HRM_I2C &i2cHRM
589
589
#define GPS_UART EV_SERIAL1
590
+ #define GPS_CASIC 1 // handle decoding of 'CASIC' packets from the GPS
590
591
#define HEARTRATE 1
591
592
592
593
bool pressureBMP280Enabled = false;
@@ -4658,7 +4659,7 @@ bool jswrap_banglejs_idle() {
4658
4659
bool jswrap_banglejs_gps_character (char ch ) {
4659
4660
#ifdef GPS_PIN_RX
4660
4661
// if too many chars, roll over since it's probably because we skipped a newline
4661
- // or messed the message length
4662
+ // or messed up the message length
4662
4663
if (gpsLineLength >= sizeof (gpsLine )) {
4663
4664
#ifdef GPS_UBLOX
4664
4665
if (inComingUbloxProtocol == UBLOX_PROTOCOL_UBX &&
@@ -4689,6 +4690,21 @@ bool jswrap_banglejs_gps_character(char ch) {
4689
4690
}
4690
4691
#endif // GPS_UBLOX
4691
4692
gpsLine [gpsLineLength ++ ] = ch ;
4693
+ #ifdef GPS_CASIC
4694
+ if (gpsLineLength > 2 && gpsLine [0 ]== 0xBA && gpsLine [1 ]== 0xCE ) {
4695
+ if (gpsLineLength < 4 ) return true; // not enough data for length
4696
+ int len = gpsLine [2 ] | (gpsLine [3 ] << 8 );
4697
+ // 4 class, 5 = msg
4698
+ // 4 byte checksum on end
4699
+ if (gpsLineLength >=len + 10 ) { // packet end!
4700
+ memcpy (gpsLastLine , gpsLine , gpsLineLength );
4701
+ gpsLastLineLength = gpsLineLength ;
4702
+ bangleTasks |= JSBT_GPS_DATA_LINE ;
4703
+ gpsClearLine ();
4704
+ }
4705
+ return true;
4706
+ }
4707
+ #endif
4692
4708
if (
4693
4709
#ifdef GPS_UBLOX
4694
4710
inComingUbloxProtocol == UBLOX_PROTOCOL_NMEA &&
0 commit comments