Struggle with Bluetooth SPP

Hi,

i want to create my DIY device with an ESP32.

The connection and the data transfer is working well but not in combination with GPS and RC3 Messages. If I send GPS or RC Data everything is working well.

I tested a delay between those two messages and this works and works not.

Has someone an idea?

Additional questions:
- Can I send GPS and RC data in one go? If yes how?
- Do I need the timestamp and the count? If yes how has the timestamp to look like?

My Code is:

if (gpsPort->available())
{
size_t len = gpsProv.gpsPort->available();
uint8_t sbuf[len];
gpsPort->readBytes(sbuf, len);

SerialBT.write(sbuf, len); //This transfers the GPS NMEA message

uint8_t checksum = 0;

char buffer[255];
sprintf(buffer, "RC3,%s,%s,%lu,%s,%s,%s,%s,%s,%s,%s,%d,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s",
"",
"",
random(1, 100),
"-0.560",
"-0.290",
"7.938",
"-0.125",
"0.063",
"",
"",
"",
"-40.438",
"2.625",
"70.875",
"9.875",
"-48.250",
"-6.360",
"-0.340",
"7.450",
"-6.100",
"-0.940",
"7.170",
"0",
"1",
"10");

int lenght = strlen(buffer);
for (int i = 0; i < lenght; i++)
{
checksum = checksum ^ (uint8_t)buffer[i];
}

btProv.SerialBT.printf("$%s*%X\r\n", buffer, checksum, sbuf); // This creates the RC3 Message
}

Comments

  • aolaol
    edited April 5
    Which device type are you using in settings? You should have it as "Add other device > RaceChrono DIY > Bluetooth RFCOMM > NMEA 0183 checked + RC2/RC3 checked"

    - You can mix NMEA 0183 sentences and RC2/RC3
    - Previously you needed RC2/RC3 have a timestamp if there's mixed NMEA 0183, but I think it will work as-is now, just mix the sentences in the stream.
    - Count is always needed if there's no timestamp

    If that does not work, can you email me a couple minutes worth of your data output to tracks(at)racechrono.com? I can check why it fails.
  • What data do you need? The sentences which i send to RC?
  • The raw output from your device. Easiest is to turn on Expert settings > Save device output, and then record a session, and share it. The data is then saved inside the .rcz file (which is just a renamed .zip)
  • I send you an E-Mail with the raw data of my device. Hope you can find the problem.

    After the connection RC shows me the GPS and RC data and after the first send I only see the updating RC messages and the GPS data is stuck
  • @R1Snake The output files shows a serious buffering(?) issue on your device. That's the reason why it does not work.
  • Thanks for your support. I have found my issue and solved it. Now everything works perfectly.

    Is it possible to name the analog channels that a can say channel 8 is water temperature for example?
  • Unfortunately not. I've been planning to create new version of the protocol to allow defining it within...
  • Hi, Can you share your code?
Sign In or Register to comment.