Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/buildexe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.14'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r quality.txt
pip install -e ".[build]"

- name: Build executable
run: |
Expand Down Expand Up @@ -51,13 +50,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.14'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r quality.txt
pip install -e ".[build]"
sudo apt install libxcb-xinerama0

- name: Build executable
Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.14"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r quality.txt
pip install -e ".[dev]"

- name: Code Format Check
run: |
Expand All @@ -31,11 +31,11 @@ jobs:
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: "3.10"
# python-version: "3.14"
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r quality.txt
# pip install -e ".[dev]"
# - name: Check code with ruff
# run: |
# ruff ./pyx2cscope
Expand All @@ -45,13 +45,16 @@ jobs:

tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.14"]
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: ${{ matrix.python-version }}

- name: Install system dependencies for Qt
run: |
Expand All @@ -72,8 +75,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r quality.txt
pip install -e .
pip install -e ".[dev]"

- name: Run tests
env:
Expand All @@ -86,6 +88,9 @@ jobs:

docs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.14"]

steps:
- name: Checkout repository
Expand All @@ -94,13 +99,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r quality.txt
pip install -e .
pip install -e ".[docs]"

- name: Build documentation
run: |
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.14'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r quality.txt
pip install -e .
pip install -e ".[docs,build]"

- name: Build documentation
run: |
Expand All @@ -33,9 +32,15 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/html

- name: Release to pypi with poetry
- name: Build package
run: |
poetry config pypi-token.pypi ${{ secrets.PYX2CSCOPE_PYPI }}
poetry publish -vvv --build
python -m build

- name: Release to pypi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYX2CSCOPE_PYPI }}
run: |
python -m twine upload dist/*


1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ celerybeat.pid
# Environments
.env
.venv
.venv*
env/
venv/
ENV/
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Detailed documentation is hosted at GitHub.io:

## Install

pyX2Cscope currently supports Python `3.10` to `3.14`.

Create a virtual environment and install pyx2cscope using the following commands (Windows):
```
python -m venv .venv
Expand All @@ -40,12 +42,16 @@ To execute the Browser based version type:
```py
from pyx2cscope.x2cscope import X2CScope

# initialize the X2CScope class with serial port, by default baud rate is 115200
x2c_scope = X2CScope(port="COM8")
# instead of loading directly the elf file, we can import it after instantiating the X2CScope class
x2c_scope.import_variables(r"..\..\tests\data\qspin_foc_same54.elf")
# Option 1: Default UART with Auto-detect COM port (recommended for single device)
x2c_scope = X2CScope(elf_file="path/to/firmware.elf")

# Option 2: Specify COM port explicitly
# x2c_scope = X2CScope(port="COM8", elf_file="path/to/firmware.elf")

# Or import variables after instantiation
# x2c_scope.import_variables(r"..\..\tests\data\qspin_foc_same54.elf")

# Collect some variables.
# Collect some variables
speed_reference = x2c_scope.get_variable("motor.apiData.velocityReference")
speed_measured = x2c_scope.get_variable("motor.apiData.velocityMeasured")

Expand Down
7 changes: 5 additions & 2 deletions doc/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ source .venv\bin\activate
## Installing dev requirements

```bash
pip install -r requirements.txt
pip install -r quality.txt
pip install -e ".[dev,docs,build]"
```

## Publishing a release

Package releases are handled by GitHub Actions as part of the maintainer release workflow.

## Running tests

### ruff syntax check
Expand Down
26 changes: 25 additions & 1 deletion doc/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ variables = [
for var in variables:
x2c_scope.add_scope_channel(x2c_scope.get_variable(var))

x2c_scope.set_sample_time(0)
x2c_scope.set_sample_time(1)

# Create the plot
plt.ion() # Turn on interactive mode
Expand Down Expand Up @@ -287,6 +287,30 @@ with open(csv_file_path, mode="w", newline="") as file:
logging.info(f"Data saved in {csv_file_path}")
````

## Check ELF compatibility

````python

"""Check whether the loaded ELF file appears compatible with the connected target."""

from pyx2cscope.utils import get_com_port, get_elf_file_path
from pyx2cscope.x2cscope import X2CScope


x2c_scope = X2CScope(port=get_com_port())

try:
x2c_scope.import_variables(get_elf_file_path())

compatibility = x2c_scope.check_compatibility()
print("Compatibility report:")
for key, value in compatibility.items():
print(f" {key}: {value}")
finally:
x2c_scope.disconnect()

````

for more visit the [pyX2Cscope example directory ](https://github.com/X2Cscope/pyx2cscope/tree/develop/pyx2cscope/examples)


Expand Down
16 changes: 14 additions & 2 deletions doc/gui_qt.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The Setup tab is where you configure the connection to your microcontroller.

### Connection Settings

1. **ELF File**: Click "Select ELF file" to choose the ELF file of the project your microcontroller is programmed with.
1. **Select File**: Click `ELF / YML / PKL` to load variable information. Supported formats are `.elf`, `.yml`, and `.pkl`.

2. **Interface**: Select the communication interface:
- **UART**: Serial communication
Expand All @@ -41,9 +41,14 @@ The Setup tab is where you configure the connection to your microcontroller.

### UART Settings

- **Port**: Select the COM port from the dropdown. Use the refresh button to update available ports.
- **Port**: Select the COM port from the dropdown.
- **AUTO**: Automatically detects the first available LNet device (recommended for single device).
- **Specific Port**: Choose a specific COM port (COM1, COM3, etc.) for manual connection.
- **Refresh Button**: Updates the list of available ports.
- **Baud Rate**: Select the baud rate (38400, 115200, 230400, 460800, 921600).

> **Tip**: When using AUTO mode, the system will scan available COM ports and connect to the first device that responds to the LNet protocol. This is useful when the exact port number is unknown or when working across different machines.

### TCP/IP Settings

- **Host**: Enter the IP address or hostname of the target device.
Expand Down Expand Up @@ -127,6 +132,13 @@ mapped to its fixed hardware address. From that point it behaves exactly like an
variable — values can be read, polled live (WatchView), or captured as a scope channel
(ScopeView).

### Export Variables

The **Export Variables** button in the Data Views toolbar allows you to:
- Export only the variables currently selected in WatchView and ScopeView.
- Save the selection as `.yml` or `.pkl`.
- Preserve SFR selections in the exported file too.

### Save and Load Config

The **Save Config** and **Load Config** buttons allow you to:
Expand Down
19 changes: 15 additions & 4 deletions doc/gui_web.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ Select the communication interface type:

When Serial is selected:

1. **UART Dropdown** - Select the COM port from the available ports list
2. **Refresh Button** - Click to rescan for available COM ports
1. **UART Dropdown** - Select the COM port:
- **AUTO (Auto-detect)**: Automatically scans and connects to the first available LNet device (recommended for single device).
- **Specific Port**: Choose a specific COM port (COM1, COM3, etc.) for manual connection.
2. **Refresh Button** - Click to rescan for available COM ports.

> **Tip**: The AUTO option is useful when you don't know the exact COM port or when working across different machines. The system will test each available port and connect to the first one that responds to the LNet protocol.

### TCP/IP Configuration

Expand All @@ -91,11 +95,18 @@ When CAN is selected:

> **Note**: CAN interface requires vendor-specific drivers to be installed. See the API documentation for driver requirements.

### ELF File Selection
### Variable File Selection

Select an ELF file (or PKL/YML import file) containing the variable information from your firmware.
Select a variable file containing the variable information for your firmware.
Supported formats: `.elf`, `.pkl`, `.yml`

### Export Variables

After connecting, click the export icon in the header to export the variables currently used in
Watch View, Scope View, and Dashboard.

Choose either `.yml` or `.pkl`. SFR selections are preserved in the exported file too.

### Connecting

Click the **Connect** button to establish communication with the target device.
Expand Down
4 changes: 3 additions & 1 deletion doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Installation

Create a virtual environment and install pyx2cscope using the following commands (Windows):

pyX2Cscope currently supports Python ``3.10`` to ``3.14``.

.. code-block:: python

python -m venv .venv
Expand Down Expand Up @@ -50,4 +52,4 @@ pyX2Cscope with argument **-l** or **--log-level**

.. code-block:: bash

pyx2cscope --log-level DEBUG
pyx2cscope --log-level DEBUG
Loading
Loading