Adafruit Clue BLE + Sparkfun NBlox GPS + GoPro + Chrono DIY

2»

Comments

  • Hey @aol I'm having some odd issues with my diy payload, I cant seem to use the full 20 bytes, since the first 4 bytes are used for the id the remaining 16 bytes are not all addressable an are actually only 12 bytes?

    so when I view the source data in the app the first 4 bytes are pretty much always

    0x00 00 00 00

    then I'm missing my last 4 data bytes. I had assumed that when you said 20 bytes, that the id was 4 bytes which indicates these first 4 bytes, then that would give me 16 bytes of data.
  • currently its not blocking me I don't need the magnetos
  • aolaol
    edited July 2
    Are you sure your data is aligned correctly? The first 4 bytes being always zeros tell me that you are reserving extra 4 bytes erroneously on top of the 4 bytes that goes for the ID.

    The payload maximum length should be 16. The maximum Bluetooth LE message payload is 20, and this protocol uses 4 first ones for the ID.
  • typedef struct
    {
    uint32_t id;
    uint64_t data;
    uint64_t data2;
    } diyRCMSG;
  • motoMessage.data |= ((uint64_t)(humi & 0xFF)) & 0x00000000000000FF;
    motoMessage.data |= ((uint64_t)(temp & 0xFF) << 8) & 0x000000000000FF00;
    motoMessage.data |= ((uint64_t)(brakePos & 0xFF) << 16) & 0x0000000000FF0000;
    motoMessage.data |= ((uint64_t)(throttlePos & 0xFF) << 24) & 0x00000000FF000000;
    motoMessage.data |= ((uint64_t)(rpm & 0xFF) << 32) & 0x000000FF00000000;
    motoMessage.data |= ((uint64_t)(pres & 0xFF) << 40) & 0x0000FF0000000000;
    motoMessage.data |= ((uint64_t)(accelx & 0xFF) << 48) & 0x00FF000000000000;
    motoMessage.data |= ((uint64_t)(accely & 0xFF) << 56) & 0xFF00000000000000;
    motoMessage.data2 |= ((uint64_t)(accelz & 0xFF)) & 0x00000000000000FF;
    motoMessage.data2 |= ((uint64_t)(gyrox & 0xFF) << 8) & 0x000000000000FF00;
    motoMessage.data2 |= ((uint64_t)(gyroy & 0xFF) << 16) & 0x0000000000FF0000;
    motoMessage.data2 |= ((uint64_t)(gyroz & 0xFF) << 24) & 0x00000000FF000000;
  • now I did have


    motoMessage.data2 |= ((uint64_t)(magx & 0xFF) << 32) & 0x000000FF00000000;
    motoMessage.data2 |= ((uint64_t)(magy & 0xFF) << 40) & 0x0000FF0000000000;
    motoMessage.data2 |= ((uint64_t)(magz & 0xFF) << 48) & 0x00FF000000000000;
  • but that doesn't actually make it to the app.
  • I'll try setting my structure alignment to be 4 bytes explicitly, I wonder if its packing it to 8 bytes and adding 4 bytes of padding after my id... good call will let you know if that is the problem, I hope so.
  • Just do sizeof(diyRCMSG) and you'll see if its 24 or 20...
  • I have no problems to use the full 16 bytes of payload. I am very happy that this was implemented so fast after my request :)
    The only trouble I have is when I send a CAN message before at least one GPS message has been sent. It is just not considering any GPS message afterwards... I always need to wait for my GPS which means I cannot start sending data when I am in the garage. There is some data I´d like see on the phone even when preparing before going out on the track :)
  • this was totally it, I set an explicit packing around my structure to 4 bytes and it resolved it.
  • I noticed while testing with my gopro that I have to manually hit record on the camera feed each time I start a session is that normal?
Sign In or Register to comment.