@@ -30,19 +30,21 @@ def connect_network(
3030 ssid : str = "" ,
3131 pswd : str = "" ,
3232 lan_if : "network.LAN" = None ,
33- eth_mode : str = "DHCP" ,
33+ protocol : str = "DHCP" ,
3434 ip : str = "" ,
3535 netmask : str = "" ,
3636 gateway : str = "" ,
3737 dns : str = "" ,
3838 ) -> bool :
3939 if self .network_type == "WIFI" and len (ssid ) > 0 :
4040 self .network .connect (ssid , pswd )
41+ if protocol == "STATIC" :
42+ self .network .ifconfig ((ip , netmask , gateway , dns ))
4143 return True
4244 elif self .network_type == "ETH" :
4345 self .network = lan_if
4446 self .network .active (True )
45- if eth_mode == "STATIC" :
47+ if protocol == "STATIC" :
4648 self .network .ifconfig ((ip , netmask , gateway , dns ))
4749 return True
4850 else :
@@ -82,7 +84,7 @@ def startup(boot_opt, timeout: int = 60) -> None:
8284 net_mode = nvs .get_str ("net_mode" )
8385 ssid = nvs .get_str ("ssid0" )
8486 pswd = nvs .get_str ("pswd0" )
85- eth_mode = nvs .get_str ("eth_mode " )
87+ protocol = nvs .get_str ("protocol " )
8688 ip = nvs .get_str ("ip_addr" )
8789 netmask = nvs .get_str ("netmask" )
8890 gateway = nvs .get_str ("gateway" )
@@ -291,7 +293,7 @@ def startup(boot_opt, timeout: int = 60) -> None:
291293 from .stamplc import StampPLC_Startup
292294
293295 plc = StampPLC_Startup ()
294- plc .startup (net_mode , ssid , pswd , eth_mode , ip , netmask , gateway , dns , timeout )
296+ plc .startup (net_mode , ssid , pswd , protocol , ip , netmask , gateway , dns , timeout )
295297
296298 elif board_id == M5 .BOARD .M5Tab5 :
297299 from .tab5 import Tab5_Startup
0 commit comments