Removed debug_callback()

Now drivers do no longer need to print out themselves
This commit is contained in:
Tommy Vestermark 2015-07-14 22:50:21 +02:00
parent 26de006eef
commit cba8159180
19 changed files with 8 additions and 107 deletions

View file

@ -45,8 +45,6 @@
#define OOK_PULSE_PWM_TERNARY 7 // Pulse Width Modulation with three widths: Sync, 0, 1. Sync determined by argument
extern int debug_output;
int debug_callback(uint8_t buffer[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_row[BITBUF_ROWS]);
struct protocol_state {
int (*callback)(uint8_t bits_buffer[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_row[BITBUF_ROWS]);

View file

@ -126,9 +126,6 @@ static int acurite5n1_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits
return 0;
}
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
}

View file

@ -167,7 +167,6 @@ static int alectov1_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_
/*
* fprintf(stdout, "L2M: %02x %02x %02x %02x %02x\n",reverse8(bb[1][0]),reverse8(bb[1][1]),reverse8(bb[1][2]),reverse8(bb[1][3]),reverse8(bb[1][4]));
*/
debug_callback(bb, bits_per_row);
}
return 1;
}

View file

@ -132,8 +132,8 @@ ambient_weather_parser (uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_r
uint16_t deviceID = get_device_id (bb[0]);
fprintf (stderr, "id = %d\n", deviceID);
}
return 1;
}
return 0;
}

View file

@ -78,9 +78,6 @@ static int calibeur_rf104_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t
fprintf(stdout, "temperature = %.1f C\n", temperature);
fprintf(stdout, "humidity = %2.0f %%\n", humidity);
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
}
return 0;

View file

@ -30,9 +30,6 @@ static int DSC_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_r
fprintf(stdout, "DSC (Digital Security Controls):\n");
fprintf(stdout, "data = %02X %02X %02X %02X %02X\n", bytes[0], bytes[1], bytes[2], bytes[3], bytes[4]);
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
}
return 0;

View file

@ -65,9 +65,6 @@ static int fineoffset_WH2_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t
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]);
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
}
return 0;

View file

@ -19,9 +19,6 @@ static int intertechno_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bi
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]);
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
}
return 0;

View file

@ -124,6 +124,7 @@ static int lacrossetx_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],
int16_t bits_per_row[BITBUF_ROWS]) {
int i, m, valid = 0;
int events = 0;
uint8_t *buf;
uint8_t msg_nybbles[11];
uint8_t sensor_id, msg_type, msg_len, msg_parity, msg_checksum;
@ -176,17 +177,20 @@ static int lacrossetx_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],
temp_f = temp_c * 1.8 + 32;
printf("%s LaCrosse TX Sensor %02x: Temperature %3.1f C / %3.1f F\n",
time_str, sensor_id, temp_c, temp_f);
events++;
break;
case 0x0E:
printf("%s LaCrosse TX Sensor %02x: Humidity %3.1f%%\n",
time_str, sensor_id, msg_value);
events++;
break;
default:
fprintf(stderr,
"%s LaCrosse Sensor %02x: Unknown Reading type %d, % 3.1f (%d)\n",
time_str, sensor_id, msg_type, msg_value, msg_value_int);
events++;
}
time(&last_msg_time);
@ -194,14 +198,10 @@ static int lacrossetx_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],
last_msg_type = msg_type;
last_sensor_id = sensor_id;
} else {
return 0;
}
}
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
return events;
}
r_device lacrossetx = {

View file

@ -29,9 +29,6 @@ static int mebus433_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_
fprintf(stdout, "humidity = %i%%\n", hum);
fprintf(stdout, "%02x %02x %02x %02x %02x\n",bb[1][0],bb[1][1],bb[1][2],bb[1][3],bb[1][4]);
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
}
return 0;

View file

@ -109,8 +109,6 @@ static int newkaku_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_p
}
fprintf(stdout, "%02x %02x %02x %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], bb[0][6], bb[0][7], bb[0][8]);
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
}
return 0;

View file

@ -40,9 +40,6 @@ static int nexus_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_per_
fprintf(stdout, "Temp: %s%d.%d\n",temp<0?"-":"",temperature_before_dec,temperature_after_dec);
fprintf(stdout, "Humidity: %d\n", humidity);
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
}
return 0;

View file

@ -48,9 +48,6 @@ static int prologue_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_p
fprintf(stdout, "%02x %02x %02x %02x %02x\n",bb[1][0],bb[1][1],bb[1][2],bb[1][3],bb[1][4]);
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
}
return 0;

View file

@ -38,9 +38,6 @@ static int rubicson_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_p
fprintf(stdout, "temp = %s%d.%d\n",temp<0?"-":"",temperature_before_dec, temperature_after_dec);
fprintf(stdout, "%02x %02x %02x %02x %02x\n",bb[1][0],bb[0][1],bb[0][2],bb[0][3],bb[0][4]);
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
}
return 0;

View file

@ -15,9 +15,6 @@ static int silvercrest_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bit
fprintf(stdout, "model = Silvercrest, %d bits\n",bits_per_row[1]);
fprintf(stdout, "%02x %02x %02x %02x %02x\n",bb[1][0],bb[0][1],bb[0][2],bb[0][3],bb[0][4]);
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
}
return 0;

View file

@ -27,9 +27,6 @@ static int steffen_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_pe
fprintf(stdout, "state = ON\n");
}
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
}
return 0;

View file

@ -21,9 +21,6 @@ static int waveman_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_pe
fprintf(stdout, "state = %s\n", (nb[2]==0xe) ? "on" : "off");
fprintf(stdout, "%02x %02x %02x\n",nb[0],nb[1],nb[2]);
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
}
return 0;

View file

@ -22,11 +22,8 @@ static int X10_RF_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_pe
fprintf(stdout, "X10 RF:\n");
fprintf(stdout, "data = %02X %02X %02X %02X\n", bb[1][0], bb[1][1], bb[1][2], bb[1][3]);
if (debug_output)
debug_callback(bb, bits_per_row);
return 1;
}
}
return 0;
}

View file

@ -41,61 +41,6 @@ int debug_output = 0;
int num_r_devices = 0;
int debug_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_row[BITBUF_ROWS]) {
int i,j,k;
int rows_used[BITBUF_ROWS];
int col_max = 0;
int row_cnt = 0;
// determine what part of bb[][] has non-zero data to avoid
// outputting lots of empty rows
for (i=0 ; i<BITBUF_ROWS ; i++) {
for (j=BITBUF_COLS - 1 ; j > 0 ; j--) {
if (bb[i][j] != 0)
break;
}
if (j != 0) {
rows_used[i] = 1;
row_cnt++;
if (j > col_max)
col_max = j;
} else {
rows_used[i] = 0;
}
}
if (!row_cnt) {
fprintf(stderr, "debug_callback: empty data array\n");
return 0;
}
fprintf(stderr, "\n");
for (i=0 ; i<BITBUF_ROWS ; i++) {
if (!rows_used[i]) {
continue;
}
fprintf(stderr, "[%02d] ",i);
for (j=0 ; j<=col_max ; j++) {
fprintf(stderr, "%02x ", bb[i][j]);
}
fprintf(stderr, ": ");
for (j=0 ; j<=col_max ; j++) {
for (k=7 ; k>=0 ; k--) {
if (bb[i][j] & 1<<k)
fprintf(stderr, "1");
else
fprintf(stderr, "0");
}
fprintf(stderr, " ");
}
fprintf(stderr, "\n");
}
fprintf(stderr, "\n");
return 0;
}
struct dm_state {
FILE *file;
int save_data;