mirror of
https://github.com/esphome/esphome.git
synced 2025-03-14 06:38:17 +00:00
fix: optimize lamp inclusion check in read_timers_to_log method of DynamicLampComponent
This commit is contained in:
parent
55fc652cd5
commit
5abdff81c1
@ -328,7 +328,14 @@ void DynamicLampComponent::read_timers_to_log() {
|
||||
this->fram_->read((0x4000 + (i * 64)), reinterpret_cast<unsigned char *>(&timer), 64);
|
||||
std::string lamp_names_str = "";
|
||||
for (uint8_t j = 0; j < 16; j++) {
|
||||
bool lamp_included = static_cast<bool>(timer.lamp_list[j / 8] & (1 << (j % 8)));
|
||||
uint8_t k = 0;
|
||||
uint8_t l = j;
|
||||
if (j > 7) {
|
||||
k = 1;
|
||||
l = j - 8;
|
||||
}
|
||||
//bool lamp_included = static_cast<bool>(timer.lamp_list[j / 8] & (1 << (j % 8)));
|
||||
bool lamp_included = static_cast<bool>(timer.lamp_list[k] & (1 << l));
|
||||
if (lamp_included == true && this->active_lamps_[j].active == true) {
|
||||
if (lamp_names_str.length() > 0) {
|
||||
lamp_names_str += ", ";
|
||||
|
Loading…
x
Reference in New Issue
Block a user