-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathConfig.h
More file actions
57 lines (48 loc) · 1.46 KB
/
Copy pathConfig.h
File metadata and controls
57 lines (48 loc) · 1.46 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once
#include <Arduino.h>
#include <ArduinoJson.h>
#define FASTLED_INTERNAL
#include <FastLED.h>
#include <LinkedList.h>
class ConfigClass
{
public:
int8_t timeZone = 0;
int8_t summerTime = 0;
float longitude = 0;
float latitude = 0;
bool alarmEnabled = false;
uint16_t alarmDuration = 1;
uint8_t alarmHour = 0;
uint8_t alarmMinute = 0;
String alarmAnimation = "";
String postAlarmAnimation = "";
bool sunsetEnabled = false;
uint16_t sunsetDuration = 1;
int8_t sunsetHour = 0;
int8_t sunsetMinute = 0;
int16_t sunsetOffset = 0;
String sunsetAnimation = "";
String startupAnimation = "";
LinkedList<int16_t> sliderValues;
LinkedList<CRGB> colorPickerValues;
/// Initialize config object by reading the config file.
/// @return True if successful
bool initialize();
/// Save config to file system
/// @return True if successful
bool save();
/// Parse a JSON char array and apply its values to the config.
/// @param input JSON char array
/// @return True if successful
bool parseJson(const char *input);
/// Get config and (optional) application state as JSON String.
/// @param includeApplicationState Include application state (default: false)
/// @return JSON String
String asString(bool includeApplicationState = false);
private:
const String m_configFilename = "/config.txt";
void getUserConfigJson(JsonDocument &doc);
void getApplicationStateJson(JsonDocument &doc);
};
extern ConfigClass Config;