firmware

Which files go onto the board, compiled with mpy-cross where possible.

Modules are precompiled to .mpy: importing them then skips compiling on the board, which for the large fonts alone saves over a second per wake. Entry points and the installation’s config.py stay source files.

The build adds version.mpy with VERSION, the firmware version from git (see version), which the board shows in its boot sequence, in Home Assistant and in the web interface.

Attributes

Functions

modules()

Source modules that are compiled to .mpy.

version([run])

Return the firmware version from git.

build()

Compile the modules into build/mpy/ where they changed.

stale_names()

List the files to remove from the board.

Module Contents

firmware.ROOT
firmware.SRC
firmware.OUT
firmware.SOURCE_FILES = ('boot.py', 'main.py', 'config.py')
firmware.EXCLUDED = ('config_example.py', 'credentials.py')
firmware.modules()

Source modules that are compiled to .mpy.

firmware.version(run=subprocess.run)

Return the firmware version from git.

It is the last tag without its “v” (“0.2.0”), with the commits since and the current one if there are any (“0.2.0-3-g6ec6236”), and “-dirty” for uncommitted changes. Without git or tags it is the commit hash, or “unknown”.

firmware.build()

Compile the modules into build/mpy/ where they changed.

Returns:

The local paths of all files for the board.

firmware.RETIRED = ('credentials.py', 'bootscreen.mpy')
firmware.stale_names()

List the files to remove from the board.

These are the sources the compiled modules replace, and retired files.