ambiot / ambd_sdk

Release SDK for AmebaD
99 stars 53 forks source link

wifi_scan_networks use of rtw_wakelock_timeout #26

Closed ValterMinute closed 1 year ago

ValterMinute commented 1 year ago

The function calls rtw_wakelock_timeout with a 2s timeout to avoid suspend during a scan. This is an issue when you just need to scan a limited range (single channel), since the operation requires much less than the 2s of a full scan. Using a wakelock may be better, forcing the MCU to stay on only for the actual time required for the scan.

S10143806H commented 1 year ago

Hi @ValterMinute , May I know in what scenario you are only using wifi_scan_networks() to scan for a single channel? Usually, we support wifi scanning over 10 channels. And which wakelock() function are you referring to? I would like to verify whether there is any issue with scanning a single channel. Thanks.

ValterMinute commented 1 year ago

Location tracking. I know that a specific wifi AP exists on that channel and limit the scan to this to reduce power consumption. I understand that this isn't a typical use-case scenario, but saving power is critical for the application (battery powered device) and that 2s timeout is keeping the CPU awake for a very long time. Using a wake lock and lock it at the beginning of the scan and releasing it at the end would make this more efficient from a power consumption point of view.

S10143806H commented 1 year ago

Hi @ValterMinute, upon some internal research with our users, it seems this usage is only applied in a limited scenario, therefore, we will not proceed with the modification. I will proceed to close this issue, thanks.