5
5
6
6
#include " ui.h"
7
7
8
+ #define IFACE_STA_JSON_SIZE 256
9
+
8
10
void Interface::frame (const String &id, const String &value){
9
- StaticJsonDocument<256 > obj;
11
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
10
12
obj[FPSTR (P_html)] = F (" iframe" );;
11
13
obj[FPSTR (P_type)] = F (" frame" );
12
14
obj[FPSTR (P_id)] = id;
@@ -18,7 +20,7 @@ void Interface::frame(const String &id, const String &value){
18
20
}
19
21
20
22
void Interface::frame2 (const String &id, const String &value){
21
- StaticJsonDocument<256 > obj;
23
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
22
24
obj[FPSTR (P_html)] = F (" iframe2" );;
23
25
obj[FPSTR (P_type)] = F (" frame" );
24
26
obj[FPSTR (P_id)] = id;
@@ -30,7 +32,7 @@ void Interface::frame2(const String &id, const String &value){
30
32
}
31
33
32
34
void Interface::hidden (const String &id, const String &value){
33
- StaticJsonDocument<256 > obj;
35
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
34
36
obj[FPSTR (P_html)] = FPSTR (P_hidden);
35
37
obj[FPSTR (P_id)] = id;
36
38
obj[FPSTR (P_value)] = value;
@@ -45,7 +47,7 @@ void Interface::hidden(const String &id){
45
47
}
46
48
47
49
void Interface::constant (const String &id, const String &value, const String &label){
48
- StaticJsonDocument<256 > obj;
50
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
49
51
obj[FPSTR (P_html)] = F (" const" );
50
52
obj[FPSTR (P_id)] = id;
51
53
obj[FPSTR (P_value)] = value;
@@ -61,7 +63,7 @@ void Interface::constant(const String &id, const String &label){
61
63
}
62
64
63
65
void Interface::text (const String &id, const String &value, const String &label, bool directly){
64
- StaticJsonDocument<256 > obj;
66
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
65
67
obj[FPSTR (P_html)] = FPSTR (P_input);
66
68
obj[FPSTR (P_type)] = F (" text" );
67
69
obj[FPSTR (P_id)] = id;
@@ -80,7 +82,7 @@ void Interface::text(const String &id, const String &label, bool directly){
80
82
}
81
83
82
84
void Interface::number (const String &id, int value, const String &label, int min, int max){
83
- StaticJsonDocument<256 > obj;
85
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
84
86
obj[FPSTR (P_html)] = FPSTR (P_input);
85
87
obj[FPSTR (P_type)] = FPSTR (P_number);
86
88
obj[FPSTR (P_id)] = id;
@@ -99,7 +101,7 @@ void Interface::number(const String &id, const String &label, int min, int max){
99
101
}
100
102
101
103
void Interface::number (const String &id, float value, const String &label, float step, int min, int max){
102
- StaticJsonDocument<256 > obj;
104
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
103
105
obj[FPSTR (P_html)] = FPSTR (P_input);
104
106
obj[FPSTR (P_type)] = FPSTR (P_number);
105
107
obj[FPSTR (P_id)] = id;
@@ -119,7 +121,7 @@ void Interface::number(const String &id, const String &label, float step, int mi
119
121
}
120
122
121
123
void Interface::time (const String &id, const String &value, const String &label){
122
- StaticJsonDocument<256 > obj;
124
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
123
125
obj[FPSTR (P_html)] = FPSTR (P_input);
124
126
obj[FPSTR (P_type)] = FPSTR (P_time);
125
127
obj[FPSTR (P_id)] = id;
@@ -136,7 +138,7 @@ void Interface::time(const String &id, const String &label){
136
138
}
137
139
138
140
void Interface::date (const String &id, const String &value, const String &label){
139
- StaticJsonDocument<256 > obj;
141
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
140
142
obj[FPSTR (P_html)] = FPSTR (P_input);
141
143
obj[FPSTR (P_type)] = FPSTR (P_date);
142
144
obj[FPSTR (P_id)] = id;
@@ -153,7 +155,7 @@ void Interface::date(const String &id, const String &label){
153
155
}
154
156
155
157
void Interface::datetime (const String &id, const String &value, const String &label){
156
- StaticJsonDocument<256 > obj;
158
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
157
159
obj[FPSTR (P_html)] = FPSTR (P_input);
158
160
obj[FPSTR (P_type)] = F (" datetime-local" );
159
161
obj[FPSTR (P_id)] = id;
@@ -170,7 +172,7 @@ void Interface::datetime(const String &id, const String &label){
170
172
}
171
173
172
174
void Interface::range (const String &id, int value, int min, int max, float step, const String &label, bool directly){
173
- StaticJsonDocument<256 > obj;
175
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
174
176
obj[FPSTR (P_html)] = FPSTR (P_input);
175
177
obj[FPSTR (P_type)] = F (" range" );
176
178
obj[FPSTR (P_id)] = id;
@@ -192,7 +194,7 @@ void Interface::range(const String &id, int min, int max, float step, const Stri
192
194
}
193
195
194
196
void Interface::email (const String &id, const String &value, const String &label){
195
- StaticJsonDocument<256 > obj;
197
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
196
198
obj[FPSTR (P_html)] = FPSTR (P_input);
197
199
obj[FPSTR (P_type)] = F (" email" );
198
200
obj[FPSTR (P_id)] = id;
@@ -209,7 +211,7 @@ void Interface::email(const String &id, const String &label){
209
211
}
210
212
211
213
void Interface::password (const String &id, const String &value, const String &label){
212
- StaticJsonDocument<256 > obj;
214
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
213
215
obj[FPSTR (P_html)] = FPSTR (P_input);
214
216
obj[FPSTR (P_type)] = FPSTR (P_password);
215
217
obj[FPSTR (P_id)] = id;
@@ -226,7 +228,7 @@ void Interface::password(const String &id, const String &label){
226
228
}
227
229
228
230
void Interface::option (const String &value, const String &label){
229
- StaticJsonDocument<256 > obj;
231
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
230
232
obj[FPSTR (P_label)] = label;
231
233
obj[FPSTR (P_value)] = value;
232
234
@@ -236,7 +238,7 @@ void Interface::option(const String &value, const String &label){
236
238
}
237
239
238
240
void Interface::select (const String &id, const String &value, const String &label, bool directly, bool skiplabel){
239
- StaticJsonDocument<256 > obj;
241
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
240
242
obj[FPSTR (P_html)] = F (" select" );
241
243
obj[FPSTR (P_id)] = id;
242
244
obj[FPSTR (P_value)] = value;
@@ -256,7 +258,7 @@ void Interface::select(const String &id, const String &label, bool directly, boo
256
258
}
257
259
258
260
void Interface::checkbox (const String &id, const String &value, const String &label, bool directly){
259
- StaticJsonDocument<256 > obj;
261
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
260
262
obj[FPSTR (P_html)] = FPSTR (P_input);
261
263
obj[FPSTR (P_type)] = F (" checkbox" );
262
264
obj[FPSTR (P_id)] = id;
@@ -274,7 +276,7 @@ void Interface::checkbox(const String &id, const String &label, bool directly){
274
276
}
275
277
276
278
void Interface::color (const String &id, const String &value, const String &label){
277
- StaticJsonDocument<256 > obj;
279
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
278
280
obj[FPSTR (P_html)] = FPSTR (P_input);
279
281
obj[FPSTR (P_type)] = FPSTR (P_color);
280
282
obj[FPSTR (P_id)] = id;
@@ -291,7 +293,7 @@ void Interface::color(const String &id, const String &label){
291
293
}
292
294
293
295
void Interface::file (const String &name, const String &action, const String &label){
294
- StaticJsonDocument<256 > obj;
296
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
295
297
obj[FPSTR (P_html)] = FPSTR (P_file);
296
298
obj[F (" name" )] = name;
297
299
obj[F (" action" )] = action;
@@ -303,7 +305,7 @@ void Interface::file(const String &name, const String &action, const String &lab
303
305
}
304
306
305
307
void Interface::button (const String &id, const String &label, const String &color){
306
- StaticJsonDocument<256 > obj;
308
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
307
309
obj[FPSTR (P_html)] = FPSTR (P_button);
308
310
obj[FPSTR (P_id)] = id;
309
311
obj[FPSTR (P_color)] = color;
@@ -315,7 +317,7 @@ void Interface::button(const String &id, const String &label, const String &colo
315
317
}
316
318
317
319
void Interface::button_submit (const String §ion, const String &label, const String &color){
318
- StaticJsonDocument<256 > obj;
320
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
319
321
obj[FPSTR (P_html)] = FPSTR (P_button);
320
322
obj[FPSTR (P_submit)] = section;
321
323
obj[FPSTR (P_color)] = color;
@@ -327,7 +329,7 @@ void Interface::button_submit(const String §ion, const String &label, const
327
329
}
328
330
329
331
void Interface::button_submit_value (const String §ion, const String &value, const String &label, const String &color){
330
- StaticJsonDocument<256 > obj;
332
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
331
333
obj[FPSTR (P_html)] = FPSTR (P_button);
332
334
obj[FPSTR (P_submit)] = section;
333
335
obj[FPSTR (P_color)] = color;
@@ -340,7 +342,7 @@ void Interface::button_submit_value(const String §ion, const String &value,
340
342
}
341
343
342
344
void Interface::spacer (const String &label){
343
- StaticJsonDocument<256 > obj;
345
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
344
346
obj[FPSTR (P_html)] = F (" spacer" );
345
347
if (label != " " ) obj[FPSTR (P_label)] = label;
346
348
@@ -350,7 +352,7 @@ void Interface::spacer(const String &label){
350
352
}
351
353
352
354
void Interface::comment (const String &label){
353
- StaticJsonDocument<512 > obj;
355
+ StaticJsonDocument<IFACE_STA_JSON_SIZE * 2 > obj;
354
356
obj[FPSTR (P_html)] = F (" comment" );
355
357
if (label != " " ) obj[FPSTR (P_label)] = label;
356
358
@@ -360,7 +362,7 @@ void Interface::comment(const String &label){
360
362
}
361
363
362
364
void Interface::textarea (const String &id, const String &value, const String &label){
363
- StaticJsonDocument<256 > obj;
365
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
364
366
obj[FPSTR (P_html)] = F (" textarea" );
365
367
obj[FPSTR (P_id)] = id;
366
368
obj[FPSTR (P_value)] = value;
@@ -376,7 +378,7 @@ void Interface::textarea(const String &id, const String &label){
376
378
}
377
379
378
380
void Interface::value (const String &id, const String &val, bool html){
379
- StaticJsonDocument<256 > obj;
381
+ StaticJsonDocument<IFACE_STA_JSON_SIZE > obj;
380
382
obj[FPSTR (P_id)] = id;
381
383
obj[FPSTR (P_value)] = val;
382
384
if (html) obj[FPSTR (P_html)] = true ;
@@ -417,7 +419,7 @@ bool Interface::json_frame_add(JsonObject obj) {
417
419
LOG (printf_P, PSTR (" UI: OK [%u]\t MEM: %u\n " ), section_stack.end ()->idx , ESP.getFreeHeap ());
418
420
return true ;
419
421
}
420
- LOG (printf_P, PSTR (" UI: BAD MEM : %u\n " ), ESP.getFreeHeap ());
422
+ LOG (printf_P, PSTR (" UI: Frame full, mem : %u\n " ), ESP.getFreeHeap ());
421
423
422
424
json_frame_send ();
423
425
json_frame_next ();
0 commit comments