[状态栏]代码逻辑优化

This commit is contained in:
renwj
2022-09-08 17:59:05 +08:00
parent 726d525a61
commit 453ed4c39d
3 changed files with 4 additions and 4 deletions

View File

@@ -97,7 +97,7 @@ internal class CanImpl(ctx: Context): IFlow<CanStatus>(ctx), IMoGoAutopilotVehic
private fun timeOutCheck() {
job?.safeCancel()
launch(Dispatchers.Default) {
launch(Dispatchers.Unconfined) {
delay(4000)
send(CanStatus(isCanEnabled()))
}.also { job = it }

View File

@@ -79,7 +79,7 @@ internal class NetsImpl(ctx: Context): IFlow<NetStatus>(ctx) {
private fun checkAndSend() {
loopCheckAndSendJob?.safeCancel()
launch(Dispatchers.Default) {
launch(Dispatchers.Unconfined) {
val connectionInfo = wifiMgr.connectionInfo
val enabled = isNetConnected()
val name =

View File

@@ -44,7 +44,7 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
return
}
check?.takeIf { it.isActive }?.cancel()
launch {
launch(Dispatchers.Unconfined) {
CallerAutoPilotManager.sendStatusQueryReq()
delay(5000)
isOldVersion.set(true)
@@ -82,7 +82,7 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
if (isRTKEnabled()) {
send(RTKStatus("RTK", 0))
timeOutCheck?.takeIf { it.isActive }?.cancel()
launch {
launch(Dispatchers.Unconfined) {
delay(4000)
send(RTKStatus("", -1))
}.also {