Skip to content
Open
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
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,21 @@ Icon
Network Trash Folder
Temporary Items
.apdisk
<<<<<<< Updated upstream
.gradle/
=======

# Auto-generated files
firmware/config/boards/**/generated_ts_name_by_pin.cpp
*_generated.h
auto_generated_*.h
firmware/fome_generated.mk
firmware/tunerstudio/generated/*.ini
firmware/generated/.gitignore
java_console/generated/
fome-can-bridge/src/main/java/com/rusefi/config/generated/FuelComputer.java
fome-can-bridge/src/main/java/com/rusefi/config/generated/IgnitionState.java
fome-can-bridge/src/main/java/com/rusefi/config/generated/readme.md
firmware/generated/
/firmware/ext
>>>>>>> Stashed changes
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@
"editor.formatOnSave": true
},
"C_Cpp.clang_format_style": "file",
"java.compile.nullAnalysis.mode": "automatic",
}
25 changes: 25 additions & 0 deletions build-bridge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BRIDGE_DIR="$SCRIPT_DIR/fome-can-bridge"
OUTPUT_DIR="$SCRIPT_DIR/current_bridge_output"

echo "Building FOME CAN Bridge..."
java -version

cd "$BRIDGE_DIR"
./gradlew shadowJar

[ -d "$OUTPUT_DIR" ] || mkdir -p "$OUTPUT_DIR"

JAR_PATH="$OUTPUT_DIR/fome-can-bridge.jar"

if [ -f "$JAR_PATH" ]; then
echo "Build successful!"
echo "Artifact: $JAR_PATH"
ls -lh "$JAR_PATH"
else
echo "ERROR: Bridge JAR not found at $JAR_PATH!"
exit 1
fi
Binary file added current_bridge_output/fome-can-bridge.jar
Binary file not shown.
50 changes: 50 additions & 0 deletions fome-can-bridge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# FOME CAN Bridge

The FOME CAN Bridge is a lightweight, high-performance proxy application designed to bridge Controller Area Network (CAN) traffic from hardware (ECUs) over to a desktop tuning software like TunerStudio.

## Building the Bridge
The bridge avoids legacy bloat and compiles rapidly using Gradle.

### Prerequisites
- Java JDK 11 or higher
- Bash environment (Linux, macOS, or Git Bash for Windows)

### Compilation
To compile the bridge simply execute the provided build script located in the repository root:
```bash
./build-bridge.sh
```
This automatically compiles the project and generates a standalone FAT JAR with all dependencies bundled here: `current_bridge_output/fome-can-bridge.jar`.

Alternatively, if you'd like to build the project directly using gradle:
```bash
cd fome-can-bridge
./gradlew shadowJar
```

## Running the Bridge

Once compiled, you can launch the application by running the executable JAR:
```bash
java -jar current_bridge_output/fome-can-bridge.jar
```
This will launch the graphical interface where you can specify your ECU parameters and select the connected adapter.

### Linux (SocketCAN)
The application natively supports SocketCAN (`can0`, `can1`, `vcan0`, etc) on Linux.
Alternatively, there is a convenient helper script provided that runs the JAR and takes CLI arguments directly to bypass the UI:
```bash
./fome_bridge.sh can0 802 809
```
*(Usage: `./fome_bridge.sh [device_name] [rx_id] [tx_id]`)*

### Windows (COM Ports / SLCAN)
On Windows, you can connect using a standard COM port (e.g. `COM1`, `COM3`, etc) mapping directly to a serial CAN bridge using the SLCAN protocol (such as CANable flashed with slcan firmware). Select your COM port within the graphical interface, and click "Start Server" to host the TunerStudio networking socket on port 29001.

## TunerStudio Integration
Once the console indicates that the TCP port is listening on `29001`, open TunerStudio:
1. Open your ECU's Project.
2. Go to `Communications -> Settings`.
3. Set the communication type to `TCP/IP`.
4. Port "29001", IP Address "localhost"
5. Run "Test port" to verify communication.
49 changes: 49 additions & 0 deletions fome-can-bridge/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
plugins {
id 'java'
id 'com.gradleup.shadow' version '8.3.5'
}

group 'com.fome'
version '1.0-SNAPSHOT'

repositories {
mavenCentral()
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

dependencies {
// Serial port access (SLCAN)
implementation 'com.fazecast:jSerialComm:2.11.4'

// SocketCAN (Linux)
implementation group: 'tel.schich', name: 'javacan-core', version: '3.2.4'
implementation group: 'tel.schich', name: 'javacan-core', version: '3.2.4', classifier: 'x86_64'

// Annotations
implementation 'org.jetbrains:annotations:16.0.1'
implementation 'net.jcip:jcip-annotations:1.0'
implementation 'com.google.code.findbugs:jsr305:3.0.2'

// UI
implementation 'com.formdev:flatlaf:3.4.1'
implementation 'com.miglayout:miglayout-swing:11.3'
}

jar {
manifest {
attributes(
'Main-Class': 'com.fome.canbridge.Main'
)
}
}

shadowJar {
archiveBaseName.set('fome-can-bridge')
archiveClassifier.set('')
archiveVersion.set('')
destinationDirectory.set(file("../current_bridge_output"))
}
Binary file added fome-can-bridge/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions fome-can-bridge/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading