Skip to content

Conversation

Evlers
Copy link
Contributor

@Evlers Evlers commented Mar 24, 2024

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

在执行wifi scan命令时,扫描出来的结果会重复打印,我测试在lts-v4.1.x是不存在这个问题的。
重复打印的问题如下:

msh />wifi scan
             SSID                      MAC            security    rssi chn Mbps
------------------------------- -----------------  -------------- ---- --- ----
EvlerHome                       c8:ea:f8:eb:cd:6e  WPA2_AES_PSK   -48    5  300
EvlerHome                       c8:ea:f8:eb:cd:6e  WPA2_AES_PSK   -47    5  300
ES-650733                       58:48:49:05:84:5d  WPA2_AES_PSK   -86    9   72
TP-LINK_403                     b8:f8:83:af:4c:61  WPA2_AES_PSK   -67   11  450
TP-LINK_403                     b8:f8:83:af:4c:61  WPA2_AES_PSK   -69   11  450
312                             20:6b:e7:81:fc:1b  WPA2_AES_PSK   -62   11  450
EvlerHome                       c8:ea:f8:eb:cd:6e  WPA2_AES_PSK   -46    5  300
EvlerHome                       c8:ea:f8:eb:cd:6e  WPA2_AES_PSK   -46    5  300
YXKJ                            48:5f:08:b2:f6:1d  WPA2_AES_PSK   -76    6  300
                                f8:9a:78:73:73:4d  WPA2_AES_PSK   -91    6  300
Xiaomi_404                      5c:02:14:63:62:5a  WPA2_MIXED_PSK -90    9  144
312                             20:6b:e7:81:fc:1b  WPA2_AES_PSK   -62   11  450
TP-LINK_403                     b8:f8:83:af:4c:61  WPA2_AES_PSK   -67   11  450
111111                          ec:26:ca:eb:c0:84  WPA2_AES_PSK   -70    1  450
111111                          ec:26:ca:eb:c0:84  WPA2_AES_PSK   -70    1  450
ChinaNet-5sD3                   bc:5d:a3:8c:84:56  WPA2_MIXED_PSK -76    4  144

你的解决方案是什么 (what is your solution)

在将扫描结果保存到cached (wifi_scan_result_cache) 之前,先读取扫描结果的数量,然后再存入cached,利用cached的查重机制检查数量是否增加新的ap。
wifi_scan_result_cache函数完成后,如果scan_result.num有增加,说明该ap属于新扫描到的ap,此时再将该ap信息打印出来。
以下是修复后的效果:

msh />wifi scan
             SSID                      MAC            security    rssi chn Mbps
------------------------------- -----------------  -------------- ---- --- ----
EvlerHome                       c8:ea:f8:eb:cd:6e  WPA2_AES_PSK   -46    5  300
ES-650733                       58:48:49:05:84:5d  WPA2_AES_PSK   -84    9   72
TP-LINK_403                     b8:f8:83:af:4c:61  WPA2_AES_PSK   -66   11  450
312                             20:6b:e7:81:fc:1b  WPA2_AES_PSK   -60   11  450
YXKJ                            48:5f:08:b2:f6:1d  WPA2_AES_PSK   -73    6  300
Xiaomi_404                      5c:02:14:63:62:5a  WPA2_MIXED_PSK -71    9  144
406                             6c:b1:58:f7:3b:3b  WPA2_AES_PSK   -91   12  300
ChinaNet-5sD3                   bc:5d:a3:8c:84:56  WPA2_MIXED_PSK -85    1  144
111111                          ec:26:ca:eb:c0:84  WPA2_AES_PSK   -67    1  450
405                             ec:26:ca:fa:c0:d2  WPA2_AES_PSK   -76    1  450
110-2                           3c:cd:57:75:c3:bc  WPA2_MIXED_PSK -85    1  300
Xiaomi_301                      c8:bf:4c:db:9e:2a  WPA2_MIXED_PSK -78    4  300

请提供验证的bsp和config (provide the config and bsp)

  • BSP:
  • .config:
  • action:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification

@mysterywolf mysterywolf added the +1 Agree +1 label Mar 24, 2024
@mysterywolf mysterywolf requested a review from Rbb666 March 24, 2024 05:45
@mysterywolf
Copy link
Member

感谢提交PR!

@mysterywolf mysterywolf merged commit dca8a06 into RT-Thread:master Mar 24, 2024
@Evlers Evlers deleted the fixed_wlan_cmd branch March 25, 2024 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

+1 Agree +1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants