mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 08:55:22 +01:00
Fix ESP8266 climate memaccess warning (#3226)
This commit is contained in:
parent
d594f43ebd
commit
0c1520dd9c
1 changed files with 6 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
#include "climate.h"
|
#include "climate.h"
|
||||||
|
#include "esphome/core/macros.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace climate {
|
namespace climate {
|
||||||
|
@ -326,14 +327,17 @@ optional<ClimateDeviceRestoreState> Climate::restore_state_() {
|
||||||
return recovered;
|
return recovered;
|
||||||
}
|
}
|
||||||
void Climate::save_state_() {
|
void Climate::save_state_() {
|
||||||
#if defined(USE_ESP_IDF) && !defined(CLANG_TIDY)
|
#if (defined(USE_ESP_IDF) || (defined(USE_ESP8266) && USE_ARDUINO_VERSION_CODE >= VERSION_CODE(3, 0, 0))) && \
|
||||||
|
!defined(CLANG_TIDY)
|
||||||
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||||
|
#define TEMP_IGNORE_MEMACCESS
|
||||||
#endif
|
#endif
|
||||||
ClimateDeviceRestoreState state{};
|
ClimateDeviceRestoreState state{};
|
||||||
// initialize as zero to prevent random data on stack triggering erase
|
// initialize as zero to prevent random data on stack triggering erase
|
||||||
memset(&state, 0, sizeof(ClimateDeviceRestoreState));
|
memset(&state, 0, sizeof(ClimateDeviceRestoreState));
|
||||||
#if USE_ESP_IDF && !defined(CLANG_TIDY)
|
#ifdef TEMP_IGNORE_MEMACCESS
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
#undef TEMP_IGNORE_MEMACCESS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
state.mode = this->mode;
|
state.mode = this->mode;
|
||||||
|
|
Loading…
Reference in a new issue