OzWrapper.OzDisplay.OzDisplay

Display wrapper for rendering Oizom sensor readings on hardware indicators.

This module exposes OzDisplay, a high-level wrapper around the TM1637 (4-digit 7-segment) and TM1638 (8-digit 7-segment with on-board LED bank) driver chips. It consumes sensor payloads pushed onto a queue by the sampling pipeline and renders the current parameter value with appropriate decimal precision, while also lighting a unit indicator LED (driven either through an drivers.MCP230XX.MCP230XX GPIO expander on the TM1637 variant or through the TM1638’s integrated LED bank).

The wrapper supports cycling through multiple parameters at a configurable cadence, so a single physical display can rotate through, e.g., PM1, PM2.5, PM4 and PM10 readings.

Example

Run the display loop standalone from a JSON config file:

>>> import json
>>> from queue import Queue
>>> from OzWrapper.OzDisplay.OzDisplay import OzDisplay
>>> with open("display.config.json") as f:
...     cfg = json.loads(f.read())["display"]
>>> q = Queue(1)
>>> d = OzDisplay()
>>> d.setup(cfg)
>>> d.loop(q)

Reference config:

{
  "display": {
    "en": 1,
    "sTime": 10,
    "parameters": [
      {
        "lb": "SULFUR DIOXIDE",
        "sc": "g8",
        "un": "PPM",
        "fc": 1000
      }
    ]
  }
}

Note

The refresh cadence is governed by sTime (seconds) in the config; a value of 10 causes the loop to block on the queue indefinitely (driven by upstream sampling), any other value uses Queue.get with that timeout so the display also advances when no new payload arrives. Rendering is done in the 7-segment font supplied by the underlying driver - no TTF fonts are used. Unit labels are not rendered as text glyphs but indicated via dedicated unit LEDs.

Attributes

Classes

OzDisplay

High-level wrapper for TM1637/TM1638 7-segment displays with unit LEDs.

Module Contents

OzWrapper.OzDisplay.OzDisplay.basic_logger
OzWrapper.OzDisplay.OzDisplay.context_logger
OzWrapper.OzDisplay.OzDisplay.file_string = 'display.config.json'