Remove some unwanted BITBUF_COLS uses
This commit is contained in:
parent
95585ff64c
commit
d4a9e09497
6 changed files with 14 additions and 10 deletions
|
@ -119,7 +119,7 @@ static int acurite_5n1raincounter = 0; // for 5n1 decoder
|
|||
static int acurite_5n1t_raincounter = 0; // for combined 5n1/TXR decoder
|
||||
|
||||
|
||||
static int acurite_checksum(uint8_t row[BITBUF_COLS], int cols) {
|
||||
static int acurite_checksum(uint8_t *row, int cols) {
|
||||
// sum of first n-1 bytes modulo 256 should equal nth byte
|
||||
// also disregard a row of all zeros
|
||||
int i;
|
||||
|
|
|
@ -105,6 +105,7 @@ static int
|
|||
ambient_weather_parser (bitbuffer_t *bitbuffer)
|
||||
{
|
||||
bitrow_t *bb = bitbuffer->bb;
|
||||
int browlen;
|
||||
float temperature;
|
||||
uint8_t humidity;
|
||||
uint16_t channel;
|
||||
|
@ -118,9 +119,11 @@ ambient_weather_parser (bitbuffer_t *bitbuffer)
|
|||
if(bitbuffer->bits_per_row[0] != 195) // There seems to be 195 bits in a correct message
|
||||
return 0;
|
||||
|
||||
browlen = (bitbuffer->bits_per_row[0] + 7) / 8;
|
||||
|
||||
/* shift all the bits left 1 to align the fields */
|
||||
int i;
|
||||
for (i = 0; i < BITBUF_COLS-1; i++) {
|
||||
for (i = 0; i < browlen; i++) {
|
||||
uint8_t bits1 = bb[0][i] << 1;
|
||||
uint8_t bits2 = (bb[0][i+1] & 0x80) >> 7;
|
||||
bits1 |= bits2;
|
||||
|
@ -130,7 +133,7 @@ ambient_weather_parser (bitbuffer_t *bitbuffer)
|
|||
/* DEBUG: print out the received packet */
|
||||
/*
|
||||
fprintf(stderr, "\n! ");
|
||||
for (i = 0 ; i < BITBUF_COLS ; i++) {
|
||||
for (i = 0 ; i < browlen ; i++) {
|
||||
fprintf (stderr, "%02x ", bb[0][i]);
|
||||
}
|
||||
fprintf (stderr,"\n\n");
|
||||
|
@ -139,7 +142,7 @@ ambient_weather_parser (bitbuffer_t *bitbuffer)
|
|||
if ( ((bb[0][0] == 0x00) && (bb[0][1] == 0x14) && (bb[0][2] & 0x50)) ||
|
||||
((bb[0][0] == 0xff) && (bb[0][1] == 0xd4) && (bb[0][2] & 0x50)) ) {
|
||||
|
||||
if (validate_checksum (bb[0], BITBUF_COLS)) {
|
||||
if (validate_checksum (bb[0], browlen)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "util.h"
|
||||
#include "data.h"
|
||||
|
||||
//static int calibeur_rf104_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_row[BITBUF_ROWS]) {
|
||||
static int calibeur_rf104_callback(bitbuffer_t *bitbuffer) {
|
||||
data_t *data;
|
||||
char time_str[LOCAL_TIME_BUFLEN];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "rtl_433.h"
|
||||
|
||||
uint16_t AD_POP(uint8_t bb[BITBUF_COLS], uint8_t bits, uint8_t bit) {
|
||||
uint16_t AD_POP(uint8_t *bb, uint8_t bits, uint8_t bit) {
|
||||
uint16_t val = 0;
|
||||
uint8_t i, byte_no, bit_no;
|
||||
for (i=0;i<bits;i++) {
|
||||
|
|
|
@ -51,7 +51,8 @@
|
|||
|
||||
|
||||
static int s3318p_callback(bitbuffer_t *bitbuffer) {
|
||||
bitrow_t *bb = bitbuffer->bb;
|
||||
uint8_t *b;
|
||||
int browlen;
|
||||
data_t *data;
|
||||
char time_str[LOCAL_TIME_BUFLEN];
|
||||
|
||||
|
@ -65,11 +66,12 @@ static int s3318p_callback(bitbuffer_t *bitbuffer) {
|
|||
if (r < 0 || bitbuffer->bits_per_row[r] != 42)
|
||||
return 0;
|
||||
|
||||
uint8_t *b = bb[r];
|
||||
b = bitbuffer->bb[r];
|
||||
browlen = (bitbuffer->bits_per_row[r] + 7) / 8;
|
||||
|
||||
/* shift all the bits left 2 to align the fields */
|
||||
int i;
|
||||
for (i = 0; i < BITBUF_COLS-1; i++) {
|
||||
for (i = 0; i < browlen; i++) {
|
||||
uint8_t bits1 = b[i] << 2;
|
||||
uint8_t bits2 = (b[i+1] & 0xC0) >> 6;
|
||||
bits1 |= bits2;
|
||||
|
|
|
@ -66,7 +66,7 @@ static int solight_te44_callback(bitbuffer_t *bitbuffer) {
|
|||
|
||||
// all lines should have equal content
|
||||
// will work also for the last, shorter line, as the separating bit is always 0 anyway
|
||||
if (i > 0 && 0 != memcmp(bb[i], bb[i - 1], BITBUF_COLS)) {
|
||||
if (i > 0 && 0 != memcmp(bb[i], bb[i - 1], 5)) { // 5 bytes to compare 40 bits
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue