-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconfig_switch.lua
More file actions
68 lines (62 loc) · 2.14 KB
/
Copy pathconfig_switch.lua
File metadata and controls
68 lines (62 loc) · 2.14 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
58
59
60
61
62
63
64
65
66
67
68
--[[
CREDENTIALS:
Author: Libor Gabaj
GitHub: https://github.com/mrkale/NodeMCU-WifiDoubleSwitch.git
--]]
--[[
NAME: HTML template placeholder constant strings
DESCRIPTION:
- label_on ........ Text for button switching on a pin.
- label_off ....... Text for button switching on a pin.
- reqvar_pin ...... HTTP request variable for controlling pins
- status_on ....... Value for switching on a pin. At relays consider active low or active high ones.
- status_off ...... Value for switching off a pin. At relays consider active low or active high ones.
- class_btn_on .... Bootstrap class modifier for button switching on a pin
- class_btn_off ... Bootstrap class modifier for button switching off a pin
- class_lbl_on .... Bootstrap class modifier for label denoting a pin switched on
- class_lbl_off ... Bootstrap class modifier for label denoting a pin switched off
--]]
cfg_tmpl_cons = {
label_on = "I",
label_off = "0",
reqvar_pin = "pin",
status_on = gpio.LOW,
status_off = gpio.HIGH,
class_btn_on = "success",
class_btn_off = "danger",
class_lbl_on = "primary",
class_lbl_off = "default",
}
--[[
NAME: HTTP headers constant strings
DESCRIPTION:
- header_server ... Name of web server for HTTP response header
- header_realm .... Real name for HTTP login dialog
--]]
cfg_header_cons = {
header_server = "NodeMCU-WifiDoubleSwitch",
header_realm = "ESP8266 Web server",
}
--[[
NAME: Parameters of pin statuses
DESCRIPTION:
Values for all parameters are taken from previous HTML templates tables
- class_lbl ... Bootstrap class modifier for pin name label
- class_btn ... Bootstrap class modifier for pin control button
- label ....... Text for control button denoting target pin status
- action ...... Target pin status invoked by its control button
--]]
cfg_tmpl_states = {
[cfg_tmpl_cons.status_on] = {
class_lbl = cfg_tmpl_cons.class_lbl_on,
class_btn = cfg_tmpl_cons.class_btn_off,
label = cfg_tmpl_cons.label_off,
action = cfg_tmpl_cons.status_off
},
[cfg_tmpl_cons.status_off] = {
class_lbl = cfg_tmpl_cons.class_lbl_off,
class_btn = cfg_tmpl_cons.class_btn_on,
label = cfg_tmpl_cons.label_on,
action = cfg_tmpl_cons.status_on
},
}