Skip to content
Draft

BLCU #544

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
6cc8eeb
feat*: flashing view integrated onto main app. changed electron confi…
l-castel May 11, 2026
bd050c0
fix(workspace): fixed pnpm workspace to integrate the flashing-view r…
l-castel May 13, 2026
7b5664b
fix(workspace): added python package and logger to .gitignore
l-castel May 14, 2026
55e024c
fix(electron): fixed gitignores.
l-castel May 14, 2026
43d26c4
chore(electron-app): stop tracking python and logger folders
l-castel May 14, 2026
ef462b6
chore(testing-view): remove embedded flash-station feature
l-castel Jun 1, 2026
537c0f7
chore(electron-app): revert to develop baseline
l-castel Jun 1, 2026
73349a6
chore(flashing-view): move app into frontend/ alongside other views
l-castel Jun 1, 2026
4459172
feat(ui-kit): add Table component and missing icons; update flashing-…
l-castel Jun 9, 2026
7dc018d
chore(old flashing-view): deleted old flashing-view implementation
l-castel Jun 9, 2026
28f3e4e
fix(GITIGNORE): updated gitignore
l-castel Jun 9, 2026
1083e5e
fix(build): fixed build errors
l-castel Jun 9, 2026
bc88c9b
fix(ci): install flashing-view + competition-view deps in frontend-te…
l-castel Jun 9, 2026
4cdd818
fix(electron): typo on electron config
l-castel Jun 9, 2026
90263d6
fix(logo): added logo to flashing view header
l-castel Jun 17, 2026
c4de2a6
docs(BLCU-programming): refactor old files
JavierRibaldelRio Jun 17, 2026
cca4b20
chore(blcu-programming): integration in pnpm
JavierRibaldelRio Jun 17, 2026
25fe715
refactor(BLCU-Programming): separate HTTP server
JavierRibaldelRio Jun 17, 2026
2ca2d0d
refactor(BLCU-Programming): create configuration file
JavierRibaldelRio Jun 17, 2026
f19dec8
fix(BLCU-programming): sync error
JavierRibaldelRio Jun 17, 2026
4ed7704
docs(blcu-programming): add comments
JavierRibaldelRio Jun 17, 2026
128030f
fix(electron): reverted unnecessary electron config changes
l-castel Jun 18, 2026
8ff0f31
feat(flashing-view): deep refactor of proposed implementation. change…
l-castel Jun 18, 2026
271fb08
feat(flashing-view): integrated with backend, tested endpoints.
l-castel Jun 18, 2026
22321d4
feat(flashing-view): replaced upload function wih flash function. imp…
l-castel Jun 18, 2026
b918b21
Merge branch 'control-station/blcu' into features/flashing-view
l-castel Jun 18, 2026
309dc09
feat(flashing-view): added flashing view
l-castel Jun 18, 2026
ceae5bb
fix(repo): pnpm remove duplicate packages
JavierRibaldelRio Jun 18, 2026
f2ef139
Merge branch 'develop' into control-station/blcu
JavierRibaldelRio Jun 18, 2026
3012a0c
feat(BLCU): update blcu config
JavierRibaldelRio Jun 18, 2026
d78fb9a
chore(BLCU-programming): new dependenc
JavierRibaldelRio Jun 18, 2026
422a0e1
feat: udp server
JavierRibaldelRio Jun 18, 2026
adb5121
fix(BLCU): correct http api port
JavierRibaldelRio Jun 18, 2026
7c068d6
feat(flashing-view): added theme toggle.
l-castel Jun 19, 2026
ff0998c
feat(flashing-view): updated polling function to inlcude correct payl…
l-castel Jun 19, 2026
2c09e45
feat(flashing-view): added operational blcu state.
l-castel Jun 19, 2026
8a1d860
wip: config
JavierRibaldelRio Jun 19, 2026
77108e8
fix(blcu-programming): recibe BLCU status
JavierRibaldelRio Jun 19, 2026
c095440
feat(BLCU-programming): ping other boards
JavierRibaldelRio Jun 19, 2026
dfa9714
fix: change period & api route
JavierRibaldelRio Jun 19, 2026
d8e3667
fix(BLCU-programming): cors error
JavierRibaldelRio Jun 19, 2026
11b99e9
feat(BLCU-Programming): improve flashing
JavierRibaldelRio Jun 19, 2026
28add65
feat: tcp connection
JavierRibaldelRio Jun 19, 2026
38ae5d1
wip(BLCU-programming): update config.json
JavierRibaldelRio Jun 20, 2026
4c3da30
Merge branch 'develop' into control-station/blcu
JavierRibaldelRio Jun 20, 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
2 changes: 1 addition & 1 deletion .github/workflows/frontend-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile --filter=testing-view --filter=competition-view --filter=ui --filter=core
run: pnpm install --frozen-lockfile --filter=testing-view --filter=flashing-view --filter=competition-view --filter=ui --filter=core

- name: Build frontend
run: pnpm build --filter="./frontend/**"
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ node_modules/

# Global binaries
*.exe

# electron modules
electron-app/python
electron-app/logger
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Before starting, ensure you have the following installed:
- **PNPM** (v10.26.0+)
- **Node.js** (v20+)
- **Go** (for the backend)
- **Python** (v3.8+, for the BLCU programming service)

---

Expand All @@ -25,6 +26,7 @@ Our `pnpm-workspace.yaml` defines the following workspaces:
| `testing-view` | TS/React | Web interface for telemetry testing |
| `competition-view` | TS/React | UI for the competition |
| `backend` | Go | Data ingestion and pod communication server |
| `blcu-programming` | Python | FastAPI service that flashes firmware to the BLCU board via TFTP |
| `hyperloop-control-station` | JS | The main Control Station electron desktop application |
| `e2e` | TS | End-to-end tests for the whole app (Playwright) |
| `@workspace/ui` | TS/React | Shared UI component library (frontend-kit) |
Expand Down
13 changes: 13 additions & 0 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions backend/pkg/adj/validator.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package adj

import (
"os"
"os/exec"
"path"
"strings"
Expand Down Expand Up @@ -62,6 +63,13 @@ func Validate() {
// If none of the candidates are found, an empty string is returned,
// indicating that no Python interpreter is available.
func pythonCommand() string {
// Prefer bundled Python shipped with the Electron app
if bundled := os.Getenv("HYPERLOOP_PYTHON_PATH"); bundled != "" {
if _, err := os.Stat(bundled); err == nil {
return bundled
}
}

candidates := []string{"python3", "python", "py"}

for _, c := range candidates {
Expand Down
42 changes: 42 additions & 0 deletions blcu-programming/BLCU-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"blcu": {
"host": "192.168.0.27",
"port": 69,
"UDP_PORT_DESTINATION": 50420,
"TCP_PORT_SERVER": 50500

},
"adj-data": {

"BCU": "192.168.2.16",
"LVBMS": "192.168.1.11",
"HVBMS": "192.168.1.17",
"PCU": "192.168.1.5",
"TCU": "127.0.0.1",
"LCU": "192.168.1.4",
"VCU": "192.168.1.3"

},
"orders":{
"Write Program": "700"
},
"packet":{

"id": 1,
"general_state_machine": [
"Connecting",
"Operational",
"Fault"
] ,
"operational_state_machine":[
"Idle",
"Flashing"
]
},
"api": {
"host": "0.0.0.0",
"port": 8069,
"log_level": "info"
},
"log_file": "tftp_server_activity.log"
}
100 changes: 37 additions & 63 deletions blcu-programming/README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,50 @@
# TFTP Server and Client
# BLCU - Programming

**TFTP Server and Client** is a comprehensive Python-based application designed to facilitate Trivial File Transfer Protocol (TFTP) operations through a user-friendly graphical interface built with PyQt5. This tool allows users to efficiently manage file transfers to and from TFTP servers, making it an essential resource for network administrators.
FastAPI service that bridges the *Flashing view* in the Control Station and the BLCU hardware board, transferring firmware files over TFTP.

## Key Features
## How it works

### TFTP Server
- **Start/Stop Server:** Easily control the TFTP server with start and stop functionalities.
- **Select IP Address:** Choose the specific IP address for the server to listen on.
- **Change Working Directory:** Modify the current working directory for file transfers with a straightforward interface.
- **View Directory Contents:** Quickly access and view files in the current working directory.
- **Logging:** Track server activity with real-time logging displayed in the application and stored in a log file.
[tftp_server](../TFTP_GUI_Server_Client/screenshot/tftp_server.png)
### TFTP Client
- **Upload Files:** Seamlessly upload files to a TFTP server using a simple interface.
- **Download Files:** Effortlessly download files from a TFTP server with progress monitoring.
- **File Browsing:** Use an integrated file dialog for easy file selection.
- **Status Updates:** Receive real-time status updates during upload and download processes.
[tftp_client](../TFTP_GUI_Server_Client/screenshot/tftp_client.png)
### Monitoring and Alerts
- Monitor TFTP server activities and transfer statuses with immediate feedback on successes or failures.
- Real-time updates ensure that users can track the progress of their operations.
```
Control Station (Electron)
|
| HTTP (port 8069)
v
api/main.py (FastAPI)
|
| TFTP (UDP port 69)
v
BLCU board @ 192.168.0.27
```

### Error Handling and Prompt Detection
- Implement robust error handling specific to TFTP operations to ensure smooth functionality.
- Dynamic prompt detection allows the application to handle varying device responses effectively.
## API endpoints

## Example Configurations
| Method | Path | Description |
| :----- | :---------- | :----------------------------------- |
| GET | `/health` | Health check |
| POST | `/upload` | Send a local firmware file to BLCU |
| POST | `/download` | Fetch a file from BLCU to local disk |
| GET | `/logs` | Tail the TFTP activity log |

### Setting Up the TFTP Server
1. Launch the application and navigate to the TFTP Server tab.
2. Select an available IP address from the dropdown menu.
3. Specify the desired port number (default is 69).
4. Click **Start Server** to begin listening for incoming TFTP requests.
## Development

### Uploading Files
1. Navigate to the TFTP Client tab.
2. Enter the TFTP server IP address.
3. Use the **Browse Upload...** button to select the file you wish to upload.
4. Click **Upload File** and monitor the status for updates.
Dependencies are managed via a Python virtual environment. `pnpm install` creates and populates it automatically.

### Downloading Files
1. Enter the TFTP server IP address and specify the file name for download.
2. Click **Download File** to initiate the download process.
3. Progress and status will be displayed in real time.
```bash
# From the repo root — starts all services including this one
pnpm dev

## System Requirements
# Or run only this service
pnpm --filter blcu-programming dev
```

To run the TFTP Server and Client application, the following system requirements must be met:
The service starts on `http://127.0.0.1:8069` by default. Override with environment variables:

- **Python 3.x**
- **PyQt5**
- **TFTP Library**
- **OS:** Windows 10 or Ubuntu >=20.04 (recommended) or any modern Linux distribution
```bash
BLCU_API_HOST=0.0.0.0 BLCU_API_PORT=9000 pnpm --filter blcu-programming dev
```

## Technologies Used
## Setup (first time)

- **Python:** The core language utilized for backend logic.
- **PyQt5:** The framework used for developing the graphical user interface.
- **TFTP Library:** Employed for implementing TFTP protocol functionalities.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Contributing

Contributions are welcome! Please fork the repository and create a pull request with your enhancements. Alternatively, you can open an issue to suggest improvements or report bugs.

## Author

**petrunetworking** (Network Engineer)

## Acknowledgements

Developed using Python and inspired by the need for efficient file transfer solutions, this application aims to simplify TFTP operations for network professionals, enabling them to manage their file transfers effectively and reliably.
```bash
pnpm install # creates .venv and installs Python deps via postinstall
```
50 changes: 50 additions & 0 deletions blcu-programming/api/board_pinger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import subprocess
import threading

from api.config import load

_cfg = load()
_BOARDS: dict[str, str] = _cfg["adj-data"]

_status: dict[str, bool] = {name: False for name in _BOARDS}
_lock = threading.Lock()

PING_INTERVAL = 60


def get_board_status() -> dict[str, bool]:
with _lock:
return dict(_status)


def _ping(ip: str) -> bool:
try:
result = subprocess.run(
["ping", "-c", "1", "-W", "1", ip],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
timeout=3,
)
return result.returncode == 0
except Exception:
return False


def _ping_all() -> None:
results = {name: _ping(ip) for name, ip in _BOARDS.items()}
with _lock:
_status.update(results)



def _run(stop: threading.Event) -> None:
while not stop.is_set():
_ping_all()
stop.wait(PING_INTERVAL)


def start() -> threading.Event:
stop = threading.Event()
t = threading.Thread(target=_run, args=(stop,), daemon=True, name="board-pinger")
t.start()
return stop
10 changes: 10 additions & 0 deletions blcu-programming/api/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import json
from pathlib import Path

_ROOT = Path(__file__).parent.parent
_CONFIG_PATH = _ROOT / "BLCU-config.json"


def load() -> dict:
with _CONFIG_PATH.open(encoding="utf-8") as f:
return json.load(f)
Loading
Loading