Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added PTSPDP Doorbell support (conf and device) #2723

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions conf/ptspdp-doorbell.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# PTSPDP doorbell
#
# This decoder reads button presses from a PTSPDP doorbell.
# https://www.amazon.com/gp/product/B0BD6XTVGL/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
#
# Analyzed by @karlg100

decoder {
name = PTSPDP Doorbell,
modulation = OOK_PWM,
short = 208,
long = 596,
reset = 6068,
gap = 1000,
tolerance = 0,
sync = 908,

rows >= 10,
get = @0:{24}:id,
}
#unique,
#bits >= 24,

#-X 'n=Front Door,m=OOK_PPM,s=208,l=596,r=6068,g=1000,t=0,y=908,match={24}db929c,repeats>=10'
1 change: 1 addition & 0 deletions include/rtl_433_devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@
DECL(tpms_nissan) \
DECL(bresser_lightning) \
DECL(schou_72543_rain) \
DECL(ptspdp) \

/* Add new decoders here. */

Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ add_library(r_433 STATIC
devices/proflame2.c
devices/prologue.c
devices/proove.c
devices/ptspdp.c
devices/quhwa.c
devices/radiohead_ask.c
devices/rainpoint.c
Expand Down
71 changes: 71 additions & 0 deletions src/devices/ptspdp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/** @file
Generic doorbell implementation for PTSPDP devices.

Copyright (C) 2016 Fabian Zaremba <[email protected]>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

*/
/**
Generic doorbell implementation for PTSPDP devices.

Based on flex decoder

Check failure on line 15 in src/devices/ptspdp.c

View workflow job for this annotation

GitHub Actions / Check code style

TRAILING whitespace error
-X m=OOK_PPM,s=208,l=596,r=6068,g=1000,t=0,y=908,match={24}db929c,repeats>=10

*/

#include "decoder.h"

static int ptspdp_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
//printf("PTSPDP: called!\n");

Check failure on line 24 in src/devices/ptspdp.c

View workflow job for this annotation

GitHub Actions / Check code style

PRINTF line

//bitbuffer_debug(bitbuffer);

// 24 bits expected, 10 minimum packet repetitions
int row = bitbuffer_find_repeated_row(bitbuffer, 10, 24);

if (row < 0 || bitbuffer->bits_per_row[row] < 24) {
//printf("PTSPDP: abort, too short row: %d bits_per_row: %d\n", row, bitbuffer->bits_per_row[row]);

Check failure on line 32 in src/devices/ptspdp.c

View workflow job for this annotation

GitHub Actions / Check code style

PRINTF line
return DECODE_ABORT_LENGTH;
}

uint8_t *b = bitbuffer->bb[row];

// 24 bits, trailing bit is dropped
char id_str[3 * 2 + 1];
snprintf(id_str, sizeof(id_str), "%02x%02x%02x", b[0], b[1], b[2]);

/* clang-format off */
data_t *data = data_make(
"model", "", DATA_STRING, "PTSPDP",
"id", "ID", DATA_STRING, id_str,
NULL);
/* clang-format on */

decoder_output_data(decoder, data);
return 1;
}

static char const *const output_fields[] = {
"model",
"id",
NULL,
};

r_device const ptspdp = {
.name = "PTSPDP Doorbell",
.modulation = OOK_PULSE_PPM,
.short_width = 208,
.long_width = 596,
.gap_limit = 1000,
.reset_limit = 6068,
.sync_width = 908,
.tolerance = 0,
.decode_fn = &ptspdp_callback,
.disabled = 0,
.fields = output_fields,
};
Loading