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
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -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
19
include/my_wifi.h
Normal 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();
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <NTPClient.h>
|
||||
#include <WiFiUdp.h>
|
||||
#include "my_wifi.h"
|
||||
#include "config.h"
|
||||
|
||||
extern NTPClient ntpClient;
|
||||
|
@ -1,9 +1,6 @@
|
||||
#ifndef ota_H
|
||||
#define ota_H
|
||||
#pragma once
|
||||
|
||||
#include <ArduinoOTA.h>
|
||||
|
||||
void ota_setup();
|
||||
void ota_loop();
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +0,0 @@
|
||||
#ifndef wifi_H
|
||||
#define wifi_H
|
||||
|
||||
void wifi_setup();
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user