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
70 changes: 70 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI Tests

on:
push:
branches: [dev, master]
pull_request:
branches: [dev, master]

jobs:
backend-tests:
name: Backend Tests (Python)
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"
cache-dependency-path: requirements-test.txt

- name: Create virtual environment
run: |
python -m venv venv
echo "$GITHUB_WORKSPACE/venv/bin" >> $GITHUB_PATH

- name: Install test dependencies
run: |
pip install --upgrade pip
pip install -r requirements-test.txt

- name: Run unit tests
run: pytest tests/unit/ -v

- name: Run functional tests
run: pytest tests/functional/ -v

frontend-tests:
name: Frontend Tests (Node / Vitest)
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js 22
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
cache-dependency-path: frontend/package-lock.json

- name: Install frontend dependencies
working-directory: frontend
run: npm ci --legacy-peer-deps

- name: Run frontend tests
working-directory: frontend
run: npm test

- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: frontend-coverage
path: frontend/coverage/
if-no-files-found: ignore
7 changes: 6 additions & 1 deletion .gitignore
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules/
venv/
dist/
frontend/dist/
frontend/node_modules/
__pycache__/


Expand All @@ -18,4 +19,8 @@ __pycache__/
._*
create-package.sh
v-link.code-workspace
logs/
logs/

#tooling
.vscode/
CLAUDE.md
25 changes: 13 additions & 12 deletions V-Link.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''

import sys
import os
import subprocess
import sys
import os
import subprocess


def activate_venv():
venv_path = f"/home/{os.getenv('USER')}/v-link/venv"
activate_script = os.path.join(venv_path, 'bin', 'activate')

if not os.path.exists(activate_script):
logger.error(f'[V-Link] Activation script for venv not found: {activate_script}')
logger.error(f'[V-Link] Please ensure the virtual environment is set up correctly. Exiting...')
sys.exit(0)
def activate_venv():
script_dir = os.path.dirname(os.path.abspath(__file__))
venv_path = os.path.join(script_dir, 'venv')
activate_script = os.path.join(venv_path, 'bin', 'activate')

if not os.path.exists(activate_script):
sys.stderr.write(f'[V-Link] Activation script for venv not found: {activate_script}\n')
sys.stderr.write('[V-Link] Please ensure the virtual environment is set up correctly. Exiting...\n')
sys.exit(0)

os.system(f'. {activate_script}')

Expand Down Expand Up @@ -423,4 +424,4 @@ def display_thread_states():
except Exception as e:
logger.error(f'Update failed: {e}')

sys.exit(0)
sys.exit(0)
75 changes: 66 additions & 9 deletions backend/config/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,75 @@
"label": "Open Screen on Start"
}
},
"reverseCam": {
"title": "Reverse Camera Settings",
"daylight_backlight": {
"ui": "range",
"label": "Daylight Backlight Level",
"value": 15,
"min": 1,
"max": 16,
"step": 1
},
"auto_backlight": {
"title": "Automatic Backlight",
"type": "system",
"enabled": {
"autoOpen": {
"value": true,
"label": "Enabled"
},
"delay": {
"value": 7,
"label": "Off Delay (sec)"
"label": "Enable Automatic Backlight"
}
},
"darkness_backlight": {
"ui": "range",
"label": "Darkness Backlight Level",
"value": 5,
"min": 1,
"max": 10,
"step": 1
},
"reverseCam": {
"title": "Reverse Camera Settings",
"type": "system",
"enabled": {
"value": true,
"label": "Enabled"
},
"delay": {
"value": 7,
"label": "Off Delay (sec)"
},
"deviceSelectionMode": {
"value": "auto",
"label": "Device Selection",
"options": [
"auto",
"deviceId",
"label"
]
},
"deviceId": {
"value": "default",
"label": "Camera Device",
"options": [
"default"
]
},
"deviceLabel": {
"type": "text",
"value": "",
"label": "Device Label Contains"
},
"videoWidth": {
"value": 1280,
"label": "Video Width"
},
"videoHeight": {
"value": 720,
"label": "Video Height"
},
"videoFps": {
"value": 30,
"label": "Video FPS"
}
},
"side_bars": {
"title": "Sidebar Settings",
"type": "system",
Expand Down Expand Up @@ -458,4 +515,4 @@
"label": "Show Advanced Settings"
}
}
}
}
48 changes: 46 additions & 2 deletions backend/config/profiles/P1/T5/can.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,50 @@
"min_value": 0,
"max_value": 260,
"limit_start": 240
},
"light": {
"interface": "can2",
"enabled": false,
"type": "diagnostic",
"parameter": [
"0x2F",
"0x60"
],
"app_id": "lgt",
"req_id": "0x000FFFFE",
"rep_id": "0x00400021",
"action": "0xA6",
"target": "0x40",
"is_16bit": true,
"priority": 3,
"scale": "(value & 0x03FF) * 5.0 / 1023.0",
"label": "Light Sensor",
"unit": "V",
"min_value": 0,
"max_value": 5
}
},
"signal_sensors": [
{
"key": "light",
"label": "Light Sensor",
"interface": "can2",
"enabled": false,
"can_id": "0x0100082C",
"byte_index": 1,
"bit_index": 7,
"invert": false,
"scale": "(1 - value) * 5.0"
},
{
"key": "reverse",
"label": "Reverse Gear",
"interface": "can2",
"enabled": false,
"can_id": "0x00000000",
"byte_index": 0,
"bit_index": 0,
"invert": false
}
}
}
]
}
27 changes: 25 additions & 2 deletions backend/config/profiles/P2/D5/can.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"enabled": true,
"type": "diagnostic",
"parameter": [
"0x0C",
"0x0C"
],
"app_id": "ld1",
"req_id": "0x000FFFFE",
Expand Down Expand Up @@ -195,5 +195,28 @@
"max_value": 260,
"limit_start": 240
}
}
},
"signal_sensors": [
{
"key": "light",
"label": "Light Sensor",
"interface": "can2",
"enabled": false,
"can_id": "0x00000000",
"byte_index": 0,
"bit_index": 0,
"invert": false,
"scale": "(1 - value) * 5.0"
},
{
"key": "reverse",
"label": "Reverse Gear",
"interface": "can2",
"enabled": false,
"can_id": "0x00000000",
"byte_index": 0,
"bit_index": 0,
"invert": false
}
]
}
25 changes: 24 additions & 1 deletion backend/config/profiles/P2/T5/can.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,28 @@
"max_value": 260,
"limit_start": 240
}
}
},
"signal_sensors": [
{
"key": "light",
"label": "Light Sensor",
"interface": "can2",
"enabled": false,
"can_id": "0x00000000",
"byte_index": 0,
"bit_index": 0,
"invert": false,
"scale": "(1 - value) * 5.0"
},
{
"key": "reverse",
"label": "Reverse Gear",
"interface": "can2",
"enabled": false,
"can_id": "0x00000000",
"byte_index": 0,
"bit_index": 0,
"invert": false
}
]
}
Loading