|
1 | 1 | #ifndef AloesDevice_h
|
2 | 2 | #define AloesDevice_h
|
3 | 3 |
|
4 |
| -// #include <Arduino.h> |
| 4 | +#include <Arduino.h> |
5 | 5 |
|
6 | 6 | #include <FS.h>
|
7 |
| -#include <advancedSerial.h> |
8 |
| - |
9 |
| -#include <ESP8266WiFi.h> |
10 |
| -#include <ESP8266WiFiMulti.h> |
11 |
| -#include <ESP8266httpUpdate.h> |
12 |
| -#include <ESP8266mDNS.h> |
13 |
| -// #include <DNSServer.h> |
14 |
| -#include <TimeLib.h> |
15 |
| -#include <Wire.h> |
16 |
| - |
17 |
| - |
18 |
| -#if CLIENT_SECURE == 1 |
19 |
| -#include <WiFiClientSecure.h> |
| 7 | +#if defined(ESP8266) |
| 8 | +#elif defined(ESP32) |
| 9 | +#include <SPIFFS.h> |
| 10 | +#define FORMAT_SPIFFS_IF_FAILED true |
20 | 11 | #endif
|
21 | 12 |
|
22 |
| -#include <ESP8266WebServer.h> |
23 |
| -#include <WiFiManager.h> |
24 | 13 | #include <ArduinoJson.h>
|
| 14 | +#include <advancedSerial.h> |
25 | 15 |
|
26 |
| -#include "lib/Constants.h" |
27 |
| - |
28 |
| -ESP8266WiFiMulti WiFiMulti; |
29 |
| - |
30 |
| -#if CLIENT_SECURE == 0 |
31 |
| -WiFiClient wifiClient; |
32 |
| -#elif CLIENT_SECURE == 1 |
33 |
| -WiFiClientSecure wifiClient; |
| 16 | +#if defined(ESP8266) |
| 17 | +#include <ESP8266WiFi.h> |
| 18 | +#elif defined(ESP32) |
| 19 | +#include <WiFi.h> |
34 | 20 | #endif
|
35 | 21 |
|
36 |
| -Config config; |
37 |
| -Message message; |
| 22 | +#include "lib/Globals.h" |
38 | 23 |
|
39 |
| -// todo :remove from global but need to change attachInterrupt callback signature ? |
40 |
| -WiFiManager wifiManager; |
| 24 | +#include "lib/AsyncWait.h" |
41 | 25 |
|
| 26 | +#include "lib/Device.cpp" |
| 27 | +Device device; |
42 | 28 |
|
43 | 29 | #include "lib/Helpers.cpp"
|
44 | 30 | Helpers helpers;
|
45 | 31 |
|
46 |
| -#include "lib/Transport.cpp" |
47 |
| -#if MQTT_CLIENT == 1 |
48 |
| -Transport transport(wifiClient); |
49 |
| -#elif WEB_SERVER == 1 |
50 |
| -ESP8266WebServer server(80); |
51 |
| -WiFiClient client = server.client(); |
52 |
| -Transport transport(client); |
53 |
| -#endif |
54 |
| - |
55 | 32 | #include "lib/Network.cpp"
|
56 |
| -Network network(config); |
| 33 | +Network _network; |
57 | 34 |
|
58 | 35 | #include "lib/Manager.cpp"
|
59 |
| -Manager manager(config); |
| 36 | +Manager manager(device); |
| 37 | + |
| 38 | +#include "lib/Transport.cpp" |
| 39 | +Transport _transport; |
60 | 40 |
|
61 | 41 | #include "lib/Aloes.cpp"
|
62 | 42 | extern Aloes aloes;
|
|
0 commit comments