Skip to content

Commit 77a82a6

Browse files
committed
replace blocking loops by async delaying, handling HTTP requests/responses, update wifimanager config and execution, creating Device and Message classes
1 parent 30adef1 commit 77a82a6

31 files changed

+3461
-1751
lines changed

AloesDevice.h

+19-39
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,42 @@
11
#ifndef AloesDevice_h
22
#define AloesDevice_h
33

4-
// #include <Arduino.h>
4+
#include <Arduino.h>
55

66
#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
2011
#endif
2112

22-
#include <ESP8266WebServer.h>
23-
#include <WiFiManager.h>
2413
#include <ArduinoJson.h>
14+
#include <advancedSerial.h>
2515

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>
3420
#endif
3521

36-
Config config;
37-
Message message;
22+
#include "lib/Globals.h"
3823

39-
// todo :remove from global but need to change attachInterrupt callback signature ?
40-
WiFiManager wifiManager;
24+
#include "lib/AsyncWait.h"
4125

26+
#include "lib/Device.cpp"
27+
Device device;
4228

4329
#include "lib/Helpers.cpp"
4430
Helpers helpers;
4531

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-
5532
#include "lib/Network.cpp"
56-
Network network(config);
33+
Network _network;
5734

5835
#include "lib/Manager.cpp"
59-
Manager manager(config);
36+
Manager manager(device);
37+
38+
#include "lib/Transport.cpp"
39+
Transport _transport;
6040

6141
#include "lib/Aloes.cpp"
6242
extern Aloes aloes;

examples/arducam.ino

-312
This file was deleted.

0 commit comments

Comments
 (0)