Page 1 of 3

How do I change the timeout on the softAP example?

Posted: Thu Nov 15, 2018 2:46 am
by detlier
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?

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

Posted: Mon Nov 19, 2018 5:39 am
by liuzhifu
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.

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

Posted: Mon Nov 19, 2018 6:41 pm
by Ritesh
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.

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

Posted: Tue Nov 20, 2018 11:27 pm
by detlier
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?

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

Posted: Wed Nov 21, 2018 12:13 am
by detlier
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.

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

Posted: Fri Nov 23, 2018 8:20 am
by Ritesh
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.

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

Posted: Tue Nov 27, 2018 9:03 pm
by detlier
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.

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

Posted: Thu Nov 29, 2018 6:03 pm
by Ritesh
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

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

Posted: Wed Jan 02, 2019 8:20 am
by zhangyanjiao
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.

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

Posted: Sat Jan 05, 2019 4:55 pm
by Ritesh
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.