Skip to content

Commit

Permalink
Add support for another Fine Offset sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Larsson committed Aug 27, 2016
1 parent 4a9e658 commit 0fb4dec
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/rtl_433.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#define DEFAULT_LEVEL_LIMIT 8000 // Theoretical high level at I/Q saturation is 128x128 = 16384 (above is ripple)
#define MINIMAL_BUF_LENGTH 512
#define MAXIMAL_BUF_LENGTH (256 * 16384)
#define MAX_PROTOCOLS 62
#define MAX_PROTOCOLS 63
#define SIGNAL_GRABBER_BUFFER (12 * DEFAULT_BUF_LENGTH)

/* Supported modulation types */
Expand Down
3 changes: 2 additions & 1 deletion include/rtl_433_devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
DECL(elro_db286a) \
DECL(efergy_optical) \
DECL(hondaremote) \
DECL(template)
DECL(template) \
DECL(fineoffset_XC0400)


typedef struct {
Expand Down
30 changes: 28 additions & 2 deletions src/devices/fineoffset_wh1080.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,26 @@ static int get_day(const uint8_t* br) {
static int fineoffset_wh1080_callback(bitbuffer_t *bitbuffer) {
data_t *data;
char time_str[LOCAL_TIME_BUFLEN];
const uint8_t *br;
uint8_t bbuf[12];
local_time_str(0, time_str);

if (bitbuffer->num_rows != 1) {
return 0;
}
if (bitbuffer->bits_per_row[0] != 88) {
if ((bitbuffer->bits_per_row[0] != 88) && (bitbuffer->bits_per_row[0] != 87)) {
return 0;
}

const uint8_t *br = bitbuffer->bb[0];
if(bitbuffer->bits_per_row[0] == 88) {
br = bitbuffer->bb[0];
} else {
/* 7 bits of preamble, bit shift the whole buffer and fix the bytestream */
bitbuffer_extract_bytes(bitbuffer, 0, 7,
(uint8_t *)&bbuf+1, 10*8);
br = bbuf;
bbuf[0] = 0xFF;
}

if (br[0] != 0xff) {
// preamble missing
Expand Down Expand Up @@ -338,3 +348,19 @@ r_device fineoffset_wh1080 = {
.demod_arg = 0,
.fields = output_fields,
};

/**
* http://www.jaycar.com.au/mini-lcd-display-weather-station/p/XC0400
*/

r_device fineoffset_XC0400 = {
.name = "Fine Offset Electronics, XC0400",
.modulation = OOK_PULSE_PWM_RAW,
.short_limit = 800, // Short pulse 544µs, long pulse 1524µs, fixed gap 1036µs
.long_limit = 2800, // Maximum pulse period (long pulse + fixed gap)
.reset_limit = 2800, // We just want 1 package
.json_callback = &fineoffset_wh1080_callback,
.disabled = 0,
.demod_arg = 0,
.fields = output_fields
};

0 comments on commit 0fb4dec

Please sign in to comment.