Skip to main content

lenz-flashtool

PyPI Version

FlashTool library for BiSS C Firmware Update and Calibration by LENZ Encoders.

This is the source repository for the lenz-flashtool Python package, designed to interface with LENZ BiSS C encoders for firmware updates, calibration, and data reading. It provides a FlashTool class and utility functions for working with encoder hardware, including hex file manipulation and color formatting utilities.

📚 Full Documentation: flashtool.lenzencoders.com

Features

  • Control LENZ BiSS C encoders via serial communication.
  • Upload firmware and calibration data.
  • Read encoder status, serial numbers, and error flags.
  • Utilities for CRC calculation, hex data generation, and colored logging output.

Installation

pip install lenz-flashtool

From local folder

pip install .

From GitHub

pip install git+https://github.com/lenzencoders/lenz-flashtool-lib.git

Requirements

  • Python 3.8 or higher
  • pyserial>=3.5 (for serial communication)
  • numpy>=1.21.0 (for data handling)

Usage

Basic Example

from lenz_flashtool import FlashTool, init_logging

# Set up logging
#
# Level	            Integer Value
# logging.CRITICAL  50
# logging.ERROR     40
# logging.WARNING   30
# logging.INFO      20
# logging.DEBUG     10
# logging.NOTSET    0
init_logging(logfilename="flashtool.log", stdout_level=20, file_level=10)

# Initialize FlashTool
with FlashTool(port_description_prefixes=('XR21V')) as ft:
    # Power cycle the encoder
    ft.encoder_power_cycle()

    # Read serial number
    bootloader_ver, serial_num, mfg_date, program_ver = ft.biss_read_snum()
    print(f"Encoder Serial Number: {serial_num}")
# The connection is automatically closed when exiting the 'with' block

Note on Naming

The package is installed as lenz-flashtool (with a hyphen), but imported in Python as lenz_flashtool (with an underscore) due to Python’s naming conventions.

Shell completion (zsh)

A zsh completion for the lenz-flashtool-cli command ships in completions/. See completions/README.md for installation and the zstyle settings required to display argument hints.

Documentation

For detailed API documentation, examples, and usage instructions, visit the LENZ FlashTool Documentation.

Development

Install Locally

git clone https://github.com/lenzencoders/lenz-flashtool-lib.git
cd lenz-flashtool-lib
pip install .

Run Tests

pip install pytest
pytest tests/

Contributing

Contributions are welcome! Please:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/my-feature).
  3. Commit your changes (git commit -m "Add my feature").
  4. Push to the branch (git push origin feature/my-feature).
  5. Open a pull request.

Report issues at github.com/lenzencoders/lenz-flashtool-lib/issues.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For support or inquiries, contact LENZ ENCODERS at info@lenzencoders.com.

Metadata

Release files for lenz-flashtool 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lenz-flashtool 0.2.1
File Size Uploaded Provenance Actions
lenz_flashtool-0.2.1.tar.gz 92.9 kB Without provenance Details for lenz_flashtool-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lenz-flashtool 0.2.1
File Interpreter ABI Platform Actions
lenz_flashtool-0.2.1-py3-none-any.whl Python 3 none any Details for lenz_flashtool-0.2.1-py3-none-any.whl

Total release size: 204.5 kB

Release files / lenz_flashtool-0.2.1.tar.gz

Download URL lenz_flashtool-0.2.1.tar.gz
Size 92.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6e1d1c56991e333e6926c3948dad657f8e7aefcc48532c02725bf0c7ba26566e
BLAKE2b-256 checksum
How to use checksums
1f23e45f14de10eb5afdece452f5299adca72cb4540b1ba715f0a904f97fc5ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / lenz_flashtool-0.2.1-py3-none-any.whl

Download URL lenz_flashtool-0.2.1-py3-none-any.whl
Size 111.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45a96c7b695a46a4cd9a8f6d3f4dce94dc335badfb17979846d5dbe9307024f2
BLAKE2b-256 checksum
How to use checksums
99671b2b00d4b58a034f5106a1659b7f37cfd647fe6003541bf0ee87ae9a8bad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for lenz-flashtool 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page