From 7903f6275fcf696ebe1d645c26592f213fa48d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sun, 19 May 2024 14:35:21 +0200 Subject: [PATCH] wifi: Fix secondary channel frequency calculation for 80+80MHz --- src/wifi/model/wifi-phy-operating-channel.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/wifi/model/wifi-phy-operating-channel.cc b/src/wifi/model/wifi-phy-operating-channel.cc index 9c5f68ee0..30c1c40b2 100644 --- a/src/wifi/model/wifi-phy-operating-channel.cc +++ b/src/wifi/model/wifi-phy-operating-channel.cc @@ -708,12 +708,9 @@ WifiPhyOperatingChannel::GetSecondaryChannelCenterFrequency( // we assume here that all segments have the same width const auto segmentWidth = GetWidth(segmentIndex); const auto segmentOffset = (segmentIndex * (segmentWidth / secondaryChannelWidth)); - const auto primaryChannelIndex = GetPrimaryChannelIndex(secondaryChannelWidth); - const auto primaryCenterFrequency = - GetFrequency(segmentIndex) - segmentWidth / 2. + - (primaryChannelIndex - segmentOffset + 0.5) * secondaryChannelWidth; - return (primaryChannelIndex % 2 == 0) ? (primaryCenterFrequency + secondaryChannelWidth) - : (primaryCenterFrequency - secondaryChannelWidth); + return GetFrequency(segmentIndex) - segmentWidth / 2. + + (GetSecondaryChannelIndex(secondaryChannelWidth) - segmentOffset + 0.5) * + secondaryChannelWidth; } uint8_t