Clean up Acurite 986

This commit is contained in:
Christian W. Zuckschwerdt
2018-09-06 11:29:43 +02:00
parent ae93b8cd20
commit 65f33acaa2

View File

@@ -792,7 +792,7 @@ static int acurite_txr_callback(bitbuffer_t *bitbuf) {
*/
static int acurite_986_callback(bitbuffer_t *bitbuf) {
int browlen;
int const browlen = 5;
uint8_t *bb, sensor_num, status, crc, crcc;
uint8_t br[8];
int8_t tempf; // Raw Temp is 8 bit signed Fahrenheit
@@ -806,8 +806,6 @@ static int acurite_986_callback(bitbuffer_t *bitbuf) {
local_time_str(0, time_str);
for (uint16_t brow = 0; brow < bitbuf->num_rows; ++brow) {
browlen = (bitbuf->bits_per_row[brow] + 7)/8;
bb = bitbuf->bb[brow];
if (debug_output > 1)
fprintf(stderr,"acurite_986: row %d bits %d, bytes %d \n", brow, bitbuf->bits_per_row[brow], browlen);
@@ -818,6 +816,7 @@ static int acurite_986_callback(bitbuffer_t *bitbuf) {
fprintf(stderr,"acurite_986: skipping wrong len\n");
continue;
}
bb = bitbuf->bb[brow];
// Reduce false positives
// may eliminate these with a better PPM (precise?) demod.
@@ -826,11 +825,6 @@ static int acurite_986_callback(bitbuffer_t *bitbuf) {
continue;
}
// There will be 1 extra false zero bit added by the demod.
// this forces an extra zero byte to be added
if (browlen > 5 && bb[browlen - 1] == 0)
browlen--;
// Reverse the bits, msg sent LSB first
for (uint8_t i = 0; i < browlen; i++)
br[i] = reverse8(bb[i]);
@@ -1173,21 +1167,20 @@ r_device acurite_txr = {
*
* Temperature only, Pulse Position
*
* 4 x 400 sample (150 uS) start/sync pulses
* 40 (42) 50 (20 uS) (sample data pulses)
* short gap approx 130 samples
* long gap approx 220 samples
*
* A preamble: 2x of 216 us pulse + 276 us gap, 4x of 1600 us pulse + 1560 us gap
* 39 bits of data: 220 us pulses with short gap of 520 us or long gap of 880 us
* A transmission consists of two packets that run into each other.
* There should be 40 bits of data though. But the last bit can't be detected.
*/
r_device acurite_986 = {
.name = "Acurite 986 Refrigerator / Freezer Thermometer",
.modulation = OOK_PULSE_PPM_RAW,
.short_limit = 720, // Threshold between short and long gap
.short_limit = 720, // Threshold between short 520 us and long 880 us gap
.long_limit = 1280,
.reset_limit = 4000,
.json_callback = &acurite_986_callback,
.disabled = 0,
.demod_arg = 2,
.demod_arg = 0, // not used
};
/*