From c33910cdbd601f535c47c45f5b5b1ac22600f1e7 Mon Sep 17 00:00:00 2001 From: Gerolf Ziegenhain Date: Wed, 5 Oct 2016 20:29:08 +0200 Subject: [PATCH] wip --- src/cwprotocol.c | 61 +++++++++++++++++++++++++++++++++++++++++------- src/cwprotocol.h | 8 ++++--- src/irmc.c | 11 ++++----- 3 files changed, 62 insertions(+), 18 deletions(-) diff --git a/src/cwprotocol.c b/src/cwprotocol.c index 0e7ec6a..59328c2 100644 --- a/src/cwprotocol.c +++ b/src/cwprotocol.c @@ -68,7 +68,7 @@ int send_latch (void) tx_data_packet.code[0] = -1; tx_data_packet.code[1] = 1; tx_data_packet.n = 2; - for(i = 0; i < 5; i++) send(fd_socket, &tx_data_packet, SIZE_DATA_PACKET, 0); + for(i = 0; i < TX_RETRIES; i++) send(fd_socket, &tx_data_packet, SIZE_DATA_PACKET, 0); tx_data_packet.n = 0; return 0; } @@ -81,7 +81,7 @@ int send_unlatch (void) tx_data_packet.code[0] = -1; tx_data_packet.code[1] = 2; tx_data_packet.n = 2; - for(i = 0; i < 5; i++) send(fd_socket, &tx_data_packet, SIZE_DATA_PACKET, 0); + for(i = 0; i < TX_RETRIES; i++) send(fd_socket, &tx_data_packet, SIZE_DATA_PACKET, 0); tx_data_packet.n = 0; return 0; } @@ -97,15 +97,58 @@ int prepare_text2morse (int wpm) return 0; } -int char2morse(void) +int clean_pkg () { - char c='c', d; - // why? because!!! - // http://stackoverflow.com/questions/1352587/convert-a-string-into-morse-code/1355594^ - for(;c= c?c:(c=toupper(getchar())-32)?c<0?1:"\x95#\x8CKa`^ZRBCEIQiw#S#nx(37+$6-2&@/4)'18=,*%.:0;?5" [c-12]-34:-3;c/=2) + int i; + for (i=0; i