Skip to content

Commit d521498

Browse files
committed
Squeeze 0.5k from code size
1 parent 272fd43 commit d521498

File tree

9 files changed

+212
-97
lines changed

9 files changed

+212
-97
lines changed

tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino

Lines changed: 190 additions & 75 deletions
Large diffs are not rendered by default.

tasmota/tasmota_xdrv_driver/xdrv_02_9_mqtt.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2055,7 +2055,6 @@ const char HTTP_BTN_MENU_MQTT[] PROGMEM =
20552055
"<p></p><form action='" WEB_HANDLE_MQTT "' method='get'><button>" D_CONFIGURE_MQTT "</button></form>";
20562056

20572057
const char HTTP_FORM_MQTT1[] PROGMEM =
2058-
"<fieldset><legend><b>&nbsp;" D_MQTT_PARAMETERS "&nbsp;</b></legend>"
20592058
"<form method='get' action='" WEB_HANDLE_MQTT "'>"
20602059
"<p><b>" D_HOST "</b> (" MQTT_HOST ")<br><input id='mh' placeholder=\"" MQTT_HOST "\" value=\"%s\"></p>"
20612060
"<p><b>" D_PORT "</b> (" STR(MQTT_PORT) ")<br><input id='ml' placeholder='" STR(MQTT_PORT) "' value='%d'></p>"
@@ -2085,6 +2084,7 @@ void HandleMqttConfiguration(void)
20852084

20862085
WSContentStart_P(PSTR(D_CONFIGURE_MQTT));
20872086
WSContentSendStyle();
2087+
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_MQTT_PARAMETERS));
20882088
WSContentSend_P(HTTP_FORM_MQTT1,
20892089
SettingsTextEscaped(SET_MQTT_HOST).c_str(),
20902090
Settings->mqtt_port,

tasmota/tasmota_xdrv_driver/xdrv_07_domoticz.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,6 @@ const char HTTP_BTN_MENU_DOMOTICZ[] PROGMEM =
640640
"<p></p><form action='" WEB_HANDLE_DOMOTICZ "' method='get'><button>" D_CONFIGURE_DOMOTICZ "</button></form>";
641641

642642
const char HTTP_FORM_DOMOTICZ[] PROGMEM =
643-
"<fieldset><legend><b>&nbsp;" D_DOMOTICZ_PARAMETERS "&nbsp;</b></legend>"
644643
"<form method='post' action='" WEB_HANDLE_DOMOTICZ "'>"
645644
"<table>";
646645
const char HTTP_FORM_DOMOTICZ_RELAY[] PROGMEM =
@@ -668,6 +667,7 @@ void HandleDomoticzConfiguration(void) {
668667

669668
WSContentStart_P(PSTR(D_CONFIGURE_DOMOTICZ));
670669
WSContentSendStyle();
670+
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_DOMOTICZ_PARAMETERS));
671671
WSContentSend_P(HTTP_FORM_DOMOTICZ);
672672
for (uint32_t i = 0; i < MAX_DOMOTICZ_IDX; i++) {
673673
if (i < TasmotaGlobal.devices_present) {

tasmota/tasmota_xdrv_driver/xdrv_07_ufs_domoticz.ino

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Domoticz_t* Domoticz;
107107
* Driver Settings load and save
108108
\*********************************************************************************************/
109109

110-
#define XDRV_07_KEY "drvset03"
110+
#define XDRV_07_KEY "drvset03" // Should have been drvset07
111111

112112
bool DomoticzLoadData(void) {
113113
char key[] = XDRV_07_KEY;
@@ -876,7 +876,6 @@ const char HTTP_BTN_MENU_DOMOTICZ[] PROGMEM =
876876
"<p></p><form action='" WEB_HANDLE_DOMOTICZ "' method='get'><button>" D_CONFIGURE_DOMOTICZ "</button></form>";
877877

878878
const char HTTP_FORM_DOMOTICZ[] PROGMEM =
879-
"<fieldset><legend><b>&nbsp;" D_DOMOTICZ_PARAMETERS "&nbsp;</b></legend>"
880879
"<form method='post' action='" WEB_HANDLE_DOMOTICZ "'>"
881880
"<table>"
882881
"<tr><td style='width:116px'></td><td style='width:70px'><b>%s</b></td><td style='width:70px'><b>%s</b></td><td style='width:70px'></td></tr>";
@@ -903,7 +902,9 @@ void HandleDomoticzConfiguration(void) {
903902

904903
WSContentStart_P(PSTR(D_CONFIGURE_DOMOTICZ));
905904
WSContentSendStyle();
906-
WSContentSend_P(HTTP_FORM_DOMOTICZ, (Domoticz->switches)? D_DOMOTICZ_SWITCH :"", (Domoticz->keys)? D_DOMOTICZ_KEY :"");
905+
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_DOMOTICZ_PARAMETERS));
906+
WSContentSend_P(HTTP_FORM_DOMOTICZ,
907+
(Domoticz->switches)? D_DOMOTICZ_SWITCH :"", (Domoticz->keys)? D_DOMOTICZ_KEY :"");
907908
for (uint32_t i = 0; i < Domoticz->devices; i++) {
908909
WSContentSend_P(HTTP_FORM_DOMOTICZ_INDEX, i +1);
909910
if (i < Domoticz->switches) {

tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10048,7 +10048,6 @@ const char HTTP_BTN_MENU_RULES[] PROGMEM =
1004810048
"<p></p><form action='" WEB_HANDLE_SCRIPT "' method='get'><button>" D_CONFIGURE_SCRIPT "</button></form>";
1004910049

1005010050
const char HTTP_FORM_SCRIPT[] PROGMEM =
10051-
"<fieldset><legend><b>&nbsp;" D_SCRIPT "&nbsp;</b></legend>"
1005210051
"<form method='post' action='" WEB_HANDLE_SCRIPT "'>";
1005310052

1005410053
const char HTTP_FORM_SCRIPT1[] PROGMEM =
@@ -10456,6 +10455,7 @@ void HandleScriptConfiguration(void) {
1045610455

1045710456
WSContentStart_P(PSTR(D_CONFIGURE_SCRIPT));
1045810457
WSContentSendStyle();
10458+
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_SCRIPT));
1045910459
WSContentSend_P(HTTP_FORM_SCRIPT);
1046010460

1046110461
#ifdef xSCRIPT_STRIP_COMMENTS

tasmota/tasmota_xdrv_driver/xdrv_28_pcf8574_v2.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,6 @@ const char HTTP_BTN_MENU_PCF8574[] PROGMEM =
519519
"<p></p><form action='" WEB_HANDLE_PCF8574 "' method='get'><button>" D_CONFIGURE_PCF8574 "</button></form>";
520520

521521
const char HTTP_FORM_I2C_PCF8574_1[] PROGMEM =
522-
"<fieldset><legend><b>&nbsp;" D_PCF8574_PARAMETERS "&nbsp;</b></legend>"
523522
"<form method='get' action='" WEB_HANDLE_PCF8574 "'>"
524523
"<p><label><input id='b1' name='b1' type='checkbox'%s><b>" D_INVERT_PORTS "</b></label></p><hr/>";
525524

@@ -544,6 +543,7 @@ void HandlePcf8574(void) {
544543

545544
WSContentStart_P(D_CONFIGURE_PCF8574);
546545
WSContentSendStyle();
546+
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_PCF8574_PARAMETERS));
547547
WSContentSend_P(HTTP_FORM_I2C_PCF8574_1, (Settings->flag3.pcf8574_ports_inverted) ? PSTR(" checked") : ""); // SetOption81 - Invert all ports on PCF8574 devices
548548
WSContentSend_P(HTTP_TABLE100);
549549
for (uint32_t idx = 0; idx < Pcf8574.max_devices; idx++) {

tasmota/tasmota_xdrv_driver/xdrv_50_filesystem.ino

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,9 +1271,6 @@ const char UFS_CURRDIR[] PROGMEM =
12711271
#define D_CURR_DIR "Folder"
12721272
#endif
12731273

1274-
const char UFS_FORM_FILE_UPLOAD[] PROGMEM =
1275-
"<div id='f1' name='f1' style='display:block;'>"
1276-
"<fieldset><legend><b>&nbsp;" D_MANAGE_FILE_SYSTEM "&nbsp;</b></legend>";
12771274
const char UFS_FORM_FILE_UPGc[] PROGMEM =
12781275
"<div style='text-align:left;color:#%06x;'>" D_FS_SIZE " %s MB - " D_FS_FREE " %s MB";
12791276

@@ -1329,7 +1326,6 @@ const char UFS_FORM_SDC_HREFedit[] PROGMEM =
13291326
"<a href='ufse?file=%s/%s'>&#x1F4DD;</a>"; // 📝
13301327

13311328
const char HTTP_EDITOR_FORM_START[] PROGMEM =
1332-
"<fieldset><legend><b>&nbsp;" D_EDIT_FILE "&nbsp;</b></legend>"
13331329
"<form>"
13341330
"<label for='name'>" D_FILE ":</label><input type='text' id='name' name='name' value='%s'><br><hr width='98%%'>"
13351331
"<textarea id='content' name='content' wrap='off' rows='8' cols='80' style='font-size: 12pt'>";
@@ -1427,7 +1423,8 @@ void UfsDirectory(void) {
14271423

14281424
WSContentStart_P(PSTR(D_MANAGE_FILE_SYSTEM));
14291425
WSContentSendStyle();
1430-
WSContentSend_P(UFS_FORM_FILE_UPLOAD);
1426+
WSContentSend_P(HTTP_DIV_BLOCK);
1427+
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_MANAGE_FILE_SYSTEM));
14311428

14321429
char ts[FLOATSZ];
14331430
dtostrfd((float)UfsInfo(0, ufs_dir == 2 ? 1:0) / 1000, 3, ts);
@@ -1756,6 +1753,7 @@ void UfsEditor(void) {
17561753

17571754
WSContentStart_P(PSTR(D_EDIT_FILE));
17581755
WSContentSendStyle();
1756+
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_EDIT_FILE));
17591757
char *bfname = fname +1;
17601758
WSContentSend_P(HTTP_EDITOR_FORM_START, bfname); // Skip leading slash
17611759

tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3584,7 +3584,6 @@ const char HTTP_BTN_MENU_BLE[] PROGMEM =
35843584
"<p></p><form action='" WEB_HANDLE_BLE "' method='get'><button>" D_CONFIGURE_BLE "</button></form>";
35853585

35863586
const char HTTP_FORM_BLE[] PROGMEM =
3587-
"<fieldset><legend><b>&nbsp;" D_BLE_PARAMETERS "&nbsp;</b></legend>"
35883587
"<form method='get' action='" WEB_HANDLE_BLE "'>"
35893588
"<p><label><input id='e0' type='checkbox'%s><b>" D_BLE_ENABLE "</b></label></p>"
35903589
"<p><label><input id='e1' type='checkbox'%s><b>" D_BLE_ACTIVESCAN "</b></label></p>"
@@ -3593,7 +3592,7 @@ const char HTTP_FORM_BLE[] PROGMEM =
35933592

35943593
const char HTTP_BLE_DEV_STYLE[] PROGMEM = "th, td { padding-left:5px; }";
35953594
const char HTTP_BLE_DEV_START[] PROGMEM =
3596-
"<fieldset><legend><b>&nbsp;" D_BLE_DEVICES "&nbsp;</b></legend><table>"
3595+
"<table>"
35973596
"<tr><th><label>mac(type)</label></th><th><label>alias</label></th><th><label>name</label></th><th><label>RSSI</label></th><th><label>Age(max)</label></th></tr>";
35983597
const char HTTP_BLE_DEV[] PROGMEM =
35993598
"<tr><td><label>%s(%d)</label></td><td><label>%s</label></td><td><label>%s</label></td><td><label>%d</label></td><td><label>%d(%d)</label></td></tr>";
@@ -3644,6 +3643,7 @@ void HandleBleConfiguration(void)
36443643
WSContentStart_P(PSTR(D_CONFIGURE_BLE));
36453644
WSContentSendStyle_P(HTTP_BLE_DEV_STYLE);
36463645
//WSContentSendStyle();
3646+
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_BLE_PARAMETERS));
36473647
WSContentSend_P(HTTP_FORM_BLE,
36483648
(Settings->flag5.mi32_enable) ? " checked" : "",
36493649
(BLEScanActiveMode) ? " checked" : ""
@@ -3655,6 +3655,7 @@ void HandleBleConfiguration(void)
36553655
//TasAutoMutex localmutex(&BLEOperationsRecursiveMutex, "BLEConf");
36563656
int number = seenDevices.size();
36573657
if (number){
3658+
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_BLE_DEVICES));
36583659
WSContentSend_P(HTTP_BLE_DEV_START);
36593660
uint64_t now = esp_timer_get_time();
36603661
now = now/1000L;

tasmota/tasmota_xsns_sensor/xsns_34_hx711.ino

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -621,15 +621,13 @@ const char HTTP_BTN_MENU_MAIN_HX711[] PROGMEM =
621621
const char HTTP_BTN_MENU_HX711[] PROGMEM =
622622
"<p></p><form action='" WEB_HANDLE_HX711 "' method='get'><button>" D_CONFIGURE_HX711 "</button></form>";
623623

624-
const char HTTP_FORM_HX711[] PROGMEM =
625-
"<fieldset><legend><b>&nbsp;" D_CALIBRATION "&nbsp;</b></legend>"
624+
const char HTTP_FORM_HX711a[] PROGMEM =
626625
"<form method='post' action='" WEB_HANDLE_HX711 "'>"
627626
"<p><b>" D_REFERENCE_WEIGHT "</b> (" D_UNIT_KILOGRAM ")<br><input type='number' step='0.001' id='p1' placeholder='0' value='%s'></p>"
628627
"<br><button name='calibrate' type='submit'>" D_CALIBRATE "</button>"
629628
"</form>"
630-
"</fieldset><br><br>"
631-
632-
"<fieldset><legend><b>&nbsp;" D_HX711_PARAMETERS "&nbsp;</b></legend>"
629+
"</fieldset><br><br>";
630+
const char HTTP_FORM_HX711b[] PROGMEM =
633631
"<form method='post' action='" WEB_HANDLE_HX711 "'>"
634632
"<p><b>" D_ITEM_WEIGHT "</b> (" D_UNIT_KILOGRAM ")<br><input type='number' max='6.5535' step='0.0001' id='p2' placeholder='0.0' value='%s'></p>";
635633

@@ -670,10 +668,12 @@ void HandleHxAction(void) {
670668

671669
WSContentStart_P(PSTR(D_CONFIGURE_HX711));
672670
WSContentSendStyle();
671+
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_CALIBRATION));
673672
dtostrfd((float)Settings->weight_reference / 1000, 3, stemp1);
674-
char stemp2[20];
675-
dtostrfd((float)Settings->weight_item / 10000, 4, stemp2);
676-
WSContentSend_P(HTTP_FORM_HX711, stemp1, stemp2);
673+
WSContentSend_P(HTTP_FORM_HX711a, stemp1);
674+
WSContentSend_P(HTTP_FIELDSET_LEGEND, PSTR(D_HX711_PARAMETERS));
675+
dtostrfd((float)Settings->weight_item / 10000, 4, stemp1);
676+
WSContentSend_P(HTTP_FORM_HX711b, stemp1);
677677
WSContentSend_P(HTTP_FORM_END);
678678
WSContentSpaceButton(BUTTON_CONFIGURATION);
679679
WSContentStop();

0 commit comments

Comments
 (0)