mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 05:24:53 +01:00
commit
142c4a87d2
5 changed files with 24 additions and 15 deletions
|
@ -8,6 +8,9 @@ namespace ltr390 {
|
||||||
|
|
||||||
static const char *const TAG = "ltr390";
|
static const char *const TAG = "ltr390";
|
||||||
|
|
||||||
|
static const uint8_t LTR390_WAKEUP_TIME = 10;
|
||||||
|
static const uint8_t LTR390_SETTLE_TIME = 5;
|
||||||
|
|
||||||
static const uint8_t LTR390_MAIN_CTRL = 0x00;
|
static const uint8_t LTR390_MAIN_CTRL = 0x00;
|
||||||
static const uint8_t LTR390_MEAS_RATE = 0x04;
|
static const uint8_t LTR390_MEAS_RATE = 0x04;
|
||||||
static const uint8_t LTR390_GAIN = 0x05;
|
static const uint8_t LTR390_GAIN = 0x05;
|
||||||
|
@ -101,21 +104,27 @@ void LTR390Component::read_mode_(int mode_index) {
|
||||||
|
|
||||||
std::bitset<8> ctrl = this->reg(LTR390_MAIN_CTRL).get();
|
std::bitset<8> ctrl = this->reg(LTR390_MAIN_CTRL).get();
|
||||||
ctrl[LTR390_CTRL_MODE] = mode;
|
ctrl[LTR390_CTRL_MODE] = mode;
|
||||||
|
ctrl[LTR390_CTRL_EN] = true;
|
||||||
this->reg(LTR390_MAIN_CTRL) = ctrl.to_ulong();
|
this->reg(LTR390_MAIN_CTRL) = ctrl.to_ulong();
|
||||||
|
|
||||||
// After the sensor integration time do the following
|
// After the sensor integration time do the following
|
||||||
this->set_timeout(((uint32_t) RESOLUTIONVALUE[this->res_]) * 100, [this, mode_index]() {
|
this->set_timeout(((uint32_t) RESOLUTIONVALUE[this->res_]) * 100 + LTR390_WAKEUP_TIME + LTR390_SETTLE_TIME,
|
||||||
// Read from the sensor
|
[this, mode_index]() {
|
||||||
std::get<1>(this->mode_funcs_[mode_index])();
|
// Read from the sensor
|
||||||
|
std::get<1>(this->mode_funcs_[mode_index])();
|
||||||
|
|
||||||
// If there are more modes to read then begin the next
|
// If there are more modes to read then begin the next
|
||||||
// otherwise stop
|
// otherwise stop
|
||||||
if (mode_index + 1 < (int) this->mode_funcs_.size()) {
|
if (mode_index + 1 < (int) this->mode_funcs_.size()) {
|
||||||
this->read_mode_(mode_index + 1);
|
this->read_mode_(mode_index + 1);
|
||||||
} else {
|
} else {
|
||||||
this->reading_ = false;
|
// put sensor in standby
|
||||||
}
|
std::bitset<8> ctrl = this->reg(LTR390_MAIN_CTRL).get();
|
||||||
});
|
ctrl[LTR390_CTRL_EN] = false;
|
||||||
|
this->reg(LTR390_MAIN_CTRL) = ctrl.to_ulong();
|
||||||
|
this->reading_ = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void LTR390Component::setup() {
|
void LTR390Component::setup() {
|
||||||
|
|
|
@ -94,10 +94,10 @@ class VoiceAssistant : public Component {
|
||||||
uint32_t get_feature_flags() const {
|
uint32_t get_feature_flags() const {
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
flags |= VoiceAssistantFeature::FEATURE_VOICE_ASSISTANT;
|
flags |= VoiceAssistantFeature::FEATURE_VOICE_ASSISTANT;
|
||||||
|
flags |= VoiceAssistantFeature::FEATURE_API_AUDIO;
|
||||||
#ifdef USE_SPEAKER
|
#ifdef USE_SPEAKER
|
||||||
if (this->speaker_ != nullptr) {
|
if (this->speaker_ != nullptr) {
|
||||||
flags |= VoiceAssistantFeature::FEATURE_SPEAKER;
|
flags |= VoiceAssistantFeature::FEATURE_SPEAKER;
|
||||||
flags |= VoiceAssistantFeature::FEATURE_API_AUDIO;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return flags;
|
return flags;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Constants used by esphome."""
|
"""Constants used by esphome."""
|
||||||
|
|
||||||
__version__ = "2024.5.0b3"
|
__version__ = "2024.5.0b4"
|
||||||
|
|
||||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
VALID_SUBSTITUTIONS_CHARACTERS = (
|
VALID_SUBSTITUTIONS_CHARACTERS = (
|
||||||
|
|
|
@ -394,7 +394,7 @@ async def to_code(config):
|
||||||
if project_conf := config.get(CONF_PROJECT):
|
if project_conf := config.get(CONF_PROJECT):
|
||||||
cg.add_define("ESPHOME_PROJECT_NAME", project_conf[CONF_NAME])
|
cg.add_define("ESPHOME_PROJECT_NAME", project_conf[CONF_NAME])
|
||||||
cg.add_define("ESPHOME_PROJECT_VERSION", project_conf[CONF_VERSION])
|
cg.add_define("ESPHOME_PROJECT_VERSION", project_conf[CONF_VERSION])
|
||||||
cg.add_define("ESPHOME_PROJECT_VERSION_30", project_conf[CONF_VERSION][:30])
|
cg.add_define("ESPHOME_PROJECT_VERSION_30", project_conf[CONF_VERSION][:29])
|
||||||
for conf in project_conf.get(CONF_ON_UPDATE, []):
|
for conf in project_conf.get(CONF_ON_UPDATE, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID])
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID])
|
||||||
await cg.register_component(trigger, conf)
|
await cg.register_component(trigger, conf)
|
||||||
|
|
|
@ -9,7 +9,7 @@ tornado==6.4
|
||||||
tzlocal==5.2 # from time
|
tzlocal==5.2 # from time
|
||||||
tzdata>=2021.1 # from time
|
tzdata>=2021.1 # from time
|
||||||
pyserial==3.5
|
pyserial==3.5
|
||||||
platformio==6.1.13 # When updating platformio, also update Dockerfile
|
platformio==6.1.15 # When updating platformio, also update Dockerfile
|
||||||
esptool==4.7.0
|
esptool==4.7.0
|
||||||
click==8.1.7
|
click==8.1.7
|
||||||
esphome-dashboard==20240412.0
|
esphome-dashboard==20240412.0
|
||||||
|
|
Loading…
Reference in a new issue