-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup_ota.h
45 lines (37 loc) · 965 Bytes
/
setup_ota.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef _SETUP_OTA_H_
#define _SETUP_OTA_H_
#include <Arduino.h>
#include <ArduinoJson.h>
#include <String.h>
#include <ESP8266WebServer.h>
#include <WiFiUdp.h>
#include <FS.h>
#define JSON_TO_CONFIG(x, y) { if (root.containsKey(y)) { config.x = root[y]; } }
#define CONFIG_TO_JSON(x, y) { root[y] = config.x; }
#define KEYVAL_TO_CONFIG(x, y) { if (server.hasArg(y)) { String str = server.arg(y); config.x = str.toInt(); } }
struct Config {
int universe;
int offset;
int pixels;
int leds;
int white;
int brightness;
int hsv;
int mode;
int reverse;
int speed;
int position;
};
bool initialConfig(void);
bool loadConfig(void);
bool saveConfig(void);
void handleUpdate1(void);
void handleUpdate2(void);
void handleDirList(void);
void handleNotFound(void);
void handleRedirect(String);
void handleRedirect(const char *);
void handleStaticFile(String);
void handleStaticFile(const char *);
void handleJSON();
#endif // _SETUP_OTA_H_