Unable to get correct value advertise in TLM format in eddystone?

I had tried to advertise in TLM format (in temp variable) of eddystone value coming from sensor ssts751 integrated with my devkit but not getting correct. Please suggest me way to rectify it.

I had used i2c communication to get values from temperature sensor.

below is code for updating temperature in advertising mode 

             

static void update_temp(void)
{
    float temp;                                        // variable to hold temp reading
	   
	  temp = *temperature;
	  
    
	
	  NRF_LOG_INFO("\r\n temp : %x ",(temp*256));

	   
    int16_t temp_new = (int16_t) (temp*256);                   // temp    convert from int32_t to int16_t
    m_tlm.temp[0] = (uint8_t)((temp_new >> 2) & 0xFFUL); // Right-shift by two to remove decimal part
    m_tlm.temp[1] = (uint8_t)((temp_new << 6) & 0xFFUL); // Left-shift 6 to get fractional part with 0.25 degrees C resolution
	
	
}

value of temperature is getting from main file  

  • You don't really write what the problem is, typically to update the advertisement packet you stop advertisement, reconfigure advertisement, and start advertisement again. If you have problems with getting the correct data format, then I suggest to debug this without the softdevice first until you get this to work as intended. Make sure to check for possible error codes when you call the api, and you can also use the nrf sniffer for ble to check the actual data on-air

    Kenneth

Related