Skip to content

Commit b357e61

Browse files
Merge pull request #125 from NorthernMan54/Release-0.3.2
Release 0.3.2
2 parents 3fea1cf + d3e27a5 commit b357e61

12 files changed

+1817
-69
lines changed

.pre-commit-config.yaml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
files: ^(.*\.(py|json|md|sh|yaml|txt|h|hpp|c|cpp)|setup.cfg)$
3+
exclude:
4+
(?x)^(
5+
.cache/.*|
6+
src/rtl_433/.*|
7+
contrib/.*|
8+
.*\.xml|
9+
.*\.hex
10+
)$
11+
repos:
12+
- repo: https://github.com/executablebooks/mdformat
13+
# Do this before other tools "fixing" the line endings
14+
rev: 0.7.17
15+
hooks:
16+
- id: mdformat
17+
stages: [manual]
18+
name: Format Markdown
19+
entry: mdformat # Executable to run, with fixed options
20+
language: python
21+
types: [markdown]
22+
args: [--wrap, '75', --number]
23+
additional_dependencies:
24+
- mdformat-toc
25+
- mdformat-gfm
26+
# - mdformat-beautysh
27+
# - mdformat-shfmt
28+
# - mdformat-tables
29+
# - mdformat-config
30+
# - mdformat-black
31+
# - mdformat-web
32+
- repo: https://github.com/pre-commit/pre-commit-hooks
33+
rev: v4.4.0
34+
hooks:
35+
# - id: no-commit-to-branch
36+
# args: [--branch, main]
37+
- id: debug-statements
38+
- id: end-of-file-fixer
39+
exclude_types: [markdown]
40+
- id: trailing-whitespace
41+
exclude_types: [markdown]
42+
# - id: check-json
43+
- id: mixed-line-ending
44+
- id: check-builtin-literals
45+
# - id: check-ast
46+
- id: check-merge-conflict
47+
- id: check-executables-have-shebangs
48+
- id: check-shebang-scripts-are-executable
49+
- id: check-docstring-first
50+
- id: fix-byte-order-marker
51+
- id: check-case-conflict
52+
# - id: check-toml
53+
#
54+
- repo: https://github.com/lovesegfault/beautysh.git
55+
rev: v6.2.1
56+
hooks:
57+
- id: beautysh
58+
- repo: https://github.com/codespell-project/codespell
59+
rev: v2.2.5
60+
hooks:
61+
- id: codespell
62+
exclude: ^((src/rtl_433/|signals/|example/).*)$
63+
args:
64+
- --toml
65+
- pyproject.toml
66+
- --ignore-words-list=mot
67+
# - -w # Correct in-place
68+
additional_dependencies:
69+
- tomli
70+
- repo: https://github.com/pre-commit/pre-commit-hooks
71+
rev: v4.4.0
72+
hooks:
73+
# - id: no-commit-to-branch
74+
# args: [--branch, main]
75+
- id: debug-statements
76+
- id: end-of-file-fixer
77+
- id: trailing-whitespace
78+
# - id: check-json
79+
- id: mixed-line-ending
80+
- id: check-builtin-literals
81+
# - id: check-ast
82+
- id: check-merge-conflict
83+
- id: check-executables-have-shebangs
84+
- id: check-shebang-scripts-are-executable
85+
- id: check-docstring-first
86+
- id: fix-byte-order-marker
87+
- id: check-case-conflict
88+
- id: check-toml
89+
- repo: https://github.com/pocc/pre-commit-hooks
90+
rev: v1.3.5
91+
# Install dependencies on windows:
92+
# choco install llvm uncrustify cppcheck
93+
hooks:
94+
- id: clang-format
95+
files: (?x)(^src/.*|include/rtl_433_devices.h|./include/log.h)
96+
exclude: (?x)^(src/rtl_433/.*)$
97+
args: [-i]
98+
- id: cppcheck
99+
files: (?x)(^src/.*|include/rtl_433_devices.h|./include/log.h)
100+
exclude: (?x)^(src/rtl_433/.*)$
101+
args:
102+
- --check-config
103+
- --force
104+
#- --std=c99
105+
#- --language=c
106+
#- -IInc
107+
- '--template={file}({line}): {severity} ({id}): {message}'
108+
#exclude: (SevenSegment_defs.h|stm32[^/]*|sysmem\.*)$
109+
- id: cpplint
110+
files: (?x)(^src/.*|include/rtl_433_devices.h|./include/log.h)
111+
exclude: (?x)^(src/rtl_433/.*)$
112+
args: ["--filter=-build/header_guard,-whitespace/comma,-whitespace/indent,-whitespace/comments,-whitespace/line_length,-whitespace/braces,-whitespace/newline,-whitespace/blank_line,-whitespace/todo,-build/include_subdir,-readability/braces,-readability/fn_size,-readability/todo,-legal/copyright"]
113+
exclude: (example/.*)$
114+
additional_dependencies:
115+
- cpplint
116+
- repo: https://github.com/shellcheck-py/shellcheck-py
117+
rev: v0.9.0.5
118+
hooks:
119+
- id: shellcheck
120+
files: ^[^\.].*\.sh$
121+
args: [-x,-eSC2086,-eSC2045,-eSC2010,-eSC2027,-eSC2164,-eSC2013,-eSC2035,-eSC2006,-eSC2002,-eSC2196,-eSC2129]

README.md

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The initial port implements only enables a subset of the available modulations a
1414

1515
### OOK
1616

17-
```
17+
```plaintext
1818
OOK_MC_ZEROBIT
1919
OOK_PULSE_DMC
2020
OOK_PULSE_MANCHESTER_ZEROBIT
@@ -29,7 +29,7 @@ OOK_PULSE_RZ
2929

3030
### FSK
3131

32-
```
32+
```plaintext
3333
FSK_PULSE_MANCHESTER_ZEROBIT
3434
FSK_PULSE_PCM
3535
FSK_PULSE_PWM
@@ -40,7 +40,7 @@ FSK_PULSE_PWM
4040

4141
### OOK Signal Device Decoders
4242

43-
```
43+
```plaintext
4444
Registering protocol [0] "Amazon Basics Meat Thermometer"
4545
Registering protocol [1] "Acurite 896 Rain Gauge"
4646
Registering protocol [2] "Acurite 609TXC Temperature and Humidity Sensor"
@@ -182,7 +182,7 @@ The gaps in the numbers are device decoders disabled by default.
182182

183183
### FSK Signal Device Decoders
184184

185-
```
185+
```plaintext
186186
Registering protocol [0] "Ambient Weather WH31E Thermo-Hygrometer Sensor, EcoWitt WH40 rain gauge"
187187
Registering protocol [2] "TBH weather sensor"
188188
Registering protocol [3] "Badger ORION water meter, 100kbps (-f 916.45M -s 1200k)"
@@ -322,13 +322,13 @@ The RSSI Threshold for signal detection is automatically determined based on the
322322

323323
For background see section 2.1.3.2. of SX127X Data sheet
324324

325-
To tune the SX127X OOK RSSI FIXED Threshold two values are used to determine if the threhold needs to be increased or decreased. The first is the noise recevied between signals. If the number of noise bits received between signals is greater than 100, then the threshold is incremented. Second is the unparsed signals. If an unparsed signal is received, but it has less than 20 pulses, the threhold is decremented.
325+
To tune the SX127X OOK RSSI FIXED Threshold two values are used to determine if the threshold needs to be increased or decreased. The first is the noise received between signals. If the number of noise bits received between signals is greater than 100, then the threshold is incremented. Second is the unparsed signals. If an unparsed signal is received, but it has less than 20 pulses, the threshold is decremented.
326326

327327
The first approach is what is recommended in the SX127X datasheet, and the second is a control to lower the threshold if it is too high and incomplete signals are received.
328328

329329
# Compile definition options
330330

331-
```
331+
```plaintext
332332
DEMOD_DEBUG ; enable verbose debugging of signal processing
333333
DEVICE_DEBUG ; Validate fields are mapped to response object ( rtl_433 )
334334
MEMORY_DEBUG ; display heap usage information
@@ -351,58 +351,75 @@ OOK_MODULATION ; Enable OOK Device Decoders, setting to false enables FSK
351351

352352
## RF Module Wiring
353353

354+
```plaintext
354355
ONBOARD_LED ; GPIO pin to toggle during signal reception ( Typically onboard LED )
356+
```
355357

356358
### SX1276 Module Options
357359

360+
```plaintext
358361
RF_SX1276 ; Enable support for SX1276 Transceiver
359-
OOK_FIXED_THRESHOLD ; Inital OOK threshold ( See 2.1.3.2. of datasheet ), defaults to 90
362+
OOK_FIXED_THRESHOLD ; Initial OOK threshold ( See 2.1.3.2. of datasheet ), defaults to 90
360363
AUTOOOKFIX ; Set to enable automatic setting of OOK_FIXED_THRESHOLD based on noise level between signals
364+
```
361365

362-
### SX1276 Module Wiring ( Required if not using standard configuraton )
366+
### SX1276 Module Wiring ( Required if not using standard configuration )
363367

368+
```plaintext
364369
RF_MODULE_CS ; SX1276 SPI Chip select
365370
RF_MODULE_DIO0 ; SX1276 DIO0 PIN
366371
RF_MODULE_RST ; SX1276 RST PIN
367372
RF_MODULE_DIO1 ; SX1276 DIO1 PIN
373+
```
368374

369375
### SX1278 Module Options
370376

377+
```plaintext
371378
RF_SX1278 - Enable support for SX1276
372-
OOK_FIXED_THRESHOLD ; Inital OOK threshold ( See 2.1.3.2. of datasheet ), defaults to 90
379+
OOK_FIXED_THRESHOLD ; Initial OOK threshold ( See 2.1.3.2. of datasheet ), defaults to 90
373380
AUTOOOKFIX ; Set to enable automatic setting of OOK_FIXED_THRESHOLD based on noise level between signals
381+
```
374382

375-
### SX1278 Module Wiring ( Required if not using standard configuraton )
383+
### SX1278 Module Wiring ( Required if not using standard configuration )
376384

385+
```plaintext
377386
RF_MODULE_CS ; SX1278 SPI Chip select
378387
RF_MODULE_DIO0 ; SX1278 DIO0 PIN
379388
RF_MODULE_RST ; SX1278 RST PIN
380389
RF_MODULE_DIO1 ; SX1278 DIO1 PIN
390+
```
381391

382392
### CC1101 Module Options
383393

394+
```plaintext
384395
RF_CC1101 ; Enable support for CC1101 Transceiver
385396
NO_DEAF_WORKAROUND ; Workaround for issue #16 ( by default the workaround is enabaled )
397+
```
386398

387399
### CC1101 Module Wiring
388400

401+
```plaintext
389402
RF_MODULE_CS ; CC1101 SPI Chip select
390403
RF_MODULE_GDO0 ; CC1101 GDOO PIN
391404
RF_MODULE_GDO2 ; CC1101 GDO2 PIN
405+
```
392406

393-
## RF Module SPI Wiring ( Required if not using standard configuraton )
407+
## RF Module SPI Wiring ( Required if not using standard configuration )
394408

395409
When using a non standard SPI configuration ( Standard config is SCK - 18, MISO - 19, MOSI - 23, CS - 5)
396410

411+
```plaintext
397412
RF_MODULE_SCK ; SPI Clock
398413
RF_MODULE_MISO ; SPI Serial Output
399414
RF_MODULE_MOSI ; SPI Serial Input
400415
RF_MODULE_CS ; SPI Chip select
416+
```
401417

402418
## Porting approach
403419

404420
Copying src files
405421

422+
```plaintext
406423
Copying rtl_433/src abuf.c to src/rtl_433
407424
Copying rtl_433/src bitbuffer.c to src/rtl_433
408425
Copying rtl_433/src compat_time.c to src/rtl_433
@@ -414,15 +431,19 @@ Copying rtl_433/src output_log.c to src/rtl_433
414431
Copying rtl_433/src pulse_data.c to src/rtl_433
415432
Copying rtl_433/src r_util.c to src/rtl_433
416433
Copying rtl_433/src util.c to src/rtl_433
434+
```
417435

418436
These src files need copying and updating
419437

438+
```shell
420439
cp ../rtl_433/src/pulse_analyzer.c ../src/rtl_433
421440
cp ../rtl_433/src/pulse_slicer.c ../src/rtl_433
422441
cp ../rtl_433/src/r_api.c ../src/rtl_433
442+
```
423443

424444
Copying include files
425445

446+
```plaintext
426447
Copying rtl_433/include abuf.h to include
427448
Copying rtl_433/include bitbuffer.h to include
428449
Copying rtl_433/include compat_time.h to include
@@ -441,19 +462,22 @@ Copying rtl_433/include r_device.h to include
441462
Copying rtl_433/include r_util.h to include
442463
Copying rtl_433/include rfraw.h to include
443464
Copying rtl_433/include util.h to include
465+
```
444466

445467
These include files need copying and updating
446468

469+
```shell
447470
cp ../rtl_433/include/data.h ../include
448471
cp ../rtl_433/include/pulse_data.h ../include
449472
cp ../rtl_433/include/r_private.h ../include
450473
cp ../rtl_433/include/rtl_433.h ../include
474+
```
451475

452476
## Codebase conflicts
453477

454478
* ESPiLight and rtl_433 conflict on silvercrest
455479

456-
```
480+
```plaintext
457481
.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: Warning: size of symbol `silvercrest' changed from 4 in .pio/build/rtl_433-9e0770/libb28/libESPiLight.a(protocol.c.o) to 76 in .pio/build/rtl_433-9e0770/lib395/librtl_433_ESP.a(silvercrest.c.o)
458482
```
459483

@@ -477,5 +501,5 @@ January 2023
477501
* [RTL 433 ON ESP32 DEVICE - MQTT HOME ASSISTANT](https://youtube.com/watch?v=H-JXWbWjJYE&feature=shares)
478502
* [Using low-cost wireless sensors in the unlicensed bands](https://lwn.net/Articles/921497/)
479503

480-
Febuary 2023
504+
February 2023
481505
* [OpenMQTTGateway Connects Many Things to Your Home Automation](https://www.youtube.com/watch?v=_gdXR1uklaY)

include/rtl_433.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ typedef struct r_cfg {
140140
int bufferSize; // size of message buffer for message callback
141141
/**
142142
* callback to controlling program to be executed when a message is received.
143-
* Object point passsed is a pointer to a JSON formatted message for
143+
* Object point passed is a pointer to a JSON formatted message for
144144
* publishing.
145145
*/
146146
void (*callback)(char *message);

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": "git",
77
"url": "https://github.com/NorthernMan54/rtl_433_ESP.git"
88
},
9-
"version": "0.3.1",
9+
"version": "0.3.2",
1010
"license": "GPL-3.0",
1111
"frameworks": "arduino",
1212
"platforms": [

pyproject.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[build-system]
2+
requires = ["setuptools>=61.2"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
dynamic = ["version"]
7+
8+
[tool.codespell]
9+
ignore-words-list = """
10+
stdio,master,ws,hsa,proove
11+
"""
12+
skip = """./.*,3rdparty,*/.metadata,*.xml,*.qrc"""
13+
quiet-level=2
14+
ignore-regex = '\\[fnrstv]'
15+
builtin = "clear,rare,informal,usage,code,names"
16+
17+
[tool.setuptools]
18+
include-package-data = false

src/rtl_433/r_api.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -798,10 +798,12 @@ void data_acquired_handler(r_device* r_dev, data_t* data) {
798798
else if ((d->type == DATA_DOUBLE) &&
799799
(str_endswith(d->key, "_in") || str_endswith(d->key, "_inch"))) {
800800
d->value.v_dbl = inch2mm(d->value.v_dbl);
801-
char* new_label =
802-
str_replace(str_replace(d->key, "_inch", "_in"), "_in", "_mm");
801+
// need to free ptr returned from str_replace
802+
char* new_label1 = str_replace(d->key, "_inch", "_in");
803+
char* new_label2 = str_replace(new_label1, "_in", "_mm");
804+
free(new_label1);
803805
free(d->key);
804-
d->key = new_label;
806+
d->key = new_label2;
805807
char* new_format_label = str_replace(d->format, "in", "mm");
806808
free(d->format);
807809
d->format = new_format_label;

0 commit comments

Comments
 (0)