Skip to content

Commit

Permalink
Correct temperature data type
Browse files Browse the repository at this point in the history
  • Loading branch information
protocentralashwin committed Nov 5, 2024
1 parent 7561d4f commit ed57ff8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
6 changes: 3 additions & 3 deletions app/src/display/display_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void display_init_styles()
// lv_style_set_bg_grad(&style_scr_back, &grad);
}

void hpi_disp_update_temp(int16_t temp)
void hpi_disp_update_temp(int32_t temp)
{
if (label_temp == NULL)
return;
Expand All @@ -167,7 +167,7 @@ void hpi_disp_update_temp(int16_t temp)

char buf[32];
double temp_d = (double)(temp / 1000.00);
sprintf(buf, "%.2f", temp_d);
sprintf(buf, "%.1f", temp_d);
lv_label_set_text(label_temp, buf);
}

Expand Down Expand Up @@ -355,7 +355,7 @@ void draw_scr_home_footer(lv_obj_t *parent)
// Temp Number label
label_temp = lv_label_create(parent);
lv_label_set_text(label_temp, "---");
lv_obj_align_to(label_temp, label_rr, LV_ALIGN_OUT_RIGHT_TOP, 60, 0);
lv_obj_align_to(label_temp, label_rr, LV_ALIGN_OUT_RIGHT_TOP, 50, 0);
lv_obj_add_style(label_temp, &style_temp, LV_STATE_DEFAULT);

// Temp label
Expand Down
2 changes: 1 addition & 1 deletion app/src/display/display_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void draw_scr_home(enum scroll_dir m_scroll_dir);
void scr_home_plot_ecg(float plot_data);
void scr_home_plot_ppg(float plot_data);

void hpi_disp_update_temp(int16_t temp);
void hpi_disp_update_temp(int32_t temp);

// Display helper functions
void hpi_show_screen(lv_obj_t *parent, enum scroll_dir m_scroll_dir);
Expand Down
8 changes: 4 additions & 4 deletions app/src/hw_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static const struct pwm_dt_spec bl_led_pwm = PWM_DT_SPEC_GET(DT_ALIAS(bl_led_pwm
#endif

uint8_t global_batt_level = 0;
static int16_t global_temp_val = 0;
static int32_t global_temp_val = 0;

static void leds_init()
{
Expand Down Expand Up @@ -223,10 +223,10 @@ static void usb_init()
printk("\nUSB Init complete\n\n");
}

int16_t hpi_hw_read_temp(void)
int32_t hpi_hw_read_temp(void)
{
int ret = 0;
int16_t temp_val = 0;
int32_t temp_val = 0;

struct sensor_value temp_sample;
sensor_sample_fetch(max30205_dev);
Expand Down Expand Up @@ -381,7 +381,7 @@ void hw_thread(void)
ble_temp_notify(global_temp_val);
#endif

k_sleep(K_MSEC(2000));
k_sleep(K_MSEC(1000));
}
}

Expand Down
7 changes: 1 addition & 6 deletions app/src/hw_module.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
#ifndef hw_module_h
#define hw_module_h

uint32_t hw_keypad_get_key(void);


int16_t hpi_hw_read_temp(void);
int32_t hpi_hw_read_temp(void);

void send_usb_cdc(const char *buf, size_t len);

int readADC(void);

enum gpio_keypad_key
{
GPIO_KEYPAD_KEY_NONE = 0,
Expand Down

0 comments on commit ed57ff8

Please sign in to comment.