How do I change the timeout on the softAP example?

detlier
Posts: 15
Joined: Tue Nov 06, 2018 3:44 am

How do I change the timeout on the softAP example?

Postby detlier » Thu Nov 15, 2018 2:46 am

In the softAP example code, if a client moves out of range or powers off suddenly, it takes about 334 seconds (5 minutes) before I see this in the serial log:

Code: Select all

W (552929) wifi: inactive timer: now=20f010f1 last_rx_time=ef8bad1 diff=4996e, aid[1]84:3a:4b:9e:64:c0 leave
I (552929) wifi: station: 84:3a:4b:9e:64:c0 leave, AID = 1
I (552939) wifi: n:4 0, o:4 0, ap:4 1, sta:255 255, prof:4
I (552939) esp-streamer: station:84:3a:4b:9e:64:c0leave, AID=1
My application requires a quicker response to this failure mode, but I cannot figure out how the timeout is enforced. I can't actually see where any code in ESP-IDF actually triggers the SYSTEM_EVENT_STA_DISCONNECTED event, only where it's handled. I can't find where this timeout is set in the initialisation code. Is there a way to tune this particular parameter?

liuzhifu
Posts: 39
Joined: Tue Dec 13, 2016 2:18 am

Re: How do I change the timeout on the softAP example?

Postby liuzhifu » Mon Nov 19, 2018 5:39 am

Hi detlier, the default station inactivity timer for soft-AP is set to 5 minutes, currently ESP32 has no API to configure this parameter. We will consider to support it in future IDF v4.0, it should be 3 or 6 months later.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: How do I change the timeout on the softAP example?

Postby Ritesh » Mon Nov 19, 2018 6:41 pm

detlier wrote:
Thu Nov 15, 2018 2:46 am
In the softAP example code, if a client moves out of range or powers off suddenly, it takes about 334 seconds (5 minutes) before I see this in the serial log:

Code: Select all

W (552929) wifi: inactive timer: now=20f010f1 last_rx_time=ef8bad1 diff=4996e, aid[1]84:3a:4b:9e:64:c0 leave
I (552929) wifi: station: 84:3a:4b:9e:64:c0 leave, AID = 1
I (552939) wifi: n:4 0, o:4 0, ap:4 1, sta:255 255, prof:4
I (552939) esp-streamer: station:84:3a:4b:9e:64:c0leave, AID=1
My application requires a quicker response to this failure mode, but I cannot figure out how the timeout is enforced. I can't actually see where any code in ESP-IDF actually triggers the SYSTEM_EVENT_STA_DISCONNECTED event, only where it's handled. I can't find where this timeout is set in the initialisation code. Is there a way to tune this particular parameter?
Hi,

You can implement your own reconnect policy as per your requirement in which you can configure like after how much time you want to start reconnection based on disconnect event.

We have implemented reconnect policy for our project in which it is going to reconnect after 60 seconds which is also configurable for user perspective.

Let me know if you need any help for same.
Regards,
Ritesh Prajapati

detlier
Posts: 15
Joined: Tue Nov 06, 2018 3:44 am

Re: How do I change the timeout on the softAP example?

Postby detlier » Tue Nov 20, 2018 11:27 pm

I'm not talking about reconnection after disconnect, I'm talking about how long it takes to disconnect in the first place. It takes five minutes of total inactivity from an associated client before the disconnect even happens — how do I change that?

detlier
Posts: 15
Joined: Tue Nov 06, 2018 3:44 am

Re: How do I change the timeout on the softAP example?

Postby detlier » Wed Nov 21, 2018 12:13 am

liuzhifu wrote:
Mon Nov 19, 2018 5:39 am
Hi detlier, the default station inactivity timer for soft-AP is set to 5 minutes, currently ESP32 has no API to configure this parameter. We will consider to support it in future IDF v4.0, it should be 3 or 6 months later.
Sorry liuzhifu, I missed this. Thanks for the info. Do you know if it's hard-coded in the IDF or a dependency? I don't usually like messing around with dependencies, but if it becomes a hard requirement it would be good to know where it's set.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: How do I change the timeout on the softAP example?

Postby Ritesh » Fri Nov 23, 2018 8:20 am

detlier wrote:
Tue Nov 20, 2018 11:27 pm
I'm not talking about reconnection after disconnect, I'm talking about how long it takes to disconnect in the first place. It takes five minutes of total inactivity from an associated client before the disconnect even happens — how do I change that?
Right now, We are using ESP32 IDF 3.0 and 3.1 IDF and we have also tested sample WiFi STA connectivity examples in which we haven't seen any 5 minutes inactivity state after getting disconnection event.

But you can do wifi connect API again on disconnect event. Let me clear if i am wrong or misunderstood anything.
Regards,
Ritesh Prajapati

detlier
Posts: 15
Joined: Tue Nov 06, 2018 3:44 am

Re: How do I change the timeout on the softAP example?

Postby detlier » Tue Nov 27, 2018 9:03 pm

Ritesh wrote:
Fri Nov 23, 2018 8:20 am
...we haven't seen any 5 minutes inactivity state after getting disconnection event.

But you can do wifi connect API again on disconnect event. Let me clear if i am wrong or misunderstood anything.
I think this is what you are misunderstanding. It is not after the disconnect event. It takes 5 minutes to get the disconnect event if the associated client disappears.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: How do I change the timeout on the softAP example?

Postby Ritesh » Thu Nov 29, 2018 6:03 pm

detlier wrote:
Tue Nov 27, 2018 9:03 pm
Ritesh wrote:
Fri Nov 23, 2018 8:20 am
...we haven't seen any 5 minutes inactivity state after getting disconnection event.

But you can do wifi connect API again on disconnect event. Let me clear if i am wrong or misunderstood anything.
I think this is what you are misunderstanding. It is not after the disconnect event. It takes 5 minutes to get the disconnect event if the associated client disappears.
We have tested it same earlier and didn't find that much of delay to get disconnectivity event. Still, I will check it again and will let you know results
Regards,
Ritesh Prajapati

zhangyanjiao
Posts: 34
Joined: Mon Aug 28, 2017 3:27 am

Re: How do I change the timeout on the softAP example?

Postby zhangyanjiao » Wed Jan 02, 2019 8:20 am

Sorry liuzhifu, I missed this. Thanks for the info. Do you know if it's hard-coded in the IDF or a dependency? I don't usually like messing around with dependencies, but if it becomes a hard requirement it would be good to know where it's set.
Hi detlier,
We know where it's set, and currently it's hard-coded in the IDF. We are preparing to add an API for users to set the inactive timer. As liuzhifu said, it may be released in IDF 4.0.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: How do I change the timeout on the softAP example?

Postby Ritesh » Sat Jan 05, 2019 4:55 pm

zhangyanjiao wrote:
Wed Jan 02, 2019 8:20 am
Sorry liuzhifu, I missed this. Thanks for the info. Do you know if it's hard-coded in the IDF or a dependency? I don't usually like messing around with dependencies, but if it becomes a hard requirement it would be good to know where it's set.
Hi detlier,
We know where it's set, and currently it's hard-coded in the IDF. We are preparing to add an API for users to set the inactive timer. As liuzhifu said, it may be released in IDF 4.0.
Hi,

Would you please let me what type of timer you are talking like disconnect timer for WiFi? Please clarify for that so that it will be easy for other as well.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: Bing [Bot] and 70 guests