Implement odometer decoding for Renault Megane 3/Clio 3 and update README with details. Adjust CAN ID definitions in main.cpp to include odometer ID (0x5D7) and enhance decoding logic.
This commit is contained in:
@@ -73,7 +73,8 @@ ID:0x29A LEN:7 DATA:00 00 1A 00 00 00 00
|
||||
```
|
||||
ID:0x29A [WheelSpeed] FL:12.5 km/h FR:12.3 km/h
|
||||
ID:0x29C [WheelSpeed] RL:12.4 km/h RR:12.6 km/h
|
||||
ID:0x??? [Engine] RPM: 1850
|
||||
ID:0x5D7 [Odometer] 125432 km
|
||||
ID:0x230 [Engine] RPM: 1850
|
||||
```
|
||||
|
||||
## Decoded CAN IDs (Renault Clio 3 / Megane 3)
|
||||
@@ -82,10 +83,11 @@ ID:0x??? [Engine] RPM: 1850
|
||||
|----|--------|-------|---------|
|
||||
| 0x29A (666) | Wheel speed front | 0-1: FR, 2-3: FL | (byte[1]<<8\|byte[0]) * 0.005 km/h |
|
||||
| 0x29C (668) | Wheel speed rear | 0-1: RR, 2-3: RL | (byte[1]<<8\|byte[0]) * 0.005 km/h |
|
||||
| **0x5D7** | **Odometer** | 2-5 | (raw>>4)/100 = km |
|
||||
| 0x230 | Engine RPM (tentative) | 2-3 | raw/4 |
|
||||
| 0x2D4 | Vehicle speed (tentative) | 0-1 | raw * 0.01 km/h |
|
||||
|
||||
To add odometer or fix RPM/speed: edit the `#define` IDs and `decode_renault()` switch cases in `main.cpp`.
|
||||
**Odometer** (0x5D7): Confirmed on Renault Megane 3 (2010); likely shared with Clio 3. Bytes 2–5 form a 32‑bit value; `(raw >> 4) / 100` gives total km. Source: [car-reminder](https://github.com/spanceac/car-reminder).
|
||||
|
||||
RPM and odometer IDs may need tuning. If decoded values look wrong:
|
||||
- **RPM**: Rev the engine and watch which IDs change; adjust `ID_ENGINE_RPM` and byte/factor in `decode_renault()`
|
||||
|
||||
11
src/main.cpp
11
src/main.cpp
@@ -56,6 +56,7 @@ void loop() {
|
||||
#define ID_WHEEL_SPEED_REAR 0x29C // 668 - RL, RR
|
||||
#define ID_ENGINE_RPM 0x230 // Common Renault/PSA engine broadcast (verify on your car)
|
||||
#define ID_VEHICLE_SPEED 0x2D4 // Possible speed/odometer (verify on your car)
|
||||
#define ID_ODOMETER 0x5D7 // Renault Megane 3 / Clio 3 - bytes 2-5, (raw>>4)/100 = km
|
||||
|
||||
// Decoder for Renault Clio 3 - outputs human-readable values
|
||||
void decode_renault(const CanFrame& frame) {
|
||||
@@ -99,6 +100,16 @@ void decode_renault(const CanFrame& frame) {
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_ODOMETER:
|
||||
if (len >= 6) {
|
||||
// Renault Megane 3 / Clio 3: bytes 2-5, (raw>>4)/100 = km (from car-reminder project)
|
||||
uint32_t raw = (uint32_t)d[2] << 24 | (uint32_t)d[3] << 16 |
|
||||
(uint32_t)d[4] << 8 | d[5];
|
||||
uint32_t km = (raw >> 4) / 100;
|
||||
if (km < 999999) Serial.printf(" -> [Odometer] %lu km\n", (unsigned long)km);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user