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 @@
#include "wifi_util.h"
#include "src/lib/PubSubClient/src/PubSubClient.h"
#if defined(ESP8266)
# include <ESP8266WiFi.h>
#elif defined(ESP32)
# include <WiFi.h>
#endif
namespace config {
// Values should be defined in config.h
uint16_t mqtt_sending_interval = MQTT_SENDING_INTERVAL; // [s]
......
......@@ -11,6 +11,7 @@ namespace config {
}
#if defined(ESP8266)
# include <ESP8266WiFi.h> // required to get MAC address
const char *current_board = "ESP8266";
# if !defined(AMPEL_WIFI)
void preinit() {
......@@ -20,6 +21,7 @@ void preinit() {
}
# endif
#elif defined(ESP32)
# include <WiFi.h> // required to get MAC address
const char *current_board = "ESP32";
#else
const char *current_board = "UNKNOWN";
......
#ifndef AMPEL_UTIL_H_INCLUDED
#define AMPEL_UTIL_H_INCLUDED
#include <stdint.h> // For uint32_t
#if defined(ESP8266)
# include <ESP8266WiFi.h> // required to get MAC address
# define esp_get_max_free_block_size() ESP.getMaxFreeBlockSize()
# define esp_get_heap_fragmentation() ESP.getHeapFragmentation()
#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_heap_fragmentation() "?" // apparently not available for ESP32
#endif
......
......@@ -5,6 +5,12 @@
#include "led_effects.h"
#include "sensor_console.h"
#if defined(ESP8266)
# include <ESP8266WiFi.h>
#elif defined(ESP32)
# include <WiFi.h>
#endif
namespace config {
// WiFi config. See 'config.h' if you want to modify those values.
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