LmacRxBlk:1 continues unabated - every time I don't close the sockets
Posted: Sun Apr 09, 2017 4:31 pm
Hi All,
I've followed all advice found on the net, but the problem continues unabated. After roughly 5 post requests with urequests, the LmacRxBlk:1 occurs and does not cease until I hard reset. A soft reboot has no effect.
The latest code is below, as is the debug info. I have used two different versions of urequests. They get the same problem. The latest version I've tried is the one by J.G.Davies.
Any advice on whether my code sucks and how to fix it will be treated like gold.
My code:
import sys
import time
import machine
import dht
import urequests
bool_interrupt = False
last_interrupt = time.time()
NOTIFICATION = "https://api.prowlapp.com/publicapi/add? ... ORTHISPOST"
def blink_led(count, delay):
for x in range(0, count - 1):
if pin_led.value():
pin_led.low()
else:
pin_led.high()
time.sleep(delay)
pin_led.value(0)
def callback(p):
global bool_interrupt
bool_interrupt = True
print(bool_interrupt)
pin_led = machine.Pin(13, machine.Pin.OUT)
pin_vibration = machine.Pin(14, machine.Pin.IN)
temp = dht.DHT11(machine.Pin(0))
#d.measure()
#print(d.temperature())
# Tell everyone we are awake
blink_led(8, 0.5)
# now set interrupt for movement
pin_vibration.irq(trigger=machine.Pin.IRQ_FALLING, handler=callback)
url = NOTIFICATION
wlan = network.WLAN(network.STA_IF)
while True:
if wlan.isconnected() == False:
print('WiFi disconnected')
break
if bool_interrupt:
this_interrupt = time.time()
if this_interrupt - last_interrupt < 5:
print('avoid interrupt')
else:
print('interrupt')
resp = urequests.urlopen(url, 'method=POST')
print(resp)
last_interrupt = this_interrupt
blink_led(6, 0.3)
bool_interrupt = False
# time.sleep(1)
The console log:
#6 ets_task(40100164, 3, 3fff828c, 4)
network config: ('192.168.1.44', '255.255.255.0', '192.168.1.1', '192.168.1.1')
True
True
interrupt
True
True
<_SSLSocket 3fff2b10>
True
True
interrupt
<_SSLSocket 3fff4420>
True
True
interrupt
True
True
True
True
True
True
True
True
True
True
<_SSLSocket 3fff2b10>
True
interrupt
True
True
<_SSLSocket 3fff65f0>
True
True
interrupt
True
True
True
True
True
True
True
True
True
True
<_SSLSocket 3fff2ed0>
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
I've followed all advice found on the net, but the problem continues unabated. After roughly 5 post requests with urequests, the LmacRxBlk:1 occurs and does not cease until I hard reset. A soft reboot has no effect.
The latest code is below, as is the debug info. I have used two different versions of urequests. They get the same problem. The latest version I've tried is the one by J.G.Davies.
Any advice on whether my code sucks and how to fix it will be treated like gold.
My code:
import sys
import time
import machine
import dht
import urequests
bool_interrupt = False
last_interrupt = time.time()
NOTIFICATION = "https://api.prowlapp.com/publicapi/add? ... ORTHISPOST"
def blink_led(count, delay):
for x in range(0, count - 1):
if pin_led.value():
pin_led.low()
else:
pin_led.high()
time.sleep(delay)
pin_led.value(0)
def callback(p):
global bool_interrupt
bool_interrupt = True
print(bool_interrupt)
pin_led = machine.Pin(13, machine.Pin.OUT)
pin_vibration = machine.Pin(14, machine.Pin.IN)
temp = dht.DHT11(machine.Pin(0))
#d.measure()
#print(d.temperature())
# Tell everyone we are awake
blink_led(8, 0.5)
# now set interrupt for movement
pin_vibration.irq(trigger=machine.Pin.IRQ_FALLING, handler=callback)
url = NOTIFICATION
wlan = network.WLAN(network.STA_IF)
while True:
if wlan.isconnected() == False:
print('WiFi disconnected')
break
if bool_interrupt:
this_interrupt = time.time()
if this_interrupt - last_interrupt < 5:
print('avoid interrupt')
else:
print('interrupt')
resp = urequests.urlopen(url, 'method=POST')
print(resp)
last_interrupt = this_interrupt
blink_led(6, 0.3)
bool_interrupt = False
# time.sleep(1)
The console log:
#6 ets_task(40100164, 3, 3fff828c, 4)
network config: ('192.168.1.44', '255.255.255.0', '192.168.1.1', '192.168.1.1')
True
True
interrupt
True
True
<_SSLSocket 3fff2b10>
True
True
interrupt
<_SSLSocket 3fff4420>
True
True
interrupt
True
True
True
True
True
True
True
True
True
True
<_SSLSocket 3fff2b10>
True
interrupt
True
True
<_SSLSocket 3fff65f0>
True
True
interrupt
True
True
True
True
True
True
True
True
True
True
<_SSLSocket 3fff2ed0>
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1