mirror of
https://github.com/esphome/esphome.git
synced 2024-09-20 01:27:31 +02:00
clang-format
This commit is contained in:
parent
0c56fccb90
commit
72e5d514d7
1 changed files with 4 additions and 6 deletions
|
@ -66,16 +66,15 @@ uint16_t shelly_dimmer_checksum(const uint8_t *buf, int len) {
|
||||||
|
|
||||||
bool ShellyDimmer::is_running_configured_version() const {
|
bool ShellyDimmer::is_running_configured_version() const {
|
||||||
return this->version_major_ == USE_SHD_FIRMWARE_MAJOR_VERSION &&
|
return this->version_major_ == USE_SHD_FIRMWARE_MAJOR_VERSION &&
|
||||||
this->version_minor_ == USE_SHD_FIRMWARE_MINOR_VERSION;
|
this->version_minor_ == USE_SHD_FIRMWARE_MINOR_VERSION;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellyDimmer::handle_firmware() {
|
void ShellyDimmer::handle_firmware() {
|
||||||
// Reset the STM32 and check the firmware version.
|
// Reset the STM32 and check the firmware version.
|
||||||
this->reset_normal_boot_();
|
this->reset_normal_boot_();
|
||||||
this->send_command_(SHELLY_DIMMER_PROTO_CMD_VERSION, nullptr, 0);
|
this->send_command_(SHELLY_DIMMER_PROTO_CMD_VERSION, nullptr, 0);
|
||||||
ESP_LOGI(TAG, "STM32 current firmware version: %d.%d, desired version: %d.%d", this->version_major_,
|
ESP_LOGI(TAG, "STM32 current firmware version: %d.%d, desired version: %d.%d", this->version_major_,
|
||||||
this->version_minor_, USE_SHD_FIRMWARE_MAJOR_VERSION, USE_SHD_FIRMWARE_MINOR_VERSION);
|
this->version_minor_, USE_SHD_FIRMWARE_MAJOR_VERSION, USE_SHD_FIRMWARE_MINOR_VERSION);
|
||||||
|
|
||||||
if (!is_running_configured_version()) {
|
if (!is_running_configured_version()) {
|
||||||
#ifdef USE_SHD_FIRMWARE_DATA
|
#ifdef USE_SHD_FIRMWARE_DATA
|
||||||
|
@ -88,7 +87,7 @@ void ShellyDimmer::handle_firmware() {
|
||||||
this->reset_normal_boot_();
|
this->reset_normal_boot_();
|
||||||
this->send_command_(SHELLY_DIMMER_PROTO_CMD_VERSION, nullptr, 0);
|
this->send_command_(SHELLY_DIMMER_PROTO_CMD_VERSION, nullptr, 0);
|
||||||
if (!is_running_configured_version()) {
|
if (!is_running_configured_version()) {
|
||||||
ESP_LOGE(TAG, "STM32 firmware upgrade already performed, but version is still incorrect");
|
ESP_LOGE(TAG, "STM32 firmware upgrade already performed, but version is still incorrect");
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +103,6 @@ void ShellyDimmer::setup() {
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Initializing Shelly Dimmer...");
|
ESP_LOGI(TAG, "Initializing Shelly Dimmer...");
|
||||||
|
|
||||||
|
|
||||||
this->handle_firmware();
|
this->handle_firmware();
|
||||||
|
|
||||||
this->send_settings_();
|
this->send_settings_();
|
||||||
|
|
Loading…
Reference in a new issue