Moved platform-specific code related to WiFi and services to my_wifi.h. Also, made the HTTP server stuff compatible to ESP32.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-13 06:01:44 +02:00
parent ea4898daa6
commit 291a3be623
11 changed files with 41 additions and 34 deletions

View File

@ -2,9 +2,14 @@
#include "config.h"
#ifdef HTTP_SERVER_ENABLE
#include <ESP8266WebServer.h>
#include "my_wifi.h"
#if defined ( ESP8266 )
extern ESP8266WebServer http_server;
#elif defined ( ESP32 )
extern ESP32WebServer http_server;
#endif
void http_server_setup();
void http_server_loop();

19
include/my_wifi.h Normal file
View File

@ -0,0 +1,19 @@
#pragma once
#include "config.h"
#if defined( ESP8266 )
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <ESP8266WebServer.h>
#elif defined( ESP32 )
#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <ESP32WebServer.h>
#endif
#include <WiFiUdp.h>
void wifi_setup();

View File

@ -1,7 +1,7 @@
#pragma once
#include <NTPClient.h>
#include <WiFiUdp.h>
#include "my_wifi.h"
#include "config.h"
extern NTPClient ntpClient;

View File

@ -1,9 +1,6 @@
#ifndef ota_H
#define ota_H
#pragma once
#include <ArduinoOTA.h>
void ota_setup();
void ota_loop();
#endif

View File

@ -1,6 +0,0 @@
#ifndef wifi_H
#define wifi_H
void wifi_setup();
#endif