Adafruit is open and shipping! Let's build back better, together!
0

Bluefruit - Timestamping weight measurements
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Bluefruit - Timestamping weight measurements

by twonius on Sun Sep 06, 2020 6:32 pm

I'm buffering data when my device is not connected so I need to implement timestamps so I can tell what was measured when.

fortunately the weight measurement characteristic includes a timestamp.

unfortunately it's not clear how to implement this using the bluefruit .notify method.

Code: Select all | TOGGLE FULL SIZE
   if(wmc.notifyEnabled()){
      while(!bufferEmpty()){
        notification = fifoRead();
        Serial.printf("buffer length: %u \n", bufferLength());
 
        if ( wmc.notify(notification, sizeof(notification)) ){
          Serial.println("Weight Measurement updated");
        }else{
          Serial.println("ERROR: Notify not set in the CCCD or not connected!");
        }
     
      };


Which is reading packets buffered this way:

Code: Select all | TOGGLE FULL SIZE
 uint8_t package[6]  = {0b00000010,highByte(weight),lowByte(weight),0,0,0};
      fifoWrite(package); //write values to the buffer


https://www.bluetooth.com/wp-content/up ... rement.xml

Currently I'm building the package out of a group of bytes but it's not clear how the timestamp would fit into there since it contains multiple fields.
https://github.com/philngo/ble-mathemat ... e_time.xml

twonius
 
Posts: 5
Joined: Wed May 29, 2013 3:36 pm

Please be positive and constructive with your questions and comments.