Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4946

MicroPython • Re: Viability of Pico W as a network device

$
0
0
After a weekend of playing and refactoring it seems there are some issues with wireless in so far as 'if it goes wrong, it can stay wrong' with all sorts of weirdness ensuing.

But, when it's working, it does seem absolutely fine, quite reliable, and quite responsive, though not actually benchmarked.

I haven't been able to return a 1 MB file because I simply don't have that much file system space but did manage to send over 256 KB without running out of memory. The trick there is to send in smaller chunks and use 'socket.sendall()' rather than 'socket.send()' which most example programs use without regard to the fact it might not send everything.

Saving on memory use was mostly in not copying and slicing strings and doing processing in functions. That way local variables disappear on exit and garbage collection will automatically reclaim them without needing to jump through additional hoops. In sending that 256 KB file, memory use, which idles at 75% free, never dropped below 50% free. It seems I have cracked that side of things.

There's still much more to do, handling 'POST', adding DNS, detecting and handling loss of connection, but in terms of being a network device, it seems perfectly capable despite sometimes needing a power-cycle to knock it back into shape. And hopefully that can be resolved.

Statistics: Posted by hippy — Mon Jan 15, 2024 1:24 pm



Viewing all articles
Browse latest Browse all 4946

Trending Articles