Page 1 of 1

RTOS SDK 2.1 : Switch OFF the wifi without enter in sleep mode

Posted: Tue Jun 11, 2019 5:14 pm
by ThierryC49
Hello,
I would like to switch OFF WiFi but still active the main MCU for survey process on some input and send alert by WiFi, is there any way to switch OFF the WiFi alone without entered in deepsleep mode

Thanks
Thierry,

Re: RTOS SDK 2.1 : Switch OFF the wifi without enter in sleep mode

Posted: Wed Jun 12, 2019 11:57 pm
by ThierryC49
I post my self reply for other user (I found this information on espressif document 20a-esp8266_rtos_sdk_programming_guide_en.pdf page 28 :
to switch OFF the RF part

Code: Select all

   
wifi_station_disconnect();
wifi_set_opmode(NULL_MODE);
wifi_set_sleep_type(MODEM_SLEEP_T);
wifi_fpm_open();
wifi_fpm_do_sleep(5*60*1000); //sleep for 1min


To switch ON the RF PART

Code: Select all

wifi_set_opmode(STATIONAP_MODE);
wifi_station_connect();       // connect to AP


Please comment this post if you see any limitation or miss understanding from myself

Thierry,

Re: RTOS SDK 2.1 : Switch OFF the wifi without enter in sleep mode

Posted: Wed Jun 26, 2019 11:24 am
by Her Mary
Maybe you can try force modem sleep, modem sleep is only switch off the RF afaik.

Code: Select all

void fpm_wakup_cb_func1(void)

 {

   wifi_fpm_close();
   wifi_set_opmode(STATION_MODE);
   wifi_station_connect();

}
void user_func()

{

wifi_station_disconnect();

wifi_set_opmode(NULL_MODE);
wifi_fpm_set_sleep_type(MODEM_SLEEP_T);
wifi_fpm_open();

// wakeup automatically when timeout.

wifi_fpm_set_wakeup_cb(fpm_wakup_cb_func1); // Set wakeup callback 

wifi_fpm_do_sleep(50*1000); 
 #endif 

}