Skip to content

Commit 1eb23fd

Browse files
authored
Add support for Gasmate-BA1008 (#2359)
1 parent 0ef985a commit 1eb23fd

File tree

5 files changed

+115
-0
lines changed

5 files changed

+115
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md).
318318
[233]* CED7000 Shot Timer
319319
[234] Watchman Sonic Advanced / Plus
320320
[235] Oil Ultrasonic SMART FSK
321+
[236] Gasmate BA1008 meat thermometer
321322
322323
* Disabled by default, use -R n or a conf file to enable
323324

conf/rtl_433.example.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ stop_after_successful_events false
457457
# protocol 233 # CED7000 Shot Timer
458458
protocol 234 # Watchman Sonic Advanced / Plus
459459
protocol 235 # Oil Ultrasonic SMART FSK
460+
protocol 236 # Gasmate BA1008 meat thermometer
460461

461462
## Flex devices (command line option "-X")
462463

include/rtl_433_devices.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@
243243
DECL(ced7000) \
244244
DECL(oil_watchman_advanced) \
245245
DECL(oil_smart) \
246+
DECL(gasmate_ba1008) \
246247

247248
/* Add new decoders here. */
248249

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ add_library(r_433 STATIC
114114
devices/fs20.c
115115
devices/ft004b.c
116116
devices/funkbus.c
117+
devices/gasmate_ba1008.c
117118
devices/ge_coloreffects.c
118119
devices/generic_motion.c
119120
devices/generic_remote.c

src/devices/gasmate_ba1008.c

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/** @file
2+
Gasmate BA1008 meat thermometer.
3+
4+
Copyright (C) 2023 Christian W. Zuckschwerdt <[email protected]>
5+
based on protocol analysis by Lucy Winters
6+
7+
This program is free software; you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation; either version 2 of the License, or
10+
(at your option) any later version.
11+
*/
12+
13+
#include "decoder.h"
14+
15+
/**
16+
Gasmate BA1008 meat thermometer.
17+
18+
Notably this protocol does not feature ID or CHANNEL information.
19+
20+
S.a. #2324
21+
22+
Data Layout:
23+
24+
PF TT ?? ?A
25+
26+
- P: (4 bit) preamble/model/type? fixed 0xf
27+
- F: (4 bit) Unknown bit; Sign bit; 2-bit temperature 100ths (BCD)
28+
- T: (8 bit) temperature 10ths and 1ths (BCD)
29+
- ?: (12 bit) unknown value
30+
- A: (4 bit) checksum, nibble-wide add with carry
31+
32+
Raw data:
33+
34+
F4040BFB [-04C]
35+
F4060BF9 [-06C]
36+
F4100BEF [-10C]
37+
f0030ffc [+03C]
38+
F0230FDC [+23C]
39+
F0310FCE [+31C]
40+
41+
Format string:
42+
43+
PREAMBLE?h ?b SIGN:b TEMP:2hhhC ?hhh CHK:h
44+
45+
*/
46+
47+
static int gasmate_ba1008_decode(r_device *decoder, bitbuffer_t *bitbuffer)
48+
{
49+
if (bitbuffer->num_rows != 1) {
50+
decoder_log(decoder, 2, __func__, "Row check fail");
51+
return DECODE_ABORT_LENGTH;
52+
}
53+
54+
int row = 0;
55+
uint8_t *b = bitbuffer->bb[row];
56+
// we expect 32 bits
57+
if (bitbuffer->bits_per_row[row] != 32) {
58+
decoder_log(decoder, 2, __func__, "Length check fail");
59+
return DECODE_ABORT_LENGTH;
60+
}
61+
62+
// preamble/model/type and first flag bit check
63+
if ((b[0] & 0xf8) != 0xf0) {
64+
decoder_log(decoder, 2, __func__, "Model check fail");
65+
return DECODE_ABORT_EARLY;
66+
}
67+
68+
// check checksum
69+
if ((add_nibbles(b, 4) & 0x0f) != 0x0c) {
70+
decoder_log(decoder, 2, __func__, "Checksum fail");
71+
return DECODE_FAIL_MIC;
72+
}
73+
74+
int sign = (b[0] & 0x04) >> 2;
75+
int huns = (b[0] & 0x03);
76+
int tens = (b[1] & 0xf0) >> 4;
77+
int ones = (b[1] & 0x0f);
78+
int temp_raw = huns * 100 + tens * 10 + ones;
79+
int temp_c = sign ? -temp_raw : temp_raw;
80+
int unknown1 = (b[2] << 4) | (b[3] >> 4);
81+
82+
/* clang-format off */
83+
data_t *data = data_make(
84+
"model", "", DATA_STRING, "Gasmate-BA1008",
85+
"temperature_C", "Temperature_C", DATA_FORMAT, "%d C", DATA_INT, temp_c,
86+
"unknown_1", "Unknown Value", DATA_FORMAT, "%03x", DATA_INT, unknown1,
87+
"mic", "Integrity", DATA_STRING, "CHECKSUM",
88+
NULL);
89+
/* clang-format on */
90+
91+
decoder_output_data(decoder, data);
92+
return 1;
93+
}
94+
95+
static char *output_fields[] = {
96+
"model",
97+
"temperature_C",
98+
"unknown_1",
99+
"mic",
100+
NULL,
101+
};
102+
103+
r_device const gasmate_ba1008 = {
104+
.name = "Gasmate BA1008 meat thermometer",
105+
.modulation = OOK_PULSE_PPM,
106+
.short_width = 536,
107+
.long_width = 1668,
108+
.reset_limit = 2000,
109+
.decode_fn = &gasmate_ba1008_decode,
110+
.fields = output_fields,
111+
};

0 commit comments

Comments
 (0)