From 747685dd0d59830230860cfffd2e07e93b697346 Mon Sep 17 00:00:00 2001 From: you name Date: Thu, 1 Apr 2021 11:03:45 +0800 Subject: [PATCH] Optimize algorithm to select wifi --- src/mainwindow.cpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 51059306..d7785b02 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1831,11 +1831,11 @@ void MainWindow::wifiListOptimize(QStringList& slist) QStringList targetList; //slist优化,同名同频AP中只留信号最强 targetList< freq) { - if ((signal-conSignal) > 50) { //低频的信号格数比高频大于两格,选低频 - deleteWifiStr.append(wifiInfo); - } else { - deleteWifiStr.append(wifiStr); - } + if (conFreq >= 5000) { + //排在前面的一个是5Gwifi,并且信号也强一些 + deleteWifiStr.append(wifiStr); } else { - if ((conSignal-signal) > 50) { //低频的信号格数比高频大于两格,选低频 - deleteWifiStr.append(wifiStr); + //排在前面的一个是2.4G + if (freq >= 5000) { + //排在后面的一个是5G + if (signal >= 55) { + //排在后面的一个是5Gwifi信号强度 >= 3格,选5G + deleteWifiStr.append(wifiInfo); + } else { + deleteWifiStr.append(wifiStr); + } } else { - deleteWifiStr.append(wifiInfo); + //排在后面的一个是2.4G + deleteWifiStr.append(wifiStr); } } break;