feat: runtime waveform override api - #12
Open
markomitranic wants to merge 1 commit into
Open
Conversation
markomitranic
force-pushed
the
waveform-override-api
branch
from
July 15, 2026 13:04
5a5b4a7 to
57dad35
Compare
gworkman
force-pushed
the
waveform-override-api
branch
from
July 19, 2026 21:02
57dad35 to
9ac7d5b
Compare
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.
Why
let apps tune the grayscale look live from app space — a
settings panel with a −/+ "brightness" slider over the mid grays, plus a grayscale on/off
toggle. Today the LUT is baked into
Settingsat compile time, so calibrating a new panelmeans editing the library and reflashing for every tweak. This adds a runtime channel: an
app pushes its own init/LUT registers and sees the result in ~1s, no rebuild.
It also retires the ad-hoc
gc4_tunecalibration scaffolding — the way you calibrate thenext panel is now just
set_waveform+ a normal draw.What changed
Two layers plus a semantic builder.
1. A generic override channel on
EInk— the public API:EInk.set_waveform(mode, init: […], lut: […])— both keys optional, stored per mode.EInk.clear_waveform(mode)— drops it, back to the packaged defaults.in chip registers that only a fresh init reloads reliably.
2. Driver plumbing. All three drivers (uc8276, uc8179, uc8253c) now prefer
opts[:init]/opts[:lut]overSettings.get_init/get_luteverywhere Settings isconsulted — including uc8179's post-draw data-interval read and uc8253c's
active_lut_regping-pong. Nothing else in the drivers changed.
3. A semantic builder
UC8276.Settings.grayscale_lut([black, dark, light, white], reset)— builds the five LUT registers from four whiten-frame counts instead of five opaque byte
literals.
get_lut(:grayscale, _)now callsgrayscale_lut([0, 5, 10, 54], 63), verifiedbyte-identical to the previous hand-tuned literals, so on-device behavior is unchanged.
The slider flow it enables
eink stays deliberately dumb here: it exposes the raw frame counts and nothing else. The
mapping from a friendly slider to counts — and clamping to the panel's usable frame window —
is the app's policy, not the library's.
Stacking
This sits on top of #11 (the grayscale LUT data). Until that merges, the diff below includes
#11's commit (
add 4-level grayscale init and LUT…). The actual new work here is the singleadd runtime waveform-override apicommit.