Skip to content

Commit

Permalink
Merge pull request #125 from NorthernMan54/Release-0.3.2
Browse files Browse the repository at this point in the history
Release 0.3.2
  • Loading branch information
NorthernMan54 authored Dec 17, 2023
2 parents 3fea1cf + d3e27a5 commit b357e61
Show file tree
Hide file tree
Showing 12 changed files with 1,817 additions and 69 deletions.
121 changes: 121 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
files: ^(.*\.(py|json|md|sh|yaml|txt|h|hpp|c|cpp)|setup.cfg)$
exclude:
(?x)^(
.cache/.*|
src/rtl_433/.*|
contrib/.*|
.*\.xml|
.*\.hex
)$
repos:
- repo: https://github.com/executablebooks/mdformat
# Do this before other tools "fixing" the line endings
rev: 0.7.17
hooks:
- id: mdformat
stages: [manual]
name: Format Markdown
entry: mdformat # Executable to run, with fixed options
language: python
types: [markdown]
args: [--wrap, '75', --number]
additional_dependencies:
- mdformat-toc
- mdformat-gfm
# - mdformat-beautysh
# - mdformat-shfmt
# - mdformat-tables
# - mdformat-config
# - mdformat-black
# - mdformat-web
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
# - id: no-commit-to-branch
# args: [--branch, main]
- id: debug-statements
- id: end-of-file-fixer
exclude_types: [markdown]
- id: trailing-whitespace
exclude_types: [markdown]
# - id: check-json
- id: mixed-line-ending
- id: check-builtin-literals
# - id: check-ast
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-docstring-first
- id: fix-byte-order-marker
- id: check-case-conflict
# - id: check-toml
#
- repo: https://github.com/lovesegfault/beautysh.git
rev: v6.2.1
hooks:
- id: beautysh
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
- id: codespell
exclude: ^((src/rtl_433/|signals/|example/).*)$
args:
- --toml
- pyproject.toml
- --ignore-words-list=mot
# - -w # Correct in-place
additional_dependencies:
- tomli
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
# - id: no-commit-to-branch
# args: [--branch, main]
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
# - id: check-json
- id: mixed-line-ending
- id: check-builtin-literals
# - id: check-ast
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-docstring-first
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-toml
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
# Install dependencies on windows:
# choco install llvm uncrustify cppcheck
hooks:
- id: clang-format
files: (?x)(^src/.*|include/rtl_433_devices.h|./include/log.h)
exclude: (?x)^(src/rtl_433/.*)$
args: [-i]
- id: cppcheck
files: (?x)(^src/.*|include/rtl_433_devices.h|./include/log.h)
exclude: (?x)^(src/rtl_433/.*)$
args:
- --check-config
- --force
#- --std=c99
#- --language=c
#- -IInc
- '--template={file}({line}): {severity} ({id}): {message}'
#exclude: (SevenSegment_defs.h|stm32[^/]*|sysmem\.*)$
- id: cpplint
files: (?x)(^src/.*|include/rtl_433_devices.h|./include/log.h)
exclude: (?x)^(src/rtl_433/.*)$
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"]
exclude: (example/.*)$
additional_dependencies:
- cpplint
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.5
hooks:
- id: shellcheck
files: ^[^\.].*\.sh$
args: [-x,-eSC2086,-eSC2045,-eSC2010,-eSC2027,-eSC2164,-eSC2013,-eSC2035,-eSC2006,-eSC2002,-eSC2196,-eSC2129]
50 changes: 37 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The initial port implements only enables a subset of the available modulations a

### OOK

```
```plaintext
OOK_MC_ZEROBIT
OOK_PULSE_DMC
OOK_PULSE_MANCHESTER_ZEROBIT
Expand All @@ -29,7 +29,7 @@ OOK_PULSE_RZ

### FSK

```
```plaintext
FSK_PULSE_MANCHESTER_ZEROBIT
FSK_PULSE_PCM
FSK_PULSE_PWM
Expand All @@ -40,7 +40,7 @@ FSK_PULSE_PWM

### OOK Signal Device Decoders

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

### FSK Signal Device Decoders

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

For background see section 2.1.3.2. of SX127X Data sheet

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.
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.

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.

# Compile definition options

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

## RF Module Wiring

```plaintext
ONBOARD_LED ; GPIO pin to toggle during signal reception ( Typically onboard LED )
```

### SX1276 Module Options

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

### SX1276 Module Wiring ( Required if not using standard configuraton )
### SX1276 Module Wiring ( Required if not using standard configuration )

```plaintext
RF_MODULE_CS ; SX1276 SPI Chip select
RF_MODULE_DIO0 ; SX1276 DIO0 PIN
RF_MODULE_RST ; SX1276 RST PIN
RF_MODULE_DIO1 ; SX1276 DIO1 PIN
```

### SX1278 Module Options

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

### SX1278 Module Wiring ( Required if not using standard configuraton )
### SX1278 Module Wiring ( Required if not using standard configuration )

```plaintext
RF_MODULE_CS ; SX1278 SPI Chip select
RF_MODULE_DIO0 ; SX1278 DIO0 PIN
RF_MODULE_RST ; SX1278 RST PIN
RF_MODULE_DIO1 ; SX1278 DIO1 PIN
```

### CC1101 Module Options

```plaintext
RF_CC1101 ; Enable support for CC1101 Transceiver
NO_DEAF_WORKAROUND ; Workaround for issue #16 ( by default the workaround is enabaled )
```

### CC1101 Module Wiring

```plaintext
RF_MODULE_CS ; CC1101 SPI Chip select
RF_MODULE_GDO0 ; CC1101 GDOO PIN
RF_MODULE_GDO2 ; CC1101 GDO2 PIN
```

## RF Module SPI Wiring ( Required if not using standard configuraton )
## RF Module SPI Wiring ( Required if not using standard configuration )

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

```plaintext
RF_MODULE_SCK ; SPI Clock
RF_MODULE_MISO ; SPI Serial Output
RF_MODULE_MOSI ; SPI Serial Input
RF_MODULE_CS ; SPI Chip select
```

## Porting approach

Copying src files

```plaintext
Copying rtl_433/src abuf.c to src/rtl_433
Copying rtl_433/src bitbuffer.c to src/rtl_433
Copying rtl_433/src compat_time.c to src/rtl_433
Expand All @@ -414,15 +431,19 @@ Copying rtl_433/src output_log.c to src/rtl_433
Copying rtl_433/src pulse_data.c to src/rtl_433
Copying rtl_433/src r_util.c to src/rtl_433
Copying rtl_433/src util.c to src/rtl_433
```

These src files need copying and updating

```shell
cp ../rtl_433/src/pulse_analyzer.c ../src/rtl_433
cp ../rtl_433/src/pulse_slicer.c ../src/rtl_433
cp ../rtl_433/src/r_api.c ../src/rtl_433
```

Copying include files

```plaintext
Copying rtl_433/include abuf.h to include
Copying rtl_433/include bitbuffer.h to include
Copying rtl_433/include compat_time.h to include
Expand All @@ -441,19 +462,22 @@ Copying rtl_433/include r_device.h to include
Copying rtl_433/include r_util.h to include
Copying rtl_433/include rfraw.h to include
Copying rtl_433/include util.h to include
```

These include files need copying and updating

```shell
cp ../rtl_433/include/data.h ../include
cp ../rtl_433/include/pulse_data.h ../include
cp ../rtl_433/include/r_private.h ../include
cp ../rtl_433/include/rtl_433.h ../include
```

## Codebase conflicts

* ESPiLight and rtl_433 conflict on silvercrest

```
```plaintext
.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)
```

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

Febuary 2023
February 2023
* [OpenMQTTGateway Connects Many Things to Your Home Automation](https://www.youtube.com/watch?v=_gdXR1uklaY)
2 changes: 1 addition & 1 deletion include/rtl_433.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ typedef struct r_cfg {
int bufferSize; // size of message buffer for message callback
/**
* callback to controlling program to be executed when a message is received.
* Object point passsed is a pointer to a JSON formatted message for
* Object point passed is a pointer to a JSON formatted message for
* publishing.
*/
void (*callback)(char *message);
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "git",
"url": "https://github.com/NorthernMan54/rtl_433_ESP.git"
},
"version": "0.3.1",
"version": "0.3.2",
"license": "GPL-3.0",
"frameworks": "arduino",
"platforms": [
Expand Down
18 changes: 18 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[build-system]
requires = ["setuptools>=61.2"]
build-backend = "setuptools.build_meta"

[project]
dynamic = ["version"]

[tool.codespell]
ignore-words-list = """
stdio,master,ws,hsa,proove
"""
skip = """./.*,3rdparty,*/.metadata,*.xml,*.qrc"""
quiet-level=2
ignore-regex = '\\[fnrstv]'
builtin = "clear,rare,informal,usage,code,names"

[tool.setuptools]
include-package-data = false
8 changes: 5 additions & 3 deletions src/rtl_433/r_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,10 +798,12 @@ void data_acquired_handler(r_device* r_dev, data_t* data) {
else if ((d->type == DATA_DOUBLE) &&
(str_endswith(d->key, "_in") || str_endswith(d->key, "_inch"))) {
d->value.v_dbl = inch2mm(d->value.v_dbl);
char* new_label =
str_replace(str_replace(d->key, "_inch", "_in"), "_in", "_mm");
// need to free ptr returned from str_replace
char* new_label1 = str_replace(d->key, "_inch", "_in");
char* new_label2 = str_replace(new_label1, "_in", "_mm");
free(new_label1);
free(d->key);
d->key = new_label;
d->key = new_label2;
char* new_format_label = str_replace(d->format, "in", "mm");
free(d->format);
d->format = new_format_label;
Expand Down
Loading

0 comments on commit b357e61

Please sign in to comment.