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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user