SimpleTime ...and then?

rin67630
Posts: 99
Joined: Sun Mar 11, 2018 5:13 pm

SimpleTime ...and then?

Postby rin67630 » Tue Apr 28, 2020 2:23 am

The setup routine of SimpleTime ends with:
  1. //disconnect WiFi as it's no longer needed
  2.   WiFi.disconnect(true);
  3.   WiFi.mode(WIFI_OFF);
Well.
And then?
Wouldn't it have been helpful to give at least the required code to reconnect as a comment?
I am losing hours to "try and error" seeking a way to do that!

tommeyers
Posts: 184
Joined: Tue Apr 17, 2018 1:51 pm
Location: Santiago, Dominican Republic

Re: SimpleTime ...and then?

Postby tommeyers » Thu Apr 30, 2020 4:40 pm

Have you tried: wifi_on, false?

Have you looked at the .h .c for wifi

Tom
IT Professional, Maker
Santiago, Dominican Republic

rin67630
Posts: 99
Joined: Sun Mar 11, 2018 5:13 pm

Re: SimpleTime ...and then?

Postby rin67630 » Thu Apr 30, 2020 7:07 pm

Thank you for replying

I have currently 2 routines:

Code: Select all

  

void disConnect()
{
//  WiFi.disconnect(); //disconnect WiFi as it's no longer needed (this appear to remove the credentials)
  WiFi.mode(WIFI_OFF);
  btStop();

}  

void reConnect()
{
  WiFi.mode(WIFI_AP);
  WiFi.begin();
  delay(15);
}
When I run
disConnect();
and immediately after
reConnect();

it works well.

When I run
disConnect();
and 900mS later
reConnect();

as i would need it in the program to save power, it does not reconnect.

I did not try your suggestion:
wifi_on, false?
I never have heared of this option.
What is the purpose of it and the difference with
WiFi.mode(WIFI_OFF);

Where is the useful reference for the WiFi library of the ESP32 describing the procedures?

Thank you.
Laszlo

rin67630
Posts: 99
Joined: Sun Mar 11, 2018 5:13 pm

Re: SimpleTime ...and then?

Postby rin67630 » Thu Apr 30, 2020 10:05 pm

rin67630 wrote:
Thu Apr 30, 2020 7:07 pm
Thank you for replying

I have currently 2 routines:
I have slightly modified the routines;

Code: Select all

void reConnect()
{
  WiFi.mode(WIFI_STA);
  WiFi.begin();
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(10);
  }
}

void disConnect()
{
  //  WiFi.disconnect(); //temporarily disconnect WiFi as it's no longer needed
  WiFi.mode(WIFI_OFF);
}
That way the WiFi functionality is given, but i have got absolutely no power benefit.

With disConnect(), reConnect() or with WiFi always on, I get exactly the same current draw: 125mA, which is really bad.

It is approximately the same consumption than a >10 times more powerful Raspberry Pi zero W running a full fledged Linux a 1GHz.!

Who is online

Users browsing this forum: No registered users and 129 guests