1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-30 00:52:20 +01:00

Avoid non-const globals and enable clang-tidy check (#1892)

This commit is contained in:
Stefan Agner
2021-06-10 22:19:44 +02:00
committed by GitHub
parent 360effcb72
commit 501f88ca86
376 changed files with 466 additions and 468 deletions

View File

@@ -39,14 +39,14 @@ class ESPPreferenceObject {
#ifdef ARDUINO_ARCH_ESP8266
#ifdef USE_ESP8266_PREFERENCES_FLASH
static bool DEFAULT_IN_FLASH = true;
static const bool DEFAULT_IN_FLASH = true;
#else
static bool DEFAULT_IN_FLASH = false;
static const bool DEFAULT_IN_FLASH = false;
#endif
#endif
#ifdef ARDUINO_ARCH_ESP32
static bool DEFAULT_IN_FLASH = true;
static const bool DEFAULT_IN_FLASH = true;
#endif
class ESPPreferences {
@@ -83,7 +83,7 @@ class ESPPreferences {
#endif
};
extern ESPPreferences global_preferences;
extern ESPPreferences global_preferences; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
template<typename T> ESPPreferenceObject ESPPreferences::make_preference(uint32_t type, bool in_flash) {
return this->make_preference((sizeof(T) + 3) / 4, type, in_flash);