|
5 | 5 | #include <chrono> |
6 | 6 | #include <map> |
7 | 7 | #include <thread> |
| 8 | +#include <unordered_map> |
8 | 9 | #include <vector> |
9 | 10 |
|
| 11 | +namespace{ |
| 12 | + int get_40mhz_center_channel(int channel) { |
| 13 | + static const std::unordered_map<int, int> channel_map = { |
| 14 | + {36, 38}, {40, 38}, {44, 46}, {48, 46}, |
| 15 | + {52, 54}, {56, 54}, {60, 62}, {64, 62}, |
| 16 | + {100, 102}, {104, 102}, {108, 110}, {112, 110}, |
| 17 | + {116, 118}, {120, 118}, {124, 126}, {128, 126}, |
| 18 | + {132, 134}, {136, 134}, {140, 142}, {144, 142}, |
| 19 | + {149, 151}, {153, 151}, {157, 159}, {161, 159} |
| 20 | + }; |
| 21 | + |
| 22 | + auto it = channel_map.find(channel); |
| 23 | + return (it != channel_map.end()) ? it->second : channel; |
| 24 | + } |
| 25 | +} |
10 | 26 | RadioManagementModule::RadioManagementModule( |
11 | 27 | RtlUsbAdapter device, std::shared_ptr<EepromManager> eepromManager, |
12 | 28 | Logger_t logger) |
@@ -89,11 +105,7 @@ static uint8_t rtw_get_center_ch(uint8_t channel, ChannelWidth_t chnl_bw, |
89 | 105 | else if (channel <= 14) |
90 | 106 | center_ch = 7; |
91 | 107 | } else if (chnl_bw == ChannelWidth_t::CHANNEL_WIDTH_40) { |
92 | | - if (chnl_offset == HAL_PRIME_CHNL_OFFSET_LOWER) { |
93 | | - center_ch = (uint8_t)(channel + 2); |
94 | | - } else { |
95 | | - center_ch = (uint8_t)(channel - 2); |
96 | | - } |
| 108 | + center_ch = get_40mhz_center_channel(center_ch); |
97 | 109 | } else if (chnl_bw == ChannelWidth_t::CHANNEL_WIDTH_20) { |
98 | 110 | center_ch = channel; |
99 | 111 | } else { |
|
0 commit comments