This reverts commit 7e6e824d56.
Fixes#7770
The change in #7623 needs to be revered; the raise-site added in #7632
is the correct one and the one in socketpool needs to be reverted.
This is not affecting 8.0.x because #7623 was not back-ported to there
before we realized it was not a full fix.
Both #7770 and #7606 should be re-tested. I didn't test.
Based on Feather RP2040 SCORPIO, but new USB PID (from MBAdafruitBoards/Production) and pin name changes for GP16-23 (CKN/CKP etc., from board schematic).
It now handles deinit, never_reset and sharing tracking. PWM
now runs in the WAIT state as well during a time.sleep().
_reset_ok() was removed because it was called in one spot right
before deinit().
Some PWMOut were also switched to a bitmap for use instead of
reference count. That way init and deinit are idempotent.
Fixes#6589. Fixes#4841. Fixes#4541.
Rather than returning the negative error value.
This is intended to close#7606, though I did not test with mqtt.
Instead, I created a simple standalone test program:
```python
import wifi, socketpool, ssl, time
#wifi.radio.connect(<omitted>)
import socketpool
socket = socketpool.SocketPool(wifi.radio)
ctx = ssl.create_default_context()
b = bytearray(8)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sss = ctx.wrap_socket(s, server_hostname='example.com')
sss.connect(('example.com', 443))
sss.setblocking(False)
r = sss.recv_into(b)
print(r, b) # prints 4294967285 which is -11 as unsigned
sss.close()
```
Before the change, r was the out of range value 4294967285. After the
change, the recv_into call raises OSError instead.
This is comparable to the behavior on standard Python, though an
SSLWantReadError is raised instead.
The original (mis)behavior seems to match what was uncovered deep inside
minimqtt by adding logging:
```
370.578: DEBUG - PKT: _sock_exact_recv: recv_len = 4294967285
```
This 2-in-1 PR started with the goal of support the Bangle.js 2
smartwatch with *no USB*.
* Adds "secure" DFU build support with a committed private key.
* Adds 3-bit color support with one dummy bit for the JDI memory display
* Allows nrf boards to have a board_background_task() run in RUN_BACKGROUND_TASK.
This is needed because the Bangle.js 2 uses the watchdog to reset.
* Renamed port_background_task() to port_background_tick() to indicate it
runs on tick, not RUN_BACKGROUND_TASK.
* Marks serial connected when the display terminal is inited. This means
that safe mode messages show up on the display.
ACep, 7-color epaper displays also pack 3 bits in 4. So, I added that
support as well.
* Adds 3-bit ACeP color support for 7-color e-paper displays. (Not
watch related but similar due to color depth.)
* Allows a refresh sequence instead of a single int command. The 7" ACeP
display requires a data byte for refresh.
* Adds optional delay after resetting the display. The ACeP displays
need this. (Probably to load LUTs from flash.)
* Adds a cleaning phase for ACeP displays before the real refresh.
For both:
* Add dither support to Palette.
* Palette no longer converts colors when set. Instead, it caches
converted colors at each index.
* ColorConverter now caches the last converted color. It should make
conversions faster for repeated colors (not dithering.)