File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 7
7
consecutive_active_reports = 0
8
8
config_hash = reset_lib .config_file_hash ()
9
9
10
+ # If auto_config is set to 0 in /etc/raspiwifi/raspiwifi.conf exit this script
10
11
if config_hash ['auto_config' ] == "0" :
11
12
sys .exit ()
12
13
else :
14
+ # Main connection monitoring loop at 10 second interval
13
15
while True :
14
16
time .sleep (10 )
15
17
18
+ # If iwconfig report no association with an AP add 10 to the "No
19
+ # Connection Couter"
16
20
if reset_lib .is_wifi_active () == False :
17
21
no_conn_counter += 10
18
22
consecutive_active_reports = 0
23
+ # If iwconfig report association with an AP add 1 to the
24
+ # consecutive_active_reports counter and 10 to the no_conn_counter
19
25
else :
20
26
consecutive_active_reports += 1
21
27
no_conn_counter += 10
28
+ # Since wpa_supplicant seems to breifly associate with an AP for
29
+ # 6-8 seconds to check the network key the below will reset the
30
+ # no_conn_counter to 0 only if two 10 second checks have come up active.
22
31
if consecutive_active_reports >= 2 :
23
32
no_conn_counter = 0
24
33
consecutive_active_reports = 0
25
34
35
+ # If the number of seconds not associated with an AP is greater or
36
+ # equal to the auto_config_delay specified in the /etc/raspiwifi/raspiwifi.conf
37
+ # trigger a reset into AP Host (Configuration) mode.
26
38
if no_conn_counter >= int (config_hash ['auto_config_delay' ]):
27
39
reset_lib .reset_to_host_mode ()
You can’t perform that action at this time.
0 commit comments