Skip to content
This repository was archived by the owner on Jan 1, 2019. It is now read-only.

Commit daa2574

Browse files
committed
Allow wifi settings for service to work.
1 parent 2490f79 commit daa2574

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

esp32/modules/services.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def setup(pmCb=False, drawCb=False):
115115

116116
if loopEnabled:
117117
try:
118-
loopCallbacks[srv.loop] = 0
118+
loopCallbacks[srv.loop] = wifiInLoop
119119
except:
120120
print("[SERVICES] Loop requested but not defined in service "+app)
121121

@@ -152,6 +152,14 @@ def loop_timer_callback(tmr):
152152
requestedInterval = 99999999
153153
newLoopCallbacks = loopCallbacks
154154
for cb in loopCallbacks:
155+
if loopCallbacks[cb]:
156+
print("[SERVICES] Loop needs wifi!")
157+
if not easywifi.status():
158+
if not easywifi.enable():
159+
print("[SERVICES] Wifi not available!")
160+
continue
161+
else:
162+
print("[SERVICES] Loop does not need wifi!")
155163
rqi = 0
156164
try:
157165
rqi = cb()
@@ -171,6 +179,8 @@ def loop_timer_callback(tmr):
171179
if requestedInterval>=99999999:
172180
print("[SERVICES] No loop interval returned.")
173181
requestedInterval = -1
182+
183+
easywifi.disable() # Always disable wifi
174184

175185
try:
176186
if pmCallback(requestedInterval):

0 commit comments

Comments
 (0)