diff --git a/app/src/ble_module.c b/app/src/ble_module.c index 6c0fdd3..df2f081 100644 --- a/app/src/ble_module.c +++ b/app/src/ble_module.c @@ -285,7 +285,7 @@ void ble_temp_notify(int16_t temp_val) uint16_t temp_val_uint16 = temp_val; - temp_val_uint16 = temp_val_uint16 / 10; + temp_val_uint16 = temp_val_uint16; temp_att_ble[0] = temp_val_uint16 & 0xFF; temp_att_ble[1] = (temp_val_uint16 >> 8) & 0xFF; diff --git a/app/src/display/display_module.c b/app/src/display/display_module.c index 65c3a62..e2cd8ff 100644 --- a/app/src/display/display_module.c +++ b/app/src/display/display_module.c @@ -166,7 +166,7 @@ void hpi_disp_update_temp(int32_t temp) } char buf[32]; - double temp_d = (double)(temp / 1000.00); + double temp_d = (double)(temp / 100.00); sprintf(buf, "%.1f", temp_d); lv_label_set_text(label_temp, buf); } diff --git a/app/src/hw_module.c b/app/src/hw_module.c index 7dbbcdb..e944354 100644 --- a/app/src/hw_module.c +++ b/app/src/hw_module.c @@ -223,10 +223,11 @@ static void usb_init() printk("\nUSB Init complete\n\n"); } -int32_t hpi_hw_read_temp(void) +int16_t hpi_hw_read_temp(void) { int ret = 0; - int32_t temp_val = 0; + int32_t i32_temp_val = 0; + int16_t temp_val = 0; struct sensor_value temp_sample; sensor_sample_fetch(max30205_dev); @@ -234,7 +235,8 @@ int32_t hpi_hw_read_temp(void) // Convert to degree F if (temp_sample.val1 > 0) { - temp_val = (temp_sample.val1 * 9 / 5) + 32000; + i32_temp_val = (temp_sample.val1 * 9 / 5) + 32000; + temp_val = (int16_t) (i32_temp_val / 10); } return temp_val; diff --git a/app/src/hw_module.h b/app/src/hw_module.h index 8fbec37..0776a9f 100644 --- a/app/src/hw_module.h +++ b/app/src/hw_module.h @@ -1,7 +1,7 @@ #ifndef hw_module_h #define hw_module_h -int32_t hpi_hw_read_temp(void); +int16_t hpi_hw_read_temp(void); void send_usb_cdc(const char *buf, size_t len);