-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJsonExample.txt
89 lines (75 loc) · 1.54 KB
/
JsonExample.txt
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <ArduinoJson.h>
// Loads the configuration from a file
void loadConfiguration() {
TimeChangeRule UST;
TimeChangeRule UT;
DynamicJsonDocument TimeJSON(128);
file.open("TimeUST.json",O_RDONLY);
deserializeJson(TimeJSON,file.readString());
file.close();
strcpy(UST.abbrev,TimeJSON["abbrev"]);
UST.week = TimeJSON["week"];
UST.dow = TimeJSON["dow"];
UST.month = TimeJSON["month"];
UST.hour = TimeJSON["hour"];
UST.offset = TimeJSON["offset"]; // Summer Time
TimeJSON.clear();
file.open("TimeUT.json",O_RDONLY);
deserializeJson(TimeJSON,file.readString());
file.close();
strcpy(UT.abbrev,TimeJSON["abbrev"]);
UT.week = TimeJSON["week"];
UT.dow = TimeJSON["dow"];
UT.month = TimeJSON["month"];
UT.hour = TimeJSON["hour"];
UT.offset = TimeJSON["offset"]; // Standard Time
//}
Serial.print(UST.offset);
Serial.println(UST.abbrev);
Serial.print(UT.offset);
Serial.println(UT.abbrev);
TimeZone.setRules(UST,UT);
}
File: TimeUT.json
{
"abbrev": "CET",
"week": 0,
"dow": 1,
"month": 10,
"hour": 3,
"offset": 60
}
File: TimeUST.json
{
"abbrev": "CEST",
"week": 0,
"dow": 1,
"month": 3,
"hour": 2,
"offset": 120
}
Intentos anteriores:
File: Time.json
{
"UST": {
"abbrev": "CEST",
"week": 0,
"dow": 1,
"month": 3,
"hour": 2,
"offset": 120
},
"UT": {
"abbrev": "CET",
"week": 0,
"dow": 1,
"month": 10,
"hour": 3,
"offset": 60
}
}
File: (first version) Time.json
{
"UST": ["CEST",0,1,3,2,120],
"UT": ["CET",0,1,10,3,60]
}