wifi: Fix secondary channel frequency calculation for 80+80MHz

This commit is contained in:
Sébastien Deronne
2024-05-19 14:35:21 +02:00
committed by Sébastien Deronne
parent 9330795f83
commit 7903f6275f

View File

@@ -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