esp32 compatibility

This commit is contained in:
2018-11-17 13:21:59 +01:00
parent 6df3595648
commit 209808b8bf
4 changed files with 24 additions and 9 deletions

View File

@@ -19,7 +19,11 @@ WiFiNet::WiFiNet(
int WiFiNet::connect(){
config.fromFile("/config.json");
WiFi.hostname(config.hostname);
#ifdef ESP32
WiFi.setHostname(config.hostname.c_str());
#elif defined(ESP8266)
WiFi.hostname(config.hostname.c_str());
#endif
Serial.println("Hostname: " + config.hostname);
if(!connectStation()) {
createAccessPoint();

View File

@@ -1,13 +1,14 @@
#ifndef __WIFI_NET__
#define __WIFI_NET__
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#ifdef ESP32
#include <WiFi.h>
#include <ESPmDNS.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#endif // ESP32
#include "Network.h"