@@ -206,6 +206,7 @@ const char MISSING_DATA [] PROGMEM = "Error: Missing data";
206
206
const char EEPROM_NOWRITE [] PROGMEM = " Error: Cannot write to EEPROM" ;
207
207
const char KEY_WEB_UPDATE [] PROGMEM = " $WEB_UPDATE_VISIBILITY$" ;
208
208
const char KEY_STA_SIGNAL [] PROGMEM = " $STA_SIGNAL$" ;
209
+ const char KEY_DATA_PORT_VISIBILITY [] PROGMEM = " $DATA_PORT_VISIBILITY$" ;
209
210
210
211
bool WEBINTERFACE_CLASS::isHostnameValid (const char * hostname)
211
212
{
@@ -594,7 +595,14 @@ void GetPorts(STORESTRINGS_CLASS & KeysList, STORESTRINGS_CLASS & ValuesList)
594
595
ValuesList.add (intTostr (wifi_config.iweb_port ));
595
596
// Data port
596
597
KeysList.add (FPSTR (KEY_DATA_PORT));
598
+ KeysList.add (FPSTR (KEY_DATA_PORT_VISIBILITY));
599
+ #ifdef TCP_IP_DATA_FEATURE
597
600
ValuesList.add (intTostr (wifi_config.idata_port ));
601
+ ValuesList.add (FPSTR (VALUE_ITEM_VISIBLE));
602
+ #else
603
+ ValuesList.add (FPSTR (VALUE_NONE));
604
+ ValuesList.add (FPSTR (VALUE_ITEM_HIDDEN));
605
+ #endif
598
606
}
599
607
// -----------------------------------------------------------------------------
600
608
// Helper for Page properties
@@ -1060,11 +1068,18 @@ void handle_web_interface_configSys()
1060
1068
// check is it is a submission or a display
1061
1069
if (web_interface->WebServer .hasArg (" SUBMIT" )) {
1062
1070
// is there a correct list of values?
1063
- if (web_interface->WebServer .hasArg (" BAUD_RATE" ) && web_interface->WebServer .hasArg (" SLEEP_MODE" )&& web_interface->WebServer .hasArg (" DATAPORT" )&& web_interface->WebServer .hasArg (" WEBPORT" )) {
1071
+ if (web_interface->WebServer .hasArg (" BAUD_RATE" )
1072
+ && web_interface->WebServer .hasArg (" SLEEP_MODE" )
1073
+ #ifdef TCP_IP_DATA_FEATURE
1074
+ && web_interface->WebServer .hasArg (" DATAPORT" )
1075
+ #endif
1076
+ && web_interface->WebServer .hasArg (" WEBPORT" )) {
1064
1077
// is each value correct ?
1065
1078
ibaud = web_interface->WebServer .arg (" BAUD_RATE" ).toInt ();
1066
1079
iweb_port = web_interface->WebServer .arg (" WEBPORT" ).toInt ();
1080
+ #ifdef TCP_IP_DATA_FEATURE
1067
1081
idata_port = web_interface->WebServer .arg (" DATAPORT" ).toInt ();
1082
+ #endif
1068
1083
bsleepmode = web_interface->WebServer .arg (" SLEEP_MODE" ).toInt ();
1069
1084
1070
1085
if (!(iweb_port>0 && iweb_port<65001 )) {
@@ -1073,12 +1088,14 @@ void handle_web_interface_configSys()
1073
1088
KeysList.add (FPSTR (KEY_WEB_PORT_STATUS));
1074
1089
ValuesList.add (FPSTR (VALUE_HAS_ERROR));
1075
1090
}
1091
+ #ifdef TCP_IP_DATA_FEATURE
1076
1092
if (!(idata_port>0 && idata_port<65001 )) {
1077
1093
msg_alert_error=true ;
1078
1094
smsg.concat (" Error: invalid port value for data port<BR>" );
1079
1095
KeysList.add (FPSTR (KEY_DATA_PORT_STATUS));
1080
1096
ValuesList.add (FPSTR (VALUE_HAS_ERROR));
1081
1097
}
1098
+ #endif
1082
1099
if (iweb_port== idata_port) {
1083
1100
msg_alert_error=true ;
1084
1101
smsg.concat (" Error: web port and data port cannot be identical<BR>" );
@@ -1105,12 +1122,19 @@ void handle_web_interface_configSys()
1105
1122
}
1106
1123
// if no error apply the changes
1107
1124
if (msg_alert_error!=true ) {
1108
- if (!CONFIG::write_buffer (EP_BAUD_RATE,(const byte *)&ibaud,INTEGER_LENGTH)||!CONFIG::write_buffer (EP_WEB_PORT,(const byte *)&iweb_port,INTEGER_LENGTH)||!CONFIG::write_buffer (EP_DATA_PORT,(const byte *)&idata_port,INTEGER_LENGTH)||!CONFIG::write_byte (EP_SLEEP_MODE,bsleepmode)) {
1125
+ if (!CONFIG::write_buffer (EP_BAUD_RATE,(const byte *)&ibaud,INTEGER_LENGTH)
1126
+ ||!CONFIG::write_buffer (EP_WEB_PORT,(const byte *)&iweb_port,INTEGER_LENGTH)
1127
+ #ifdef TCP_IP_DATA_FEATURE
1128
+ ||!CONFIG::write_buffer (EP_DATA_PORT,(const byte *)&idata_port,INTEGER_LENGTH)
1129
+ #endif
1130
+ ||!CONFIG::write_byte (EP_SLEEP_MODE,bsleepmode)) {
1109
1131
msg_alert_error=true ;
1110
1132
smsg = FPSTR (EEPROM_NOWRITE);
1111
1133
} else {
1112
1134
msg_alert_success=true ;
1135
+ #ifdef TCP_IP_DATA_FEATURE
1113
1136
wifi_config.iweb_port =iweb_port;
1137
+ #endif
1114
1138
wifi_config.idata_port =idata_port;
1115
1139
smsg = F (" Changes saved to EEPROM, restarting...." );
1116
1140
}
@@ -1125,10 +1149,12 @@ void handle_web_interface_configSys()
1125
1149
if (!CONFIG::read_buffer (EP_WEB_PORT, (byte *)&iweb_port , INTEGER_LENGTH)) {
1126
1150
iweb_port=DEFAULT_WEB_PORT;
1127
1151
}
1152
+ wifi_config.iweb_port =iweb_port;
1128
1153
if (!CONFIG::read_buffer (EP_DATA_PORT, (byte *)&idata_port , INTEGER_LENGTH)) {
1129
1154
idata_port=DEFAULT_DATA_PORT;
1130
1155
}
1131
- }
1156
+ wifi_config.idata_port =idata_port;
1157
+ };
1132
1158
// Baud rate list
1133
1159
istatus = 0 ;
1134
1160
stmp=" " ;
0 commit comments