@@ -695,7 +695,7 @@ wifiManager.setTimeout(30);
695695#endif
696696 IPAddress ip, dns, gw, mask;
697697 int res = 1 ;
698- debugSerial<<F (" Starting lan" );
698+ debugSerial<<F (" Starting lan" )<<endl ;
699699 if (ipLoadFromFlash (OFFSET_IP, ip)) {
700700 debugSerial<<" Loaded from flash IP:" ;
701701 printIPAddress (ip);
@@ -714,6 +714,9 @@ wifiManager.setTimeout(30);
714714 } else Ethernet.begin (mac, ip);
715715 debugSerial<<endl;
716716 lanStatus = HAVE_IP_ADDRESS;
717+ #ifdef _artnet
718+ if (artnet) artnet->begin ();
719+ #endif
717720 }
718721 else {
719722 debugSerial<<" \n No IP data found in flash\n " ;
@@ -1081,24 +1084,28 @@ void cmdFunctionIp(int arg_cnt, char **args)
10811084 #define inet_aton(cp, addr) inet_aton(cp, addr)
10821085 #endif
10831086*/
1084- switch (arg_cnt) {
1085- case 5 :
1086- if (inet_aton (args[4 ], ip)) saveFlash (OFFSET_MASK, ip);
1087+
1088+ // switch (arg_cnt) {
1089+ // case 5:
1090+ if (arg_cnt>4 && inet_aton (args[4 ], ip)) saveFlash (OFFSET_MASK, ip);
10871091 else saveFlash (OFFSET_MASK, ip0);
1088- case 4 :
1089- if (inet_aton (args[3 ], ip)) saveFlash (OFFSET_GW, ip);
1092+ // case 4:
1093+ if (arg_cnt> 3 && inet_aton (args[3 ], ip)) saveFlash (OFFSET_GW, ip);
10901094 else saveFlash (OFFSET_GW, ip0);
1091- case 3 :
1092- if (inet_aton (args[2 ], ip)) saveFlash (OFFSET_DNS, ip);
1095+ // case 3:
1096+ if (arg_cnt> 2 && inet_aton (args[2 ], ip)) saveFlash (OFFSET_DNS, ip);
10931097 else saveFlash (OFFSET_DNS, ip0);
1094- case 2 :
1095- if (inet_aton (args[1 ], ip)) saveFlash (OFFSET_IP, ip);
1098+ // case 2:
1099+ if (arg_cnt> 1 && inet_aton (args[1 ], ip)) saveFlash (OFFSET_IP, ip);
10961100 else saveFlash (OFFSET_IP, ip0);
1097- break ;
1101+ // break;
10981102
1099- case 1 : // dynamic IP
1103+ // case 1: //dynamic IP
1104+ if (arg_cnt==1 )
1105+ {
11001106 saveFlash (OFFSET_IP,ip0);
11011107 debugSerial<<F (" Set dynamic IP\n " );
1108+ }
11021109/*
11031110 IPAddress current_ip = Ethernet.localIP();
11041111 IPAddress current_mask = Ethernet.subnetMask();
@@ -1113,7 +1120,7 @@ void cmdFunctionIp(int arg_cnt, char **args)
11131120 printIPAddress(current_dns);
11141121 printIPAddress(current_gw);
11151122 printIPAddress(current_mask); */
1116- }
1123+ // }
11171124 debugSerial<<F (" Saved\n " );
11181125}
11191126
@@ -1174,7 +1181,7 @@ void saveFlash(short n, IPAddress& ip) {
11741181int ipLoadFromFlash (short n, IPAddress &ip) {
11751182 for (int i = 0 ; i < 4 ; i++)
11761183 ip[i] = EEPROM.read (n++);
1177- return (ip[0 ] && (ip[0 ] != 0xff ));
1184+ return (ip[0 ] && (( ip[0 ] != 0xff ) || (ip[ 1 ] != 0xff ) || (ip[ 2 ] != 0xff ) || (ip[ 3 ] != 0xff ) ));
11781185}
11791186lan_status loadConfigFromHttp (int arg_cnt, char **args)
11801187{
0 commit comments