diff --git a/src/wifi/model/he/he-ppdu.cc b/src/wifi/model/he/he-ppdu.cc index 5d2e17248..7e0747735 100644 --- a/src/wifi/model/he/he-ppdu.cc +++ b/src/wifi/model/he/he-ppdu.cc @@ -664,7 +664,7 @@ HePpdu::GetHeSigBContentChannels(const WifiTxVector& txVector, uint8_t p20Index) std::optional cc2Central26ToneRu; const auto& orderedMap = txVector.GetUserInfoMapOrderedByRus(p20Index); - std::optional prevRuType; + HeRu::RuType prevRuType{HeRu::RuType::RU_TYPE_MAX}; std::size_t prevRuIndex{0}; std::size_t prevCcIndex{0}; for (const auto& [ru, staIds] : orderedMap) @@ -688,9 +688,9 @@ HePpdu::GetHeSigBContentChannels(const WifiTxVector& txVector, uint8_t p20Index) } const auto ruIndex = ru.GetPhyIndex(channelWidth, p20Index); - if (prevRuType && (*prevRuType != ruType)) + if ((prevRuType < HeRu::RuType::RU_TYPE_MAX) && (prevRuType != ruType)) { - prevRuIndex *= HeRu::GetBandwidth(*prevRuType) / HeRu::GetBandwidth(ruType); + prevRuIndex *= HeRu::GetBandwidth(prevRuType) / HeRu::GetBandwidth(ruType); } if (ruType >= HeRu::RU_484_TONE) { @@ -725,7 +725,7 @@ HePpdu::GetHeSigBContentChannels(const WifiTxVector& txVector, uint8_t p20Index) { ccIndex = ((prevRuIndex / numRus) % 2 == 0) ? 0 : 1; } - const auto central26TonesRus = HeRu::GetCentral26TonesRus(channelWidth, *prevRuType); + const auto central26TonesRus = HeRu::GetCentral26TonesRus(channelWidth, prevRuType); const auto isCentral26ToneRu = std::none_of(central26TonesRus.cbegin(), central26TonesRus.cend(), diff --git a/src/wifi/model/he/he-ru.h b/src/wifi/model/he/he-ru.h index 62f4ec4ef..d73c7e389 100644 --- a/src/wifi/model/he/he-ru.h +++ b/src/wifi/model/he/he-ru.h @@ -36,7 +36,8 @@ class HeRu RU_242_TONE, RU_484_TONE, RU_996_TONE, - RU_2x996_TONE + RU_2x996_TONE, + RU_TYPE_MAX }; /// (lowest index, highest index) pair defining a subcarrier range diff --git a/src/wifi/model/spectrum-wifi-phy.cc b/src/wifi/model/spectrum-wifi-phy.cc index 495a77141..dfcc6c75e 100644 --- a/src/wifi/model/spectrum-wifi-phy.cc +++ b/src/wifi/model/spectrum-wifi-phy.cc @@ -152,7 +152,7 @@ SpectrumWifiPhy::GetHeRuBands(Ptr spectrumPhyInterface { for (uint32_t i = 0; i < (channelWidth / bw); ++i) { - for (uint32_t type = 0; type < 7; type++) + for (uint32_t type = 0; type < HeRu::RuType::RU_TYPE_MAX; type++) { auto ruType = static_cast(type); std::size_t nRus = HeRu::GetNRus(bw, ruType);