Fix stray tabs to spaces

This commit is contained in:
Christian W. Zuckschwerdt 2019-02-15 16:52:39 +01:00
parent 9452ac8fc5
commit 3b4b8d2f72
22 changed files with 120 additions and 121 deletions

View file

@ -217,7 +217,7 @@ static int acurite_rain_gauge_callback(r_device *decoder, bitbuffer_t *bitbuffer
"rain", "Total Rain", DATA_FORMAT, "%.1f mm", DATA_DOUBLE, total_rain,
NULL);
decoder_output_data(decoder, data);
decoder_output_data(decoder, data);
return 1;
}

View file

@ -56,7 +56,7 @@ static int ambientweather_tx8300_callback(r_device *decoder, bitbuffer_t *bitbuf
return 0;
}
/* dropping 2 bit preamle */
/* dropping 2 bit preamble */
bitbuffer_extract_bytes(bitbuffer, 0, 2, b, 72);
// flip inverted bytes

View file

@ -20,25 +20,25 @@
static int blyss_callback(r_device *decoder,bitbuffer_t *bitbuffer) {
data_t *data;
uint8_t *b;
char id_str[16];
char id_str[16];
for (int i = 0; i < bitbuffer->num_rows; ++i) {
if (bitbuffer->bits_per_row[i] != 33) // last row is 32
continue;
continue;
b = bitbuffer->bb[i];
//This needs additional validation, but works on mine. Suspect each DC5-UK-WH uses different codes as the transmitter
//is paired to the receivers to avoid being triggered by the neighbours transmitter ?!?
if (((b[0] != 0xce) || (b[1] != 0x8e) || (b[2] != 0x2a) || (b[3] != 0x6c) || (b[4] != 0x80)) &&
((b[0] != 0xe7) || (b[1] != 0x37) || (b[2] != 0x7a) || (b[3] != 0x2c) || (b[4] != 0x80)))
((b[0] != 0xe7) || (b[1] != 0x37) || (b[2] != 0x7a) || (b[3] != 0x2c) || (b[4] != 0x80)))
continue;
sprintf(id_str, "%02x%02x%02x%02x", b[0], b[1], b[2], b[3]);
data = data_make(
"model", "", DATA_STRING, "Blyss-DC5ukwh",
"id", "", DATA_STRING, id_str,
"model", "", DATA_STRING, "Blyss-DC5ukwh",
"id", "", DATA_STRING, id_str,
NULL);
decoder_output_data(decoder, data);

View file

@ -24,7 +24,7 @@
#include "decoder.h"
// Actually 37 bits for all but last transmission which is 36 bits
#define NUM_BITS 36
#define NUM_BITS 36
static int bt_rain_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
data_t *data;

View file

@ -118,7 +118,6 @@ static int dish_remote_6_3_callback(r_device *decoder, bitbuffer_t *bitbuffer)
button = b[0] >> 2;
button_string = button_map[button];
data = data_make(
"model", "", DATA_STRING, "Dish remote 6.3",

View file

@ -106,11 +106,11 @@ static char *output_fields[] = {
r_device efergy_e2_classic = {
.name = "Efergy e2 classic",
.modulation = FSK_PULSE_PWM,
.short_width = 64,
.long_width = 136,
.sync_width = 500,
.gap_limit = 200,
.reset_limit = 400,
.short_width = 64,
.long_width = 136,
.sync_width = 500,
.gap_limit = 200,
.reset_limit = 400,
.decode_fn = &efergy_e2_classic_callback,
.disabled = 0,
.fields = output_fields

View file

@ -103,9 +103,9 @@ static int efergy_optical_callback(r_device *decoder, bitbuffer_t *bitbuffer)
energy = ((pulsecount/imp_kwh[i]) * (3600/30));
}
data = data_make(
"model", "Model", DATA_STRING, "Efergy Optical",
"pulses", "Pulse-rate", DATA_FORMAT, "%i", DATA_INT, imp_kwh[i],
"energy", "Energy", DATA_FORMAT, "%.03f KWh", DATA_DOUBLE, energy,
"model", "Model", DATA_STRING, "Efergy Optical",
"pulses", "Pulse-rate", DATA_FORMAT, "%i", DATA_INT, imp_kwh[i],
"energy", "Energy", DATA_FORMAT, "%.03f KWh", DATA_DOUBLE, energy,
NULL);
decoder_output_data(decoder, data);
}

View file

@ -41,7 +41,7 @@ static int elro_db286a_callback(r_device *decoder, bitbuffer_t *bitbuffer)
"id", "ID", DATA_STRING, id_str,
NULL);
decoder_output_data(decoder, data);
decoder_output_data(decoder, data);
return 1;

View file

@ -103,8 +103,8 @@ static int fineoffset_WH2_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
if (bitbuffer->bits_per_row[0] != 47 || decoder->decode_ctx) { // WH2, Telldus, WH2A
// The temperature is signed magnitude and scaled by 10
if (temp & 0x800) {
temp &= 0x7FF; // remove sign bit
temp = -temp; // reverse magnitude
temp &= 0x7FF; // remove sign bit
temp = -temp; // reverse magnitude
}
} else { // WH5
// The temperature is unsigned offset by 40 C and scaled by 10
@ -498,9 +498,9 @@ static char *output_fields_WH0530[] = {
r_device fineoffset_WH2 = {
.name = "Fine Offset Electronics, WH2, WH5, Telldus Temperature/Humidity/Rain Sensor",
.modulation = OOK_PULSE_PWM,
.short_width = 500, // Short pulse 544µs, long pulse 1524µs, fixed gap 1036µs
.long_width = 1500, // Maximum pulse period (long pulse + fixed gap)
.reset_limit = 1200, // We just want 1 package
.short_width = 500, // Short pulse 544µs, long pulse 1524µs, fixed gap 1036µs
.long_width = 1500, // Maximum pulse period (long pulse + fixed gap)
.reset_limit = 1200, // We just want 1 package
.tolerance = 160, // us
.decode_fn = &fineoffset_WH2_callback,
.create_fn = &fineoffset_WH2_create,
@ -511,9 +511,9 @@ r_device fineoffset_WH2 = {
r_device fineoffset_WH25 = {
.name = "Fine Offset Electronics, WH25, WH24, WH65B, HP1000 Temperature/Humidity/Pressure Sensor",
.modulation = FSK_PULSE_PCM,
.short_width = 58, // Bit width = 58µs (measured across 580 samples / 40 bits / 250 kHz )
.long_width = 58, // NRZ encoding (bit width = pulse width)
.reset_limit = 20000, // Package starts with a huge gap of ~18900 us
.short_width = 58, // Bit width = 58µs (measured across 580 samples / 40 bits / 250 kHz )
.long_width = 58, // NRZ encoding (bit width = pulse width)
.reset_limit = 20000, // Package starts with a huge gap of ~18900 us
.decode_fn = &fineoffset_WH25_callback,
.disabled = 0,
.fields = output_fields_WH25
@ -522,9 +522,9 @@ r_device fineoffset_WH25 = {
r_device fineoffset_WH0530 = {
.name = "Fine Offset Electronics, WH0530 Temperature/Rain Sensor",
.modulation = OOK_PULSE_PWM,
.short_width = 504, // Short pulse 504µs
.short_width = 504, // Short pulse 504µs
.long_width = 1480, // Long pulse 1480µs
.reset_limit = 1200, // Fixed gap 960µs (We just want 1 package)
.reset_limit = 1200, // Fixed gap 960µs (We just want 1 package)
.sync_width = 0, // No sync bit used
.tolerance = 160, // us
.decode_fn = &fineoffset_WH0530_callback,

View file

@ -29,15 +29,15 @@ static int hondaremote_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t *b;
char const *code;
char const *code;
uint16_t device_id;
for (int row = 0; row < bitbuffer->num_rows; ++row) {
b = bitbuffer->bb[row];
// Validate package
if (((bitbuffer->bits_per_row[row] <= 385) || (bitbuffer->bits_per_row[row] > 394)) ||
((b[0] != 0xFF ) || (b[38] != 0xFF)))
continue;
((b[0] != 0xFF ) || (b[38] != 0xFF)))
continue;
code = get_command_codes(b);
device_id = b[44]<<8 | b[45];
@ -67,7 +67,7 @@ r_device hondaremote = {
.short_width = 250,
.long_width = 500,
.reset_limit = 2000,
.decode_fn = &hondaremote_callback,
.decode_fn = &hondaremote_callback,
.disabled = 0,
.fields = output_fields
};

View file

@ -57,13 +57,13 @@ static int ht680_callback(r_device *decoder, bitbuffer_t *bitbuffer)
int button4 = (b[2]>>0) & 0x03;
data = data_make(
"model", "", DATA_STRING, "HT680 Remote control",
"tristate", "Tristate code", DATA_STRING, tristate,
"address", "Address", DATA_FORMAT, "0x%06X", DATA_INT, address,
"button1", "Button 1", DATA_STRING, button1 == 3 ? "PRESSED" : "",
"button2", "Button 2", DATA_STRING, button2 == 3 ? "PRESSED" : "",
"button3", "Button 3", DATA_STRING, button3 == 3 ? "PRESSED" : "",
"button4", "Button 4", DATA_STRING, button4 == 3 ? "PRESSED" : "",
"model", "", DATA_STRING, "HT680 Remote control",
"tristate", "Tristate code", DATA_STRING, tristate,
"address", "Address", DATA_FORMAT, "0x%06X", DATA_INT, address,
"button1", "Button 1", DATA_STRING, button1 == 3 ? "PRESSED" : "",
"button2", "Button 2", DATA_STRING, button2 == 3 ? "PRESSED" : "",
"button3", "Button 3", DATA_STRING, button3 == 3 ? "PRESSED" : "",
"button4", "Button 4", DATA_STRING, button4 == 3 ? "PRESSED" : "",
NULL);
decoder_output_data(decoder, data);

View file

@ -26,7 +26,7 @@
* Payload looks like this:
*
* [00] { 4} 00 : 0000
* [01] {40} 0f 30 5c e7 61 : 00001111 00110000 01011100 11100111 01100001
* [01] {40} 0f 30 5c e7 61 : 00001111 00110000 01011100 11100111 01100001
*
* First row is actually the preample part. This is added to make the signal more unique.
*
@ -66,10 +66,10 @@ static int infactory_callback(r_device *decoder, bitbuffer_t *bitbuffer)
temp_f = (float)temp / 10 - 90;
data = data_make(
"model", "", DATA_STRING, "inFactory sensor",
"id", "ID", DATA_FORMAT, "%u", DATA_INT, id,
"temperature_F", "Temperature",DATA_FORMAT, "%.02f °F", DATA_DOUBLE, temp_f,
"humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity,
"model", "", DATA_STRING, "inFactory sensor",
"id", "ID", DATA_FORMAT, "%u", DATA_INT, id,
"temperature_F", "Temperature", DATA_FORMAT, "%.02f °F", DATA_DOUBLE, temp_f,
"humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity,
NULL);
decoder_output_data(decoder, data);

View file

@ -71,13 +71,13 @@ static int lightwave_rf_callback(r_device *decoder, bitbuffer_t *bitbuffer)
// Check length is correct
// Due to encoding there will be two "0"s per byte, thus message grows to 91 bits
if (bitbuffer->bits_per_row[1] != 91)
return 0;
return 0;
// Check initial delimiter bit is "1"
unsigned bit_idx = 0;
uint8_t delimiter_bit = bitrow_get_bit(bb[1], bit_idx++);
if (delimiter_bit == 0)
return 0; // Decode error
return 0; // Decode error
// Strip delimiter bits
// row_in = 1, row_out = 2
@ -85,7 +85,7 @@ static int lightwave_rf_callback(r_device *decoder, bitbuffer_t *bitbuffer)
for(unsigned n=0; n<10; ++n) { // We have 10 bytes
delimiter_bit = bitrow_get_bit(bb[1], bit_idx++);
if (delimiter_bit == 0)
return 0; // Decode error
return 0; // Decode error
for(unsigned m=0; m<8; ++m) {
bitbuffer_add_bit(bitbuffer, bitrow_get_bit(bb[1], bit_idx++));
@ -125,8 +125,8 @@ static int lightwave_rf_callback(r_device *decoder, bitbuffer_t *bitbuffer)
"model", "", DATA_STRING, "LightwaveRF",
"id", "", DATA_FORMAT, "%06x", DATA_INT, id,
"subunit", "", DATA_INT, subunit,
"command", "", DATA_INT, command,
"parameter", "", DATA_INT, parameter,
"command", "", DATA_INT, command,
"parameter", "", DATA_INT, parameter,
NULL);
decoder_output_data(decoder, data);
@ -148,7 +148,7 @@ r_device lightwave_rf = {
.modulation = OOK_PULSE_PPM,
.short_width = 250, // Short gap 250µs, long gap 1250µs, (Pulse width is 250µs)
.long_width = 1250, //
.reset_limit = 1500, // Gap between messages is unknown so let us get them individually
.reset_limit = 1500, // Gap between messages is unknown so let us get them individually
.decode_fn = &lightwave_rf_callback,
.disabled = 1,
.fields = output_fields,

View file

@ -26,8 +26,8 @@ static int quhwa_callback(r_device *decoder, bitbuffer_t *bitbuffer)
b[2] = ~b[2];
if (bitbuffer->bits_per_row[r] != 18
|| (b[1] & 0x03) != 0x03
|| (b[2] & 0xC0) != 0xC0)
|| (b[1] & 0x03) != 0x03
|| (b[2] & 0xC0) != 0xC0)
return 0;
uint32_t id = (b[0] << 8) | b[1];

View file

@ -25,7 +25,7 @@ static int silvercrest_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
b = bitbuffer->bb[1];
if ((b[0] == 0x7c) && (b[1] == 0x26)) {
cmd = b[2] & 0xF;
// Validate button
// Validate button
if ((b[3]&0xF) != cmd_lu_tab[cmd])
return 0;

View file

@ -46,20 +46,20 @@ ss_sensor_parser(r_device *decoder, bitbuffer_t *bitbuffer, int row)
ss_get_id(id, b);
if (state == 1) {
strcpy(extradata,"Contact Open");
strcpy(extradata,"Contact Open");
} else if (state == 2) {
strcpy(extradata,"Contact Closed");
strcpy(extradata,"Contact Closed");
} else if (state == 3) {
strcpy(extradata,"Alarm Off");
strcpy(extradata,"Alarm Off");
}
data = data_make(
"model", "", DATA_STRING, "SimpliSafe Sensor",
"device", "Device ID", DATA_STRING, id,
"seq", "Sequence", DATA_INT, seq,
"state", "State", DATA_INT, state,
"extradata", "Extra Data", DATA_STRING, extradata,
NULL
"model", "", DATA_STRING, "SimpliSafe Sensor",
"device", "Device ID", DATA_STRING, id,
"seq", "Sequence", DATA_INT, seq,
"state", "State", DATA_INT, state,
"extradata", "Extra Data", DATA_STRING, extradata,
NULL
);
decoder_output_data(decoder, data);
@ -89,11 +89,11 @@ ss_pinentry_parser(r_device *decoder, bitbuffer_t *bitbuffer, int row)
sprintf(extradata, "Disarm Pin: %x%x%x%x", digits[0], digits[1], digits[2], digits[3]);
data = data_make(
"model", "", DATA_STRING, "SimpliSafe Keypad",
"device", "Device ID", DATA_STRING, id,
"seq", "Sequence", DATA_INT, b[9],
"extradata", "Extra Data", DATA_STRING, extradata,
NULL
"model", "", DATA_STRING, "SimpliSafe Keypad",
"device", "Device ID", DATA_STRING, id,
"seq", "Sequence", DATA_INT, b[9],
"extradata", "Extra Data", DATA_STRING, extradata,
NULL
);
decoder_output_data(decoder, data);
@ -125,11 +125,11 @@ ss_keypad_commands(r_device *decoder, bitbuffer_t *bitbuffer, int row)
ss_get_id(id, b);
data = data_make(
"model", "", DATA_STRING, "SimpliSafe Keypad",
"device", "", DATA_STRING, id,
"seq", "Sequence",DATA_INT, b[9],
"extradata", "", DATA_STRING, extradata,
NULL
"model", "", DATA_STRING, "SimpliSafe Keypad",
"device", "Device ID", DATA_STRING, id,
"seq", "Sequence", DATA_INT, b[9],
"extradata", "Extra Data", DATA_STRING, extradata,
NULL
);
decoder_output_data(decoder, data);

View file

@ -152,13 +152,13 @@ vaillant_vrt340_callback(r_device *decoder, bitbuffer_t *bitbuffer)
uint8_t isBatteryLow = get_battery_status(bb[0]);
data = data_make(
"model", "", DATA_STRING, "Vaillant VRT340f Central Heating Thermostat",
"device", "Device ID", DATA_FORMAT, "0x%04X", DATA_INT, deviceID,
"heating", "Heating Mode", DATA_STRING, (heating_mode==0)?"OFF":((heating_mode==1)?"ON (2-point)":"ON (analogue)"),
"heating_temp", "Heating Water Temp.", DATA_FORMAT, "%d", DATA_INT, (int16_t)target_temperature,
"water", "Pre-heated Water", DATA_STRING, water_preheated ? "ON" : "off",
"battery", "Battery", DATA_STRING, isBatteryLow ? "Low" : "Ok",
NULL);
"model", "", DATA_STRING, "Vaillant VRT340f Central Heating Thermostat",
"device", "Device ID", DATA_FORMAT, "0x%04X", DATA_INT, deviceID,
"heating", "Heating Mode", DATA_STRING, (heating_mode==0)?"OFF":((heating_mode==1)?"ON (2-point)":"ON (analogue)"),
"heating_temp", "Heating Water Temp.", DATA_FORMAT, "%d", DATA_INT, (int16_t)target_temperature,
"water", "Pre-heated Water", DATA_STRING, water_preheated ? "ON" : "off",
"battery", "Battery", DATA_STRING, isBatteryLow ? "Low" : "Ok",
NULL);
decoder_output_data(decoder, data);
return 1;
@ -175,9 +175,9 @@ vaillant_vrt340_callback(r_device *decoder, bitbuffer_t *bitbuffer)
uint16_t deviceID = get_device_id(bb[0], 11);
data = data_make(
"model", "", DATA_STRING, "Vaillant VRT340f Central Heating Thermostat (RF Detection)",
"device", "Device ID", DATA_INT, deviceID,
NULL);
"model", "", DATA_STRING, "Vaillant VRT340f Central Heating Thermostat (RF Detection)",
"device", "Device ID", DATA_INT, deviceID,
NULL);
decoder_output_data(decoder, data);
return 1;

View file

@ -92,9 +92,9 @@ static char *output_fields[] = {
r_device wg_pb12v1 = {
.name = "WG-PB12V1 Temperature Sensor",
.modulation = OOK_PULSE_PWM,
.short_width = 564, // Short pulse 564µs, long pulse 1476µs, fixed gap 960µs
.long_width = 1476, // Maximum pulse period (long pulse + fixed gap)
.reset_limit = 2500, // We just want 1 package
.short_width = 564, // Short pulse 564µs, long pulse 1476µs, fixed gap 960µs
.long_width = 1476, // Maximum pulse period (long pulse + fixed gap)
.reset_limit = 2500, // We just want 1 package
.decode_fn = &wg_pb12v1_callback,
.disabled = 0,
.fields = output_fields

View file

@ -23,9 +23,9 @@
#include "decoder.h"
#define WS_PACKETLEN 24
#define WS_MINREPEATS 4
#define WS_REPEATS 23
#define WS_PACKETLEN 24
#define WS_MINREPEATS 4
#define WS_REPEATS 23
static int wssensor_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
uint8_t *b;
@ -58,14 +58,14 @@ static int wssensor_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
if (decoder->verbose) {
fprintf(stdout, "Hyundai WS SENZOR received raw data:\n");
bitbuffer_print(bitbuffer);
fprintf(stdout, "Sensor ID = %01d = 0x%02x\n", sensor_id, sensor_id);
fprintf(stdout, "Bitstream HEX = ");
fprintf(stdout, "Sensor ID = %01d = 0x%02x\n", sensor_id, sensor_id);
fprintf(stdout, "Bitstream HEX = ");
bitrow_print(b, 24);
fprintf(stdout, "Battery OK = %0d\n", battery_status);
fprintf(stdout, "Startup = %0d\n", startup);
fprintf(stdout, "Channel = %0d\n", channel);
fprintf(stdout, "temp = %d = 0x%02x\n", temperature, temperature);
fprintf(stdout, "TemperatureC = %.1f\n", temperature_c);
fprintf(stdout, "Battery OK = %0d\n", battery_status);
fprintf(stdout, "Startup = %0d\n", startup);
fprintf(stdout, "Channel = %0d\n", channel);
fprintf(stdout, "temp = %d = 0x%02x\n", temperature, temperature);
fprintf(stdout, "TemperatureC = %.1f\n", temperature_c);
}
data = data_make(

View file

@ -116,13 +116,13 @@ static int wt450_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
temp = (temp_whole - 50) + (temp_fraction/100.0);
data = data_make(
"model", "", DATA_STRING, "WT450 sensor",
"id", "House Code", DATA_INT, house_code,
"channel", "Channel", DATA_INT, channel,
"battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK",
"temperature_C", "Temperature",DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp,
"humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity,
NULL);
"model", "", DATA_STRING, "WT450 sensor",
"id", "House Code", DATA_INT, house_code,
"channel", "Channel", DATA_INT, channel,
"battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK",
"temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp,
"humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity,
NULL);
decoder_output_data(decoder, data);
return 1;
@ -144,7 +144,7 @@ r_device wt450 = {
.short_width = 980, // half-bit width 980 us
.long_width = 1952, // bit width 1952 us
.reset_limit = 18000,
.tolerance = 80, // us
.tolerance = 80, // us
.decode_fn = &wt450_callback,
.disabled = 0,
.fields = output_fields

View file

@ -225,7 +225,7 @@ int pulse_demod_pwm(const pulse_data_t *pulses, r_device *device)
bitbuffer_clear(&bits);
}
else if (device->s_gap_limit > 0 && pulses->gap[n] > device->s_gap_limit
&& bits.num_rows > 0 && bits.bits_per_row[bits.num_rows - 1] > 0) {
&& bits.num_rows > 0 && bits.bits_per_row[bits.num_rows - 1] > 0) {
// New packet in multipacket
bitbuffer_add_row(&bits);
}
@ -245,10 +245,10 @@ int pulse_demod_manchester_zerobit(const pulse_data_t *pulses, r_device *device)
for (unsigned n = 0; n < pulses->num_pulses; ++n) {
// Falling edge is on end of pulse
if (device->s_tolerance > 0
&& (pulses->pulse[n] < device->s_short_width - device->s_tolerance
|| pulses->pulse[n] > device->s_short_width * 2 + device->s_tolerance
|| pulses->gap[n] < device->s_short_width - device->s_tolerance
|| pulses->gap[n] > device->s_short_width * 2 + device->s_tolerance)) {
&& (pulses->pulse[n] < device->s_short_width - device->s_tolerance
|| pulses->pulse[n] > device->s_short_width * 2 + device->s_tolerance
|| pulses->gap[n] < device->s_short_width - device->s_tolerance
|| pulses->gap[n] > device->s_short_width * 2 + device->s_tolerance)) {
// The pulse or gap is too long or too short, thus invalid
bitbuffer_add_row(&bits);
bitbuffer_add_bit(&bits, 0); // Prepare for new message with hardcoded 0
@ -329,7 +329,7 @@ int pulse_demod_dmc(const pulse_data_t *pulses, r_device *device)
bitbuffer_add_bit(&bits, 0);
}
else if (symbol[n] >= device->s_reset_limit - device->s_tolerance
&& bits.num_rows > 0) { // Only if data has been accumulated
&& bits.num_rows > 0) { // Only if data has been accumulated
//END message ?
if (device->decode_fn) {
events += device->decode_fn(device, &bits);
@ -370,8 +370,8 @@ int pulse_demod_piwm_raw(const pulse_data_t *pulses, r_device *device)
bitbuffer_add_bit(&bits, 1 - n % 2);
}
else if (symbol[n] < device->s_reset_limit
&& bits.num_rows > 0
&& bits.bits_per_row[bits.num_rows - 1] > 0) {
&& bits.num_rows > 0
&& bits.bits_per_row[bits.num_rows - 1] > 0) {
bitbuffer_add_row(&bits);
/*
fprintf(stderr, "Detected error during pulse_demod_piwm_raw(): %s\n",
@ -420,8 +420,8 @@ int pulse_demod_piwm_dc(const pulse_data_t *pulses, r_device *device)
bitbuffer_add_bit(&bits, 0);
}
else if (symbol[n] < device->s_reset_limit
&& bits.num_rows > 0
&& bits.bits_per_row[bits.num_rows - 1] > 0) {
&& bits.num_rows > 0
&& bits.bits_per_row[bits.num_rows - 1] > 0) {
bitbuffer_add_row(&bits);
/*
fprintf(stderr, "Detected error during pulse_demod_piwm_dc(): %s\n",
@ -513,8 +513,8 @@ int pulse_demod_osv1(const pulse_data_t *pulses, r_device *device)
bitbuffer_add_bit(&bits, 1);
}
if ((n == pulses->num_pulses - 1
|| pulses->gap[n] > device->s_reset_limit)
&& (bits.num_rows > 0)) { // Only if data has been accumulated
|| pulses->gap[n] > device->s_reset_limit)
&& (bits.num_rows > 0)) { // Only if data has been accumulated
//END message ?
if (device->decode_fn) {
events += device->decode_fn(device, &bits);

View file

@ -902,14 +902,14 @@ static void sdr_callback(unsigned char *iq_buf, uint32_t len, void *ctx)
time_t rawtime;
time(&rawtime);
if (cfg->frequencies > 1 && difftime(rawtime, cfg->rawtime_old) > demod->hop_time) {
cfg->rawtime_old = rawtime;
cfg->do_exit_async = 1;
if (cfg->frequencies > 1 && difftime(rawtime, cfg->rawtime_old) > demod->hop_time) {
cfg->rawtime_old = rawtime;
cfg->do_exit_async = 1;
#ifndef _WIN32
alarm(0); // cancel the watchdog timer
alarm(0); // cancel the watchdog timer
#endif
sdr_stop(cfg->dev);
}
sdr_stop(cfg->dev);
}
if (cfg->duration > 0 && rawtime >= cfg->stop_time) {
cfg->do_exit_async = cfg->do_exit = 1;
#ifndef _WIN32