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

ThierryC49
Posts: 2
Joined: Tue Jun 11, 2019 4:27 am

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

Postby ThierryC49 » Tue Jun 11, 2019 5:14 pm

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,

ThierryC49
Posts: 2
Joined: Tue Jun 11, 2019 4:27 am

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

Postby ThierryC49 » Wed Jun 12, 2019 11:57 pm

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,

Her Mary
Posts: 394
Joined: Mon Oct 27, 2014 11:09 am

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

Postby Her Mary » Wed Jun 26, 2019 11:24 am

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 

}


Who is online

Users browsing this forum: No registered users and 6 guests