@@ -542,6 +542,20 @@ bool tcpipInit(){
542
542
* */
543
543
544
544
static bool lowLevelInitDone = false ;
545
+ bool WiFiGenericClass::_wifiUseStaticBuffers = false ;
546
+
547
+ bool WiFiGenericClass::useStaticBuffers (){
548
+ return _wifiUseStaticBuffers;
549
+ }
550
+
551
+ void WiFiGenericClass::useStaticBuffers (bool bufferMode){
552
+ if (lowLevelInitDone) {
553
+ log_w (" WiFi already started. Call WiFi.mode(WIFI_MODE_NULL) before setting Static Buffer Mode." );
554
+ }
555
+ _wifiUseStaticBuffers = bufferMode;
556
+ }
557
+
558
+
545
559
bool wifiLowLevelInit (bool persistent){
546
560
if (!lowLevelInitDone){
547
561
lowLevelInitDone = true ;
@@ -557,6 +571,16 @@ bool wifiLowLevelInit(bool persistent){
557
571
}
558
572
559
573
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT ();
574
+
575
+ if (!WiFiGenericClass::useStaticBuffers ()) {
576
+ cfg.static_tx_buf_num = 0 ;
577
+ cfg.dynamic_tx_buf_num = 32 ;
578
+ cfg.tx_buf_type = 1 ;
579
+ cfg.cache_tx_buf_num = 1 ; // can't be zero!
580
+ cfg.static_rx_buf_num = 4 ;
581
+ cfg.dynamic_rx_buf_num = 32 ;
582
+ }
583
+
560
584
esp_err_t err = esp_wifi_init (&cfg);
561
585
if (err){
562
586
log_e (" esp_wifi_init %d" , err);
@@ -644,7 +668,6 @@ wifi_ps_type_t WiFiGenericClass::_sleepEnabled = WIFI_PS_MIN_MODEM;
644
668
645
669
WiFiGenericClass::WiFiGenericClass ()
646
670
{
647
-
648
671
}
649
672
650
673
const char * WiFiGenericClass::getHostname ()
0 commit comments