-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathswcfg.wfc
407 lines (335 loc) · 8.06 KB
/
swcfg.wfc
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
/*
* Copyright (C) 2018-2023, Thomas Maier-Komor
* Atrium Firmware Package for ESP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
option author="Thomas Maier-Komor";
option copyright="2018-2024";
option common {
BaseClass=Message;
getMember=getMember;
id0=true;
wfclib=extern;
SortMembers=size;
}
option pc : common {
toSink="";
toASCII=toASCII;
optimize=speed;
//header="pcconfig.h";
header="support.h";
enumnames=true;
enummap=true;
cfgdefs=all;
}
option esp : common {
withEqual=true;
toString="";
toSink="";
toWire="";
toASCII=toASCII;
intsize=32;
varintbits=32;
header="estring.h";
header=<sdkconfig.h>;
header="stream.h";
header="support.h";
streamtype=stream;
stringtype=estring;
bytestype=estring;
enumnames=true;
enummap="!CONFIG_ESPTOOLPY_FLASHSIZE_1MB";
}
option esp32 : esp {
optimize=speed;
endian=little; // not for esp8266, does not allow unaligned access
withUnequal=true;
}
option esp8266 : esp {
ssize_t=_ssize_t;
optimize=size;
withUnequal=false;
}
option esp8285 : esp8266 {
BaseClass="";
getMember="";
/MQTT/keepalive : used = false;
/NodeConfig/signals : used = false;
/NodeConfig/functions : used = false;
/NodeConfig/screen : used = false;
/NodeConfig/statemachs : used = false;
}
enum rstrsn_t {
unknown = 0;
powerup = 1;
external = 2;
software = 3;
panic = 4;
internal_wdt = 5;
task_wdt = 6;
watchdog = 7;
deepsleep = 8;
brownout = 9;
sdio = 10;
option toString=strReset;
}
message WifiConfig
{
string ssid = 1;
string pass = 2;
bytes mac = 3;
required bool activate = 4 [ unset = false ];
fixed32 addr4 = 5 [ to_ascii=ip4_to_ascii, to_json=ip4_to_ascii, parse_ascii=parse_ipv4 ];
fixed8 netmask4 = 6;
fixed32 gateway4 = 7 [ to_ascii=ip4_to_ascii, to_json=ip4_to_ascii, parse_ascii=parse_ipv4 ];
}
message MQTT
{
string uri = 1;
bool enable = 2 [ unset = false ];
string username = 3;
string password = 4;
repeated string subscribtions = 5; // qos0 subscribptions
// keepalive in [s], 0 for no timeout
uint16 keepalive = 6 [ default = 60 ];
}
message Date
{
fixed8 day = 1 [ unset = 0 ];
fixed8 month = 2 [ unset = 0 ];
fixed16 year = 3 [ unset = 0 ];
fixed8 endday = 4 [ unset = 0 ];
fixed8 endmonth = 5 [ unset = 0 ];
fixed8 endyear = 6 [ unset = 0 ];
}
enum WeekDay
{
Sunday = 0;
Monday = 1;
Tuesday = 2;
Wednesday = 3;
Thursday = 4;
Friday = 5;
Saturday = 6;
WorkDay = 7;
WeekEnd = 8;
EveryDay = 9;
Holiday = 10;
}
message AtAction
{
optional WeekDay day = 1;
unsigned min_of_day = 2 [ to_json = min_of_day_to_ascii ];
string action = 3;
required bool enable = 4 [ default = true ];
}
message Influx
{
string hostname = 1;
fixed16 port = 2 [ unset = 0 ];
string measurement = 3;
unsigned interval = 4 [ default = 60000, usage = obsolete ];
string database = 5; // implies TCP
}
enum uart_wl_t
{
uart_wl_5 = 0;
uart_wl_6 = 1;
uart_wl_7 = 2;
uart_wl_8 = 3;
}
enum uart_sb_t
{
uart_sb_none = 0;
uart_sb_1 = 1;
uart_sb_1_5 = 2;
uart_sb_2 = 3;
}
enum uart_p_t
{
uart_p_n = 0;
uart_p_e = 2;
uart_p_o = 3;
}
bitset uartcfg_t
{
uart_wl_t wl : 0..1;
uart_sb_t sb : 2..3;
bool rts : 4;
bool cts : 5;
uart_p_t p : 6..7;
// bit8,9: reserved for future uart_parity_t extension
bool ref_tick : 10;
// bit11-15: reserved
}
message UartSettings
{
sint8 port = 1 [ unset = -1 ];
unsigned baudrate = 2 [ default = 115200 ];
uartcfg_t config = 3 [ default = 5, encoding = fixed16 ];
fixed8 rx_thresh = 4 [ unset = 0 ];
unsigned tx_bufsize = 6;
unsigned rx_bufsize = 7;
}
message FtpHttpConfig
{
fixed16 port = 1 [ unset = 0 ];
bool start = 2 [ default = true ];
string root = 3;
string uploaddir = 4;
}
message TerminalConfig
{
// set rx and tx to define a terminal for shell command 'con'
// set rx only to define a UART monitor that forwards to syslg
sint8 uart_rx = 1 [ unset = -1 ];
sint8 uart_tx = 2 [ unset = -1 ];
string name = 3;
}
message Trigger
{
string event = 1;
repeated string action = 2;
}
message AppParam
{
string key = 1;
unsigned uValue = 2;
string sValue = 3;
signed dValue = 4;
double fValue = 5;
}
bitset eventcfg_t
{
bool restart : 0;
bool autostart : 1;
}
message EventTimer
{
string name = 1;
unsigned time = 2; // in msec
// bit0: repeat, bit1: autostart
eventcfg_t config = 3 [ unset = 0 ];
}
message FunctionConfig
{
string name = 1;
string func = 2;
repeated string params = 3;
}
enum sigtype_t
{
st_invalid = 0;
st_int = 1;
st_float = 2;
st_string = 3;
}
message SignalConfig
{
string name = 1;
sigtype_t type = 2 [ unset = st_invalid ];
string iv = 3;
// TODO
//bool persistent = 4 [ unset = false ]; // store every update to NVS
}
message OwDeviceConfig
{
fixed64 id = 1 [ to_ascii = id64_to_ascii ];
string name = 2;
}
message StateConfig
{
string name = 1;
repeated Trigger conds = 2;
}
message StateMachineConfig
{
string name = 1;
uint8 ini_st = 2 [ default = 0 ];
repeated StateConfig states = 3;
// store state-change in NVM, start with NVM value
bool persistent = 4 [ unset = false ];
}
message ThresholdConfig
{
string name = 1;
float low = 2;
float high = 3;
}
message EnvConfig
{
string path = 1;
string title = 2;
string action = 3;
}
message ScreenConfig
{
repeated EnvConfig envs = 1;
string font_tiny = 4;
string font_small = 5;
string font_medium = 6;
string font_large = 7;
}
message NodeConfig
{
fixed32 magic = 0; // should always be set to 0xAE54EDC0
string nodename = 1;
bytes pass_hash = 2;
unsigned cpu_freq = 3;
WifiConfig station = 4;
WifiConfig softap = 5;
repeated string dns_server = 6;
string syslog_host = 7;
string sntp_server = 8;
string timezone = 9;
MQTT mqtt = 10 [ ifdef=CONFIG_MQTT ];
fixed16 dmesg_size = 11 [ default = 2048 ];
Influx influx = 12 [ ifdef=CONFIG_INFLUX ];
unsigned station2ap_time = 13; // failover time from station to ap mode [s]
string domainname = 15;
// action timers
repeated Date holidays = 16;
repeated AtAction at_actions = 17;
// bit0: enable, bit1: enable factory_reset
unsigned actions_enable = 18 [ default = 1 ];
repeated Trigger triggers = 19;
repeated UartSettings uart = 20;
repeated TerminalConfig terminal = 21 [ ifdef=CONFIG_TERMSERV ];
// set udp_ctrl_port to 0 to disable this feature
fixed16 udp_ctrl_port = 22 [ default = 12719 ];
repeated string debugs = 23;
FtpHttpConfig ftpd = 24 [ ifdef=CONFIG_FTP ];
FtpHttpConfig httpd = 25 [ ifdef=CONFIG_HTTP ];
string otasrv = 26;
ScreenConfig screen = 27 [ ifdef=CONFIG_DISPLAY ];
// event timer/timefuse
repeated EventTimer timefuses = 30;
repeated SignalConfig signals = 31 [ ifdef=CONFIG_SIGNAL_PROC, usage=obsolete ];
repeated FunctionConfig functions = 32 [ ifdef=CONFIG_SIGNAL_PROC, usage=obsolete ];
repeated StateMachineConfig statemachs = 33 [ ifdef=CONFIG_STATEMACHINES ];
// relay control (e.g. s20)
unsigned max_on_time = 34 [ unset = 0, usage=obsolete ]; // in minutes
// application: light sensor controlled LED
unsigned threshold_off = 35 [ usage=obsolete ]; // replaced by thresholds
unsigned threshold_on = 36 [ usage=obsolete ];
unsigned dim_step = 37; // ms per 1% step
bool lightctrl = 38 [ usage=obsolete ];
unsigned pwm_freq = 39; // base PWM frequenzy in Hz - shared for all channels
repeated AppParam app_params = 40 [ ifdef=CONFIG_APP_PARAMS ];
repeated ThresholdConfig thresholds = 41 [ ifdef=CONFIG_THRESHOLDS ];
repeated string luafiles = 42 [ ifdef=CONFIG_LUA ];
bool lua_disable = 43 [ unset = false, ifdef=CONFIG_LUA ];
repeated OwDeviceConfig owdevices = 50 [ ifdef=CONFIG_ONEWIRE ];
}