mirror of
https://github.com/esphome/esphome.git
synced 2026-10-10 05:23:07 +00:00
[core] Use numeric scheduler ids instead of string names (5/5) (#20378)
This commit is contained in:
@@ -6,6 +6,8 @@ namespace esphome::ufire_ec {
|
||||
|
||||
ESPHOME_LOG_TAG(TAG, "ufire_ec");
|
||||
|
||||
static constexpr uint32_t DATA_TIMEOUT_ID = 0;
|
||||
|
||||
void UFireECComponent::setup() {
|
||||
uint8_t version;
|
||||
if (!this->read_byte(REGISTER_VERSION, &version) || version == 0xFF) {
|
||||
@@ -45,7 +47,7 @@ void UFireECComponent::update() {
|
||||
}
|
||||
|
||||
if (wait > 0) {
|
||||
this->set_timeout("data", wait, [this]() { this->update_internal_(); });
|
||||
this->set_timeout(DATA_TIMEOUT_ID, wait, [this]() { this->update_internal_(); });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace esphome::ufire_ise {
|
||||
|
||||
ESPHOME_LOG_TAG(TAG, "ufire_ise");
|
||||
|
||||
static constexpr uint32_t DATA_TIMEOUT_ID = 0;
|
||||
|
||||
void UFireISEComponent::setup() {
|
||||
uint8_t version;
|
||||
if (!this->read_byte(REGISTER_VERSION, &version) || version == 0xFF) {
|
||||
@@ -38,7 +40,7 @@ void UFireISEComponent::update() {
|
||||
}
|
||||
|
||||
// Wait until measurement are taken
|
||||
this->set_timeout("data", wait, [this]() { this->update_internal_(); });
|
||||
this->set_timeout(DATA_TIMEOUT_ID, wait, [this]() { this->update_internal_(); });
|
||||
}
|
||||
|
||||
void UFireISEComponent::update_internal_() {
|
||||
|
||||
@@ -6,6 +6,8 @@ namespace esphome::veml3235 {
|
||||
|
||||
ESPHOME_LOG_TAG(TAG, "veml3235.sensor");
|
||||
|
||||
static constexpr uint32_t REREAD_TIMEOUT_ID = 0;
|
||||
|
||||
// ADC counts at or above this value (98% of full scale) are treated as clipped: the true light level cannot
|
||||
// be estimated from such a reading, so auto-gain restarts from minimum sensitivity instead
|
||||
static const uint16_t CLIPPED_COUNTS = 64224;
|
||||
@@ -71,7 +73,7 @@ void VEML3235Sensor::read_and_publish_(uint8_t adjustments_left) {
|
||||
const uint32_t old_integration_time_ms = this->integration_time_ms_();
|
||||
if (this->adjust_sensitivity_(als_counts)) {
|
||||
const uint32_t wait_ms = old_integration_time_ms + 2 * this->integration_time_ms_();
|
||||
this->set_timeout("reread", wait_ms,
|
||||
this->set_timeout(REREAD_TIMEOUT_ID, wait_ms,
|
||||
[this, adjustments_left]() { this->read_and_publish_(adjustments_left - 1); });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace esphome::xgzp68xx {
|
||||
|
||||
ESPHOME_LOG_TAG(TAG, "xgzp68xx.sensor");
|
||||
|
||||
static constexpr uint32_t MEASUREMENT_TIMEOUT_ID = 0;
|
||||
|
||||
static const uint8_t CMD_ADDRESS = 0x30;
|
||||
static const uint8_t SYSCONFIG_ADDRESS = 0xA5;
|
||||
static const uint8_t PCONFIG_ADDRESS = 0xA6;
|
||||
@@ -54,7 +56,7 @@ void XGZP68XXComponent::update() {
|
||||
this->write_register(0x30, &READ_COMMAND, 1);
|
||||
|
||||
// Wait 20mS per datasheet
|
||||
this->set_timeout("measurement", 20, [this]() {
|
||||
this->set_timeout(MEASUREMENT_TIMEOUT_ID, 20, [this]() {
|
||||
uint8_t data[5] = {};
|
||||
uint32_t pressure_raw = 0;
|
||||
uint16_t temperature_raw = 0;
|
||||
|
||||
Reference in New Issue
Block a user