-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Update WiFiGeneric.cpp #7044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update WiFiGeneric.cpp #7044
Conversation
libraries/WiFi/src/WiFiGeneric.cpp
Outdated
@@ -664,15 +664,6 @@ bool wifiLowLevelInit(bool persistent){ | |||
|
|||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); | |||
|
|||
if(!WiFiGenericClass::useStaticBuffers()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes... Default now is WiFi Dynamic Allocation in order to reduce HEAP consumption.
If the user wants to go with Static Allocation, the application shall use WiFiGenericClass::useStaticBuffers(true);
before setting the WiFi Mode with WiFiGenericClass::mode()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SuGlider Although the customers can call WiFiGenericClass::useStaticBuffers(true)
to solve the problem, but I think we also need to change the value cfg.cache_tx_buf_num = 1
to at least 4
, this will ensure the customers can send several packets at the same time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, Agree. Please commit this change. This will cost 5K RAM in the heap. It is worth it.
@zhangyanjiaoesp - void setup() {
Serial.begin(115200);
WiFi.useStaticBuffers(true);
WiFi.mode(WIFI_STA);
// rest of the necessary code ...
}
|
libraries/WiFi/src/WiFiGeneric.cpp
Outdated
cfg.static_rx_buf_num = 4; | ||
cfg.dynamic_rx_buf_num = 32; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reject this PR and changes.... as explained in
espressif/esp-idf#8992 (comment)
espressif/esp-idf#8992 (comment)
@zhangyanjiaoesp - Some background about the PR #5791: At the time of this PR #5791, the idea was to free some heap space when WiFi was activated. One possible solution, for the lack of heap, was to disable malloc over psram, as done in IDF 3.3, and then enable dynamic buffers in sdkconfig. The PR #5791 was intended to find a way to keep psram malloc working and, at the same time, enable dynamic WiFi buffer allocation to free some heap memory. This combination was impossible due to a limitation imposed by KConfig. This work around used in the PR was a nice suggestion from @igrr to try to override WiFi driver and kconfig limitation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @zhangyanjiaoesp !
Description of Change
Enlarge the cache_tx_buf num
Related links
Related PR in Arduino Lib: #5791
close espressif/esp-idf#8992