Commit Graph

17756 Commits

Author SHA1 Message Date
Jensen
3c5a08628a Merge branch 'color-converter-transparency' of github.com:jensechu/circuitpython into color-converter-transparency 2020-10-14 21:52:49 -05:00
Jensen
2517e4b486 displayio: ColorConverter handle if opaque color is black 2020-10-14 21:51:40 -05:00
Jensen Kuras
de9ea47e8e
Merge branch 'main' into color-converter-transparency 2020-10-12 20:48:55 -05:00
Jensen
337019626a displayio: Add make_transparent to ColorConverter 2020-10-12 20:48:04 -05:00
Jensen
b359e2945a displayio: Add make_transparent and make_opaque to ColorConvertor 2020-10-12 20:48:04 -05:00
Jensen
57b44928a3 displayio: Pass transparent_color to ColorConverter
Signed-off-by: Jensen <jensechu@gmail.com>
2020-10-12 20:48:04 -05:00
Scott Shawcroft
9de96786ad
Merge pull request #3538 from jepler/parallel-qstrlast
build: parallelize the qstr build steps
2020-10-12 15:52:43 -07:00
Scott Shawcroft
1eb1434fc9
Merge pull request #3537 from jepler/update-protomatter-2
rgbmatrix: update protomatter to 1.0.5 tag
2020-10-12 15:45:51 -07:00
Scott Shawcroft
179e13f103
Merge pull request #3539 from jepler/lto-type-mismatch
remove warning-disable flag that seems unneeded now
2020-10-12 15:44:25 -07:00
Scott Shawcroft
bb046f9983
Merge pull request #3540 from WarriorOfWire/async_syntax
__await__ magic method and async/await
2020-10-12 15:31:43 -07:00
Scott Shawcroft
2e5bea2629
Merge pull request #3543 from jepler/rgbmatrix-brighness-crash
rgbmatrix: Don't crash when setting brightness=0
2020-10-12 15:24:58 -07:00
Scott Shawcroft
4a95965b1a
Merge pull request #3542 from jepler/terminal-memory-allocation
displayio, framebufferio: Remove spurious call to supervisor_start_terminal
2020-10-12 15:17:05 -07:00
Scott Shawcroft
638c7f7b57
Merge pull request #3514 from hierophect/esp32-analogout
ESP32-S2: AnalogOut
2020-10-12 15:08:50 -07:00
Jeff Epler
0a60a42396
Merge pull request #3531 from weblate/weblate-circuitpython-main
Translations update from Weblate
2020-10-12 16:00:49 -05:00
Jeff Epler
8ddbebd2c1 esp32s2: fix build after qstr rule changes 2020-10-12 13:35:15 -05:00
Jeff Epler
9696dbfd38 rgbmatrix: Don't crash when setting brightness=0
If the display is paused, `_PM_swapbuffer_maybe` will never return.
So, when brightness is 0, refresh does nothing.  This makes it necessary
to update the display when unpausing.

Closes: #3524
2020-10-12 13:28:20 -05:00
Kenny
10badd93c3 leftover newlines 2020-10-11 22:52:27 -07:00
Kenny
94beeabc51 remove unnecessary board configuration and address feedback 2020-10-11 22:42:59 -07:00
Jeff Epler
479552ce56 build: Make genlast write the "split" files
This gets a further speedup of about 2s (12s -> 9.5s elapsed build time)
for stm32f405_feather

For what are probably historical reasons, the qstr process involves
preprocessing a large number of source files into a single "qstr.i.last"
file, then reading this and splitting it into one "qstr" file for each
original source ("*.c") file.

By eliminating the step of writing qstr.i.last as well as making the
regular-expression-matching part be parallelized, build speed is further
improved.

Because the step to build QSTR_DEFS_COLLECTED does not access
qstr.i.last, the path is replaced with "-" in the Makefile.
2020-10-11 21:18:03 -05:00
Jeff Epler
774f2e16ba displayio, framebufferio: Remove spurious call to supervisor_start_terminal
A call to supervisor_start_terminal remained in
common_hal_displayio_display_construct and was copied to other display
_construct functions, even though it was also being done in
displayio_display_core_construct when that was factored out.

Originally, this was harmless, except it created an extra allocation.
When investigating #3482, I found that this bug became harmful,
especially for displays that were created in Python code, because it
caused a supervisor allocation to leak.

I believe that it is safe to merge #3482 after this PR is merged.
2020-10-11 21:09:08 -05:00
Jeff Epler
607e4a905a build: parallelize the creation of qstr.i.last
Rather than simply invoking gcc in preprocessor mode with a list of files, use
a Python script with the (python3) ThreadPoolExecutor to invoke the
preprocessor in parallel.

The amount of concurrency is the number of system CPUs, not the makefile "-j"
parallelism setting, because there is no simple and correct way for a Python
program to correctly work together with make's idea of parallelism.

This reduces the build time of stm32f405 feather (a non-LTO build) from 16s to
12s on my 16-thread Ryzen machine.
2020-10-11 20:19:59 -05:00
Jeff Epler
c139eccc92 remove warning that seems unneeded now 2020-10-11 16:23:02 -05:00
Kenny
3c46e3a6aa
Turn off async for circuitplayground express
Firmware too large
2020-10-11 08:16:36 -07:00
Kenny
88db16a2c6 add translations 2020-10-10 23:50:12 -07:00
Kenny
98aa4b7943 update async tests with less upython workaround and more cpython compatibility 2020-10-10 23:39:32 -07:00
hexthat
6583e1087c Translated using Weblate (Chinese (Pinyin))
Currently translated at 100.0% (830 of 830 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/
2020-10-11 01:51:31 +02:00
oon arfiandwi
e3378b7ccb Translated using Weblate (Indonesian)
Currently translated at 45.6% (379 of 830 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/id/
2020-10-11 01:51:31 +02:00
Wellington Terumi Uemura
f987b363c8 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (830 of 830 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/
2020-10-11 01:51:31 +02:00
Hosted Weblate
940013a621 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/
2020-10-11 01:51:31 +02:00
dherrada
92fcb92138 Translated using Weblate (Spanish)
Currently translated at 100.0% (829 of 829 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/
2020-10-11 01:51:31 +02:00
Jeff Epler
40a3d11d64
Merge pull request #3535 from ladyada/main
fix for https://github.com/adafruit/circuitpython/issues/3534
2020-10-10 18:51:20 -05:00
Kenny
5d96afc5c2 i do not know if this is needed but this is not the vm i use anymore 2020-10-10 15:45:08 -07:00
Kenny
bf849ff674 async def syntax rigor and __await__ magic method
Some examples of improved compliance with CPython that currently
have divergent behavior in CircuitPython are listed below:

* yield from is not allowed in async methods
```
>>> async def f():
...     yield from 'abc'
...
Traceback (most recent call last):
  File "<stdin>", line 2, in f
SyntaxError: 'yield from' inside async function
```

* await only works on awaitable expressions
```
>>> async def f():
...     await 'not awaitable'
...
>>> f().send(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in f
AttributeError: 'str' object has no attribute '__await__'
```

* only __await__()able expressions are awaitable
Okay this one actually does not work in circuitpython at all today.
This is how CPython works though and pretending __await__ does not
exist will only bite users who write both.
```
>>> class c:
...     pass
...
>>> def f(self):
...     yield
...     yield
...     return 'f to pay respects'
...
>>> c.__await__ = f  # could just as easily have put it on the class but this shows how it's wired
>>> async def g():
...     awaitable_thing = c()
...     partial = await awaitable_thing
...     return 'press ' + partial
...
>>> q = g()
>>> q.send(None)
>>> q.send(None)
>>> q.send(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
StopIteration: press f to pay respects
```
2020-10-10 15:45:08 -07:00
warriorofwire
5cadf525bd fix missing cflag defeating the board gating 2020-10-10 15:45:08 -07:00
warriorofwire
f5f1e29dc0 disable async/await on a several small ucontrollers 2020-10-10 15:43:12 -07:00
warriorofwire
d94d2d2975 Add async/await syntax to FULL_BUILD
This adds the `async def` and `await` verbs to valid CircuitPython syntax using the Micropython implementation.

Consider:
```
>>> class Awaitable:
...     def __iter__(self):
...         for i in range(3):
...             print('awaiting', i)
...             yield
...         return 42
...
>>> async def wait_for_it():
...     a = Awaitable()
...     result = await a
...     return result
...
>>> task = wait_for_it()
>>> next(task)
awaiting 0
>>> next(task)
awaiting 1
>>> next(task)
awaiting 2
>>> next(task)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  StopIteration: 42
>>>
```

and more excitingly:
```
>>> async def it_awaits_a_subtask():
...     value = await wait_for_it()
...     print('twice as good', value * 2)
...
>>> task = it_awaits_a_subtask()
>>> next(task)
awaiting 0
>>> next(task)
awaiting 1
>>> next(task)
awaiting 2
>>> next(task)
twice as good 84
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  StopIteration:
```

Note that this is just syntax plumbing, not an all-encompassing implementation of an asynchronous task scheduler or asynchronous hardware apis.
  uasyncio might be a good module to bring in, or something else - but the standard Python syntax does not _strictly require_ deeper hardware
  support.
Micropython implements the await verb via the __iter__ function rather than __await__.  It's okay.

The syntax being present will enable users to write clean and expressive multi-step state machines that are written serially and interleaved
  according to the rules provided by those users.

Given that this does not include an all-encompassing C scheduler, this is expected to be an advanced functionality until the community settles
  on the future of deep hardware support for async/await in CircuitPython.  Users will implement yield-based schedulers and tasks wrapping
  synchronous hardware APIs with polling to avoid blocking, while their application business logic gets simple `await` statements.
2020-10-10 15:38:40 -07:00
Jeff Epler
5e38bb98cb rgbmatrix: update protomatter to 1.0.5 tag
this is compile-tested on
 stm32f405 feather
 matrixportal
 nrf52840 feather

but not actually tested-tested.
2020-10-10 14:30:37 -05:00
lady ada
70a94c8d2d fix for https://github.com/adafruit/circuitpython/issues/3534 2020-10-10 12:27:35 -04:00
Scott Shawcroft
c7d87cea62
Merge pull request #3532 from tannewt/samd21_autoreload
Fix autoreload on SAMD21
2020-10-09 14:49:48 -07:00
Lucian Copeland
b435ef0272 Merge remote-tracking branch 'upstream/main' into esp32-analogout 2020-10-09 17:19:46 -04:00
Scott Shawcroft
375676ff58
Merge pull request #3501 from hierophect/esp32-analogin
ESP32S2: Add AnalogIn
2020-10-09 14:10:24 -07:00
Scott Shawcroft
699f19f44a
Merge pull request #3522 from tannewt/imx_metro
Unify iMX RT flash config and add Metro M7 1011
2020-10-09 13:48:58 -07:00
Scott Shawcroft
3ccf644dd0
Fix autoreload on SAMD21
The issue was that a time.sleep() would set the RTC wake up
further into the future even if we wanted to tick every ms. Ticking
every ms is used to time the autoreload delay and without it,
autoreload doesn't work.

Fixes #3528
2020-10-09 12:53:00 -07:00
Scott Shawcroft
e1a80aeb03
Merge pull request #3517 from microDev1/disableAutoReload
Disable auto-reload in safe mode
2020-10-09 11:00:32 -07:00
Lucian Copeland
ccbc15046a Fix submodule issue 2020-10-09 13:29:35 -04:00
Scott Shawcroft
506936ea2e
Merge pull request #3525 from UnexpectedCircuitPython/UM_S2_Boards
Fixed the FeatherS2 prerelease hardware name
2020-10-09 10:20:13 -07:00
Scott Shawcroft
1b307c90a7
Merge pull request #3527 from jepler/issue3526-actions-setenv
workflows: Replace deprecated ::set-env
2020-10-09 10:19:23 -07:00
Jeff Epler
3149f5bfd8 workflows: Replace deprecated ::set-env 2020-10-08 16:20:23 -05:00
Scott Shawcroft
b578afa02f
Merge pull request #3523 from tannewt/ble_connectionerror
Replace _bleio.ConnectionError with the native version
2020-10-08 13:00:06 -07:00
Lucian Copeland
5af1e054a7 Fix strange merge submodule edit 2020-10-08 14:57:41 -04:00