Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
4855935
fix zip relative path for artifacts
Nov 25, 2025
94d3c29
update mchplnet pointer
Dec 4, 2025
3c7ab73
tcp-ip demo (WIP)
Jan 22, 2026
4d4db18
update pointer
Jan 30, 2026
48b4480
optimizing code
Feb 3, 2026
d3ce7a8
enhanced interface factory for default values
Feb 4, 2026
3da85d8
unit test for tcp interface
Feb 4, 2026
9d2749b
oficial tcp demo
Feb 4, 2026
bd0fd8c
adding dashboard tab to web view
Feb 5, 2026
2f2d2b4
Adding new widget and config
Feb 5, 2026
08dc788
including scripting tab on web view
Feb 5, 2026
1a12d37
including multiple interfaces
Feb 5, 2026
240eea8
fix dashboard behavior
Feb 6, 2026
2a32d82
replacing plotly by chartjs
Feb 6, 2026
30ee34e
fix gauge render
Feb 6, 2026
caa2829
update pointer
edras Feb 7, 2026
9f92415
dashboard connected to x2cscope
edras Feb 7, 2026
987b622
gauge working
edras Feb 7, 2026
e976bc6
tweaking gauge value
edras Feb 7, 2026
b0c8e55
widgets are stored and loaded individually
Feb 9, 2026
5531070
enhancing script
Feb 24, 2026
f6264c1
cleaning dashboard_view.js
Feb 24, 2026
5dc8373
fix for trigger_level
Feb 25, 2026
86a0389
fix for trigger_level
Feb 25, 2026
24651d8
update pointer
Feb 25, 2026
5988307
enhance dashboard template
Feb 26, 2026
bc359bf
transparent widgets on view
Feb 26, 2026
3dee006
inserting labels on plots and fix bg color
Feb 26, 2026
1133c28
Labels do not interfere with widgets
Feb 26, 2026
6ec8403
added switch widget
Feb 26, 2026
0d00138
added sample control widget
Feb 26, 2026
fc79be5
sample control save and load
Feb 26, 2026
fdcad35
visual enhancements on plots
Feb 26, 2026
ab70774
fixed trigger level on generic_gui
Feb 26, 2026
7051bc3
refactoring generic gui to best practices
Feb 27, 2026
724ea21
color on scope view and moving scope position and tabs
Mar 2, 2026
053f488
dual window for watch and plot view
Mar 2, 2026
315a272
renaming generic_gui folder to qt
Mar 2, 2026
6cafbdf
enhanced connection interface
Mar 3, 2026
31e5183
loading message when connecting
Mar 3, 2026
63e0373
scripting tab working
Mar 3, 2026
54b5b66
enhanced scripting tab help
Mar 3, 2026
6aa0626
update doc for gui qt
Mar 3, 2026
777f02a
update mchplnet pointer
Mar 3, 2026
bc799bc
update mchplnet version
Mar 3, 2026
ac38502
removed lin from web, added CAN parameters
Mar 4, 2026
4548e78
enhancements on web view
Mar 4, 2026
9224bb4
unit tests for gui qt and web
Mar 4, 2026
5c7ffb6
ruff check
Mar 4, 2026
02277ab
update mchplnet pointer
Mar 4, 2026
7598809
mchplnet v0.4.1 + fix utils.py + docs
Mar 4, 2026
724156a
added update rate on widgets
Mar 5, 2026
959e139
reading SFRs
Mar 5, 2026
39e0070
including SFRs on Web and GUI Qt
Mar 5, 2026
fea49ac
update project version
Mar 5, 2026
a879ae9
fix script html size
Mar 5, 2026
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
8 changes: 8 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"permissions": {
"allow": [
"Bash(python -c \"from pyx2cscope.gui.generic_gui.tabs.watch_view_tab import WatchViewTab; from pyx2cscope.gui.generic_gui.tabs.scope_view_tab import ScopeViewTab; from pyx2cscope.gui.generic_gui.tabs.watch_plot_tab import WatchPlotTab; print\\(''All imports successful''\\)\")",
"Bash(ruff check .)"
]
}
}
32 changes: 21 additions & 11 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,21 @@ jobs:
with:
python-version: "3.10"

# Since we moved to generic parser, we don't need to install the xc-16 compiler anymore,
# because generic parser is based on pyelftools.
#
# - name: Set up Microchip XC16 v2.10 compiler
# run: |
# wget -nv -O /tmp/xc16 https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/xc16-v2.10-full-install-linux64-installer.run && \
# chmod +x /tmp/xc16 && \
# sudo /tmp/xc16 --mode unattended --unattendedmodeui none --netservername localhost --LicenseType FreeMode --prefix /opt/microchip/xc16/v2.10 && \
# rm /tmp/xc16
# echo "/opt/microchip/xc16/v2.10/bin" >> $GITHUB_PATH
- name: Install system dependencies for Qt
run: |
sudo apt-get update
sudo apt-get install -y \
libxkbcommon-x11-0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-xinerama0 \
libxcb-xfixes0 \
libegl1 \
libgl1-mesa-glx \
xvfb

- name: Install dependencies
run: |
Expand All @@ -71,8 +76,13 @@ jobs:
pip install -e .

- name: Run tests
env:
QT_QPA_PLATFORM: offscreen
DISPLAY: ":99.0"
run: |
pytest
Xvfb :99 -screen 0 1024x768x24 &
sleep 2
pytest -v

docs:
runs-on: ubuntu-latest
Expand Down
6 changes: 2 additions & 4 deletions doc/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,12 @@ sphinx-build -M html doc build --keep-going
pyinstaller --noconfirm .\pyx2cscope_win.spec
```

## Creating artifacts to upload to github release page
## Creating artifacts to upload to Github release page
This script will execute the pyinstaller command listed above,
include the script file to start the web interface, zip
the contents of the dist folder and add the whell file
available on pypi in the dist folder.

```bash
python -m scripts/build.py
python scripts/build.py
```

## Creating artifacts to upload to GitHu
198 changes: 162 additions & 36 deletions doc/gui_qt.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,169 @@ application.
The GUI Qt is currently the default GUI, it runs out-of-the-box when running the command below:

```
python -m pyx2cscope
```
python -m pyx2cscope
```

It can also be executed over argument -q
It can also be executed with the argument -q:

```
python -m pyx2cscope -q
```

## Getting Started with pyX2Cscope reference GUI
## Tab: WatchPlot
![WatchPlot](https://raw.githubusercontent.com/X2Cscope/pyx2cscope/refs/heads/main/doc/images/gui_watch_plot.jpg)
1. pyX2Cscope-GUI is based on Serial interface.
2. The Firmware of the microcontroller should have the X2Cscope library/Peripheral enabled.
3. In Tab WatchPlot, five channels values can be viewed, modified and can be plotted in the plot window.
4. In COM Port, either select **Auto Connect** or select the appropriate COM Port, Baud Rate from the drop-down menus and the ELF file of the project, the microcontroller programmed with. <br>
5. Sample time can be changed during run time as well, by default its set to 500 ms.
6. Press on **Connect**
7. Once the connection between pyX2Cscope and Microcontroller takes place, the buttons will be enabled.
8. Information related to the microcontroller will be displayed in the top-left corner.

## Tab: ScopeView
![ScopeView](https://raw.githubusercontent.com/X2Cscope/pyx2cscope/refs/heads/main/doc/images/gui_scope_view.jpg)

1. ScopeView supports up to 8 PWM resolution channels for precise signal control.
2. You can configure all trigger settings directly within the window. To enable the trigger for a variable, check the corresponding trigger checkbox.
3. To apply modifications during sampling, first stop the sampling, make the necessary changes, then click Sample again to update and apply the modifications.
4. From the plot window, User can export the plot in various formats, including CSV, image files, Matplotlib Window, and Scalable Vector Graphics (SVG).
5. To zoom in on the plot, left-click and drag on the desired area. To return to the original view, right-click and select View All.

## Tab: WatchView
![WatchView](https://raw.githubusercontent.com/X2Cscope/pyx2cscope/refs/heads/main/doc/images/gui_watch_view.jpg)

1. WatchView lets users add or remove variables as needed. To remove a variable, click the Remove button next to it.
2. Users can visualize variables in live mode with an update rate of 500 milliseconds. This rate is the default setting and cannot be changed.
3. Users can select, view, and modify all global variables during runtime, providing real-time control and adjustments.

## Save and Load Config.
1. The Save and Load buttons, found at the bottom of the GUI, allow users to save or load the entire configuration, including the COM Port, Baud Rate, ELF file path, and all other selected variables across different tabs. This ensures a consistent setup, regardless of which tab is active.
2. When a pre-saved configuration file is loaded, the system will automatically attempt to load the ELF file and establish a connection. If the ELF file is missing or unavailable at the specified path, user will need to manually select the correct ELF file path.
```

## Getting Started with pyX2Cscope Reference GUI

The GUI consists of three main tabs: **Setup**, **Data Views**, and **Scripting**.

---

## Tab: Setup

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.

2. **Interface**: Select the communication interface:
- **UART**: Serial communication
- **TCP/IP**: Network communication
- **CAN**: CAN bus communication

3. **Connect**: Press to establish the connection. The button changes to "Disconnect" when connected.

### UART Settings

- **Port**: Select the COM port from the dropdown. Use the refresh button to update available ports.
- **Baud Rate**: Select the baud rate (38400, 115200, 230400, 460800, 921600).

### TCP/IP Settings

- **Host**: Enter the IP address or hostname of the target device.
- **Port**: Enter the TCP port number (default: 12666).

### CAN Settings

- **Bus Type**: Select USB or LAN.
- **Channel**: Enter the CAN channel number.
- **Baudrate**: Select from 125K, 250K, 500K, or 1M.
- **Mode**: Select Standard or Extended.
- **Tx-ID (hex)**: Transmit ID in hexadecimal (default: 7F1).
- **Rx-ID (hex)**: Receive ID in hexadecimal (default: 7F0).

### Device Information

Once connected, device information is displayed on the right side:
- Processor ID
- UC Width
- Date and Time
- App Version
- DSP State

> **Note**: All connection settings are automatically saved and restored on the next application start.

---

## Tab: Data Views

The Data Views tab provides two views that can be toggled independently using the buttons at the top:

- **WatchView**: Monitor and modify variable values in real-time
- **ScopeView**: Capture and visualize variable waveforms

You can enable both views simultaneously for a split-screen layout. You can change the width of each column by dragging the line between them. For this to take effect, adjust the App window size accordingly.

### WatchView

1. Click "Add Variable" to add variables to monitor.
2. Select variables from the dialog window.
3. Configure scaling and offset for each variable.
4. Enable "Live" checkbox to poll values at 500ms intervals.
5. Enter new values and click "Write" to modify variables on the device.
6. Click "Remove" to delete a variable row.

### ScopeView

1. ScopeView supports up to 8 channels for precise signal capture.
2. Select variables for each channel from the dropdown.
3. Configure trigger settings:
- **Mode**: Auto (continuous) or Triggered
- **Edge**: Rising or Falling
- **Level**: Trigger threshold value
- **Delay**: Trigger delay in samples
4. Check the "Trigger" checkbox on the channel you want to use as trigger source.
5. Click "Sample" to start capturing, "Single" for one-shot capture, or "Stop" to halt.
6. Use the plot toolbar to zoom, pan, and export data (CSV, PNG, SVG, or Matplotlib window).

### Special Function Registers (SFR)

Both **WatchView** and **ScopeView** support searching and adding Special Function Registers
(SFRs) — hardware peripheral registers such as `LATD`, `TMR1`, or `PORTA` — in addition to
ordinary firmware variables.

When the variable selection dialog opens, an **SFR** checkbox appears next to the search bar:

- When the checkbox is **unchecked** (default) the list shows firmware variables.
- When the checkbox is **checked** the list switches to SFRs parsed from the ELF file.

The checkbox is disabled (greyed out) if the connected ELF file contains no SFR entries.

Once an SFR is selected and confirmed, it is retrieved with `sfr=True` internally so it is
mapped to its fixed hardware address. From that point it behaves exactly like any other
variable — values can be read, polled live (WatchView), or captured as a scope channel
(ScopeView).

### Save and Load Config

The **Save Config** and **Load Config** buttons allow you to:
- Save the entire configuration including ELF file path, connection settings, and all variable configurations.
- Load a previously saved configuration to quickly restore your setup.
- When loading, the system automatically attempts to connect using the saved settings.

---

## Tab: Scripting

The Scripting tab allows you to run Python scripts with direct access to the x2cscope connection.

### Script Selection

1. Click **Browse** to select a Python script (.py file).
2. Click **Edit (IDLE)** to open the script in Python's IDLE editor.
3. Click **Help** for documentation on writing scripts.

### Execution Controls

1. Click **Execute** to run the selected script.
2. Click **Stop** to request the script to stop (scripts must check `stop_requested()` in loops).
3. Enable **Log output to file** and select a location to save script output.

### Output Tabs

- **Script Output**: Displays the actual output from your script (print statements, errors).
- **Log**: Displays timestamped system messages (script started, stopped, connection status).

### Available Objects in Scripts

When running from the Scripting tab, your script has access to:

- **x2cscope**: The X2CScope instance (or `None` if not connected via Setup tab)
- **stop_requested()**: Function that returns `True` when the Stop button is pressed

### Example Script

```python
# Example: Read and print a variable value
if globals().get("x2cscope") is not None:
var = x2cscope.get_variable("myVariable")
print(f"Value: {var.get_value()}")

# Example: Loop with stop support
stop_requested = globals().get("stop_requested", lambda: False)
while not stop_requested():
var = x2cscope.get_variable("myVar")
print(var.get_value())
time.sleep(0.5)
print("Script stopped.")
```

> **Note**: Scripts run in the same process as the GUI. If connected via the Setup tab, scripts share the same x2cscope connection. Scripts can also create their own connections when running standalone.
Loading
Loading