Thermopro TP-11.
This commit is contained in:
parent
034d8b4b09
commit
591873205f
6 changed files with 105 additions and 1 deletions
1
AUTHORS
1
AUTHORS
|
@ -20,3 +20,4 @@ Andrea <andrea@andreaaizza.com>
|
|||
Helge Weissig <helgew@grajagan.org>
|
||||
Robert Fraczkiewicz <aromring@gmail.com>
|
||||
Nicola Quiriti <nik@wifi4all.it>
|
||||
Petr Konecny <pekon@google.com>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#define MINIMAL_BUF_LENGTH 512
|
||||
#define MAXIMAL_BUF_LENGTH (256 * 16384)
|
||||
#define MAX_PROTOCOLS 83
|
||||
#define MAX_PROTOCOLS 84
|
||||
#define SIGNAL_GRABBER_BUFFER (12 * DEFAULT_BUF_LENGTH)
|
||||
|
||||
/* Supported modulation types */
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
DECL(oregon_scientific_sl109h) \
|
||||
DECL(acurite_606) \
|
||||
DECL(tfa_pool_thermometer) \
|
||||
DECL(thermopro_tp11) \
|
||||
DECL(kedsum) \
|
||||
DECL(blyss) \
|
||||
DECL(steelmate) \
|
||||
|
|
|
@ -67,6 +67,7 @@ add_executable(rtl_433
|
|||
devices/steffen.c
|
||||
devices/tfa_twin_plus_30.3049.c
|
||||
devices/tfa_pool_thermometer.c
|
||||
devices/thermopro_tp11.c
|
||||
devices/valeo.c
|
||||
devices/waveman.c
|
||||
devices/wg_pb12v1.c
|
||||
|
|
|
@ -58,6 +58,7 @@ rtl_433_SOURCES = baseband.c \
|
|||
devices/steffen.c \
|
||||
devices/tfa_twin_plus_30.3049.c \
|
||||
devices/tfa_pool_thermometer.c \
|
||||
devices/thermopro_tp11.c \
|
||||
devices/valeo.c \
|
||||
devices/waveman.c \
|
||||
devices/wt450.c \
|
||||
|
|
100
src/devices/thermopro_tp11.c
Normal file
100
src/devices/thermopro_tp11.c
Normal file
|
@ -0,0 +1,100 @@
|
|||
/* Thermopro TP-11 Thermometer.
|
||||
*
|
||||
* Copyright (C) 2017 Google Inc.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
#include "data.h"
|
||||
#include "rtl_433.h"
|
||||
#include "util.h"
|
||||
|
||||
#define MODEL "Thermopro TP11 Thermometer"
|
||||
|
||||
/* normal sequence of bit rows:
|
||||
[00] {33} db 41 57 c2 80 : 11011011 01000001 01010111 11000010 1
|
||||
[01] {33} db 41 57 c2 80 : 11011011 01000001 01010111 11000010 1
|
||||
[02] {33} db 41 57 c2 80 : 11011011 01000001 01010111 11000010 1
|
||||
[03] {32} db 41 57 c2 : 11011011 01000001 01010111 11000010
|
||||
|
||||
The code below checks that at least three rows are the same and
|
||||
that the validation code is correct for the known device ids.
|
||||
*/
|
||||
|
||||
static int valid(unsigned data, unsigned check) {
|
||||
// This table is computed for device ids 0xb34 and 0xdb4. Since the code
|
||||
// appear to be linear, it is most likely correct also for device ids
|
||||
// 0 and 0xb34^0xdb4 == 0x680. It needs to be updated for others, the
|
||||
// values starting at table[12] are most likely wrong for other devices.
|
||||
static int table[] = {
|
||||
0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x51, 0xa2,
|
||||
0x15, 0x2a, 0x54, 0xa8, 0x00, 0x00, 0xed, 0x00,
|
||||
0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00};
|
||||
for(int i=0;i<24;i++) {
|
||||
if (data & (1 << i)) check ^= table[i];
|
||||
}
|
||||
return check == 0;
|
||||
}
|
||||
|
||||
static int thermopro_tp11_sensor_callback(bitbuffer_t *bitbuffer) {
|
||||
bitrow_t *bb = bitbuffer->bb;
|
||||
data_t *data;
|
||||
char time_str[LOCAL_TIME_BUFLEN];
|
||||
local_time_str(0, time_str);
|
||||
int good = -1;
|
||||
|
||||
for (int i = 0; good < 0 && i < 4; i++) {
|
||||
int equal_rows = 0;
|
||||
if (bitbuffer->bits_per_row[i] < 32
|
||||
|| bitbuffer->bits_per_row[i] > 33) continue;
|
||||
|
||||
for (int j = i+1; good < 0 && j < 4; j++) {
|
||||
if (bitbuffer->bits_per_row[j] < 32
|
||||
|| bitbuffer->bits_per_row[j] > 33) continue;
|
||||
if (bb[i][0] == bb[j][0]
|
||||
&& bb[i][1] == bb[j][1]
|
||||
&& bb[i][2] == bb[j][2]
|
||||
&& bb[i][3] == bb[j][3]
|
||||
&& ++equal_rows >= 2) good = i;
|
||||
}
|
||||
}
|
||||
if (good < 0) return 0;
|
||||
// bb[good] is equal to at least two other rows, decode.
|
||||
unsigned value = (bb[good][0] << 16) + (bb[good][1] << 8) + bb[good][2];
|
||||
unsigned device = value >> 12;
|
||||
// Validate code for known devices.
|
||||
if ((device == 0xb34 || device == 0xdb4 ) && !valid(value, bb[good][3]))
|
||||
return 0;
|
||||
int iTemp = value & 0xfff;
|
||||
float fTemp = (iTemp - 200) / 10.;
|
||||
|
||||
data = data_make("time", "", DATA_STRING, time_str,
|
||||
"model", "", DATA_STRING, MODEL,
|
||||
"id", "Id", DATA_FORMAT, "\t %d", DATA_INT, device,
|
||||
"temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, fTemp,
|
||||
NULL);
|
||||
data_acquired_handler(data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static char *output_fields[] = {
|
||||
"time",
|
||||
"model",
|
||||
"id",
|
||||
"temperature_C",
|
||||
NULL
|
||||
};
|
||||
|
||||
r_device thermopro_tp11 = {
|
||||
.name = MODEL,
|
||||
.modulation = OOK_PULSE_PPM_RAW,
|
||||
.short_limit = 956,
|
||||
.long_limit = 1912,
|
||||
.reset_limit = 3880,
|
||||
.json_callback = &thermopro_tp11_sensor_callback,
|
||||
.disabled = 0,
|
||||
.demod_arg = 0,
|
||||
.fields = output_fields,
|
||||
};
|
Loading…
Add table
Reference in a new issue