rm tx_method

This commit is contained in:
Gerolf Ziegenhain 2016-10-04 20:59:40 +02:00
parent d8815db878
commit a62c28dcdf

View File

@ -153,7 +153,6 @@ int main(int argc, char *argv[])
int channel; int channel;
char id[SIZE_ID]; char id[SIZE_ID];
char serialport[64]; char serialport[64];
int tx_method = TX_NONE;
// Set default values // Set default values
snprintf(hostname, 64, "mtc-kob.dyndns.org"); snprintf(hostname, 64, "mtc-kob.dyndns.org");
@ -246,20 +245,14 @@ int main(int argc, char *argv[])
fprintf(stderr, "Connected to %s.\n", s); fprintf(stderr, "Connected to %s.\n", s);
beep_init(); beep_init();
#ifdef TX_SERIAL #ifdef TX_SERIAL
if ((strcmp (serialport, "")) != 0) fd_serial = open(serialport, O_RDWR | O_NOCTTY | O_NDELAY);
tx_method = TX_SERIAL; if(fd_serial == -1) {
fprintf(stderr,"Unable to open serial port %s.\n", serialport);
if (tx_method == TX_SERIAL) { }
fd_serial = open(serialport, O_RDWR | O_NOCTTY | O_NDELAY);
if(fd_serial == -1) {
fprintf(stderr,"Unable to open serial port %s.\n", serialport);
}
}
#endif #endif
#ifdef RASPI #ifdef RASPI
// Starte die WiringPi-Api (wichtig) // Starte die WiringPi-Api (wichtig)
tx_method = TX_RASPI;
if (wiringPiSetup() == -1) if (wiringPiSetup() == -1)
return 1; return 1;
// Schalte GPIO 24 (=WiringPi Pin 5) auf Eingang // Schalte GPIO 24 (=WiringPi Pin 5) auf Eingang
@ -343,25 +336,20 @@ tx_method = TX_RASPI;
tx_data_packet.n = 0; tx_data_packet.n = 0;
} }
#ifdef TX_SERIAL #ifdef TX_SERIAL
if (tx_method == TX_SERIAL) { ioctl(fd_serial,TIOCMGET, &serial_status);
ioctl(fd_serial,TIOCMGET, &serial_status); if(serial_status & TIOCM_DSR){
if(serial_status & TIOCM_DSR){ txloop();
txloop(); tx_timer = TX_WAIT;
tx_timer = TX_WAIT; message(1);
message(1);
}
} }
#endif #endif
#ifdef RASPI #ifdef RASPI
if (tx_method == TX_RASPI) { if(digitalRead(5)==1){
if(digitalRead(5)==1){ txloop();
txloop(); tx_timer = TX_WAIT;
tx_timer = TX_WAIT; message(1);
message(1);
}
} }
#endif #endif
if(keepalive_t < 0 && tx_timer == 0){ if(keepalive_t < 0 && tx_timer == 0){