Skip to content

Bluetooth Receiver: the board as a Bluetooth speaker, cover first - #190

Open
bdbarnett wants to merge 5 commits into
mainfrom
btreceiver
Open

bdbarnett wants to merge 5 commits into
mainfrom
btreceiver

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

A new Home app, Bluetooth Receiver, makes the board a Bluetooth speaker. Pair a phone or computer and play anything. The cover fills the left of an 800 x 480 screen. Beside it the app shows everything the sender reports: title, artist, album, track number and count, genre, position and length, play status, the sender's name, the codec, rate and channels, and the sender's battery or a weak signal when either matters. A line the sender leaves empty isn't shown. The transport drives the sender's player (hold a skip button to rewind or fast forward), the slider is the sender's own volume, and a small spectrum runs while it plays. The screen takes its accent colour from the cover. Audio goes through the board config's audio_out on the audio pump.

The app adds two controls to controlkit for a flatter, thin-line look: RingButton, a round unfilled button with a tinted icon, a larger hit area and an optional hold, and SpectrumBars, a row of thin bars with meter ballistics. Icons are drawn once by svgio and recoloured by LVGL, so a redraw never parses an SVG.

Playing
Waiting to pair

How I checked it: on a computer without btclassic, the app plays a demo phone with generated covers, and apps/btreceiver/tools/shots.py saves each state (pairing, connected, playing, paused, no cover, long title). tests/test_btreceiver.py drives the screen against that demo by touch on CPython and on unix MicroPython with the firmware's C svgio and jpegio, and both pass. A planted fault (empty fields shown) fails it. The controls contract covers the two new controls on both interpreters, and a planted fault (a hold counted as a tap) fails three checks. The stub check, tools/app_packages.py --check and the style check pass. A new CI job runs the app's test on CPython.

Not verified: nothing here has run on a board with btclassic yet. The real AVRCP fields, cover art, audio_out playback through the pump, the spectrum from the pump's tap, touch on the panel, and drawing speed are all unproven on hardware.

RingButton is a round, unfilled button: a ring and a tinted icon in one
colour, a faint fill while pressed, a hit area larger than the ring for a
small panel, and an optional hold (fast forward on a skip button).
SpectrumBars is a row of thin bars, one per band, that jump to a louder
level and fall back, redrawing only the bars that move.

The controls contract drives both by touch on CPython and unix
MicroPython; a planted fault (a hold that also counts as a tap) fails
three of its checks.
Pair a phone or computer and play anything. The cover fills the left of
the screen; beside it, everything the sender reports and nothing it
leaves empty: title, artist, album, track number and count, genre,
position and length, the play status, the sender's name, the codec,
rate and channels, and its battery or a weak signal when they matter.
The transport drives the sender's player (hold a skip button to seek),
the slider is the sender's own volume, and a small spectrum runs while it
plays. The screen takes its colour from the cover. Audio goes through the
board's audio_out on the audio pump.

On a computer without btclassic the app plays a demo phone, and
tools/shots.py saves each state. tests/test_btreceiver.py drives the
screen against the demo on CPython and unix MicroPython; a planted fault
(empty fields shown) fails it. Not yet run on a board with btclassic.
…icons

The battery icon sits at the right end of the source row whenever the
phone reports a battery state: bars for full, normal, warning and
critical (the last two in amber), and the charging icon for external
power. A phone that reports nothing shows nothing.
The README shows idle, paused, a track with no cover and a long title
beside the playing and pairing pictures. With no folder given, shots.py
now saves into the app's docs/images, so a re-render replaces them.
An Android phone that's connected with nothing playing sends the title
"Not Provided", and the app showed it as a track. Fields with that text
are now treated as empty, so the idle screen shows instead.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant