LED strip control and colour picker for Bengle - #3
Open
ChampionDesigns wants to merge 1 commit into
Open
ChampionDesigns wants to merge 1 commit into
ChampionDesigns wants to merge 1 commit into
Conversation
A Bengle has two addressable LED strips. The firmware stores an awake and a sleep colour for each and switches between them itself on sleep and wake, so the app needs no state-change listener and re-pushes nothing when the machine sleeps. FrontLEDAwake 0x00803898 RearLEDAwake 0x0080389C FrontLEDSleep 0x008038A0 RearLEDSleep 0x008038A4 FrontLEDColor 0x00803890 RearLEDColor 0x00803894 The first four are persistent and carry the colours. The last two are transient and exist only for the picker's live preview, so the strips follow the control without writing flash on every frame. Each holds a 24-bit 0xRRGGBB value, matching decentespresso/decaid. Adds a ::led namespace (hex/int/HSV conversion, transient and persistent writes, validation), five settings, a push of all four stored colours on connect, a Lighting card on settings_3, and the picker page itself. The transient write cache is cleared on disconnect: if the machine is power-cycled while the tablet is away its registers may come back different, and a stale cache would suppress the write that corrects them. The Lighting card sits where the Firmware card's button otherwise reaches, so the Firmware card is narrowed. That narrowing is gated on is_bengle_model, the same as the card itself -- ungated it would leave a DE1 with a full-width card and a half-width button. Every write proc returns early on a DE1. All 57 ::led references resolve. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
707 insertions, 4 files.
Summary
A Bengle has two addressable LED strips. The firmware stores an awake and a sleep colour
for each and switches between them itself on sleep and wake, so the app needs no
state-change listener and re-pushes nothing when the machine sleeps.
0x008038980x0080389C0x008038A00x008038A40x008038900x00803894Each holds a 24-bit
0xRRGGBBvalue.decentespresso/decaidagrees on the fourpersistent addresses and on the colour depth; it drives only those four, because it has no
picker page.
Changes
de1_comms.tcl— a::lednamespace: hex, integer and HSV conversion; a transientwrite_stripwith a per-strip cache so an unchanged colour does not re-queue a write; apersistent
write_stored;push_all_stored; and_validate_hex.The write cache is cleared on disconnect. If the machine is power-cycled while the tablet
is away its registers may come back different, and a stale cache would suppress the write
that corrects them.
machine.tcl— five settings: four stored colours, defaulting to#191919awake and#000000sleep, plusled_target_mode.bluetooth.tcl—::led::push_all_storedon connect, after the state reads.skins/default/de1_skin_settings.tcl— a Lighting card onsettings_3and theled_pickerpage: a hue/saturation wheel, brightness slider, preset swatches,front/rear/both targeting, awake/sleep bank selection, and debounced commit and save.
The Lighting card and the Firmware card
The Lighting card sits at x=1934, where the Firmware card's button otherwise reaches 2540,
so the Firmware card is narrowed. That narrowing is gated on
is_bengle_model, the sameas the card itself. An earlier draft narrowed it unconditionally, which on a DE1 left a
full-width purple card with a half-width button and dead space beside it.
Known issues, not fixed here
Raised by a review of the series, recorded rather than fixed. Neither has been reproduced
on hardware.
is_bengle_modelis evaluated at skin-load time. On a first-ever connect the modelMMR has not returned, so the predicate is false and the
led_pickerpage may never beregistered. If so, the Lighting card would open a page that does not exist. This affects
the machine-autonomy PR the same way and probably needs one fix covering both.
_last_writtendedupe cache is not invalidated bypush_all_stored. Thefirmware repaints the live registers from the stored pair, so a later preview of the same
hex would be skipped and the strips would not change.
remove_matching_ble_queue_entries {^MMR ...}never matches, because queue commentsare the bare note. This mirrors the existing upstream calls, so the new dedupes are inert
rather than newly broken.
Impact on a DE1
Every write proc tests
is_bengle_modeland returns early. The card, the page and thenarrowed geometry are inside the same gate. The five settings are inert.
Test plan
settings_3on a DE1. Confirm the Firmware card looks as it does today and noLighting card appears.
and the machine switches to the sleep pair on its own.
this is the known issue above.
are re-pushed rather than suppressed by the cache.
Testing
Manual verification only, plus a check that all 57
::ledreferences resolve. There is noautomated test coverage for these Tcl paths in the repo.