Docs and code: translate Polish comments, messages and documentation to English
check / check-without-hardware (push) Successful in 6m45s
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:
1 parent
1563e34d05
commit
e183d23950
42 files changed
+1106
-1019
No files matched your search
+2
-2
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wszystkie testy mozliwe bez ESP32/CC1101/RTL-SDR/samochodu.
|
||||
# All tests possible without ESP32/CC1101/RTL-SDR/car.
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
@@ -37,4 +37,4 @@ if [ ! -x "${RTL433:-$ROOT/.cache/rtl_433/build/src/rtl_433}" ] \
|
||||
fi
|
||||
run rtl433 bash ./tools/verify_rtl433.sh
|
||||
|
||||
echo "PASS: wszystkie testy bez sprzetu zakonczone sukcesem"
|
||||
echo "PASS: all hardware-free tests completed successfully"
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pobiera i buduje dokladnie przypiete, niezalezne referencje RF.
|
||||
# Fetches and builds the exactly pinned, independent RF references.
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
DEPS="${DEPS_DIR:-$ROOT/.cache}"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wgrywa pelny obraz release; PORT=np. /dev/ttyACM0. Kasuje flash ESP32-S2.
|
||||
# Flashes the full release image; PORT=e.g. /dev/ttyACM0. Erases the ESP32-S2 flash.
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PORT="${PORT:?Ustaw PORT=/dev/ttyACMX lub /dev/ttyUSBX}"
|
||||
PORT="${PORT:?Set PORT=/dev/ttyACMX or /dev/ttyUSBX}"
|
||||
ESPTOOL="${ESPTOOL:-${PLATFORMIO_CORE_DIR:-$HOME/.platformio}/packages/tool-esptool/esptool}"
|
||||
IMAGE="$ROOT/artifacts/release/firmware-full.bin"
|
||||
[ -f "$IMAGE" ] || { echo "Brak $IMAGE; uruchom tools/package_release.sh"; exit 1; }
|
||||
[ -f "$IMAGE" ] || { echo "Missing $IMAGE; run tools/package_release.sh"; exit 1; }
|
||||
"$ESPTOOL" --chip esp32s2 --port "$PORT" --baud 460800 write-flash 0x0 "$IMAGE"
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Synteza CU8 OOK/Manchester dla niezaleznego testu rtl_433 (bez RF)."""
|
||||
"""CU8 synthesis of OOK/Manchester for an independent rtl_433 test (no RF)."""
|
||||
import argparse
|
||||
import math
|
||||
import os
|
||||
@@ -18,7 +18,7 @@ def synth(bits: str, amp: float, noise: float, rng: random.Random):
|
||||
for n in range(int(round(len(bits) * samples_per_chip))):
|
||||
chip = bits[int(n / samples_per_chip) % len(bits)]
|
||||
amplitude = amp if chip == "1" else 0.0
|
||||
phase += 0.1 # dowolna nośna w pasmie IQ; demodulator uzywa amplitudy
|
||||
phase += 0.1 # any carrier inside the IQ band; the demodulator uses amplitude
|
||||
yield (amplitude * math.cos(phase) + rng.gauss(0, noise),
|
||||
amplitude * math.sin(phase) + rng.gauss(0, noise))
|
||||
|
||||
@@ -63,7 +63,7 @@ def main() -> int:
|
||||
output.extend(synth(bits, args.amp, args.noise, rng))
|
||||
output.extend(gap)
|
||||
write_cu8(args.out, output)
|
||||
print(f"{args.out}: {len(output) / SAMPLE_RATE:.3f} s, {args.frames} ramek")
|
||||
print(f"{args.out}: {len(output) / SAMPLE_RATE:.3f} s, {args.frames} frames")
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Buduje obrazy ESP32-S2 i pelny obraz 4 MB oraz manifest SHA-256.
|
||||
# Builds the ESP32-S2 images, the full 4 MB image and the SHA-256 manifest.
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
@@ -26,13 +26,13 @@ cp "$BOOT_APP0" "$OUT/boot_app0.bin"
|
||||
firmware-full.bin firmware.elf > SHA256SUMS
|
||||
)
|
||||
cat > "$OUT/BUILD-INFO.txt" <<'EOF'
|
||||
Wersja: 2.0.0-rc.1 (release candidate, bez HIL)
|
||||
Version: 2.0.0-rc.1 (release candidate, no HIL)
|
||||
PlatformIO: 6.1.18
|
||||
Platforma: espressif32 8.0.0, ESP32-S2-MINI ESP32-S2FN4R2 (lolin_s2_mini)
|
||||
Platform: espressif32 8.0.0, ESP32-S2-MINI ESP32-S2FN4R2 (lolin_s2_mini)
|
||||
CC1101: de6757ef633b3e626dae5c7835cdb66ab53f9a1d
|
||||
Adresy: 0x1000 bootloader, 0x8000 partitions, 0xe000 boot_app0, 0x10000 firmware
|
||||
Flash: dio, 80 MHz, 4 MB (zgodne z board manifest lolin_s2_mini)
|
||||
Pelny obraz firmware-full.bin: flash od 0x0.
|
||||
Addresses: 0x1000 bootloader, 0x8000 partitions, 0xe000 boot_app0, 0x10000 firmware
|
||||
Flash: dio, 80 MHz, 4 MB (consistent with the lolin_s2_mini board manifest)
|
||||
Full image firmware-full.bin: flash from 0x0.
|
||||
EOF
|
||||
cat "$OUT/BUILD-INFO.txt"
|
||||
cat "$OUT/SHA256SUMS"
|
||||
+29
-27
@@ -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
|
||||
|
||||
|
||||
|
||||
+12
-12
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Walidacja prawdziwych i syntetycznych CU8 przez przypiety rtl_433."""
|
||||
"""Validation of real and synthetic CU8 with the pinned rtl_433."""
|
||||
import argparse
|
||||
import json
|
||||
import pathlib
|
||||
@@ -50,7 +50,7 @@ def main() -> int:
|
||||
|
||||
for filename, (sensor_id, temp_f) in EXPECTED.items():
|
||||
capture = args.reference_dir / filename
|
||||
if not require(capture.is_file(), f"brak {capture}", failures):
|
||||
if not require(capture.is_file(), f"missing {capture}", failures):
|
||||
continue
|
||||
status, records, raw = decode(args.rtl433, capture)
|
||||
valid = status == 0 and len(records) == 16 and all(
|
||||
@@ -58,13 +58,13 @@ def main() -> int:
|
||||
and record.get("pressure_kPa") == 0.0
|
||||
and record.get("temperature_F") == temp_f
|
||||
and record.get("mic") == "CHECKSUM" for record in records)
|
||||
require(valid, f"{filename}: niezgodne rekordy\n{raw}", failures)
|
||||
print(f"{'OK' if valid else 'FAIL'} referencja {filename}: "
|
||||
require(valid, f"{filename}: mismatched records\n{raw}", failures)
|
||||
print(f"{'OK' if valid else 'FAIL'} reference {filename}: "
|
||||
f"{len(records)}/16, id={sensor_id}, flags=4c900070")
|
||||
|
||||
# rtl_433 liczy pole P skala 2,5 kPa/bit (niepotwierdzona); firmware
|
||||
# koryguje ja stala PRESSURE_KPA100_PER_RAW, wiec oczekiwana wartosc
|
||||
# z rtl_433 to surowy bajt P * 2.5, a nie zadane kPa.
|
||||
# rtl_433 computes the P field on a 2.5 kPa/bit scale (unconfirmed); the
|
||||
# firmware corrects it with the PRESSURE_KPA100_PER_RAW constant, so the
|
||||
# expected rtl_433 value is the raw P byte * 2.5, not the requested kPa.
|
||||
synthetic = [("2FC871", 260, 23, 73.0), ("3495AC", 220, -5, 23.0),
|
||||
("ABCDEE", 262.5, 24, 75.0)]
|
||||
with tempfile.TemporaryDirectory(prefix="tpms-rtl433-") as temp:
|
||||
@@ -82,8 +82,8 @@ def main() -> int:
|
||||
and record.get("temperature_F") == temp_f
|
||||
and record.get("flags") == "4c900070"
|
||||
and record.get("mic") == "CHECKSUM" for record in records)
|
||||
require(valid, f"syntetyczna {sensor_id}: {raw}", failures)
|
||||
print(f"{'OK' if valid else 'FAIL'} syntetyczna id={sensor_id}: "
|
||||
require(valid, f"synthetic {sensor_id}: {raw}", failures)
|
||||
print(f"{'OK' if valid else 'FAIL'} synthetic id={sensor_id}: "
|
||||
f"{len(records)} dekodowan, P={press_raw(pressure)} "
|
||||
f"(rtl_433: {expect_kpa:.1f} kPa z {pressure:.1f} kPa), "
|
||||
f"{temp_f:.1f} F")
|
||||
@@ -95,11 +95,11 @@ def main() -> int:
|
||||
check=True, capture_output=True)
|
||||
status, records, raw = decode(args.rtl433, capture)
|
||||
valid = status == 0 and not records
|
||||
require(valid, f"negatywny {corruption}: blednie zdekodowano\n{raw}", failures)
|
||||
print(f"{'OK' if valid else 'FAIL'} negatywny {corruption}: "
|
||||
require(valid, f"negative {corruption}: decoded incorrectly\n{raw}", failures)
|
||||
print(f"{'OK' if valid else 'FAIL'} negative {corruption}: "
|
||||
f"{len(records)} dekodowan (oczekiwano 0)")
|
||||
|
||||
print(f"WYNIK: {'PASS' if not failures else 'FAIL'}; bledow={len(failures)}")
|
||||
print(f"RESULT: {'PASS' if not failures else 'FAIL'}; errors={len(failures)}")
|
||||
for failure in failures:
|
||||
print(" - " + failure)
|
||||
return 1 if failures else 0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Zwraca niezerowy kod przy bledzie i zapisuje czytelny raport.
|
||||
# Returns a non-zero code on error and writes a readable report.
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
RTL433="${RTL433:-$ROOT/.cache/rtl_433/build/src/rtl_433}"
|
||||
|
||||
Reference in new issue
Block a user