From 4bc796d9e4e15f8debcba7935f6b06e49b71abd8 Mon Sep 17 00:00:00 2001 From: Tommy Vestermark Date: Tue, 14 Jul 2015 23:43:30 +0200 Subject: [PATCH] Fix many compile warnings --- src/devices/acurite.c | 42 +++++++++++++++++++-------------- src/devices/alecto.c | 37 ++++++++++------------------- src/devices/ambient_weather.c | 14 ++++++----- src/devices/cardin.c | 16 ++++++------- src/devices/elv.c | 28 ++++++++++++---------- src/devices/fineoffset.c | 15 ++++++------ src/devices/intertechno.c | 17 ++++++------- src/devices/mebus.c | 15 ++++++------ src/devices/newkaku.c | 14 ++++++----- src/devices/nexus.c | 14 ++++++----- src/devices/oregon_scientific.c | 14 ++++++----- src/devices/prologue.c | 21 ++++++++--------- src/devices/rubicson.c | 14 ++++++----- src/devices/silvercrest.c | 14 ++++++----- src/devices/steffen.c | 14 ++++++----- src/devices/waveman.c | 14 ++++++----- 16 files changed, 159 insertions(+), 144 deletions(-) diff --git a/src/devices/acurite.c b/src/devices/acurite.c index 5693e93f..701bdc42 100644 --- a/src/devices/acurite.c +++ b/src/devices/acurite.c @@ -172,28 +172,34 @@ static int acurite_th_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bit } r_device acurite5n1 = { - /* .name = */ "Acurite 5n1 Weather Station", - /* .modulation = */ OOK_PWM_P, - /* .short_limit = */ 70, - /* .long_limit = */ 240, - /* .reset_limit = */ 21000, - /* .json_callback = */ &acurite5n1_callback, + .name = "Acurite 5n1 Weather Station", + .modulation = OOK_PWM_P, + .short_limit = 70, + .long_limit = 240, + .reset_limit = 21000, + .json_callback = &acurite5n1_callback, + .disabled = 0, + .demod_arg = 0, }; r_device acurite_rain_gauge = { - /* .name = */ "Acurite 896 Rain Gauge", - /* .modulation = */ OOK_PWM_D, - /* .short_limit = */ 1744/4, - /* .long_limit = */ 3500/4, - /* .reset_limit = */ 5000/4, - /* .json_callback = */ &acurite_rain_gauge_callback, + .name = "Acurite 896 Rain Gauge", + .modulation = OOK_PWM_D, + .short_limit = 1744/4, + .long_limit = 3500/4, + .reset_limit = 5000/4, + .json_callback = &acurite_rain_gauge_callback, + .disabled = 0, + .demod_arg = 0, }; r_device acurite_th = { - /* .name = */ "Acurite Temperature and Humidity Sensor", - /* .modulation = */ OOK_PWM_D, - /* .short_limit = */ 300, - /* .long_limit = */ 550, - /* .reset_limit = */ 2500, - /* .json_callback = */ &acurite_th_callback, + .name = "Acurite Temperature and Humidity Sensor", + .modulation = OOK_PWM_D, + .short_limit = 300, + .long_limit = 550, + .reset_limit = 2500, + .json_callback = &acurite_th_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/alecto.c b/src/devices/alecto.c index 3fe8aa1a..7c0de231 100644 --- a/src/devices/alecto.c +++ b/src/devices/alecto.c @@ -64,8 +64,6 @@ static int alectov1_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_ int16_t temp; uint8_t humidity, csum = 0, csum2 = 0; int i; - time_t time_now; - char time_str[LOCAL_TIME_BUFLEN]; if (bb[1][0] == bb[5][0] && bb[2][0] == bb[6][0] && (bb[1][4] & 0xf) == 0 && (bb[5][4] & 0xf) == 0 && (bb[5][0] != 0 && bb[5][1] != 0)) { @@ -85,11 +83,7 @@ static int alectov1_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_ /* Quit if checksup does not work out */ if (csum != (bb[1][4] >> 4) || csum2 != (bb[5][4] >> 4)) { //fprintf(stdout, "\nAlectoV1 CRC error"); - time(&time_now); - local_time_str(time_now, time_str); - fprintf(stdout, - "%s AlectoV1 Checksum/Parity error\n", - time_str); + fprintf(stderr, "AlectoV1 Checksum/Parity error\n"); return 0; } //Invalid checksum @@ -98,13 +92,8 @@ static int alectov1_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_ if ((bb[1][1] & 0xe0) == 0x60) { wind = ((bb[1][1] & 0xf) == 0xc) ? 0 : 1; - time(&time_now); - local_time_str(time_now, time_str); - time(&time_now); - local_time_str(time_now, time_str); fprintf(stdout, - "%s AlectoV1 %s Sensor %d", - time_str, + "AlectoV1 %s Sensor %d", wind ? "Wind" : "Rain", reverse8(bb[1][0]) ); @@ -147,16 +136,13 @@ static int alectov1_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_ temperature_before_dec = abs(temp / 10); temperature_after_dec = abs(temp % 10); humidity = bcd_decode8(reverse8(bb[1][3])); - time(&time_now); - local_time_str(time_now, time_str); fprintf(stdout, - "%s AlectoV1 Sensor %d Channel %d", - time_str, + "AlectoV1 Sensor %d Channel %d", reverse8(bb[1][0]), (bb[1][0] & 0xc) >> 2 ); fprintf(stdout, ": Temperature %s%d.%d C", temp < 0 ? "-" : "", temperature_before_dec, temperature_after_dec); - fprintf(stdout, ": Humidity %d %", humidity); + fprintf(stdout, ": Humidity %d %%", humidity); fprintf(stdout, ": Battery %s\n", bb[1][1]&0x80 ? "Low" : "OK"); } @@ -175,11 +161,12 @@ static int alectov1_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_ //Timing based on 250000 r_device alectov1 = { - /* .name = */ "AlectoV1 Weather Sensor (Alecto WS3500 WS4500 Ventus W155/W044 Oregon)", - /* .modulation = */ OOK_PWM_D, - /* .short_limit = */ 3500 / 4, //875 - /* .long_limit = */ 7000 / 4, //1750 - /* .reset_limit = */ 15000 / 4, //3750 - /* .json_callback = */ &alectov1_callback, - /* .Disable = */ 0, + .name = "AlectoV1 Weather Sensor (Alecto WS3500 WS4500 Ventus W155/W044 Oregon)", + .modulation = OOK_PWM_D, + .short_limit = 3500 / 4, //875 + .long_limit = 7000 / 4, //1750 + .reset_limit = 15000 / 4, //3750 + .json_callback = &alectov1_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/ambient_weather.c b/src/devices/ambient_weather.c index 97626b38..4fed3715 100644 --- a/src/devices/ambient_weather.c +++ b/src/devices/ambient_weather.c @@ -145,10 +145,12 @@ ambient_weather_callback (uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per } r_device ambient_weather = { - /* .name = */ "Ambient Weather Temperature Sensor", - /* .modulation = */ OOK_PULSE_MANCHESTER_ZEROBIT, - /* .short_limit = */ 125, - /* .long_limit = */ 0, // not used - /* .reset_limit = */ 600, - /* .json_callback = */ &ambient_weather_callback, + .name = "Ambient Weather Temperature Sensor", + .modulation = OOK_PULSE_MANCHESTER_ZEROBIT, + .short_limit = 125, + .long_limit = 0, // not used + .reset_limit = 600, + .json_callback = &ambient_weather_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/cardin.c b/src/devices/cardin.c index 729c3258..21692ea6 100644 --- a/src/devices/cardin.c +++ b/src/devices/cardin.c @@ -119,12 +119,12 @@ static int cardin_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_pe } r_device cardin = { - /* .name = */ "Cardin S466-TX2", - /* .modulation = */ OOK_PULSE_PPM_RAW, - /* .short_limit = */ 303, - /* .long_limit = */ 400, - /* .reset_limit = */ 8000, - /* .json_callback = */ &cardin_callback, - /* .disabled = */ 0, - /* .json_callback = */ //&debug_callback, + .name = "Cardin S466-TX2", + .modulation = OOK_PULSE_PPM_RAW, + .short_limit = 303, + .long_limit = 400, + .reset_limit = 8000, + .json_callback = &cardin_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/elv.c b/src/devices/elv.c index b25f7014..8f052b34 100644 --- a/src/devices/elv.c +++ b/src/devices/elv.c @@ -127,19 +127,23 @@ static int ws2000_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_per } r_device elv_em1000 = { - /* .name = */ "ELV EM 1000", - /* .modulation = */ OOK_PWM_D, - /* .short_limit = */ 750/4, - /* .long_limit = */ 7250/4, - /* .reset_limit = */ 30000/4, - /* .json_callback = */ &em1000_callback, + .name = "ELV EM 1000", + .modulation = OOK_PWM_D, + .short_limit = 750/4, + .long_limit = 7250/4, + .reset_limit = 30000/4, + .json_callback = &em1000_callback, + .disabled = 0, + .demod_arg = 0, }; r_device elv_ws2000 = { - /* .name = */ "ELV WS 2000", - /* .modulation = */ OOK_PWM_D, - /* .short_limit = */ (602+(1155-602)/2)/4, - /* .long_limit = */ ((1755635-1655517)/2)/4, // no repetitions - /* .reset_limit = */ ((1755635-1655517)*2)/4, - /* .json_callback = */ &ws2000_callback, + .name = "ELV WS 2000", + .modulation = OOK_PWM_D, + .short_limit = (602+(1155-602)/2)/4, + .long_limit = ((1755635-1655517)/2)/4, // no repetitions + .reset_limit = ((1755635-1655517)*2)/4, + .json_callback = &ws2000_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/fineoffset.c b/src/devices/fineoffset.c index 8a5aee9d..8a6fb4fe 100644 --- a/src/devices/fineoffset.c +++ b/src/devices/fineoffset.c @@ -63,7 +63,6 @@ static int fineoffset_WH2_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t fprintf(stdout, "ID = 0x%2X\n", ID); fprintf(stdout, "temperature = %.1f C\n", temperature); fprintf(stdout, "humidity = %2.0f %%\n", humidity); - // fprintf(stdout, "raw = %02x %02x %02x %02x %02x %02x\n",bb[0][0],bb[0][1],bb[0][2],bb[0][3],bb[0][4],bb[0][5]); return 1; } @@ -72,12 +71,14 @@ static int fineoffset_WH2_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t r_device fineoffset_WH2 = { - /* .name = */ "Fine Offset Electronics, WH-2 Sensor", - /* .modulation = */ OOK_PULSE_PWM_RAW, - /* .short_limit = */ 200, // Short pulse 136, long pulse 381, fixed gap 259 - /* .long_limit = */ 700, // Maximum pulse period (long pulse + fixed gap) - /* .reset_limit = */ 700, // We just want 1 package - /* .json_callback = */ &fineoffset_WH2_callback, + .name = "Fine Offset Electronics, WH-2 Sensor", + .modulation = OOK_PULSE_PWM_RAW, + .short_limit = 200, // Short pulse 136, long pulse 381, fixed gap 259 + .long_limit = 700, // Maximum pulse period (long pulse + fixed gap) + .reset_limit = 700, // We just want 1 package + .json_callback = &fineoffset_WH2_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/intertechno.c b/src/devices/intertechno.c index f46c9e97..8e8d1351 100644 --- a/src/devices/intertechno.c +++ b/src/devices/intertechno.c @@ -16,7 +16,7 @@ static int intertechno_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bi fprintf(stdout, "rid = %x\n",bb[1][7]); fprintf(stdout, "ADDR Slave = %i\n",bb[1][7] & 0b00001111); fprintf(stdout, "ADDR Master = %i\n",(bb[1][7] & 0b11110000) >> 4); - fprintf(stdout, "command = %i\n",(bb[1][6] & 0b00000111)); + fprintf(stdout, "command = %i\n",(bb[1][6] & 0b00000111)); fprintf(stdout, "%02x %02x %02x %02x %02x\n",bb[1][0],bb[1][1],bb[1][2],bb[1][3],bb[1][4]); return 1; @@ -25,11 +25,12 @@ static int intertechno_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bi } r_device intertechno = { - /* .name = */ "Intertechno 433", - /* .modulation = */ OOK_PWM_D, - /* .short_limit = */ 100, - /* .long_limit = */ 350, - /* .reset_limit = */ 3000, - /* .json_callback = */ &intertechno_callback, - /* .json_callback = */ //&debug_callback, + .name = "Intertechno 433", + .modulation = OOK_PWM_D, + .short_limit = 100, + .long_limit = 350, + .reset_limit = 3000, + .json_callback = &intertechno_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/mebus.c b/src/devices/mebus.c index fe10a81b..913cdf53 100644 --- a/src/devices/mebus.c +++ b/src/devices/mebus.c @@ -35,11 +35,12 @@ static int mebus433_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_ } r_device mebus433 = { - /* .name = */ "Mebus 433", - /* .modulation = */ OOK_PWM_D, - /* .short_limit = */ 300, - /* .long_limit = */ 600, - /* .reset_limit = */ 1500, - /* .json_callback = */ &mebus433_callback, - /* .json_callback = */ //&debug_callback, + .name = "Mebus 433", + .modulation = OOK_PWM_D, + .short_limit = 300, + .long_limit = 600, + .reset_limit = 1500, + .json_callback = &mebus433_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/newkaku.c b/src/devices/newkaku.c index 686bc6ac..f53eded7 100644 --- a/src/devices/newkaku.c +++ b/src/devices/newkaku.c @@ -115,10 +115,12 @@ static int newkaku_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_p } r_device newkaku = { - /* .name = */ "KlikAanKlikUit Wireless Switch", - /* .modulation = */ OOK_PWM_D, - /* .short_limit = */ 200, - /* .long_limit = */ 800, - /* .reset_limit = */ 4000, - /* .json_callback = */ &newkaku_callback, + .name = "KlikAanKlikUit Wireless Switch", + .modulation = OOK_PWM_D, + .short_limit = 200, + .long_limit = 800, + .reset_limit = 4000, + .json_callback = &newkaku_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/nexus.c b/src/devices/nexus.c index 84560760..65a2bec3 100644 --- a/src/devices/nexus.c +++ b/src/devices/nexus.c @@ -47,11 +47,13 @@ static int nexus_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_per_ // timings based on samp_rate=1024000 r_device nexus = { - /* .name = */ "Nexus Temperature & Humidity Sensor", - /* .modulation = */ OOK_PWM_D, - /* .short_limit = */ 1744/4, - /* .long_limit = */ 3500/4, - /* .reset_limit = */ 5000/4, - /* .json_callback = */ &nexus_callback, + .name = "Nexus Temperature & Humidity Sensor", + .modulation = OOK_PWM_D, + .short_limit = 1744/4, + .long_limit = 3500/4, + .reset_limit = 5000/4, + .json_callback = &nexus_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/oregon_scientific.c b/src/devices/oregon_scientific.c index 483e6321..d19fc1e4 100644 --- a/src/devices/oregon_scientific.c +++ b/src/devices/oregon_scientific.c @@ -341,10 +341,12 @@ static int oregon_scientific_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int1 } r_device oregon_scientific = { - /* .name = */ "Oregon Scientific Weather Sensor", - /* .modulation = */ OOK_PULSE_MANCHESTER_ZEROBIT, - /* .short_limit = */ 125, - /* .long_limit = */ 0, // not used - /* .reset_limit = */ 600, - /* .json_callback = */ &oregon_scientific_callback, + .name = "Oregon Scientific Weather Sensor", + .modulation = OOK_PULSE_MANCHESTER_ZEROBIT, + .short_limit = 125, + .long_limit = 0, // not used + .reset_limit = 600, + .json_callback = &oregon_scientific_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/prologue.c b/src/devices/prologue.c index a7718b5a..a598d7cc 100644 --- a/src/devices/prologue.c +++ b/src/devices/prologue.c @@ -28,8 +28,8 @@ static int prologue_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_p /* FIXME validate the received message better */ if (((bb[1][0]&0xF0) == 0x90 && (bb[2][0]&0xF0) == 0x90 && (bb[3][0]&0xF0) == 0x90 && (bb[4][0]&0xF0) == 0x90 && (bb[5][0]&0xF0) == 0x90 && (bb[6][0]&0xF0) == 0x90) || - ((bb[1][0]&0xF0) == 0x50 && (bb[2][0]&0xF0) == 0x50 && (bb[3][0]&0xF0) == 0x50 && (bb[4][0]&0xF0) == 0x50) && - (bb[1][3] == bb[2][3]) && (bb[1][4] == bb[2][4])) { + ((bb[1][0]&0xF0) == 0x50 && (bb[2][0]&0xF0) == 0x50 && (bb[3][0]&0xF0) == 0x50 && (bb[4][0]&0xF0) == 0x50 && + (bb[1][3] == bb[2][3]) && (bb[1][4] == bb[2][4]))) { /* Prologue sensor */ temp2 = (int16_t)((uint16_t)(bb[1][2] << 8) | (bb[1][3]&0xF0)); @@ -45,19 +45,18 @@ static int prologue_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_p rid = ((bb[1][0]&0x0F)<<4)|(bb[1][1]&0xF0)>>4; fprintf(stdout, "rid = %d\n", rid); fprintf(stdout, "hrid = %02x\n", rid); - - fprintf(stdout, "%02x %02x %02x %02x %02x\n",bb[1][0],bb[1][1],bb[1][2],bb[1][3],bb[1][4]); - return 1; } return 0; } r_device prologue = { - /* .name = */ "Prologue Temperature Sensor", - /* .modulation = */ OOK_PULSE_PPM_RAW, - /* .short_limit = */ 3500/4, - /* .long_limit = */ 7000/4, - /* .reset_limit = */ 2500, - /* .json_callback = */ &prologue_callback, + .name = "Prologue Temperature Sensor", + .modulation = OOK_PULSE_PPM_RAW, + .short_limit = 3500/4, + .long_limit = 7000/4, + .reset_limit = 2500, + .json_callback = &prologue_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/rubicson.c b/src/devices/rubicson.c index fa22f531..37169044 100644 --- a/src/devices/rubicson.c +++ b/src/devices/rubicson.c @@ -45,11 +45,13 @@ static int rubicson_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_p // timings based on samp_rate=1024000 r_device rubicson = { - /* .name = */ "Rubicson Temperature Sensor", - /* .modulation = */ OOK_PWM_D, - /* .short_limit = */ 1744/4, - /* .long_limit = */ 3500/4, - /* .reset_limit = */ 5000/4, - /* .json_callback = */ &rubicson_callback, + .name = "Rubicson Temperature Sensor", + .modulation = OOK_PWM_D, + .short_limit = 1744/4, + .long_limit = 3500/4, + .reset_limit = 5000/4, + .json_callback = &rubicson_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/silvercrest.c b/src/devices/silvercrest.c index b2b94a6c..e62aae86 100644 --- a/src/devices/silvercrest.c +++ b/src/devices/silvercrest.c @@ -21,10 +21,12 @@ static int silvercrest_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bit } r_device silvercrest = { - /* .name = */ "Silvercrest Remote Control", - /* .modulation = */ OOK_PWM_P, - /* .short_limit = */ 600/4, - /* .long_limit = */ 5000/4, - /* .reset_limit = */ 15000/4, - /* .json_callback = */ &silvercrest_callback, + .name = "Silvercrest Remote Control", + .modulation = OOK_PWM_P, + .short_limit = 600/4, + .long_limit = 5000/4, + .reset_limit = 15000/4, + .json_callback = &silvercrest_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/steffen.c b/src/devices/steffen.c index 82810896..b2afefca 100644 --- a/src/devices/steffen.c +++ b/src/devices/steffen.c @@ -33,10 +33,12 @@ static int steffen_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_pe } r_device steffen = { - /* .name = */ "Steffen Switch Transmitter", - /* .modulation = */ OOK_PWM_D, - /* .short_limit = */ 140, - /* .long_limit = */ 270, - /* .reset_limit = */ 1500, - /* .json_callback = */ &steffen_callback, + .name = "Steffen Switch Transmitter", + .modulation = OOK_PWM_D, + .short_limit = 140, + .long_limit = 270, + .reset_limit = 1500, + .json_callback = &steffen_callback, + .disabled = 0, + .demod_arg = 0, }; diff --git a/src/devices/waveman.c b/src/devices/waveman.c index 55804050..39f9fb0a 100644 --- a/src/devices/waveman.c +++ b/src/devices/waveman.c @@ -27,10 +27,12 @@ static int waveman_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_pe } r_device waveman = { - /* .name = */ "Waveman Switch Transmitter", - /* .modulation = */ OOK_PWM_P, - /* .short_limit = */ 1000/4, - /* .long_limit = */ 8000/4, - /* .reset_limit = */ 30000/4, - /* .json_callback = */ &waveman_callback, + .name = "Waveman Switch Transmitter", + .modulation = OOK_PWM_P, + .short_limit = 1000/4, + .long_limit = 8000/4, + .reset_limit = 30000/4, + .json_callback = &waveman_callback, + .disabled = 0, + .demod_arg = 0, };