Weirdly we have to stop the AP too (which we never started),
or cyw43_tcpip_link_status still reports that STA is connected.
As long as AP mode isn't implemented, this doesn't matter and
we can just do it.
The standard Python 'fix' for 'send()' returning prematurely is to
use the 'sendall()' method instead. However, this method was not
available. adafruit_httpserver will probably need to code a version
of it for older versions or for Airlift, but when it's available
this code works (Tested on picow sending 8192 bytes) and may be more
efficient.
(implementing 'sendall' in python should take care to slice a memoryview
rather than the original buffer)
Foamyguy discovered that trying to send >2920 bytes at once consistently
failed. I further discovered that sometimes trying to send >1460 bytes
would fail too. By "fail", I mean that it would take a very long time
(around 200 * 50ms) before erroneously reporting that all bytes were
written.
In my testing, this change causes larger writes to successfully
send either 2920 or 1460 bytes (possibly after doing some 50ms waits
for a previous packet to clear).
The documentation of socket.send always stated that it COULD send fewer
bytes than requested, but adafruit_httpserver assumed that the number
of requested bytes were always sent, so after this change alone,
adafruit_httpserver will still not work properly.
Closes: #7077 (albeit fixes are needed in adafruit_httpserver too)
A task that has been sent to the loop's exception handler due to being
re-scheduled twice will then subsequently cause a `raise None` if it is
subsequently awaited. In the C version of task.py, this causes a segfault.
This makes the await succeed (via raising StopIteration instead).
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
.. since Adafruit_CircuitPython_asyncio is hard-coded to this _TICKS_PERIOD
not the one that would otherwise be used on Unix
This fixes all the uasyncio test failures on Unix
This also depends on https://github.com/adafruit/Adafruit_CircuitPython_Ticks/pull/8
otherwise adafruit_ticks is unimportable and the tests are just skipped.
Several of the tests fail, and one runs forever instead of terminating.
We should fix our asyncio until the tests patch, then incorporate this
change.
We adopted the file "py/ioctl.h" and the ioctl names beginning
with MP_IOCTL_POLL while micropython went with "py/stream.h" and
MP_STREAM_POLL.
Align with upstream.
Closes#6711
This reduces power consumption during true deep sleep.
In my measurements with ppk2 and a program that _irrevocably_ entered
deep sleep (no time alarm or pin alarm), power usage as measured on a
ppk2 decreased from ~10mA to ~1mA.