Skip to content

Commit a5c53ff

Browse files
aurel32nashif
authored andcommitted
samples: mesh_badge: fix temperature format
The sensor API returns the temperature in celsisus degree. The Bluetooth temperature characteristics uses M = 1, d = -2, b = 0, which corresponds to a resolution of 0.01 degree. This means that the value returned by sensor_value_to_double has to be multiplied by 100. Signed-off-by: Aurelien Jarno <[email protected]>
1 parent 0e11d13 commit a5c53ff

File tree

1 file changed

+1
-1
lines changed
  • samples/boards/reel_board/mesh_badge/src

1 file changed

+1
-1
lines changed

samples/boards/reel_board/mesh_badge/src/mesh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ static void sens_temperature_celsius_fill(struct net_buf_simple *msg)
213213
hdr.prop_id = SENS_PROP_ID_PRESENT_DEVICE_TEMP;
214214

215215
get_hdc1010_val(val);
216-
temp_degrees = sensor_value_to_double(&val[0]);
216+
temp_degrees = sensor_value_to_double(&val[0]) * 100;
217217

218218
net_buf_simple_add_mem(msg, &hdr, sizeof(hdr));
219219
net_buf_simple_add_le16(msg, temp_degrees);

0 commit comments

Comments
 (0)