fix: keep WiFi LED on after STA detection
This commit is contained in:
@@ -51,12 +51,18 @@ class ProvisionManager extends EventEmitter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 有线网络可用时,网络已就绪;但不自动开启 AP,不抢占 wlan0。
|
// 网络已就绪时先启动 WS;hasInternet() 可能来自 WiFi,也可能来自有线,不能直接当作 wired。
|
||||||
if (hasInternet()) {
|
if (hasInternet()) {
|
||||||
this._state = 'wired';
|
if (isWifiStaConnected()) {
|
||||||
log.info('provision', '有线网络就绪,启动 WS;不自动开启 AP');
|
this._state = 'sta';
|
||||||
led.off();
|
log.info('provision', 'WiFi STA 已连接,AP 不启动');
|
||||||
this._emitNetworkReady();
|
this._emitNetworkReady();
|
||||||
|
} else {
|
||||||
|
this._state = 'wired';
|
||||||
|
log.info('provision', '有线网络就绪,启动 WS;不自动开启 AP');
|
||||||
|
led.off();
|
||||||
|
this._emitNetworkReady();
|
||||||
|
}
|
||||||
this._startMonitor();
|
this._startMonitor();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -232,7 +238,7 @@ class ProvisionManager extends EventEmitter {
|
|||||||
this._stopAPServices();
|
this._stopAPServices();
|
||||||
}
|
}
|
||||||
this._state = 'sta';
|
this._state = 'sta';
|
||||||
this.emit('network-ready');
|
this._emitNetworkReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._state === 'sta' && !wifiUp) {
|
if (this._state === 'sta' && !wifiUp) {
|
||||||
|
|||||||
Reference in New Issue
Block a user