Skip to content

Class OpenSkyhawk::DrumDisplay

ClassList > OpenSkyhawk > DrumDisplay

Rolling-drum OLED readout. One instance == one OLED panel. More...

  • #include <DrumDisplay.h>

Inherits the following classes: OpenSkyhawk::OutputBase, OpenSkyhawk::I2cHealth

Public Types

Type Name
enum uint8_t Fault
Which I2C hop failed the last reachability probe (feeds node health reporting, #163).

Public Functions

Type Name
DrumDisplay (U8G2 & oled, const DrumReadout & readout, DrumFont font=DrumFont::LARGE, float xOffsetMm=0.0f, float yOffsetMm=0.0f)
Construct and register a direct-bus drum display.
DrumDisplay (U8G2 & oled, const DrumReadout & readout, I2cMux & mux, uint8_t channel, DrumFont font=DrumFont::LARGE, float xOffsetMm=0.0f, float yOffsetMm=0.0f)
Construct and register a muxed drum display (one TCA9548A branch).
virtual void configure () override
Compute pixel geometry from the panel + descriptor, set the font, blank the panel.
virtual void onControlPacket (uint16_t controlId, uint16_t value) override
Decode one CTRL_BCAST packet into this readout's digits/flag. Never draws.
void setFontSize (DrumFont font)
Change glyph size at runtime (e.g. swap a cramped 6-digit readout to SMALL).
void setOffset (float xOffsetMm, float yOffsetMm)
Re-register the digit block to the faceplate window at runtime.
virtual void update () override
Advance the ease/snap animation and push one frame if needed.

Public Functions inherited from OpenSkyhawk::OutputBase

See OpenSkyhawk::OutputBase

Type Name
virtual void configure ()
Configure hardware pins for this output.
OutputBase * next () const
Next output in the list; nullptr at end.
virtual void onControlPacket (uint16_t controlId, uint16_t value) = 0
Called for every non-null ControlPacket in a CTRL_BCAST frame.
virtual void update ()
Called every PanelGroup::loop() iteration.

Public Functions inherited from OpenSkyhawk::I2cHealth

See OpenSkyhawk::I2cHealth

Type Name
bool i2cHealthy () const
Breaker state — true while the device last probed reachable.

Public Static Functions inherited from OpenSkyhawk::OutputBase

See OpenSkyhawk::OutputBase

Type Name
OutputBase * head ()
Head of the self-registered linked list.

Protected Static Attributes inherited from OpenSkyhawk::I2cHealth

See OpenSkyhawk::I2cHealth

Type Name
constexpr uint32_t I2C_RETRY_MS = 2000
Back-off between retries once tripped (ms). A couple of seconds keeps the bus quiet.

Protected Functions

Type Name
virtual bool i2cProbe () override
Contract: probe this device's reachability (e.g. the mux ACKs and the device ACKs).

Protected Functions inherited from OpenSkyhawk::OutputBase

See OpenSkyhawk::OutputBase

Type Name
OutputBase ()
Registers this instance into the linked list.

Protected Functions inherited from OpenSkyhawk::I2cHealth

See OpenSkyhawk::I2cHealth

Type Name
virtual bool i2cProbe () = 0
Contract: probe this device's reachability (e.g. the mux ACKs and the device ACKs).
bool i2cReachable ()
Gate for every I2C op. Rate-limits the probe while tripped; trips/heals on the result.
~I2cHealth () = default

Detailed Description

Construct at global scope so OutputBase self-registers it. onControlPacket() only decodes + flags dirty (cheap); update() does the ~60 fps gate, channel reselect, ease+snap, render, and the single expensive sendBuffer().

Public Types Documentation

enum Fault

Which I2C hop failed the last reachability probe (feeds node health reporting, #163).

enum OpenSkyhawk::DrumDisplay::Fault {
    None,
    Mux,
    Device
};

Public Functions Documentation

function DrumDisplay [1/2]

Construct and register a direct-bus drum display.

OpenSkyhawk::DrumDisplay::DrumDisplay (
    U8G2 & oled,
    const DrumReadout & readout,
    DrumFont font=DrumFont::LARGE,
    float xOffsetMm=0.0f,
    float yOffsetMm=0.0f
) 

Parameters:

  • oled Caller-owned U8G2 (already begin()'d, rotation set). Must outlive this.
  • readout Descriptor for this readout (sources, geometry, flag). Must outlive this.
  • font Per-mounting glyph size. Default DrumFont::LARGE.
  • xOffsetMm X shift (mm) of the whole digit block, registers it to the faceplate window.
  • yOffsetMm Y shift (mm) of the digit block centre line.

Note:

The sketch owns Wire.begin() + oled.begin(). Geometry is auto-fitted in configure().


function DrumDisplay [2/2]

Construct and register a muxed drum display (one TCA9548A branch).

OpenSkyhawk::DrumDisplay::DrumDisplay (
    U8G2 & oled,
    const DrumReadout & readout,
    I2cMux & mux,
    uint8_t channel,
    DrumFont font=DrumFont::LARGE,
    float xOffsetMm=0.0f,
    float yOffsetMm=0.0f
) 

Parameters:

  • oled Caller-owned U8G2. Must outlive this.
  • readout Descriptor. Must outlive this.
  • mux Shared TCA9548A selector. Must outlive this.
  • channel TCA9548A channel 0–7 this panel sits on.
  • font Per-mounting glyph size. Default DrumFont::LARGE.
  • xOffsetMm X registration shift (mm).
  • yOffsetMm Y registration shift (mm).

Note:

The class calls mux.select(channel) before geometry fit in configure() and before each sendBuffer() so interleaved displays never write to the wrong panel.


function configure

Compute pixel geometry from the panel + descriptor, set the font, blank the panel.

virtual void OpenSkyhawk::DrumDisplay::configure () override

Note:

Called once by PanelGroup::setup() after chip init. Selects the mux channel (if any) first, reads getDisplayWidth()/Height(), runs the geometry fit, and clears the OLED. The sketch owns oled.begin(); this does NOT call begin().

Implements OpenSkyhawk::OutputBase::configure


function onControlPacket

Decode one CTRL_BCAST packet into this readout's digits/flag. Never draws.

virtual void OpenSkyhawk::DrumDisplay::onControlPacket (
    uint16_t controlId,
    uint16_t value
) override

Parameters:

  • controlId DCS-BIOS output address from the packet. Ignored unless it matches a DrumSource.address or the flag.address of this readout.
  • value 16-bit DCS-BIOS value (0..65535) for that address.

Note:

Cheap: decodes value→digit(s), splices into the target number, sets the dirty flag. The expensive full-buffer I2C send happens in update(), never here.

Implements OpenSkyhawk::OutputBase::onControlPacket


function setFontSize

Change glyph size at runtime (e.g. swap a cramped 6-digit readout to SMALL).

void OpenSkyhawk::DrumDisplay::setFontSize (
    DrumFont font
) 

Parameters:

  • font New DrumFont. Re-fits geometry on the next update() so cells re-auto-fit.

function setOffset

Re-register the digit block to the faceplate window at runtime.

void OpenSkyhawk::DrumDisplay::setOffset (
    float xOffsetMm,
    float yOffsetMm
) 

Parameters:

  • xOffsetMm New X shift (mm) of the digit block — measure the cutout misalignment after assembly.
  • yOffsetMm New Y shift (mm, centre line) of the digit block.

Note:

Marks geometry dirty; the new offsets apply on the next rendered frame. Resolution- independent (converted to px via the panel scale), so the same mm value registers correctly on any OLED size.

Note:

Rounds to whole pixels, so the smallest useful step is ~0.25 mm (≈1 px); a 0.1 mm nudge is sub-pixel and may not move. The 1.3" 128x64 (~0.23 mm/px) is the coarser panel.


function update

Advance the ease/snap animation and push one frame if needed.

virtual void OpenSkyhawk::DrumDisplay::update () override

Note:

Called every loop(). ~60 fps frame gate; early-out when idle (settled AND not dirty). On a live frame: mux.select(channel), ease each place toward target/10^place with SNAP_SETTLE jump handling, render every cell with setClipWindow, then one sendBuffer().

Implements OpenSkyhawk::OutputBase::update


Protected Functions Documentation

function i2cProbe

Contract: probe this device's reachability (e.g. the mux ACKs and the device ACKs).

virtual bool OpenSkyhawk::DrumDisplay::i2cProbe () override

Returns:

true if reachable. The implementer records any fault detail it wants to report.

Note:

Must be cheap — a single address probe, no payload — and must not throw or block beyond one bounded I2C transaction.

Implements OpenSkyhawk::I2cHealth::i2cProbe



The documentation for this class was generated from the following file Firmware/Libraries/DrumDisplay/DrumDisplay.h