@@ -31,14 +31,14 @@ def __init__(self):
3131 self .FUNCTION_SUFFIX = "endfunction"
3232 self .display_arrows = False
3333
34- def start_network (self , robot_number :int ):
34+ def start_network (self , robot_id :int ):
3535 """
3636 Open an access point from the XRP board to be used as a captive host. The network password is "remote.xrp"
3737 """
38- self .access_point = access_point (f"XRP_{ robot_number } " , "remote.xrp" )
38+ self .access_point = access_point (f"XRP_{ robot_id } " , "remote.xrp" )
3939 self .ip = network .WLAN (network .AP_IF ).ifconfig ()[0 ]
4040
41- def connect_to_network (self , ssid :str , password :str , timeout = 10 ):
41+ def connect_to_network (self , ssid :str , password :str , robot_id : int , timeout = 10 ):
4242 """
4343 Connect to a wifi network with the given ssid and password.
4444 If the connection fails, the board will disconnect from the network and return.
@@ -62,8 +62,9 @@ def start_server(self):
6262 """
6363 logging .info (f"Starting DNS Server at { self .ip } " )
6464 dns .run_catchall (self .ip )
65+ self .DOMAIN = self .ip
66+ logging .disable_logging_types (logging .LOG_INFO )
6567 server .run ()
66- logging .info ("Webserver Started" )
6768
6869 def _index_page (self , request ):
6970 # Render index page and respond to form requests
@@ -164,12 +165,12 @@ def _handleUserFunctionRequest(self, text) -> bool:
164165 try :
165166 user_function = self .buttons [text ]
166167 if user_function is None :
167- print ("User function " + text + " not found" )
168+ logging . warning ("User function " + text + " not found" )
168169 return False
169170 user_function ()
170171 return True
171172 except :
172- print ("User function " + text + " caused an exception" )
173+ logging . error ("User function " + text + " caused an exception" )
173174 return False
174175
175176 def _generateHTML (self ):
0 commit comments