writer: framebuf_utils is now Pyboard-only. Matches reality :)

pull/45/head
Peter Hinch 2021-02-19 17:26:13 +00:00
rodzic 0803aeab57
commit f2a9f4c03a
2 zmienionych plików z 14 dodań i 12 usunięć

Wyświetl plik

@ -271,19 +271,21 @@ the `framebuf.blit` method the class renders glyphs one pixel at a time. There
is a way to improve performance. It was developed by Jim Mussared (@jimmo) and is a way to improve performance. It was developed by Jim Mussared (@jimmo) and
consists of a native C module. consists of a native C module.
This works well on Pyboards (1.x and D) but I have had no success on other
platforms including the Raspberry Pi Pico. The code will silently ignore this
module on other platforms. The following applies only when run on a Pyboard.
On import, `writer.py` attempts to import a module `framebuf_utils`. If this On import, `writer.py` attempts to import a module `framebuf_utils`. If this
succeeds, glyph rendering will be substantially faster. If the file is not succeeds, glyph rendering will be substantially faster. If the file is not
present the class will work using normal rendering. If the file exists but was present the class will work using normal rendering. If the file is missing or
compiled for a different architecture a warning message will be printed. This invalid a harmless advisory note is printed and the code will run using normal
is a harmless advisory - the code will run using normal rendering. rendering.
The directory `framebuf_utils` contains the source file, the makefile and a The directory `framebuf_utils` contains the source file, the makefile and a
version of `framebuf_utils.mpy` for `armv7m` architecture (e.g. Pyboards). version of `framebuf_utils.mpy` for `armv7m` architecture (e.g. Pyboards).
ESP32 users with access to the development toolchain should change `Makefile` This allows for recompiling for other architectures if anyone feels like
to specify the `xtensawin` arch and rebuild. experimenting. However the fact that it crashes the Pico suggests that the code
is highly specific to the Pybaord.
It is suggested that moving the appropriate `framebuf_utils.mpy` to the target
is only done once the basic operation of an application has been verified.
The module has a `fast_mode` variable which is set `True` on import if the mode The module has a `fast_mode` variable which is set `True` on import if the mode
was successfully engaged. User code should treat this as read-only. was successfully engaged. User code should treat this as read-only.

Wyświetl plik

@ -25,9 +25,9 @@ import framebuf
from uctypes import bytearray_at, addressof from uctypes import bytearray_at, addressof
from sys import platform from sys import platform
__version__ = (0, 4, 1) __version__ = (0, 4, 2)
fast_mode = platform != 'rp2' # framebuf_utils crashes RP2 fast_mode = platform == 'pyboard'
if fast_mode: if fast_mode:
try: try:
try: try:
@ -39,8 +39,8 @@ if fast_mode:
fast_mode = False fast_mode = False
except ValueError: except ValueError:
fast_mode = False fast_mode = False
if not fast_mode: if not fast_mode:
print('Ignoring framebuf_utils.mpy: compiled for incorrect architecture.') print('Ignoring missing or invalid framebuf_utils.mpy.')
class DisplayState(): class DisplayState():