Commit 6c4ef5bf authored by Eric Duminil's avatar Eric Duminil
Browse files

Wifi.h only where needed.

parent f8b87cdb
Pipeline #5742 canceled with stage
...@@ -7,6 +7,12 @@ ...@@ -7,6 +7,12 @@
#include "wifi_util.h" #include "wifi_util.h"
#include "src/lib/PubSubClient/src/PubSubClient.h" #include "src/lib/PubSubClient/src/PubSubClient.h"
#if defined(ESP8266)
# include <ESP8266WiFi.h>
#elif defined(ESP32)
# include <WiFi.h>
#endif
namespace config { namespace config {
// Values should be defined in config.h // Values should be defined in config.h
uint16_t mqtt_sending_interval = MQTT_SENDING_INTERVAL; // [s] uint16_t mqtt_sending_interval = MQTT_SENDING_INTERVAL; // [s]
......
...@@ -11,6 +11,7 @@ namespace config { ...@@ -11,6 +11,7 @@ namespace config {
} }
#if defined(ESP8266) #if defined(ESP8266)
# include <ESP8266WiFi.h> // required to get MAC address
const char *current_board = "ESP8266"; const char *current_board = "ESP8266";
# if !defined(AMPEL_WIFI) # if !defined(AMPEL_WIFI)
void preinit() { void preinit() {
...@@ -20,6 +21,7 @@ void preinit() { ...@@ -20,6 +21,7 @@ void preinit() {
} }
# endif # endif
#elif defined(ESP32) #elif defined(ESP32)
# include <WiFi.h> // required to get MAC address
const char *current_board = "ESP32"; const char *current_board = "ESP32";
#else #else
const char *current_board = "UNKNOWN"; const char *current_board = "UNKNOWN";
......
#ifndef AMPEL_UTIL_H_INCLUDED #ifndef AMPEL_UTIL_H_INCLUDED
#define AMPEL_UTIL_H_INCLUDED #define AMPEL_UTIL_H_INCLUDED
#include <stdint.h> // For uint32_t
#if defined(ESP8266) #if defined(ESP8266)
# include <ESP8266WiFi.h> // required to get MAC address
# define esp_get_max_free_block_size() ESP.getMaxFreeBlockSize() # define esp_get_max_free_block_size() ESP.getMaxFreeBlockSize()
# define esp_get_heap_fragmentation() ESP.getHeapFragmentation() # define esp_get_heap_fragmentation() ESP.getHeapFragmentation()
#elif defined(ESP32) #elif defined(ESP32)
# include <WiFi.h> // required to get MAC address
# define esp_get_max_free_block_size() ESP.getMaxAllocHeap() //largest block of heap that can be allocated. # define esp_get_max_free_block_size() ESP.getMaxAllocHeap() //largest block of heap that can be allocated.
# define esp_get_heap_fragmentation() "?" // apparently not available for ESP32 # define esp_get_heap_fragmentation() "?" // apparently not available for ESP32
#endif #endif
......
...@@ -5,6 +5,12 @@ ...@@ -5,6 +5,12 @@
#include "led_effects.h" #include "led_effects.h"
#include "sensor_console.h" #include "sensor_console.h"
#if defined(ESP8266)
# include <ESP8266WiFi.h>
#elif defined(ESP32)
# include <WiFi.h>
#endif
namespace config { namespace config {
// WiFi config. See 'config.h' if you want to modify those values. // WiFi config. See 'config.h' if you want to modify those values.
const char *wifi_ssid = WIFI_SSID; const char *wifi_ssid = WIFI_SSID;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment