mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 09:18:00 +01:00
Fixes for CLANG-FORMAT + added Code owner
This commit is contained in:
parent
d2f656ed13
commit
4fbe82a504
6 changed files with 91 additions and 128 deletions
|
@ -91,6 +91,7 @@ esphome/components/dht/* @OttoWinter
|
|||
esphome/components/display_menu_base/* @numo68
|
||||
esphome/components/dps310/* @kbx81
|
||||
esphome/components/ds1307/* @badbadc0ffee
|
||||
esphome/components/ds3232/* @ViKozh
|
||||
esphome/components/dsmr/* @glmnet @zuidwijk
|
||||
esphome/components/duty_time/* @dudanov
|
||||
esphome/components/ee895/* @Stock-M
|
||||
|
|
|
@ -89,7 +89,7 @@ void DS3232Component::setup() {
|
|||
|
||||
|
||||
void DS3232Component::update() {
|
||||
if(this->late_startup_)
|
||||
if (this->late_startup_)
|
||||
return;
|
||||
this->read_time();
|
||||
this->read_temperature_();
|
||||
|
@ -103,12 +103,11 @@ float DS3232Component::get_setup_priority() const { return setup_priority::DATA
|
|||
|
||||
void DS3232Component::reinit_osf_() {
|
||||
this->read_data_();
|
||||
if(!this->reg_data_.reg.osf_bit)
|
||||
if (!this->reg_data_.reg.osf_bit)
|
||||
return;
|
||||
ESP_LOGD(TAG, "Found disabled oscillator. Restarting it.");
|
||||
this->reg_data_.reg.osf_bit = false;
|
||||
if(!this->write_byte(I2C_REG_STATUS, this->reg_data_.raw_blocks.status_raw[0]))
|
||||
{
|
||||
if (!this->write_byte(I2C_REG_STATUS, this->reg_data_.raw_blocks.status_raw[0])) {
|
||||
ESP_LOGE(TAG, "Unable to restart oscillator.");
|
||||
return;
|
||||
}
|
||||
|
@ -165,21 +164,19 @@ void DS3232Component::loop() {
|
|||
}
|
||||
this->pin_state_ = pin_state;
|
||||
}
|
||||
switch (this->nvram_state_)
|
||||
{
|
||||
switch (this->nvram_state_) {
|
||||
case DS3232NVRAMState::NEED_INITIALIZATION:
|
||||
if(this->busy_) {
|
||||
if (this->busy_) {
|
||||
ESP_LOGI(TAG, "Performing planned NVRAM full reset...");
|
||||
clear_nvram_();
|
||||
}
|
||||
break;
|
||||
case DS3232NVRAMState::NEED_RESET:
|
||||
if(this->busy_) {
|
||||
if (this->busy_) {
|
||||
ESP_LOGI(TAG, "Performing planned NVRAM factory reset...");
|
||||
this->nvram_state_ = DS3232NVRAMState::OK;
|
||||
this->variable_init_callback_.call();
|
||||
if(this->nvram_state_ != DS3232NVRAMState::OK)
|
||||
{
|
||||
if (this->nvram_state_ != DS3232NVRAMState::OK) {
|
||||
ESP_LOGE(TAG, "NVRAM: Failed to reset to factory defaults.");
|
||||
}
|
||||
this->busy_ = false;
|
||||
|
@ -212,10 +209,9 @@ void DS3232Component::clear_nvram_() {
|
|||
std::vector<uint8_t> zeroes;
|
||||
zeroes.resize(write_len_, 0);
|
||||
|
||||
while (step < total_size)
|
||||
{
|
||||
while (step < total_size) {
|
||||
bool res = false;
|
||||
if((total_size - step) < write_len) {
|
||||
if ((total_size - step) < write_len) {
|
||||
res_ = this->write_bytes(MIN_NVRAM_ADDRESS + step_, zeroes.data(), total_size - step_);
|
||||
step += (total_size - step);
|
||||
} else {
|
||||
|
@ -226,8 +222,7 @@ void DS3232Component::clear_nvram_() {
|
|||
state &= res;
|
||||
}
|
||||
|
||||
if(!state)
|
||||
{
|
||||
if (!state) {
|
||||
ESP_LOGE(TAG, "NVRAM: Unable to clear memory. Marking as failed.");
|
||||
this->nvram_state_ = DS3232NVRAMState::FAIL;
|
||||
} else {
|
||||
|
@ -237,8 +232,7 @@ void DS3232Component::clear_nvram_() {
|
|||
this->nvram_info_.info.is_initialized = false;
|
||||
this->nvram_info_.info.maj_version = NVRAM_DATA_MAJ_VERSION;
|
||||
this->nvram_info_.info.min_version = NVRAM_DATA_MIN_VERSION;
|
||||
if(!this->write_bytes(SVC_NVRAM_ADDRESS, this->nvram_info_.raw, sizeof(this->nvram_info_.raw)))
|
||||
{
|
||||
if (!this->write_bytes(SVC_NVRAM_ADDRESS, this->nvram_info_.raw, sizeof(this->nvram_info_.raw))) {
|
||||
ESP_LOGE(TAG, "NVRAM: Unable to write service NVRAM information. Marking as failed.");
|
||||
this->nvram_state_ = DS3232NVRAMState::FAIL;
|
||||
}
|
||||
|
@ -247,8 +241,7 @@ void DS3232Component::clear_nvram_() {
|
|||
ESP_LOGD(TAG, "NVRAM: Variables has been initialized. Saving state.");
|
||||
|
||||
this->nvram_info_.info.is_initialized = true;
|
||||
if(!this->write_bytes(SVC_NVRAM_ADDRESS, this->nvram_info_.raw, sizeof(this->nvram_info_.raw)))
|
||||
{
|
||||
if (!this->write_bytes(SVC_NVRAM_ADDRESS, this->nvram_info_.raw, sizeof(this->nvram_info_.raw))) {
|
||||
ESP_LOGE(TAG, "NVRAM: Unable to write service NVRAM information. Marking as failed.");
|
||||
this->nvram_state_ = DS3232NVRAMState::FAIL;
|
||||
}
|
||||
|
@ -267,7 +260,7 @@ bool DS3232Component::validate_mem_(uint8_t reg_id, uint8_t size, bool ignore_em
|
|||
}
|
||||
|
||||
void DS3232Component::reset_memory() {
|
||||
if(this->nvram_state_ == DS3232NVRAMState::INITIALIZATION) {
|
||||
if (this->nvram_state_ == DS3232NVRAMState::INITIALIZATION) {
|
||||
ESP_LOGW(TAG, "NVRAM: Another memory reset process in progress already.");
|
||||
return;
|
||||
}
|
||||
|
@ -276,7 +269,7 @@ void DS3232Component::reset_memory() {
|
|||
}
|
||||
|
||||
void DS3232Component::reset_to_factory() {
|
||||
if(this->nvram_state_ == DS3232NVRAMState::INITIALIZATION) {
|
||||
if (this->nvram_state_ == DS3232NVRAMState::INITIALIZATION) {
|
||||
ESP_LOGW(TAG, "NVRAM: Another memory reset process in progress already.");
|
||||
return;
|
||||
}
|
||||
|
@ -285,11 +278,11 @@ void DS3232Component::reset_to_factory() {
|
|||
}
|
||||
|
||||
bool DS3232Component::read_memory(uint8_t reg_id, std::vector<uint8_t> &data) {
|
||||
if(this->nvram_state_ == DS3232NVRAMState::INITIALIZATION) {
|
||||
if (this->nvram_state_ == DS3232NVRAMState::INITIALIZATION) {
|
||||
ESP_LOGW(TAG, "NVRAM: Memory reset process in progress. Try later.");
|
||||
return false;
|
||||
}
|
||||
if(data.size() == 0) {
|
||||
if (data.size() == 0) {
|
||||
ESP_LOGW(TAG, "NVRAM: Nothing to write to memory.");
|
||||
return true;
|
||||
}
|
||||
|
@ -297,7 +290,7 @@ bool DS3232Component::read_memory(uint8_t reg_id, std::vector<uint8_t> &data) {
|
|||
ESP_LOGE(TAG, "Invalid NVRAM memory mapping.");
|
||||
return false;
|
||||
} else {
|
||||
if(!this->read_bytes(reg_id, data.data(), data.size())) {
|
||||
if (!this->read_bytes(reg_id, data.data(), data.size())) {
|
||||
ESP_LOGE(TAG, "NVRAM: Unable to read from %#02x register with size %u.", reg_id, data.size());
|
||||
this->nvram_state_ = DS3232NVRAMState::FAIL;
|
||||
return false;
|
||||
|
@ -307,26 +300,23 @@ bool DS3232Component::read_memory(uint8_t reg_id, std::vector<uint8_t> &data) {
|
|||
}
|
||||
}
|
||||
|
||||
bool DS3232Component::write_memory(const uint8_t reg_id, const std::vector<uint8_t> &data)
|
||||
{
|
||||
if(data.size() == 0) {
|
||||
bool DS3232Component::write_memory(const uint8_t reg_id, const std::vector<uint8_t> &data) {
|
||||
if (data.size() == 0) {
|
||||
ESP_LOGW(TAG, "NVRAM: Nothing to write to memory.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if(this->nvram_state_ == DS3232NVRAMState::INITIALIZATION) {
|
||||
if (this->nvram_state_ == DS3232NVRAMState::INITIALIZATION) {
|
||||
ESP_LOGW(TAG, "NVRAM: Memory reset process in progress. Try later.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!this->validate_mem_(reg_id, data.size(), true))
|
||||
{
|
||||
if (!this->validate_mem_(reg_id, data.size(), true)) {
|
||||
ESP_LOGE(TAG, "Invalid NVRAM memory mapping.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!this->write_bytes(reg_id, data))
|
||||
{
|
||||
if (!this->write_bytes(reg_id, data)) {
|
||||
ESP_LOGE(TAG, "NVRAM: Unable to write to %#02x register with size %u.", reg_id, data.size());
|
||||
this->nvram_state_ = DS3232NVRAMState::FAIL;
|
||||
return false;
|
||||
|
@ -481,11 +471,8 @@ ds3232_alarm::DS3232Alarm DS3232Component::get_alarm_one() {
|
|||
ds3232_alarm::DS3232Alarm alarm = {};
|
||||
alarm.enabled = reg_data_.reg.alarm_1_enable;
|
||||
alarm.seconds_supported = true;
|
||||
alarm.mode = ds3232_alarm::DS3232Alarm::alarm_mode(
|
||||
reg_data_.reg.alarm_1_mode_1,
|
||||
reg_data_.reg.alarm_1_mode_2,
|
||||
reg_data_.reg.alarm_1_mode_3,
|
||||
reg_data_.reg.alarm_1_mode_4,
|
||||
alarm.mode = ds3232_alarm::DS3232Alarm::alarm_mode(reg_data_.reg.alarm_1_mode_1, reg_data_.reg.alarm_1_mode_2,
|
||||
reg_data_.reg.alarm_1_mode_3, reg_data_.reg.alarm_1_mode_4,
|
||||
reg_data_.reg.alarm_1_use_day_of_week);
|
||||
alarm.second = reg_data_.reg.alarm_1_second + 10u * reg_data_.reg.alarm_1_second_10;
|
||||
alarm.minute = reg_data_.reg.alarm_1_minute + 10u * reg_data_.reg.alarm_1_minute_10;
|
||||
|
@ -508,12 +495,9 @@ ds3232_alarm::DS3232Alarm DS3232Component::get_alarm_two() {
|
|||
ds3232_alarm::DS3232Alarm alarm = {};
|
||||
alarm.enabled = reg_data_.reg.alarm_2_enable;
|
||||
alarm.seconds_supported = false;
|
||||
alarm.mode = ds3232_alarm::DS3232Alarm::alarm_mode(
|
||||
false,
|
||||
reg_data_.reg.alarm_2_mode_2,
|
||||
reg_data_.reg.alarm_2_mode_3,
|
||||
reg_data_.reg.alarm_2_mode_4,
|
||||
reg_data_.reg.alarm_2_use_day_of_week);
|
||||
alarm.mode =
|
||||
ds3232_alarm::DS3232Alarm::alarm_mode(false, reg_data_.reg.alarm_2_mode_2, reg_data_.reg.alarm_2_mode_3,
|
||||
reg_data_.reg.alarm_2_mode_4, reg_data_.reg.alarm_2_use_day_of_week);
|
||||
alarm.second = 0;
|
||||
alarm.minute = reg_data_.reg.alarm_2_minute + 10u * reg_data_.reg.alarm_2_minute_10;
|
||||
alarm.hour = reg_data_.reg.alarm_2_hour + 10u * reg_data_.reg.alarm_2_hour_10;
|
||||
|
|
|
@ -111,8 +111,12 @@ class DS3232Component : public time::RealTimeClock, public i2c::I2CDevice {
|
|||
void add_on_power_change_callback(std::function<void(DS3232PowerState)> &&func) {
|
||||
this->power_state_callback_.add(std::move(func));
|
||||
}
|
||||
void add_on_variable_init_required_callback(std::function<void()> &&func) { this->variable_init_callback_.add(std::move(func)); }
|
||||
void add_on_variable_fail_callback(std::function<void()> &&func) { this->variable_fail_callback_.add(std::move(func)); }
|
||||
void add_on_variable_init_required_callback(std::function<void()> &&func) {
|
||||
this->variable_init_callback_.add(std::move(func));
|
||||
}
|
||||
void add_on_variable_fail_callback(std::function<void()> &&func) {
|
||||
this->variable_fail_callback_.add(std::move(func));
|
||||
}
|
||||
bool read_memory(uint8_t reg_id, std::vector<uint8_t> &data);
|
||||
bool write_memory(uint8_t reg_id, const std::vector<uint8_t> &data);
|
||||
bool is_valid_nvram(const uint8_t reg_id, uint8_t size) { return this->validate_mem_(reg_id, size, true); }
|
||||
|
@ -151,9 +155,9 @@ class DS3232Component : public time::RealTimeClock, public i2c::I2CDevice {
|
|||
|
||||
union DS3232NVRAMData {
|
||||
struct {
|
||||
uint8_t magix_1 : 2; //Always should be 0b11;
|
||||
uint8_t magix_2 : 6; //Always should be 'E' char.
|
||||
bool is_initialized : 1; //If set to 1 then it means that nvram has initialized values.
|
||||
uint8_t magix_1 : 2; // Always should be 0b11;
|
||||
uint8_t magix_2 : 6; // Always should be 'E' char.
|
||||
bool is_initialized : 1; // If set to 1 then it means that nvram has initialized values.
|
||||
uint8_t min_version : 3;
|
||||
uint8_t maj_version : 4;
|
||||
} info;
|
||||
|
|
|
@ -32,13 +32,6 @@ static const char *const FORMAT_STRING_INVALID = INVALID;
|
|||
// So, the recommended formatted_string length initialization: 128 symbols (35 * 3 (105) growed to 2^x(128))
|
||||
static const size_t DS3232_ALARM_FORMAT_STRING_LENGTH = 128;
|
||||
|
||||
/// Converts alarm match bits to mode
|
||||
// static AlarmMode bits_to_mode(bool use_week, bool match_day, bool match_hour, bool match_min, bool match_sec = false) {
|
||||
// uint8_t mode_bits =
|
||||
// 0x00001 * match_sec + 0x00010 * match_min + 0x00100 * match_hour + 0x01000 * match_day + 0x10000 * use_week;
|
||||
// return static_cast<AlarmMode>(mode_bits);
|
||||
// };
|
||||
|
||||
DS3232AlarmMode DS3232Alarm::alarm_mode(const AlarmMode mode) {
|
||||
DS3232AlarmMode am = {};
|
||||
am.alarm_mode = mode;
|
||||
|
@ -48,10 +41,10 @@ DS3232AlarmMode DS3232Alarm::alarm_mode(const AlarmMode mode) {
|
|||
DS3232AlarmMode DS3232Alarm::alarm_mode(const bool bit_seconds, const bool bit_minutes, const bool bit_hours,
|
||||
const bool bit_days, const bool use_weekdays) {
|
||||
bool weekdays_bit = use_weekdays && !(bit_seconds || bit_minutes || bit_hours);
|
||||
uint8_t mode_bits = 0b00001 * bit_seconds + 0b00010 * bit_minutes + 0b00100 * bit_hours + 0b01000 * bit_days +
|
||||
0b10000 * weekdays_bit;
|
||||
ESP_LOGVV(TAG, "Converted alarm mode from %.1u, %.1u, %.1u, %.1u, %.1u to bits %.2u",
|
||||
bit_seconds, bit_minutes, bit_hours, bit_days, use_weekdays, mode_bits);
|
||||
uint8_t mode_bits =
|
||||
0b00001 * bit_seconds + 0b00010 * bit_minutes + 0b00100 * bit_hours + 0b01000 * bit_days + 0b10000 * weekdays_bit;
|
||||
ESP_LOGVV(TAG, "Converted alarm mode from %.1u, %.1u, %.1u, %.1u, %.1u to bits %.2u", bit_seconds, bit_minutes,
|
||||
bit_hours, bit_days, use_weekdays, mode_bits);
|
||||
return DS3232Alarm::alarm_mode(static_cast<AlarmMode>(mode_bits));
|
||||
};
|
||||
|
||||
|
@ -66,21 +59,9 @@ bool DS3232Alarm::is_valid() const {
|
|||
}
|
||||
|
||||
DS3232Alarm DS3232Alarm::create(const bool is_enabled, const DS3232AlarmMode mode, const bool use_weekdays,
|
||||
const uint8_t day, const uint8_t hour, const uint8_t minute,
|
||||
const uint8_t second, const bool is_fired,
|
||||
const bool is_seconds_supported)
|
||||
{
|
||||
const uint8_t day, const uint8_t hour, const uint8_t minute, const uint8_t second,
|
||||
const bool is_fired, const bool is_seconds_supported) {
|
||||
DS3232Alarm alarm = {};
|
||||
// .enabled = is_enabled,
|
||||
// .seconds_supported = is_seconds_supported,
|
||||
// .mode = mode,
|
||||
// .second = second,
|
||||
// .minute = minute,
|
||||
// .hour = hour,
|
||||
// .day_of_week = (use_weekdays ? day : 1),
|
||||
// .day_of_month = (use_weekdays ? 1 : day),
|
||||
// .is_fired = is_fired
|
||||
// };
|
||||
ESP_LOGVV(TAG, "Initializing new instance of alarm:");
|
||||
alarm.enabled = is_enabled;
|
||||
ESP_LOGVV(TAG, " Alarm state: %s", ONOFF(alarm.enabled));
|
||||
|
@ -125,8 +106,7 @@ std::string DS3232Alarm::to_string() const {
|
|||
return std::string(formatted_string);
|
||||
case AlarmMode::MATCH_MINUTES_SECONDS:
|
||||
case 28:
|
||||
len =
|
||||
snprintf(formatted_string, sizeof(formatted_string), FORMAT_STRING_EVERY_HOUR, this->minute, this->second);
|
||||
len = snprintf(formatted_string, sizeof(formatted_string), FORMAT_STRING_EVERY_HOUR, this->minute, this->second);
|
||||
if (len < 0) {
|
||||
ESP_LOGE(TAG, "Unable to format alarm data.");
|
||||
return std::string(INVALID);
|
||||
|
|
|
@ -90,20 +90,18 @@ struct DS3232Alarm {
|
|||
|
||||
/// Formats alarm into human-readable text.
|
||||
/// @return Textual description of alarm.
|
||||
std::string to_string() const;
|
||||
std::string to_string() const;
|
||||
|
||||
/// @brief Sets target alarm mode
|
||||
/// @param target_mode Mode of alarm to set
|
||||
void set_mode(AlarmMode target_mode) { mode.alarm_mode = target_mode; }
|
||||
|
||||
static DS3232AlarmMode alarm_mode(AlarmMode mode);
|
||||
static DS3232AlarmMode alarm_mode(bool bit_seconds = false, bool bit_minutes = false,
|
||||
bool bit_hours = false, bool bit_days = false,
|
||||
bool use_weekdays = false);
|
||||
static DS3232AlarmMode alarm_mode(AlarmMode mode);
|
||||
static DS3232AlarmMode alarm_mode(bool bit_seconds = false, bool bit_minutes = false, bool bit_hours = false,
|
||||
bool bit_days = false, bool use_weekdays = false);
|
||||
|
||||
static DS3232Alarm create(bool is_enabled, DS3232AlarmMode mode, bool use_weekdays = true,
|
||||
uint8_t day = 1, uint8_t hour = 0, uint8_t minute = 0,
|
||||
uint8_t second = 0, bool is_fired = false,
|
||||
static DS3232Alarm create(bool is_enabled, DS3232AlarmMode mode, bool use_weekdays = true, uint8_t day = 1,
|
||||
uint8_t hour = 0, uint8_t minute = 0, uint8_t second = 0, bool is_fired = false,
|
||||
bool is_seconds_supported = false);
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@ template<typename T> class DS3232Variable : public Component {
|
|||
parent_ = parent;
|
||||
}
|
||||
|
||||
explicit DS3232Variable(DS3232Component *parent, const uint8_t reg_id, T initial_value) : initial_value_(initial_value) {
|
||||
explicit DS3232Variable(DS3232Component *parent, const uint8_t reg_id, T initial_value)
|
||||
: initial_value_(initial_value) {
|
||||
reg_ = reg_id;
|
||||
parent_ = parent;
|
||||
}
|
||||
|
@ -48,33 +49,32 @@ template<typename T> class DS3232Variable : public Component {
|
|||
|
||||
DS3232NVRAMState nvram_state_ = this->parent_->get_nvram_state();
|
||||
|
||||
while(nvram_state_ != DS3232NVRAMState::OK)
|
||||
{
|
||||
if(nvram_state_ == DS3232NVRAMState::FAIL)
|
||||
{
|
||||
while (nvram_state_ != DS3232NVRAMState::OK) {
|
||||
if (nvram_state_ == DS3232NVRAMState::FAIL) {
|
||||
this->log_error_("Unable to init with failed NVRAM.");
|
||||
this->mark_failed();
|
||||
break;
|
||||
}
|
||||
if(nvram_state_ == DS3232NVRAMState::NEED_RESET)
|
||||
{
|
||||
if (nvram_state_ == DS3232NVRAMState::NEED_RESET) {
|
||||
this->set_to_default_();
|
||||
}
|
||||
delay_microseconds_safe(10);
|
||||
nvram_state_ = this->parent_->get_nvram_state();
|
||||
}
|
||||
|
||||
if(!this->try_read_()) {
|
||||
if (!this->try_read_()) {
|
||||
this->mark_failed_();
|
||||
} else {
|
||||
this->is_initialized_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
float get_setup_priority() const override { return this->parent_->get_setup_priority() - 0.5f; } //Ensure that variables will be initialized after ds3232 component.
|
||||
float get_setup_priority() const override {
|
||||
return this->parent_->get_setup_priority() - 0.5f;
|
||||
} // Ensure that variables will be initialized after ds3232 component.
|
||||
|
||||
void loop() override {
|
||||
if(!this->try_write_())
|
||||
if (!this->try_write_())
|
||||
this->mark_failed_();
|
||||
}
|
||||
|
||||
|
@ -92,14 +92,14 @@ template<typename T> class DS3232Variable : public Component {
|
|||
bool is_initialized_{false};
|
||||
std::va_list llist_{};
|
||||
|
||||
void log_error_(const char* log_str) {
|
||||
#ifdef USE_LOGGER
|
||||
void log_error_(const char *log_str) {
|
||||
#ifdef USE_LOGGER
|
||||
auto *log = logger::global_logger;
|
||||
if (log == nullptr)
|
||||
return;
|
||||
|
||||
log->log_vprintf_(ESPHOME_LOG_LEVEL_ERROR, TAG, __LINE__, log_str, this->llist_);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void mark_failed_() {
|
||||
|
@ -113,8 +113,7 @@ template<typename T> class DS3232Variable : public Component {
|
|||
std::vector<uint8_t> buffer;
|
||||
buffer.resize(sizeof(T));
|
||||
memcpy(buffer.data(), &this->initial_value_, sizeof(T));
|
||||
if(!this->parent_->write_memory(this->reg_, buffer))
|
||||
{
|
||||
if (!this->parent_->write_memory(this->reg_, buffer)) {
|
||||
this->mark_failed_();
|
||||
} else {
|
||||
memcpy(&this->value_, &this->initial_value_, sizeof(T));
|
||||
|
@ -153,8 +152,7 @@ template<typename T> class DS3232Variable : public Component {
|
|||
this->log_error_("No crystal defined. Read from NVRAM failed.");
|
||||
return false;
|
||||
}
|
||||
if (this->parent_->get_nvram_state() != ds3232::DS3232NVRAMState::OK)
|
||||
{
|
||||
if (this->parent_->get_nvram_state() != ds3232::DS3232NVRAMState::OK) {
|
||||
this->log_error_("Invalid NVRAM state. Unable to read data.");
|
||||
return false;
|
||||
}
|
||||
|
@ -185,9 +183,7 @@ template<class C, typename... Ts> class DS3232VariableSetAction : public Action<
|
|||
|
||||
TEMPLATABLE_VALUE(T, value);
|
||||
|
||||
void play(Ts... x) override {
|
||||
this->parent_->value() = this->value_.value(x...);
|
||||
}
|
||||
void play(Ts... x) override { this->parent_->value() = this->value_.value(x...); }
|
||||
|
||||
protected:
|
||||
C *parent_;
|
||||
|
|
Loading…
Reference in a new issue