File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -107,10 +107,10 @@ void xs_net_get(xsMachine *the)
107107 xsResult = xsStringBuffer (NULL , 18 );
108108 out = xsToString (xsResult );
109109 twoHex (config .bssid [0 ], out ); out += 2 ; * out ++ = ':' ;
110- twoHex (config .bssid [1 ], out ); out += 2 ; * out ++ = '. ' ;
111- twoHex (config .bssid [2 ], out ); out += 2 ; * out ++ = '. ' ;
112- twoHex (config .bssid [3 ], out ); out += 2 ; * out ++ = '. ' ;
113- twoHex (config .bssid [4 ], out ); out += 2 ; * out ++ = '. ' ;
110+ twoHex (config .bssid [1 ], out ); out += 2 ; * out ++ = ': ' ;
111+ twoHex (config .bssid [2 ], out ); out += 2 ; * out ++ = ': ' ;
112+ twoHex (config .bssid [3 ], out ); out += 2 ; * out ++ = ': ' ;
113+ twoHex (config .bssid [4 ], out ); out += 2 ; * out ++ = ': ' ;
114114 twoHex (config .bssid [5 ], out ); out += 2 ; * out ++ = 0 ;
115115 }
116116 }
Original file line number Diff line number Diff line change @@ -144,6 +144,7 @@ void xs_wifi_connect(xsMachine *the)
144144 char * str ;
145145 int argc = xsmcToInteger (xsArgc );
146146 wifi_mode_t mode ;
147+ int channel = -1 ;
147148
148149 initWiFi ();
149150
@@ -180,6 +181,11 @@ void xs_wifi_connect(xsMachine *the)
180181 config .sta .bssid_set = 1 ;
181182 }
182183
184+ if (xsmcHas (xsArg (0 ), xsID_channel )) {
185+ xsmcGet (xsVar (0 ), xsArg (0 ), xsID_channel );
186+ channel = xsmcToInteger (xsVar (0 ));
187+ }
188+
183189 esp_wifi_get_mode (& mode );
184190 if (WIFI_MODE_STA != mode )
185191 esp_wifi_set_mode (WIFI_MODE_STA );
@@ -189,6 +195,9 @@ void xs_wifi_connect(xsMachine *the)
189195
190196 esp_wifi_set_config (WIFI_IF_STA , & config );
191197
198+ if (channel >= 0 )
199+ esp_wifi_set_channel (channel , WIFI_SECOND_CHAN_NONE );
200+
192201 if (0 != esp_wifi_connect ())
193202 xsUnknownError ("esp_wifi_connect failed" );
194203}
You can’t perform that action at this time.
0 commit comments