FunHouse board package works on stock MicroPython; board_peripherals import order on seven boards; MADCTL rotation on RGB panels - #112
Merged
Conversation
…ds' import order fixed - board_peripherals on seven PWM-buzzer boards (funhouse, pyportal, pyportal_titano, pybadge, pygamer, odroid_go, hallowing_m4) used AudioCapability a line before importing it, so import board_config raised NameError. New static test walks every board's module-level code and fails on a name used before it is bound. - FunHouse: the barometer is a DPS310 (product id 0x10 at 0x77), not a BMP280; new drivers/env/dps310.py (hPa, C, continuous 4 Hz, 8x). - FunHouse has no touchscreen: TT21100 removed (nothing answers 0x24). - GPIO21 is the TFT backlight: the display now drives it, and the DotStars move to hardware SPI with no MISO instead of claiming it. DotStars start at brightness 0.1. - New light (GPIO18 ADC) and motion (PIR, GPIO16) roles. - The package ships drivers/bus/spibus.py, since stock MicroPython has no C spibus; a built-in spibus still wins where one is frozen.
…omes up the right way up The MADCTL line parsed as (table | BGR) if bgr else RGB, so every bgr=False panel sent MADCTL 0 and ignored rotation. With it parenthesised, the ten other bgr=False boards (all ST7789, all rotation 0) move to mirrored=True, whose rotation 0 is MADCTL 0: the same byte they have always sent, and rotation now works on them. FunHouse (MicroPython and cp/): the panel is mounted upside down against the controller, so MX|MY (0xC0), the mirrored table's 180; flipping rows puts the visible 240 of 320 at rows 0-239, so rowstart 80 becomes 0. Measured on the board: MADCTL 0xc0, rowstart 0.
… with MY set, as in CircuitPython's board definition)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
import board_configraisedNameError: name 'AudioCapability' isn't definedon seven boards: funhouse, pyportal, pyportal_titano, pybadge, pygamer, odroid_go and hallowing_m4. Each one'sboard_peripherals.pyusedAudioCapabilitya line before importing it (from ec3d498). The import now comes first.tests/test_board_peripherals_static.pywalks every board's module-level code in order and fails on a name used before it is bound. It flags exactly these seven onmain, passes here, and carries a planted-fault case.The FunHouse needed more than that before it would come up on stock MicroPython 1.29 (
ESP32_GENERIC_S2):drivers/env/dps310.pyreports hPa and °C.light(GPIO18 ADC) andmotion(PIR, GPIO16) roles.drivers/bus/spibus.py, because stock firmware has no Cspibus. On our own images the frozen or built-in one still loads first.Proven on the FunHouse (MicroPython v1.29.0, pydevices 0.6.3 from the MIP index plus these files over serial):
The other six boards get only the import move. None of them was on hand.
The package.json
versionis untouched.Rotation on RGB panels (second commit)
On the FunHouse the screen came up upside down, and
rotationcouldn't turn it.BusDisplay.init()built MADCTL asself.rotation_table[index] | _BGR if self.bgr else _RGB, which parses as(table | _BGR) if bgr else _RGB. So everybgr=Falsepanel has always sent MADCTL 0, whatever its rotation. The line is now parenthesised, andtests/test_busdisplay_madctl.pypins it down: it fails on the old line and passes on the new one.Twelve board configs are
bgr=False, all ST7789 on the default tables, allrotation=0, mirrored=False:mirrored=True. That table's rotation 0 is MADCTL 0, the same byte they have always sent, so they come up exactly as before, and settingrotationnow works on them. None of them was on hand to look at.cp/) getsmirrored=True, rotation=180, which is MADCTL 0xC0, and keepsrowstart=80. The panel is mounted upside down against the controller. With MY set, the glass is still rows 80-319, as in CircuitPython's board definition, which keeps MY set and offsets that axis by 80. A first try with rowstart 0 showed the picture shifted up by about 80 rows. Read back on the board:MADCTL 0xc0 rot 180.The
cp/FunHouse config also loses its TT21100, since the MicroPython I2C scan found nothing at 0x24 (only 0x38 and 0x77). Thecp/change is untested on CircuitPython.