Add BengleShotSample (0xA013), the Bengle high-resolution shot sample - #1
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 exposes an extra BLE characteristic carrying a superset of ShotSample at higher precision, plus a milk probe and integrated-scale fields the stock packet has no room for. 28 bytes, big-endian, matching the firmware's T_BengleShotSample and decodeBengleShotSample in decentespresso/decaid. ShotSample (0xA00D) keeps its stock v1 layout on every machine, a Bengle included, so a stock build talking to a Bengle still works and this app talking to a DE1 still works, with no negotiation on the shared packet. Weight is SIGNED (S16P4). It is net of tare, so an unloaded platform after a tare reads negative; clamping at zero would hide a real reading. from_shotvalue splits into from_shotvalue / from_bengleshotvalue and a shared _apply_shotvalue. The stale-frame guard added by decentespresso#343 moves into the shared body, so it now protects the 0xA013 path too. The superset-only fields are picked up with [info exists]. On a Bengle the 0xA00D dispatch is gated off: it still streams, but charting both would double-sample with broken intersample timing. Receiving 0xA013 pins the protocol to v2 immediately, closing the window between connect and the model MMR read. The enable is gated on the characteristic being present in ::cinstance. That gate is load-bearing: on a DE1 the enable would throw on the unset instance, and the vital-retry path re-runs a failed vital command every 500 ms WITHOUT advancing the FIFO, stalling the whole BLE queue. gui.tcl normalises sample-to-sample deltas to their 5 Hz-equivalent magnitude using the measured intersample time. The chart math was implicitly tuned for 5 Hz; without this the delta trace and the diff_flow_rate_text readout scale with the notify rate. Falls back to the raw delta when the event carries no intersample time. The milk probe lands here too: ::de1(milk_temperature), a steam_milk_temperature chart vector, and milktemp / milktemp_text. 0 means no probe. set_target_milk_temp is gated and clamped to 0-85 C, matching BengleSteamMmr.targetMilkTemp in decaid. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 of 6 tasks
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.
merges. 242 insertions, 8 files.
Summary
A Bengle exposes an extra BLE characteristic carrying a superset of
ShotSampleat higherprecision, plus a milk probe and integrated-scale fields the stock packet has no room for.
28 bytes, big-endian, matching the firmware's
T_BengleShotSampleanddecodeBengleShotSampleindecentespresso/decaid.ShotSample(0xA00D) keeps its stock v1 layout on every machine, a Bengle included, so astock build talking to a Bengle still works and this app talking to a DE1 still works, with
no negotiation on the shared packet.
Wire format
Weightis signed on purpose: it is net of tare, so an unloaded platform after a tarereads negative.
A note on the spec table. The signed column must be left empty, not set to
signed.fields::2formonly strips thesmodifier for typeI, so{signed}on aShortemits
Ss— two binary specifiers — which shiftsFrameNumber,SteamTemp,MilkTempand
Flagsoff their bytes. Tcl'sSis already signed;Suis the unsigned one. Thiswas caught by running
fields::2formon the real spec, not by reading it.Changes
machine.tcl—cuuid_13, the command name, and defaults forsteam_stop_modeandtarget_milk_temp.de1_de1.tcl—bengleshotsample_parse, andfrom_shotvaluesplit intofrom_shotvalue/from_bengleshotvalue/ a shared_apply_shotvalue. The stale-frameguard added by decentespresso#343 moves into the shared body, so it protects both paths.
bluetooth.tcl— dispatch for0xA013. The0xA00Ddispatch is gated onuse_ble_v2, because a Bengle streams both and charting both would double-sample withbroken intersample timing. Receiving
0xA013pins the protocol to v2 immediately, closingthe window before the model MMR read returns.
de1_comms.tcl— the enable, gated on the characteristic being present in::cinstance. That gate is load-bearing: on a DE1 the enable would throw on the unsetinstance, and the vital-retry path re-runs a failed vital command every 500 ms without
advancing the FIFO, stalling the whole BLE queue. Also
set_target_milk_temp, gated andclamped to 0–85 °C to match
BengleSteamMmr.targetMilkTempin decaid.gui.tcl— sample deltas are normalised to their 5 Hz-equivalent magnitude using themeasured intersample time. The chart math was implicitly tuned for 5 Hz; without this the
delta trace and the
diff_flow_rate_textreadout scale with the notify rate. Falls back tothe raw delta when the event carries no intersample time.
vars.tcl,utils.tcl,shot.tcl— the milk probe:::de1(milk_temperature), asteam_milk_temperaturechart vector, andmilktemp/milktemp_text.Known issues, not fixed here
Raised by a review of the series, recorded rather than fixed. Neither has been reproduced
on hardware.
steam_milk_temperatureis not truncated inreset_gui_starting_steam, which zeroesits five sibling vectors. It may grow unbounded across steam sessions and desynchronise
from
steam_elapsed.::settings(steam_stop_mode)hasno UI in this series, so it never equals
"temp". Both settings now have defaults andthe read is guarded, so nothing throws, but the feature needs a control before it does
anything.
Impact on a DE1
The enable returns early because
0xA013is not in::cinstance. Nothing subscribes ordispatches, and
0xA00Dcharts as before. Thegui.tcldelta change is the one path a DE1does reach — see the test plan.
Test plan
build without this PR.
FrameNumber, SteamTemp and Flags decode correctly.
Testing
Manual verification, plus a
tclshrun offields::2formover the sample spec to confirmthe byte layout decodes correctly. There is no automated test coverage for these Tcl paths.