rename heart variables and function

This commit is contained in:
2025-12-01 12:18:38 +01:00
parent 3ba29199c4
commit 6dd232fb83
4 changed files with 7 additions and 7 deletions

View File

@@ -9,7 +9,7 @@
#define HEART_RATE_TASK_PERIOD (1000 / portTICK_PERIOD_MS) #define HEART_RATE_TASK_PERIOD (1000 / portTICK_PERIOD_MS)
/* Public function declarations */ /* Public function declarations */
uint8_t get_heart_rate(void); uint8_t get_temp(void);
void update_heart_rate(void); void update_temp(void);
#endif // HEART_RATE_H #endif // HEART_RATE_H

View File

@@ -59,8 +59,8 @@ static void heart_rate_task(void *param) {
/* Loop forever */ /* Loop forever */
while (1) { while (1) {
/* Update heart rate value every 1 second */ /* Update heart rate value every 1 second */
update_heart_rate(); update_temp();
ESP_LOGI(TAG, "heart rate updated to %d", get_heart_rate()); ESP_LOGI(TAG, "heart rate updated to %d", get_temp());
/* Send heart rate indication if enabled */ /* Send heart rate indication if enabled */
send_heart_rate_indication(); send_heart_rate_indication();

View File

@@ -87,7 +87,7 @@ static int heart_rate_chr_access(uint16_t conn_handle, uint16_t attr_handle,
/* Verify attribute handle */ /* Verify attribute handle */
if (attr_handle == heart_rate_chr_val_handle) { if (attr_handle == heart_rate_chr_val_handle) {
/* Update access buffer value */ /* Update access buffer value */
heart_rate_chr_val[1] = get_heart_rate(); heart_rate_chr_val[1] = get_temp();
rc = os_mbuf_append(ctxt->om, &heart_rate_chr_val, rc = os_mbuf_append(ctxt->om, &heart_rate_chr_val,
sizeof(heart_rate_chr_val)); sizeof(heart_rate_chr_val));
return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;

View File

@@ -6,6 +6,6 @@
static uint8_t heart_rate; static uint8_t heart_rate;
/* Public functions */ /* Public functions */
uint8_t get_heart_rate(void) { return heart_rate; } uint8_t get_temp(void) { return heart_rate; }
void update_heart_rate(void) { heart_rate = 60 + (uint8_t)(esp_random() % 21); } void update_temp(void) { heart_rate = 60 + (uint8_t)(esp_random() % 21); }