mirror of
https://github.com/merbanan/rtl_433.git
synced 2026-05-18 23:05:27 -04:00
minor: Update style on Renault-0435R
This commit is contained in:
@@ -295,6 +295,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md).
|
||||
[209] SimpliSafe Gen 3 Home Security System
|
||||
[210] Yale HSA (Home Security Alarm), YES-Alarmkit
|
||||
[211] Regency Ceiling Fan Remote (-f 303.75M to 303.96M)
|
||||
[212] Renault 0435R TPMS
|
||||
|
||||
* Disabled by default, use -R n or -G
|
||||
|
||||
|
||||
@@ -437,6 +437,7 @@ stop_after_successful_events false
|
||||
protocol 209 # SimpliSafe Gen 3 Home Security System
|
||||
protocol 210 # Yale HSA (Home Security Alarm), YES-Alarmkit
|
||||
protocol 211 # Regency Ceiling Fan Remote (-f 303.75M to 303.96M)
|
||||
protocol 212 # Renault 0435R TPMS
|
||||
|
||||
## Flex devices (command line option "-X")
|
||||
|
||||
|
||||
@@ -64,7 +64,10 @@ Moisture is transmitted in the humidity field as index 1-16: 0, 7, 13, 20, 27, 3
|
||||
{150} 5c e4 18 80 02 c3 18 fb ba fc 26 98 11 84 81 ff f0 16 00 [Temp 11.8 C Hum 81%]
|
||||
{148} d0 bd 18 80 02 c3 18 f9 ad fa 26 48 ff ff ff fe 02 ff f0
|
||||
|
||||
DIGEST:8h8h ID?8h8h8h8h FLAGS:4h BATT:1b CH:3d WSPEED:~8h~4h ~4h~8h WDIR:12h ?4h TEMP8h.4h ?4h HUM8h UV?~12h ?4h CHKSUM:8h
|
||||
Wind and Temperature/Humidity or Rain:
|
||||
|
||||
DIGEST:8h8h ID:8h8h8h8h FLAGS:4h BATT:1b CH:3d WSPEED:~8h~4h ~4h~8h WDIR:12h ?4h TEMP:8h.4h ?4h HUM:8h UV?~12h ?4h CHKSUM:8h
|
||||
DIGEST:8h8h ID:8h8h8h8h FLAGS:4h BATT:1b CH:3d WSPEED:~8h~4h ~4h~8h WDIR:12h ?4h RAINFLAG:8h RAIN:8h8h UV:8h8h CHKSUM:8h
|
||||
|
||||
Digest is LFSR-16 gen 0x8810 key 0x5412, excluding the add-checksum and trailer.
|
||||
Checksum is 8-bit add (with carry) to 0xff.
|
||||
|
||||
@@ -10,20 +10,21 @@
|
||||
*/
|
||||
/**
|
||||
FSK 9 byte Manchester encoded TPMS with xor checksum, Renault 0435R.
|
||||
|
||||
Part no:
|
||||
Renault 40700 0435R
|
||||
VDO S180052064Z
|
||||
- Renault 40700 0435R
|
||||
- VDO S180052064Z
|
||||
|
||||
List of compatible Renault vehicles (from: https://www.vdo.com/media/190553/vdo-2017-tpms_2017-05-03.pdf)
|
||||
FLUENCE (L30_)
|
||||
LAGUNA III (BT0/1)
|
||||
LAGUNA III Grandtour (KT0/1)
|
||||
LATITUDE (L70_)
|
||||
MEGANE III Coupe (DZ0/1_)
|
||||
MEGANE III Grandtour (KZ0/1)
|
||||
MEGANE III Hatchback(BZ0_)
|
||||
SCÉNIC III (JZ0/1_)
|
||||
ZOE (BFM_)
|
||||
- FLUENCE (L30_)
|
||||
- LAGUNA III (BT0/1)
|
||||
- LAGUNA III Grandtour (KT0/1)
|
||||
- LATITUDE (L70_)
|
||||
- MEGANE III Coupe (DZ0/1_)
|
||||
- MEGANE III Grandtour (KZ0/1)
|
||||
- MEGANE III Hatchback(BZ0_)
|
||||
- SCÉNIC III (JZ0/1_)
|
||||
- ZOE (BFM_)
|
||||
|
||||
Packet nibbles:
|
||||
|
||||
@@ -44,25 +45,26 @@ Note: Pressure unit of 4/3 kPa is a guess, one of possible alternatives
|
||||
the precision of the sensor anyways.
|
||||
|
||||
Note: Centrifugal acceleration unit guessed by following calculation:
|
||||
I have tires 195/65R15:
|
||||
tire height over wheel: s = 195mm * 65% = 0.12675m
|
||||
radius of wheel without tire: r₀ = 15''/2 = 0.1905m
|
||||
radius of tire: r = r₀ + s = 0.31725m
|
||||
cirumference of tire: c = 2πr = 0.31725m * 6.283186 = 1.99334m
|
||||
Centrifugal acceleration at circumference of a tire (a) is related to the centrifugal
|
||||
acceleration at sensor (a₀) by ratio of radius of tire and position of sensor,
|
||||
which we guess is located exactly at the edge between the wheel and the tire.
|
||||
a₀ = a * r₀/r
|
||||
Radial acceleration at circumference of tire can be calculated by formula
|
||||
a = v²/r where v is speed of the vehicle
|
||||
Thus centrifugal acceleration at the sensor should be:
|
||||
a₀ = v² * r₀/r² = (KPH² / 3.6²) * (r₀/r²)
|
||||
- I have tires 195/65R15:
|
||||
- tire height over wheel: s = 195mm * 65% = 0.12675m
|
||||
- radius of wheel without tire: r₀ = 15''/2 = 0.1905m
|
||||
- radius of tire: r = r₀ + s = 0.31725m
|
||||
- cirumference of tire: c = 2πr = 0.31725m * 6.283186 = 1.99334m
|
||||
|
||||
I get a₀ = KPH² * 0.146 for my tires. I plugged in speed obtained by OBD interface
|
||||
(which matches GPS speed with less than 1% accuracy (yes it is lower than speed
|
||||
displayed to driver)), and got values exactly five times greater than values
|
||||
reported by the sensor for speeds under 93 kph. The sensor sends 255 when value does
|
||||
not fit into 8 bits (that is for speeds above 93 kph on my tires).
|
||||
Centrifugal acceleration at circumference of a tire (a) is related to the centrifugal
|
||||
acceleration at sensor (a₀) by ratio of radius of tire and position of sensor,
|
||||
which we guess is located exactly at the edge between the wheel and the tire.
|
||||
a₀ = a * r₀/r
|
||||
Radial acceleration at circumference of tire can be calculated by formula
|
||||
a = v²/r where v is speed of the vehicle
|
||||
Thus centrifugal acceleration at the sensor should be:
|
||||
a₀ = v² * r₀/r² = (KPH² / 3.6²) * (r₀/r²)
|
||||
|
||||
I get a₀ = KPH² * 0.146 for my tires. I plugged in speed obtained by OBD interface
|
||||
(which matches GPS speed with less than 1% accuracy (yes it is lower than speed
|
||||
displayed to driver)), and got values exactly five times greater than values
|
||||
reported by the sensor for speeds under 93 kph. The sensor sends 255 when value does
|
||||
not fit into 8 bits (that is for speeds above 93 kph on my tires).
|
||||
|
||||
*/
|
||||
|
||||
@@ -70,54 +72,49 @@ Note: Centrifugal acceleration unit guessed by following calculation:
|
||||
|
||||
static int tpms_renault_0435r_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsigned row, unsigned bitpos)
|
||||
{
|
||||
data_t *data;
|
||||
bitbuffer_t packet_bits = {0};
|
||||
uint8_t *b;
|
||||
int flags;
|
||||
char flags_str[3];
|
||||
char id_str[7];
|
||||
int pressure_datorr, temp_c, rad_acc, tick, has_tick;
|
||||
double pressure_kpa;
|
||||
int checksum;
|
||||
|
||||
bitbuffer_manchester_decode(bitbuffer, row, bitpos, &packet_bits, 160);
|
||||
// require 72 data bits
|
||||
if (packet_bits.bits_per_row[0] < 72) {
|
||||
return 0;
|
||||
return DECODE_ABORT_EARLY;
|
||||
}
|
||||
b = packet_bits.bb[0];
|
||||
uint8_t *b = packet_bits.bb[0];
|
||||
|
||||
// check checksum (checksum8 xor)
|
||||
checksum = xor_bytes(b, 9);
|
||||
if (checksum != 0) {
|
||||
return 0;
|
||||
int chk = xor_bytes(b, 9);
|
||||
if (chk != 0) {
|
||||
return DECODE_FAIL_MIC;
|
||||
}
|
||||
|
||||
tick = b[8] & 0x7f;
|
||||
has_tick = b[8] >> 7;
|
||||
int tick = b[8] & 0x7f;
|
||||
int has_tick = b[8] >> 7;
|
||||
|
||||
// Sensor begins with has_tick = 1, and tick = 0. It sends data every 4.5s
|
||||
// and increments tick. Value tick >= 30 is never send, sensor instead
|
||||
// drops flag has_tick, and sets tick = 0 for rest of measurement session.
|
||||
// Tick counter is reset by several minutes of inactivity (vehicle stopped).
|
||||
if (b[8] && (!has_tick || tick > 30)) {
|
||||
return 0;
|
||||
return DECODE_FAIL_SANITY;
|
||||
}
|
||||
|
||||
flags = b[3];
|
||||
int flags = b[3];
|
||||
// observed always 0xc0 - FIXME: find possible combinations and reject message with impossible combination
|
||||
// to avoid confusion with other FSK manchester 9-byte sensors with 8bit xor checksum.
|
||||
|
||||
char id_str[7];
|
||||
sprintf(id_str, "%02x%02x%02x", b[0], b[1], b[2]);
|
||||
|
||||
char flags_str[3];
|
||||
sprintf(flags_str, "%02x", flags);
|
||||
pressure_datorr = b[4];
|
||||
pressure_kpa = pressure_datorr / 0.75;
|
||||
temp_c = (int)b[5] - 50;
|
||||
rad_acc = (int)b[6] * 5;
|
||||
|
||||
int pressure_raw = b[4];
|
||||
double pressure_kpa = pressure_raw / 0.75;
|
||||
int temp_c = (int)b[5] - 50;
|
||||
int rad_acc = (int)b[6] * 5;
|
||||
|
||||
/* clang-format off */
|
||||
data = data_make(
|
||||
data_t *data = data_make(
|
||||
"model", "", DATA_STRING, "Renault-0435R",
|
||||
"type", "", DATA_STRING, "TPMS",
|
||||
"id", "", DATA_STRING, id_str,
|
||||
@@ -141,15 +138,13 @@ static int tpms_renault_0435r_callback(r_device *decoder, bitbuffer_t *bitbuffer
|
||||
// full preamble is 55 55 55 56 (inverted: aa aa aa a9)
|
||||
uint8_t const preamble_pattern[2] = {0xaa, 0xa9}; // 16 bits
|
||||
|
||||
int row;
|
||||
unsigned bitpos;
|
||||
int ret = 0;
|
||||
int events = 0;
|
||||
|
||||
bitbuffer_invert(bitbuffer);
|
||||
|
||||
for (row = 0; row < bitbuffer->num_rows; ++row) {
|
||||
bitpos = 0;
|
||||
for (int row = 0; row < bitbuffer->num_rows; ++row) {
|
||||
unsigned bitpos = 0;
|
||||
// Find a preamble with enough bits after it that it could be a complete packet
|
||||
while ((bitpos = bitbuffer_search(bitbuffer, row, bitpos,
|
||||
preamble_pattern, 16)) +
|
||||
@@ -186,6 +181,5 @@ r_device tpms_renault_0435r = {
|
||||
.long_width = 52, // FSK
|
||||
.reset_limit = 150, // Maximum gap size before End Of Message [us].
|
||||
.decode_fn = &tpms_renault_0435r_callback,
|
||||
.disabled = 0,
|
||||
.fields = output_fields,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user