From f02828096395439aceaadb1ad44848cc4fd5b6fc Mon Sep 17 00:00:00 2001 From: Gerolf Ziegenhain Date: Sun, 4 Jan 2015 15:29:26 +0100 Subject: [PATCH] cleanup --- src/cwprotocol.c | 2 +- src/cwprotocol.h | 2 ++ src/irmc.c | 30 +++++++++++++----------------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/cwprotocol.c b/src/cwprotocol.c index 869bfde..d6daf96 100644 --- a/src/cwprotocol.c +++ b/src/cwprotocol.c @@ -8,7 +8,7 @@ int prepare_id (struct data_packet_format *id_packet, char *id) snprintf(id_packet->id, SIZE_ID, id, "%s"); id_packet->sequence = 0; id_packet->n = 0; - snprintf(id_packet->status, SIZE_ID, "irmc v0.02"); + snprintf(id_packet->status, SIZE_ID, INTERFACE_VERSION); id_packet->a21 = 1; /* These magic numbers was provided by Les Kerr */ id_packet->a22 = 755; id_packet->a23 = 65535; diff --git a/src/cwprotocol.h b/src/cwprotocol.h index ebcddb4..8f943bd 100644 --- a/src/cwprotocol.h +++ b/src/cwprotocol.h @@ -1,3 +1,5 @@ +#define INTERFACE_VERSION "irmc v0.02" + // Structures for the packets: unsigned short command #define DIS 0x0002 // disconnect #define DAT 0x0003 diff --git a/src/irmc.c b/src/irmc.c index a694639..f0ba75a 100644 --- a/src/irmc.c +++ b/src/irmc.c @@ -284,11 +284,7 @@ int main(int argc, char *argv[]) prepare_id (&id_packet, id); prepare_tx (&tx_data_packet, id); - - - connect_packet.command = CON; connect_packet.channel = channel; - signal(SIGINT, inthandler); @@ -373,19 +369,19 @@ int main(int argc, char *argv[]) if(audio_status == 1) { -int length = rx_data_packet.code[i]; -if(length == 0 || abs(length) > 2000) { -} -else -{ -if(length < 0) { -beep(0.0, abs(length)/1000.); -} -else -{ -beep(1000.0, length/1000.); -} -} + int length = rx_data_packet.code[i]; + if(length == 0 || abs(length) > 2000) { + } + else + { + if(length < 0) { + beep(0.0, abs(length)/1000.); + } + else + { + beep(1000.0, length/1000.); + } + } } break; }