[code-quality] fix clang-tidy network (#7266)

This commit is contained in:
tomaszduda23 2024-08-13 21:48:27 +02:00 committed by GitHub
parent c9979ad90c
commit b082a64d32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 2 deletions

View file

@ -32,6 +32,7 @@ CONFIG_SCHEMA = cv.Schema(
async def to_code(config): async def to_code(config):
cg.add_define("USE_NETWORK")
if (enable_ipv6 := config.get(CONF_ENABLE_IPV6, None)) is not None: if (enable_ipv6 := config.get(CONF_ENABLE_IPV6, None)) is not None:
cg.add_define("USE_NETWORK_IPV6", enable_ipv6) cg.add_define("USE_NETWORK_IPV6", enable_ipv6)
if enable_ipv6: if enable_ipv6:

View file

@ -1,4 +1,6 @@
#pragma once #pragma once
#include "esphome/core/defines.h"
#ifdef USE_NETWORK
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include <cstdio> #include <cstdio>
@ -140,3 +142,4 @@ using IPAddresses = std::array<IPAddress, 5>;
} // namespace network } // namespace network
} // namespace esphome } // namespace esphome
#endif

View file

@ -1,6 +1,6 @@
#include "util.h" #include "util.h"
#include "esphome/core/defines.h" #include "esphome/core/defines.h"
#ifdef USE_NETWORK
#ifdef USE_WIFI #ifdef USE_WIFI
#include "esphome/components/wifi/wifi_component.h" #include "esphome/components/wifi/wifi_component.h"
#endif #endif
@ -63,3 +63,4 @@ std::string get_use_address() {
} // namespace network } // namespace network
} // namespace esphome } // namespace esphome
#endif

View file

@ -1,5 +1,6 @@
#pragma once #pragma once
#include "esphome/core/defines.h"
#ifdef USE_NETWORK
#include <string> #include <string>
#include "ip_address.h" #include "ip_address.h"
@ -16,3 +17,4 @@ IPAddresses get_ip_addresses();
} // namespace network } // namespace network
} // namespace esphome } // namespace esphome
#endif

View file

@ -51,6 +51,7 @@
#define USE_MDNS #define USE_MDNS
#define USE_MEDIA_PLAYER #define USE_MEDIA_PLAYER
#define USE_MQTT #define USE_MQTT
#define USE_NETWORK
#define USE_NEXTION_TFT_UPLOAD #define USE_NEXTION_TFT_UPLOAD
#define USE_NUMBER #define USE_NUMBER
#define USE_ONLINE_IMAGE_PNG_SUPPORT #define USE_ONLINE_IMAGE_PNG_SUPPORT