1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-19 00:05:43 +00:00

[ble_client] Use function pointers for lambda actions and sensors (#11564)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
J. Nick Koston
2025-10-28 14:10:32 -05:00
committed by GitHub
parent 0119e17f04
commit 08b8454555
3 changed files with 57 additions and 32 deletions

View File

@@ -117,9 +117,9 @@ void BLESensor::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t ga
}
float BLESensor::parse_data_(uint8_t *value, uint16_t value_len) {
if (this->data_to_value_func_.has_value()) {
if (this->has_data_to_value_) {
std::vector<uint8_t> data(value, value + value_len);
return (*this->data_to_value_func_)(data);
return this->data_to_value_func_(data);
} else {
return value[0];
}