Docs and code: translate Polish comments, messages and documentation to English
check / check-without-hardware (push) Successful in 6m45s

- README, CHANGELOG, RELEASE_NOTES, THIRD_PARTY_NOTICES and docs/*.md
  translated to English; cross-markdown anchors updated
- C/C++/Python/shell comments and user-facing messages translated
- identifiers, protocol names, commands and literals unchanged
- native tests re-verified: 24/24 PASS; tpms_frame.py self-test PASS
This commit is contained in:
czcionka committed 2026-10-30 18:01:32 +00:00
1 parent 1563e34d05
commit e183d23950
42 files changed
+1106 -1019

No files matched your search

+29 -27
View File
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
"""Niezalezny model ramki EG53MA4 i testy pomocnicze (OOK/Manchester).
"""Independent EG53MA4 frame model and auxiliary tests (OOK/Manchester).
Referencje: rtl_433 commit 406f9a33550a2b6b3d0d8a8a486417ce5b3f13ab,
References: rtl_433 commit 406f9a33550a2b6b3d0d8a8a486417ce5b3f13ab,
rtl_433_tests commit 1aa8c29d6b9383739d1aeed495dbc5069b704392.
Narzedzie generuje sztuczne dane wylacznie do diagnostyki.
The tool generates synthetic data for diagnostics only.
"""
import argparse
import math
@@ -14,19 +14,19 @@ SYNC_BITS = 40
TX_BYTES = 30
DEFAULT_FLAGS = 0x4C900070
# Kalibracja pola P (patrz docs/AUDIT.md): tyle setnych kPa przypada na jeden
# bit bajtu P. Skala rtl_433 (250 = 2,5 kPa/bit) nie jest potwierdzona
# nagraniami (wszystkie maja P=0), a pomiar z auta: 260 kPa -> 284 kPa na
# wyswietlaczu przy P=104 => korekta skalujaca 2,73 kPa/bit (P=95 dla 260).
# Potwierdzone z autem: 260 kPa -> 260 kPa - zmienic tez
# TPMS_PRESSURE_KPA100_PER_RAW w src/tpms_frame.h.
# Calibration of the P field (see docs/AUDIT.md): how many hundredths of a kPa
# one bit of the P byte represents. The rtl_433 scale (250 = 2.5 kPa/bit) is not
# confirmed by the captures (all have P=0), while a car measurement showed
# 260 kPa -> 284 kPa on the display at P=104 => a scaling correction of
# 2.73 kPa/bit (P=95 for 260). Confirmed with the car: 260 kPa -> 260 kPa -
# also change TPMS_PRESSURE_KPA100_PER_RAW in src/tpms_frame.h.
PRESSURE_KPA100_PER_RAW = 273
def press_raw(pressure_kpa: float) -> int:
kpa10 = int(math.floor(pressure_kpa * 10.0 + 0.5))
if not 0 <= kpa10 <= 6375:
raise ValueError("cisnienie musi byc w zakresie 0..637.5 kPa")
raise ValueError("pressure must be in the range 0..637.5 kPa")
return (kpa10 * 10 + PRESSURE_KPA100_PER_RAW // 2) // PRESSURE_KPA100_PER_RAW
@@ -41,20 +41,21 @@ def cell(bit: int) -> str:
def build_row(sensor_id: int, pressure_kpa: float, temp_c: float,
flags: int = DEFAULT_FLAGS) -> str:
if not valid_id(sensor_id):
raise ValueError("ID musi byc w zakresie 000001..FFFFFE")
raise ValueError("ID must be in the range 000001..FFFFFE")
if not 0 <= flags <= 0xFFFFFFFF:
raise ValueError("flags musza miec 32 bity")
raise ValueError("flags must be 32-bit")
kpa10 = int(math.floor(pressure_kpa * 10.0 + 0.5))
if not 0 <= kpa10 <= 6375:
raise ValueError("cisnienie musi byc w zakresie 0..637.5 kPa")
raise ValueError("pressure must be in the range 0..637.5 kPa")
press_byte = press_raw(pressure_kpa)
tc = int(math.floor(temp_c + 0.5))
if not -40 <= tc <= 85:
raise ValueError("temperatura musi byc w zakresie -40..85 C")
raise ValueError("temperature must be in the range -40..85 C")
num = 9 * tc + 160
temp_f = (num + 2) // 5 if num >= 0 else -((-num + 2) // 5)
# Saturacja zgodna z tpms_frame.cpp: bez niej temperatura <= -19 C daje
# ujemny bajt i psuje ramke (roznica miedzy modelem Pythona a firmware).
# Saturation consistent with tpms_frame.cpp: without it a temperature
# <= -19 C produces a negative byte and corrupts the frame (difference
# between the Python model and the firmware).
temp_f = max(0, min(255, temp_f))
payload = [flags >> 24, (flags >> 16) & 255, (flags >> 8) & 255,
flags & 255, sensor_id >> 16, (sensor_id >> 8) & 255,
@@ -65,14 +66,14 @@ def build_row(sensor_id: int, pressure_kpa: float, temp_c: float,
def build_tx_bits(row: str) -> str:
if len(row) != FRAME_BITS:
raise ValueError("ramka musi miec 120 bitow")
raise ValueError("frame must have 120 bits")
bits = "1" + "".join(cell(int(bit)) for bit in row[1:])
return bits.ljust(TX_BYTES * 8, "0")
def tx_bytes(bits: str) -> bytes:
if len(bits) != TX_BYTES * 8:
raise ValueError("bufor nadawczy musi miec 30 bajtow")
raise ValueError("TX buffer must have 30 bytes")
return bytes(int(bits[i:i + 8], 2) for i in range(0, len(bits), 8))
@@ -83,9 +84,9 @@ def decode_row(row: str):
for i in range(10)]
return {"flags": int.from_bytes(bytes(data[:4]), "big"),
"id": int.from_bytes(bytes(data[4:7]), "big"),
# 2,5 kPa/bit to skala dekodera rtl_433 (niepotwierdzona); firmware
# koryguje ja stala PRESSURE_KPA100_PER_RAW, wiec wartosc ponizej
# != cisnieniu zadanemu w konsoli.
# 2.5 kPa/bit is the rtl_433 decoder scale (unconfirmed); the
# firmware corrects it with the PRESSURE_KPA100_PER_RAW constant,
# so the value below != the pressure set in the console.
"pressure_kPa": data[7] * 2.5, "temperature_F": data[8],
"checksum_ok": sum(data[:9]) & 255 == data[9], "bytes": data}
@@ -95,19 +96,20 @@ def self_test() -> int:
row = build_row(0x2FC871, 0, 32)
got = decode_row(row)["bytes"]
if got != expected:
print(f"FAIL: nagranie gfile001: {got} != {expected}")
print(f"FAIL: capture gfile001: {got} != {expected}")
return 1
# Regresja: saturacja temperatury zgodna z firmware (zakres -40..85 C).
# Regression: temperature saturation consistent with the firmware
# (range -40..85 C).
for tc, want in ((-40, 0), (-19, 0), (-18, 0), (23, 73), (85, 185)):
byte = decode_row(build_row(0x2FC871, 0, tc))["bytes"][8]
if byte != want:
print(f"FAIL: temperatura {tc} C: {byte} != {want}")
print(f"FAIL: temperature {tc} C: {byte} != {want}")
return 1
# Regresja kalibracji pola P (punkt pomiarowy z auta: 260 kPa -> P=95).
# Regression of the P field calibration (car measurement point: 260 kPa -> P=95).
for kpa, want in ((0, 0), (1.2, 0), (1.4, 1), (260.0, 95), (637.5, 234)):
byte = press_raw(kpa)
if byte != want:
print(f"FAIL: cisnienie {kpa} kPa: {byte} != {want}")
print(f"FAIL: pressure {kpa} kPa: {byte} != {want}")
return 1
import random
rng = random.Random(42)
@@ -119,7 +121,7 @@ def self_test() -> int:
if not decoded["checksum_ok"] or decoded["id"] != sensor_id:
print("FAIL: round trip")
return 1
print("self-test: OK (nagranie + 500 ramek)")
print("self-test: OK (capture + 500 frames)")
return 0