-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathglobal.tbh
270 lines (243 loc) · 7.26 KB
/
global.tbh
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
const FIRMWARE_VERSION="{RemoteIO.1.00.00}"
'------------------------------------------------------------------------------
#define FIXEDCONFIG
#define FILEFIXEDCONFIG "fixedconf.json"
#define MAX_NUM_WLN_FAILURES 5
#define SIMULATE_ETHER_OFF_BY_BUTTON 0
#define AGG_MULTI_NODE 0
#define AGG_LOGIN_CONTROL 1
#define AGG_SEND_WAIT_TIME 10
#define GPRS_PAYLOAD_SIZE 2
#define RED_IO_NUM_1 24
#define GREEN_IO_NUM_1 25
#define MAX_NUM_INTERFACES 4
#define WLN_WPA 1
#define NUM_SERIAL_PORTS 4
#define MODBUS_SOCKS_MAX 7
#define OW_DEBUG_PRINT 0
#define BP_DEBUG_PRINT 0
#define LUIS_DEBUG_PRINT 0
#define STG_DEBUG_PRINT 0
#define DEV_DEBUG_PRINT 0
#define WLN_DEBUG_PRINT 0
#define GPRS_DEBUG_PRINT 0
#define DHCP_DEBUG_PRINT 0
#define UI_TABLE_CONTROL 0
const LOGIN_TIMEOUT = 1500
#if PLATFORM_ID = TPP3WG2
#define BT_NAME "BLE_RemoteIOTPP3"
#define NUM_OF_IO 49
#define MAX_ANALOG_LINES 48
#define NUM_OF_SLOTS 13
#define NUM_OF_SLOTS_ALL 26
#define NUM_OF_SLOTS_STG 29
#define NUM_I2C_SLOTS 12
#define NUM_STD_SLOTS 11
#define NUM_SERIAL_PORTS 4
#define SNMP_INTERFACE_COUNT_VALUE 7
#define SNMP_TIBBO_SLOT_COUNT_VALUE 13
#define SNMP_TIBBO_PIN_COUNT_VALUE 49
#define SNMP_SET_DESCRIPTION "Tibbo RemoteIO TPP3WG2"
#define SNMP_SET_SYSNAME "Tibbo RemoteIO"
#define SIGNAL_STRENGTH_INDICATION 1
#define SIGNAL_STRENGTH_CLR PL_IO_NUM_46
#define SIGNAL_STRENGTH_CK PL_IO_NUM_47
#define SIGNAL_STRENGTH_DATA PL_IO_NUM_48
#define WLN_RST PL_IO_NUM_51
#define WLN_CS PL_IO_NUM_49
#define WLN_DI PL_IO_NUM_52
#define WLN_DO PL_IO_NUM_50
#define WLN_CLK PL_IO_NUM_53
#define STG_FILE "stg_tpp3.txt"
#define SDF_FILE "sdf_tpp3.txt"
#define MAX_NUM_SDF_LINES 633
includepp "stg_tpp3.txt"
includepp "agg_tpp3.txt"
#elif PLATFORM_ID = TPP2WG2
#define BT_NAME "BLE_RemoteIOTPP2"
#define NUM_OF_IO 24
#define MAX_ANALOG_LINES 24
#define NUM_OF_SLOTS 6
#define NUM_OF_SLOTS_ALL 12
#define NUM_OF_SLOTS_STG 13
#define NUM_I2C_SLOTS 6
#define NUM_STD_SLOTS 6
#define NUM_SERIAL_PORTS 4
#define SNMP_INTERFACE_COUNT_VALUE 7
#define SNMP_TIBBO_SLOT_COUNT_VALUE 6
#define SNMP_TIBBO_PIN_COUNT_VALUE 24
#define SNMP_SET_DESCRIPTION "Tibbo RemoteIO TPP2WG2"
#define SNMP_SET_SYSNAME "Tibbo RemoteIO"
#define SIGNAL_STRENGTH_INDICATION 1
#define SIGNAL_STRENGTH_CLR PL_IO_NUM_46
#define SIGNAL_STRENGTH_CK PL_IO_NUM_47
#define SIGNAL_STRENGTH_DATA PL_IO_NUM_48
#define WLN_RST PL_IO_NUM_51
#define WLN_CS PL_IO_NUM_49
#define WLN_DI PL_IO_NUM_52
#define WLN_DO PL_IO_NUM_50
#define WLN_CLK PL_IO_NUM_53
#define STG_FILE "stg_tpp2.txt"
#define SDF_FILE "sdf_tpp2.txt"
#define MAX_NUM_SDF_LINES 369
includepp "stg_tpp2.txt"
includepp "agg_tpp2.txt"
#else
#error "intentional garbage: currently selected platform is not supported!"
#endif
#define LUIS_CONFIG_FILE "luis.txt"
#if SUPPORTS_DISPLAY
#define MENU_CURSOR_STYLE 1
#define LIST_BOX_CURSOR_STYLE 1
#define INPUT_BOX_CURSOR_STYLE 1
#define LCD_LOCK lcd.lock
#define LCD_UNLOCK lcd.unlock
#define VER_SPACING 9
#define HOR_SPACING 2
#define BMP_LEFT_XOFFSET 320
#define BMP_NUM_XOFFSET 240
#define BMP_ALPH1_XOFFSET 280
#define BMP_ALPH2_XOFFSET 360
#define BMP_STORE_XOFFSET 40
#define STD_INPUT_WAIT_TIME 20 'in 0.5 seconds
'------ ui_menu ------
#define BMP_CANCEL_XOFFSET 0
#define BMP_ENTER_XOFFSET 40
#define BMP_UP_XOFFSET 80
#define BMP_DOWN_XOFFSET 120
#define MENU_MAX_LVL 5
#define MENU_MAX_ITEM_PER_LVL 16
#define MENU_DISPLAY_ITEM_PER_LVL 6
#define LCD_MENU_TOUT 0
#define DISPLAY_STR_LEN 150
#define MENU_STRING_LEN 255
#define SCROLL_BAR_WIDTH 15
#define SCROLL_ARROW_HEIGHT 12
#define SCROLL_MIN_HEIGHT 2
#define SCROLL_CURSOR_WIDTH 9
#define CURSOR_BAR_LEN_OFFSET 2
#define SCROLL_BORDER 2
#define LCD_BACKCOLOR 0
#define LCD_FORECOLOR 65535
#define LCD_DISABLE_BACKCOLOR 14823
#define LCD_DISABLE_FORECOLOR 33840
#define LCD_CURSORCOLOR 63080
#define LCD_DEAD_SCREEN_COLOR 63488
#define MENU_X 0
#define MENU_Y 7
#define MENU_W 320
#define MENU_H 187
#define MENU_MAX_LINE 6
#define UM_HOR_SPACING HOR_SPACING
#define UM_VER_SPACING VER_SPACING
#define MENU_SCRIPT_FILE "menu.txt"
#define USE_STG_TIMESTAMP 0
'------ ui_msg_box ------
#define MSG_BOX_X 0
#define MSG_BOX_Y 0
#define MSG_BOX_W lcd.width
#define MSG_BOX_H 185
#define MSB_HOR_SPACING 2
#define MSB_VER_SPACING 3
'------ ui_input_box -----
#define IB_MAX_LEN 64
#define LCD_FIX_FONT "11X19(H).bin"
#define INPUT_BOX_X MENU_X
#define INPUT_BOX_Y MENU_H+MENU_Y-9
#define INPUT_BOX_W MENU_W-MENU_X
#define INPUT_BOX_H 25
#define INPUT_BOX_CURSOR_OFFSET 2
#define INPUT_BOX_CURSOR_WIDTH 2
#define INPUT_BOX_INIT_POS 0
#define LCD_INPUTBOX_FORECOLOR 65535
#define LCD_INPUTBOX_BACKCOLOR 63080
#define UIB_HOR_SPACING HOR_SPACING
#define RESTART yes
'------ ui_list_box ------
#define SMALL_ICON_FILE "small_icons.bmp"
#define LCD_STD_FONT "11X19(HP).bin"
#define SMALL_FONT "Tibbo-5x7(V).bin"
#define LIST_BOX_X 25
#define LIST_BOX_Y 15
#define LIST_BOX_W 270
#define LIST_BOX_H 160
#define SCROLL_ARROW_X_POS_OFFSET 0
#define SCROLL_ARROW_Y_POS_OFFSET 2
#define ULB_VER_SPACING VER_SPACING
#define ULB_HOR_SPACING HOR_SPACING
includepp "menu.txt"
include "ui_input_box.tbh"
include "ui_list_box.tbh"
include "ui_msg_box.tbh"
include "ui_menu.tbh"
#endif
' #define GPRS_SER_PORT 1
' #define GPRS_SER_PORT_RTSMAP 5
' #define GPRS_SER_PORT_CTSMAP 4
' #define GPRS_RESET PL_IO_NUM_7_TX3_INT7
' #define GPRS_POWER PL_IO_NUM_6_RX3_INT6
'------------------------------------------------------------------------------
const CR_LF = chr(13) + chr(10)
#if USE_DNS
include "dns\trunk\dns.tbh"
#endif
include "settings\trunk\settings.tbh"
include "time\trunk\time.tbh"
#if WLN_AVAILABLE
include "wln\trunk\wln.tbh"
#endif
include "dhcp\trunk\dhcp.tbh"
include "sock\trunk\sock.tbh"
include "filenum\trunk\filenum.tbh"
include "aggregate\trunk\aggregate.tbh"
include "sntp\trunk\sntp.tbh"
#if SUPPORTS_GPRS
include "gprs\trunk\gprs.tbh"
#endif
include "boot.tbh"
include "login_control.tbh"
include "html_common.tbh"
include "html_session.tbh"
include "flags.tbh"
include "net_cmd.tbh"
include "device.tbh"
include "luis.tbh"
include "io.tbh"
include "adc.tbh"
include "serial.tbh"
include "modbus.tbh"
include "snmp.tbh"
include "bp.tbh"
include "onewire.tbh"
include "api.tbh"
declare function FloatToDWord(fData as float) as dword
'------------------------------------------------------------------------------
declare sock_http(NUM_HTTP_SOCKETS) as byte
declare sock_dns as byte
declare param_dh as no_yes
#if WLN_AVAILABLE
declare param_ws as pl_wln_security_modes
declare param_wd as no_yes
declare param_we as en_param_we
declare param_wa as string(32)
#endif
#if SUPPORTS_GPRS
declare param_ge as en_param_ge
declare param_ga as string(16)
declare param_gn as string(32)
declare param_gu as string(16)
declare param_gp as string(16)
#endif
declare param_ar as byte
declare interface_ready(MAX_NUM_INTERFACES) as no_yes
declare current_interface as pl_sock_interfaces
declare ip_configured(MAX_NUM_INTERFACES) as no_yes
declare wln_password as string(32)
declare num_wln_failures as byte
declare gprs_already_started,wln_already_started as no_yes
declare wln_error,gprs_error as no_yes
declare reboot_flag as no_yes
declare server_ip_obtain as no_yes
declare agg_port_fallback_count as byte
declare io_index as byte
declare enter_menu as no_yes