another ENOMEM error with PicoW and urequests.post() #11559
-
Hi, I'm working with a Raspberry Pico W and 4 sensors connected via i2c. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I know you'll probably need lightsleep for your final version, but does your code (less any lightsleep-reliant bits) work with the stock 1.20 Pico W firmware? A couple of comments on the code:
|
Beta Was this translation helpful? Give feedback.
-
try calling this import gc
def free(full=False, collect=False):
if collect:
gc.collect()
F = gc.mem_free()
A = gc.mem_alloc()
T = F+A
P = '{0:.2f}%'.format(F/T*100)
if not full:
return P
else:
return ('Total:{0} Free:{1} ({2})'.format(T, F, P)) |
Beta Was this translation helpful? Give feedback.
@aleppax I would say those
ENOMEM
errors are definitelySSL
related, creating a ssl socket with every https request doesn't play out very well as you already tested. As an alternative you should consider usingmqtt
, which works withSSL
too and avoids these memory allocations errors since it only needs to be connected once.